@redpanda-data/docs-extensions-and-macros 3.6.4 → 3.6.5
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.
- package/macros/rp-connect-components.js +37 -39
- package/package.json +1 -1
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports.register = function (registry, context) {
|
|
4
4
|
function filterComponentTable() {
|
|
5
|
-
// Retrieve and standardize filter inputs
|
|
6
5
|
const nameInput = document.getElementById('componentTableSearch').value.trim().toLowerCase();
|
|
7
6
|
const typeFilter = Array.from(document.querySelector('#typeFilter').selectedOptions).map(option => option.value);
|
|
8
7
|
|
|
9
|
-
// Check
|
|
8
|
+
// Check for the existence of support and enterprise license filters (optional)
|
|
10
9
|
const supportFilterElement = document.querySelector('#supportFilter');
|
|
11
10
|
const supportFilter = supportFilterElement
|
|
12
11
|
? Array.from(supportFilterElement.selectedOptions).map(option => option.value)
|
|
13
12
|
: [];
|
|
14
13
|
|
|
14
|
+
// Get the 'support=enterprise' query parameter from the URL
|
|
15
|
+
const params = getQueryParams();
|
|
16
|
+
const enterpriseSupportFilter = params.support === 'enterprise'; // Check if 'support=enterprise' is in the URL
|
|
17
|
+
|
|
15
18
|
const table = document.getElementById('componentTable');
|
|
16
19
|
const trs = table.getElementsByTagName('tr');
|
|
17
20
|
|
|
@@ -19,34 +22,26 @@ module.exports.register = function (registry, context) {
|
|
|
19
22
|
const row = trs[i];
|
|
20
23
|
const nameTd = row.querySelector('td[id^="componentName-"]');
|
|
21
24
|
const typeTd = row.querySelector('td[id^="componentType-"]');
|
|
22
|
-
const supportTd = row.querySelector('td[id^="componentSupport-"]');
|
|
23
|
-
const
|
|
25
|
+
const supportTd = row.querySelector('td[id^="componentSupport-"]'); // Support column, if present
|
|
26
|
+
const enterpriseSupportTd = row.querySelector('td[id^="componentLicense-"]'); // Enterprise License column, if present
|
|
24
27
|
|
|
25
|
-
if (
|
|
26
|
-
const nameText = nameTd.textContent.trim().toLowerCase();
|
|
28
|
+
if (typeTd) { // Ensure that at least the Type column is present
|
|
29
|
+
const nameText = nameTd ? nameTd.textContent.trim().toLowerCase() : '';
|
|
27
30
|
const typeText = typeTd.textContent.trim().toLowerCase().split(', ').map(item => item.trim());
|
|
28
31
|
const supportText = supportTd ? supportTd.textContent.trim().toLowerCase() : '';
|
|
32
|
+
const enterpriseSupportText = enterpriseSupportTd ? enterpriseSupportTd.textContent.trim().toLowerCase() : ''; // Yes or No
|
|
29
33
|
|
|
30
34
|
// Determine if the row should be shown
|
|
31
35
|
const showRow =
|
|
32
|
-
((!nameInput || nameText.includes(nameInput)) &&
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
((!nameInput || nameText.includes(nameInput)) && // Filter by name if present
|
|
37
|
+
(typeFilter.length === 0 || typeFilter.some(value => typeText.includes(value))) && // Filter by type
|
|
38
|
+
(!supportTd || supportFilter.length === 0 || supportFilter.some(value => supportText.includes(value))) && // Filter by support if present
|
|
39
|
+
(!enterpriseSupportFilter || !enterpriseSupportTd || supportText.includes('enterprise') || enterpriseSupportText === 'yes') // Filter by enterprise support if 'support=enterprise' is in the URL
|
|
35
40
|
);
|
|
36
41
|
|
|
37
42
|
row.style.display = showRow ? '' : 'none';
|
|
38
|
-
|
|
39
|
-
if (showRow && typeFilter.length > 0 && typeDropdown) {
|
|
40
|
-
const matchingOption = Array.from(typeDropdown.options).find(option =>
|
|
41
|
-
typeFilter.includes(option.text.toLowerCase())
|
|
42
|
-
);
|
|
43
|
-
if (matchingOption) {
|
|
44
|
-
typeDropdown.value = matchingOption.value;
|
|
45
|
-
updateComponentUrl(typeDropdown, false);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
43
|
} else {
|
|
49
|
-
row.style.display = 'none'; // Hide row if
|
|
44
|
+
row.style.display = 'none'; // Hide row if the Type column is missing
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
47
|
}
|
|
@@ -289,8 +284,9 @@ function generateConnectorsHTMLTable(connectors, isCloud) {
|
|
|
289
284
|
const params = {};
|
|
290
285
|
const searchParams = new URLSearchParams(window.location.search);
|
|
291
286
|
searchParams.forEach((value, key) => {
|
|
292
|
-
params[key] = value;
|
|
287
|
+
params[key] = value.toLowerCase();
|
|
293
288
|
});
|
|
289
|
+
|
|
294
290
|
return params;
|
|
295
291
|
}
|
|
296
292
|
|
|
@@ -304,24 +300,26 @@ function generateConnectorsHTMLTable(connectors, isCloud) {
|
|
|
304
300
|
|
|
305
301
|
// Initialize Choices.js for type dropdowns
|
|
306
302
|
document.addEventListener('DOMContentLoaded', function() {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
document.getElementById('
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (params.
|
|
315
|
-
|
|
303
|
+
const params = getQueryParams();
|
|
304
|
+
const search = document.getElementById('componentTableSearch');
|
|
305
|
+
const typeFilter = document.getElementById('typeFilter');
|
|
306
|
+
const supportFilter = document.getElementById('supportFilter');
|
|
307
|
+
if (params.search && search) {
|
|
308
|
+
search.value = params.search;
|
|
309
|
+
}
|
|
310
|
+
if (params.type && typeFilter) {
|
|
311
|
+
typeFilter.value = params.type;
|
|
316
312
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
313
|
+
if (params.support && supportFilter) {
|
|
314
|
+
supportFilter.value = params.support;
|
|
315
|
+
}
|
|
316
|
+
filterComponentTable();
|
|
317
|
+
const typeDropdowns = document.querySelectorAll('.type-dropdown');
|
|
318
|
+
typeDropdowns.forEach(dropdown => {
|
|
319
|
+
new Choices(dropdown, {
|
|
320
|
+
searchEnabled: false,
|
|
321
|
+
allowHTML: true,
|
|
322
|
+
removeItemButton: true });
|
|
325
323
|
});
|
|
326
324
|
});
|
|
327
325
|
</script>`;
|
|
@@ -410,4 +408,4 @@ function generateConnectorsHTMLTable(connectors, isCloud) {
|
|
|
410
408
|
return self.createBlock(parent, 'pass', typeDropdown + enterpriseAdmonition);
|
|
411
409
|
});
|
|
412
410
|
});
|
|
413
|
-
};
|
|
411
|
+
};
|