@redpanda-data/docs-extensions-and-macros 3.6.1 → 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
|
|
|
@@ -153,7 +175,8 @@ module.exports.register = function (registry, context) {
|
|
|
153
175
|
self.positionalAttributes(['type']);
|
|
154
176
|
self.process((parent, target, attrs) => {
|
|
155
177
|
const type = attrs.type;
|
|
156
|
-
const categoriesData = context.config?.attributes?.connectCategoriesData ||
|
|
178
|
+
const categoriesData = context.config?.attributes?.connectCategoriesData || null
|
|
179
|
+
if (!categoriesData) return console.error (`Category data is not available for ${parent.getDocument().getAttributes()['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-categories extension.`)
|
|
157
180
|
const categories = categoriesData[type] || null;
|
|
158
181
|
const currentTabsId = `tabs-${tabsCounter++}`; // Unique ID for this set of tabs
|
|
159
182
|
if (!categories) return
|
|
@@ -206,8 +229,9 @@ module.exports.register = function (registry, context) {
|
|
|
206
229
|
const self = this;
|
|
207
230
|
self.named('component_table');
|
|
208
231
|
self.process((parent, target, attrs) => {
|
|
209
|
-
const isCloud =
|
|
210
|
-
const csvData = context.config?.attributes?.csvData ||
|
|
232
|
+
const isCloud = parent.getDocument().getAttributes()['env-cloud'] !== undefined;
|
|
233
|
+
const csvData = context.config?.attributes?.csvData || null;
|
|
234
|
+
if (!csvData) return console.error(`CSV data is not available for ${parent.getDocument().getAttributes()['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-info extension.`)
|
|
211
235
|
const types = new Set();
|
|
212
236
|
const uniqueSupportLevel = new Set();
|
|
213
237
|
|
|
@@ -218,7 +242,7 @@ module.exports.register = function (registry, context) {
|
|
|
218
242
|
|
|
219
243
|
const createOptions = (values) =>
|
|
220
244
|
Array.from(values)
|
|
221
|
-
.map(value => `<option selected value="${value}">${capitalize(value)}</option>`)
|
|
245
|
+
.map(value => `<option selected value="${value}">${capitalize(value).replace("_"," ")}</option>`)
|
|
222
246
|
.join('');
|
|
223
247
|
|
|
224
248
|
let tableHtml = `
|
|
@@ -318,7 +342,8 @@ module.exports.register = function (registry, context) {
|
|
|
318
342
|
return self.createBlock(parent, 'pass', '');
|
|
319
343
|
}
|
|
320
344
|
|
|
321
|
-
const csvData = context.config?.attributes?.csvData ||
|
|
345
|
+
const csvData = context.config?.attributes?.csvData || null;
|
|
346
|
+
if (!csvData) return console.error(`CSV data is not available for ${attributes['page-relative-src-path']}. Make sure your playbook includes the generate-rp-connect-info extension.`)
|
|
322
347
|
const componentRows = csvData.data.filter(row => row.connector.trim().toLowerCase() === name.trim().toLowerCase());
|
|
323
348
|
|
|
324
349
|
if (componentRows.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redpanda-data/docs-extensions-and-macros",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"description": "Antora extensions and macros developed for Redpanda documentation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antora",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"url": "git+https://github.com/redpanda-data/docs-extensions-and-macros"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
+
"@asciidoctor/tabs": "^1.0.0-beta.6",
|
|
61
62
|
"@octokit/core": "^6.1.2",
|
|
62
63
|
"@octokit/plugin-retry": "^7.1.1",
|
|
63
64
|
"@octokit/rest": "^21.0.1",
|