diff --git a/instances/tests/js/table_filter.test.js b/instances/tests/js/table_filter.test.js index a5285a3c..ffd601e3 100644 --- a/instances/tests/js/table_filter.test.js +++ b/instances/tests/js/table_filter.test.js @@ -16,7 +16,7 @@ function plainRow(text) { return {textContent: text, dataset: {}, hidden: false, hasAttribute: () => false, querySelector: () => null}; } function group(rows, host) { - return {dataset: host ? {host} : {}, querySelectorAll: (s) => (s === "tr" ? rows : [])}; + return {dataset: host ? {host} : {}, querySelectorAll: (s) => (s === "tr, [data-search], [data-group-header]" ? rows : [])}; } function page(groups, text, state, noMatch, extra = {}) { // a list without a state list (state undefined) has no such element @@ -57,6 +57,13 @@ assert.deepStrictEqual(visible(a), ["host-a Connected", "db-1 Off"], "the state filterInstances(page(groups, "Connected", "")); assert.deepStrictEqual(visible(a), [], "a host row's other text is not its name"); +// the interfaces list: a type's heading shows while any of its cards does +const bridges = [hostRow("Bridges 2"), vm("x", undefined, "br-v101"), vm("x", undefined, "br-v102")]; +const vlans = [hostRow("VLANs 1"), vm("x", undefined, "bond1.101")]; +filterInstances(page([group(bridges), group(vlans)], "v102")); +assert.deepStrictEqual(bridges.map((r) => r.hidden), [false, true, false], "a card is found by its data-search"); +assert.deepStrictEqual(vlans.map((r) => r.hidden), [true, true], "a type without a match is hidden, its heading too"); + // any other list: no state list, no groups; its rows are filtered by their text const plain = [plainRow("alice Active"), plainRow("bob (vda) Blocked"), plainRow("carol Active")]; filterInstances(page([group(plain)], "ACTIVE")); diff --git a/interfaces/templates/create_iface_block.html b/interfaces/templates/create_iface_block.html index 432b8c78..ece6d9c9 100644 --- a/interfaces/templates/create_iface_block.html +++ b/interfaces/templates/create_iface_block.html @@ -1,150 +1,168 @@ {% load i18n %} +{% load static %} {% load bootstrap_icons %} +{% load form_fields %} {% if request.user.is_superuser %} - - - + - -