Skip to content

Commit 0435ed7

Browse files
authored
[O2B-1493] Add run numbers filter to the environments overview (#2036)
* Introduces a raw text filter for the run numbers of environments. * Adds tests to verify correct filtering behaviour.
1 parent e793674 commit 0435ed7

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ export const environmentsActiveColumns = {
7474
size: 'w-10',
7575
format: formatRunsList,
7676
balloon: true,
77+
78+
/**
79+
* Run numbers filter component
80+
*
81+
* @param {EnvironmentOverviewModel} environmentOverviewModel the environment overview model
82+
* @return {Component} the filter component
83+
*/
84+
filter: (environmentOverviewModel) => rawTextFilter(
85+
environmentOverviewModel.filteringModel.get('runNumbers'),
86+
{ classes: ['w-100'], placeholder: 'e.g. 553203, 553221, ...' },
87+
),
7788
},
7889
updatedAt: {
7990
name: 'Last Update',

lib/public/views/Environments/Overview/EnvironmentOverviewModel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class EnvironmentOverviewModel extends OverviewPageModel {
3232
super();
3333

3434
this._filteringModel = new FilteringModel({
35+
runNumbers: new RawTextFilterModel(),
3536
statusHistory: new RawTextFilterModel(),
3637
currentStatus: new SelectionFilterModel({
3738
availableOptions: Object.keys(StatusAcronym).map((status) => ({

test/public/envs/overview.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,33 @@ module.exports = () => {
294294
await page.waitForSelector(filterPanelSelector, { visible: true });
295295
});
296296

297+
it('should successfully filter environments by their related run numbers', async () => {
298+
/**
299+
* This is the sequence to test filtering the environments based on their related run numbers.
300+
*
301+
* @param {string} selector the filter input selector
302+
* @param {string} inputValue the value to type in the filter input
303+
* @param {string[]} expectedIds the list of expected environment IDs after filtering
304+
* @return {void}
305+
*/
306+
const filterOnRunNumbers = async (selector, inputValue, expectedIds) => {
307+
await fillInput(page, selector, inputValue, ['change']);
308+
await waitForTableLength(page, expectedIds.length);
309+
expect(await page.$$eval('tbody tr', (rows) => rows.map((row) => row.id))).to.eql(expectedIds.map(id => `row${id}`));
310+
}
311+
312+
await expectAttributeValue(page, '.runs-filter input', 'placeholder', 'e.g. 553203, 553221, ...');
313+
314+
await filterOnRunNumbers('.runs-filter input', '10', ['TDI59So3d', 'Dxi029djX']);
315+
await resetFilters(page);
316+
317+
await filterOnRunNumbers('.runs-filter input', '103', ['TDI59So3d']);
318+
await resetFilters(page);
319+
320+
await filterOnRunNumbers('.runs-filter input', '86, 91', ['KGIS12DS', 'VODdsO12d']);
321+
await resetFilters(page);
322+
});
323+
297324
it('should successfully filter environments by their status history', async () => {
298325
/**
299326
* This is the sequence to test filtering the environments on their status history.

0 commit comments

Comments
 (0)