@redpanda-data/docs-extensions-and-macros 3.6.2 → 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function customStringify(obj) {
|
|
2
|
+
return JSON.stringify(obj, (key, value) => {
|
|
3
|
+
if (value instanceof Map) {
|
|
4
|
+
return {
|
|
5
|
+
type: 'Map',
|
|
6
|
+
value: Array.from(value.entries())
|
|
7
|
+
};
|
|
8
|
+
} else if (value instanceof Set) {
|
|
9
|
+
return {
|
|
10
|
+
type: 'Set',
|
|
11
|
+
value: Array.from(value)
|
|
12
|
+
};
|
|
13
|
+
} else if (typeof value === 'function') {
|
|
14
|
+
return value.toString();
|
|
15
|
+
} else {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
}, 2);
|
|
19
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports.register = function (registry, context) {
|
|
4
|
-
|
|
5
4
|
function filterComponentTable() {
|
|
6
5
|
// Retrieve and standardize filter inputs
|
|
7
6
|
const nameInput = document.getElementById('componentTableSearch').value.trim().toLowerCase();
|
|
@@ -56,93 +55,116 @@ module.exports.register = function (registry, context) {
|
|
|
56
55
|
|
|
57
56
|
function processConnectors(parsedData) {
|
|
58
57
|
return parsedData.data.reduce((connectors, row) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
connectors[connector]
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
const { connector, commercial_name, type, support_level, is_cloud_supported, is_licensed, url } = row;
|
|
59
|
+
const isCloudSupported = is_cloud_supported === 'y';
|
|
60
|
+
|
|
61
|
+
if (!connectors[connector]) {
|
|
62
|
+
connectors[connector] = {
|
|
63
|
+
types: new Map(),
|
|
64
|
+
supportLevels: new Map(),
|
|
65
|
+
isLicensed: is_licensed === 'y' ? 'Yes' : 'No',
|
|
66
|
+
isCloudConnectorSupported: false,
|
|
67
|
+
urls: new Set()
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
connectors[connector].types.set(capitalize(type), { url });
|
|
71
|
+
|
|
72
|
+
// Check at the connector level if any type supports cloud
|
|
73
|
+
if (isCloudSupported) {
|
|
74
|
+
connectors[connector].isCloudConnectorSupported = true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Update supportLevels with commercial name and cloud support info
|
|
78
|
+
if (!connectors[connector].supportLevels.has(support_level)) {
|
|
79
|
+
connectors[connector].supportLevels.set(support_level, []);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
connectors[connector].supportLevels.get(support_level).push({
|
|
83
|
+
commercial_name,
|
|
84
|
+
isCloudSupported
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (url) connectors[connector].urls.add(url);
|
|
88
|
+
|
|
89
|
+
return connectors;
|
|
77
90
|
}, {});
|
|
78
|
-
|
|
91
|
+
}
|
|
79
92
|
|
|
80
93
|
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
|
|
95
|
+
function generateConnectorsHTMLTable(connectors, isCloud) {
|
|
96
|
+
return Object.entries(connectors).map(([connector, details], id) => {
|
|
83
97
|
const { types, supportLevels, isCloudConnectorSupported, isLicensed, urls } = details;
|
|
84
98
|
const firstUrl = urls.size > 0 ? urls.values().next().value : null;
|
|
85
99
|
|
|
86
100
|
const typesArray = Array.from(types.entries())
|
|
87
|
-
.map(([type, { url
|
|
88
|
-
if(isCloud){
|
|
89
|
-
if (isCloudSupported) {
|
|
90
|
-
return url ? `<a href="${url}/">${type}</a>` : `<span>${type}</span>`;
|
|
91
|
-
} else {
|
|
92
|
-
return '';
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else{
|
|
101
|
+
.map(([type, { url }]) => {
|
|
96
102
|
return url ? `<a href="${url}/">${type}</a>` : `<span>${type}</span>`;
|
|
97
|
-
}
|
|
98
103
|
})
|
|
99
104
|
.filter(item => item !== '');
|
|
100
105
|
|
|
101
106
|
const typesStr = typesArray.join(', ');
|
|
102
107
|
|
|
103
108
|
const supportLevelStr = Array.from(supportLevels.entries())
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
.sort(([levelA], [levelB]) => levelA.localeCompare(levelB)) // Sort by level alphabetically
|
|
110
|
+
.map(([level, commercialNames]) => {
|
|
111
|
+
let filteredNames = commercialNames;
|
|
112
|
+
|
|
113
|
+
if (isCloud) {
|
|
114
|
+
filteredNames = commercialNames
|
|
115
|
+
.filter(({ isCloudSupported }) => isCloudSupported)
|
|
116
|
+
.map(({ commercial_name }) => commercial_name);
|
|
117
|
+
} else {
|
|
118
|
+
filteredNames = commercialNames.map(({ commercial_name }) => commercial_name);
|
|
119
|
+
}
|
|
120
|
+
filteredNames = [...new Set(filteredNames)];
|
|
121
|
+
if (filteredNames.length === 0) return '';
|
|
122
|
+
if (supportLevels.size === 1) {
|
|
123
|
+
return `<p>${capitalize(level)}</p>`;
|
|
124
|
+
} else {
|
|
125
|
+
return `<p><b>${capitalize(level)}</b>: ${filteredNames.join(', ')}</p>`;
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
.filter(item => item !== '')
|
|
129
|
+
.join('');
|
|
106
130
|
|
|
107
131
|
const connectorNameHtml = firstUrl
|
|
108
|
-
|
|
109
|
-
|
|
132
|
+
? `<code><a href="${firstUrl}/">${connector}</a></code>`
|
|
133
|
+
: `<code><span>${connector}</span></code>`;
|
|
110
134
|
|
|
111
135
|
if (isCloud) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
if (isCloudConnectorSupported && supportLevelStr.trim() !== '') {
|
|
137
|
+
return `
|
|
138
|
+
<tr id="row-${id}">
|
|
139
|
+
<td class="tableblock halign-left valign-top" id="componentName-${id}">
|
|
140
|
+
<p class="tableblock">${connectorNameHtml}</p>
|
|
141
|
+
</td>
|
|
142
|
+
<td class="tableblock halign-left valign-top" id="componentType-${id}">
|
|
143
|
+
<p class="tableblock">${typesStr}</p>
|
|
144
|
+
</td>
|
|
145
|
+
</tr>`;
|
|
146
|
+
} else {
|
|
147
|
+
return '';
|
|
148
|
+
}
|
|
125
149
|
} else {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
150
|
+
return `
|
|
151
|
+
<tr id="row-${id}">
|
|
152
|
+
<td class="tableblock halign-left valign-top" id="componentName-${id}">
|
|
153
|
+
<p class="tableblock">${connectorNameHtml}</p>
|
|
154
|
+
</td>
|
|
155
|
+
<td class="tableblock halign-left valign-top" id="componentType-${id}">
|
|
156
|
+
<p class="tableblock">${typesStr}</p>
|
|
157
|
+
</td>
|
|
158
|
+
<td class="tableblock halign-left valign-top" id="componentSupport-${id}">
|
|
159
|
+
<p class="tableblock">${supportLevelStr.trim()}</p>
|
|
160
|
+
</td>
|
|
161
|
+
<td class="tableblock halign-left valign-top" id="componentLicense-${id}">
|
|
162
|
+
<p class="tableblock">${isLicensed}</p>
|
|
163
|
+
</td>
|
|
164
|
+
</tr>`;
|
|
141
165
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
166
|
+
}).filter(row => row !== '').join(''); // Filter out empty rows
|
|
167
|
+
}
|
|
146
168
|
|
|
147
169
|
let tabsCounter = 1; // Counter for generating unique IDs
|
|
148
170
|
|
|
@@ -220,7 +242,7 @@ module.exports.register = function (registry, context) {
|
|
|
220
242
|
|
|
221
243
|
const createOptions = (values) =>
|
|
222
244
|
Array.from(values)
|
|
223
|
-
.map(value => `<option selected value="${value}">${capitalize(value)}</option>`)
|
|
245
|
+
.map(value => `<option selected value="${value}">${capitalize(value).replace("_"," ")}</option>`)
|
|
224
246
|
.join('');
|
|
225
247
|
|
|
226
248
|
let tableHtml = `
|