Skip to content

Commit 3078694

Browse files
Doris-xmgarymm
authored andcommitted
Sort experiments by descending creation date by default in katib-ui (kubeflow#2498)
* Sort experiments by descending creation date by default in katib-ui Signed-off-by: Xinmin Du <[email protected]> * fix: Update "renders every Experiment name into the table" test to not check order Signed-off-by: Xinmin Du <[email protected]> * fix: Update "renders every Experiment name into the table" test in order of startTime Signed-off-by: Xinmin Du <[email protected]> --------- Signed-off-by: Xinmin Du <[email protected]> Signed-off-by: Gary Miguel <[email protected]>
1 parent 78ca56e commit 3078694

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

pkg/ui/v1beta1/frontend/cypress/e2e/index-page.cy.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ describe('Index page', () => {
3333

3434
let i = 0;
3535
const experiments = this.experimentsRequest;
36-
// Table is sorted by Name in ascending order by default
37-
// and experiment objects are also sorted alphabetically by name
36+
37+
// Experiment objects are sorted alphabetically by name
38+
// We sort them by startTime in descending
39+
const sortedExperiments = [...experiments].sort((a, b) => {
40+
const timeA = new Date(a.startTime).getTime();
41+
const timeB = new Date(b.startTime).getTime();
42+
return timeB - timeA;
43+
});
44+
45+
// Table is sorted by startTime in descending order
3846
cy.get(`[data-cy-resource-table-row="Name"]`).each(element => {
39-
expect(element).to.contain(experiments[i].name);
47+
expect(element).to.contain(sortedExperiments[i].name);
4048
i++;
4149
});
4250
});

pkg/ui/v1beta1/frontend/src/app/pages/experiments/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,6 @@ export const experimentsTableConfig: TableConfig = {
9595
]),
9696
},
9797
],
98+
sortByColumn: 'age',
99+
sortDirection: 'desc',
98100
};

0 commit comments

Comments
 (0)