Skip to content

Commit

Permalink
Sort experiments by descending creation date by default in katib-ui (k…
Browse files Browse the repository at this point in the history
…ubeflow#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]>
  • Loading branch information
Doris-xm authored and garymm committed Feb 12, 2025
1 parent 78ca56e commit 3078694
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/ui/v1beta1/frontend/cypress/e2e/index-page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ describe('Index page', () => {

let i = 0;
const experiments = this.experimentsRequest;
// Table is sorted by Name in ascending order by default
// and experiment objects are also sorted alphabetically by name

// Experiment objects are sorted alphabetically by name
// We sort them by startTime in descending
const sortedExperiments = [...experiments].sort((a, b) => {
const timeA = new Date(a.startTime).getTime();
const timeB = new Date(b.startTime).getTime();
return timeB - timeA;
});

// Table is sorted by startTime in descending order
cy.get(`[data-cy-resource-table-row="Name"]`).each(element => {
expect(element).to.contain(experiments[i].name);
expect(element).to.contain(sortedExperiments[i].name);
i++;
});
});
Expand Down
2 changes: 2 additions & 0 deletions pkg/ui/v1beta1/frontend/src/app/pages/experiments/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ export const experimentsTableConfig: TableConfig = {
]),
},
],
sortByColumn: 'age',
sortDirection: 'desc',
};

0 comments on commit 3078694

Please sign in to comment.