Skip to content

Commit

Permalink
Sort incidents on blocked page by priority in decedent order
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Feb 28, 2024
1 parent 0760e0e commit 9b05950
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/vue/components/PageBlocked.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
searchParams.delete('group_names');
}
history.pushState({}, '', url);
return results;
return results.sort((a, b) => (b.incident.priority || 0) - (a.incident.priority || 0));
},
smelt() {
return this.appConfig.smeltUrl;
Expand Down
2 changes: 1 addition & 1 deletion t/lib/Dashboard/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ sub minimal_fixtures ($self, $app) {
emu => false,
embargoed => false,
isActive => true,
priority => undef,
priority => 100, # highest priority; supposed to show first on "Blocked" page
},
]
);
Expand Down
20 changes: 11 additions & 9 deletions t/ui.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ t.test('Test dashboard ui', skip, async t => {
t.match(await page.innerText('.incident-results mark'), /1 passed, 1 waiting/);
});

await t.test('Filter blocked', async t => {
await t.test('Sorting and filtering on "Blocked" page', async t => {
await page.goto(`${url}/blocked`);
await page.waitForSelector('tbody');
const list = page.locator('tbody > tr');
t.equal(await list.count(), 2);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(1) a'), /16860:perl-Mojolicious/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(2)'), /SLE 12 SP5 1/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(2)'), /SAP\/HA Maintenance 1\/5/);
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(1) a'), /16860:perl-Mojolicious/);
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(2)'), /SLE 12 SP5 1/);
const pageUrl = await page.url();
t.notMatch(pageUrl, /incident/);
t.notMatch(pageUrl, /group_names/);
Expand Down Expand Up @@ -118,21 +120,21 @@ t.test('Test dashboard ui', skip, async t => {
await t.test('Group blocked', async t => {
await page.goto(`${url}/blocked`);
await page.waitForSelector('tbody');
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(2)'), /SAP\/HA Maintenance 1\/5/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(2)'), /SAP\/HA Maintenance 1\/5/);

await page.getByLabel('Group Flavors').uncheck();
await page.waitForSelector('tbody');
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(
await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(2)'),
await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(2)'),
/SAP\/HA Maintenance 1\/3.+SAP\/HA Maintenance 2/s
);

await page.getByLabel('Group Flavors').check();
await page.waitForSelector('tbody');
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(await page.innerText('tbody tr:nth-of-type(2) td:nth-of-type(2)'), /SAP\/HA Maintenance 1\/5/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(1) a'), /29722:multipath-tools/);
t.match(await page.innerText('tbody tr:nth-of-type(1) td:nth-of-type(2)'), /SAP\/HA Maintenance 1\/5/);
});

await t.test('Incident popup', async t => {
Expand Down

0 comments on commit 9b05950

Please sign in to comment.