From feda0eff0dbc7b32dbb86000ff1252c0faab80a6 Mon Sep 17 00:00:00 2001 From: Isaac Hill <71404865+isaachilly@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:56:02 +0100 Subject: [PATCH 1/3] [O2B-1493] Add run numbers filter to the environments overview Introduces a raw text filter for the run numbers of environments. Adds tests to verify correct filtering behaviour. --- .../environmentsActiveColumns.js | 12 ++++++++ .../Overview/EnvironmentOverviewModel.js | 2 ++ test/public/envs/overview.test.js | 30 +++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js b/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js index c570931869..7f5b0e6ec1 100644 --- a/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js +++ b/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js @@ -24,6 +24,7 @@ import { environmentStatusHistoryLegendComponent } from '../../../components/env import { infoTooltip } from '../../../components/common/popover/infoTooltip.js'; import { aliEcsEnvironmentLinkComponent } from '../../../components/common/externalLinks/aliEcsEnvironmentLinkComponent.js'; import { StatusAcronym } from '../../../domain/enums/statusAcronym.mjs'; +import { rawTextFilter } from '../../../components/Filters/common/filters/rawTextFilter.js'; /** * List of active columns for a generic Environments component @@ -61,6 +62,17 @@ export const environmentsActiveColumns = { size: 'w-10', format: formatRunsList, balloon: true, + + /** + * Run numbers filter component + * + * @param {EnvironmentOverviewModel} environmentOverviewModel the environment overview model + * @return {Component} the filter component + */ + filter: (environmentOverviewModel) => rawTextFilter( + environmentOverviewModel.filteringModel.get('runNumbers'), + { classes: ['w-100'], placeholder: 'e.g. 123456, 123...' }, + ), }, updatedAt: { name: 'Last Update', diff --git a/lib/public/views/Environments/Overview/EnvironmentOverviewModel.js b/lib/public/views/Environments/Overview/EnvironmentOverviewModel.js index 1d701b4a27..af412172ef 100644 --- a/lib/public/views/Environments/Overview/EnvironmentOverviewModel.js +++ b/lib/public/views/Environments/Overview/EnvironmentOverviewModel.js @@ -14,6 +14,7 @@ import { buildUrl } from '/js/src/index.js'; import { FilteringModel } from '../../../components/Filters/common/FilteringModel.js'; import { OverviewPageModel } from '../../../models/OverviewModel.js'; +import { RawTextFilterModel } from '../../../components/Filters/common/filters/RawTextFilterModel.js'; import { debounce } from '../../../utilities/debounce.js'; /** @@ -28,6 +29,7 @@ export class EnvironmentOverviewModel extends OverviewPageModel { super(); this._filteringModel = new FilteringModel({ + runNumbers: new RawTextFilterModel(), }); this._filteringModel.observe(() => this._applyFilters(true)); diff --git a/test/public/envs/overview.test.js b/test/public/envs/overview.test.js index ae673ef4e0..88fd55fbe5 100644 --- a/test/public/envs/overview.test.js +++ b/test/public/envs/overview.test.js @@ -26,6 +26,9 @@ const { getPopoverSelector, goToPage, openFilteringPanel, + fillInput, + expectAttributeValue, + resetFilters, } = require('../defaults.js'); const dateAndTime = require('date-and-time'); const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js'); @@ -290,4 +293,31 @@ module.exports = () => { await openFilteringPanel(page); await page.waitForSelector(filterPanelSelector, { visible: true }); }); + + it('should successfully filter environments by their related run numbers', async () => { + /** + * This is the sequence to test filtering the environments based on their related run numbers. + * + * @param {string} selector the filter input selector + * @param {string} inputValue the value to type in the filter input + * @param {string[]} expectedIds the list of expected environment IDs after filtering + * @return {void} + */ + const filterOnRunNumbers = async (selector, inputValue, expectedIds) => { + await fillInput(page, selector, inputValue, ['change']); + await waitForTableLength(page, expectedIds.length); + expect(await page.$$eval('tbody tr', (rows) => rows.map((row) => row.id))).to.eql(expectedIds.map(id => `row${id}`)); + } + + await expectAttributeValue(page, '.runs-filter input', 'placeholder', 'e.g. 123456, 123...'); + + await filterOnRunNumbers('.runs-filter input', '10', ['TDI59So3d', 'Dxi029djX']); + await resetFilters(page); + + await filterOnRunNumbers('.runs-filter input', '103', ['TDI59So3d']); + await resetFilters(page); + + await filterOnRunNumbers('.runs-filter input', '86, 91', ['KGIS12DS', 'VODdsO12d']); + await resetFilters(page); + }); }; From 047736dd68306026445fd0d2aa5754e988537527 Mon Sep 17 00:00:00 2001 From: George Raduta Date: Tue, 16 Dec 2025 15:04:13 +0100 Subject: [PATCH 2/3] Update placeholder --- .../Environments/ActiveColumns/environmentsActiveColumns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js b/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js index c7bb2f5151..5e2b185f29 100644 --- a/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js +++ b/lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js @@ -83,7 +83,7 @@ export const environmentsActiveColumns = { */ filter: (environmentOverviewModel) => rawTextFilter( environmentOverviewModel.filteringModel.get('runNumbers'), - { classes: ['w-100'], placeholder: 'e.g. 123456, 123...' }, + { classes: ['w-100'], placeholder: 'e.g. 553203, 553221, ...' }, ), }, updatedAt: { From 10a0286f806e4e0d27f7dda4909ac525954edb4b Mon Sep 17 00:00:00 2001 From: George Raduta Date: Tue, 16 Dec 2025 15:05:19 +0100 Subject: [PATCH 3/3] Fix test --- test/public/envs/overview.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/public/envs/overview.test.js b/test/public/envs/overview.test.js index 3e89bc8501..b56499de1d 100644 --- a/test/public/envs/overview.test.js +++ b/test/public/envs/overview.test.js @@ -309,7 +309,7 @@ module.exports = () => { expect(await page.$$eval('tbody tr', (rows) => rows.map((row) => row.id))).to.eql(expectedIds.map(id => `row${id}`)); } - await expectAttributeValue(page, '.runs-filter input', 'placeholder', 'e.g. 123456, 123...'); + await expectAttributeValue(page, '.runs-filter input', 'placeholder', 'e.g. 553203, 553221, ...'); await filterOnRunNumbers('.runs-filter input', '10', ['TDI59So3d', 'Dxi029djX']); await resetFilters(page);