Skip to content
Snippets Groups Projects
Commit b90c8a50 authored by Daniel Nemergut's avatar Daniel Nemergut
Browse files

Sorting tiles by their order in the jobspec name

parent 8e0ca6ba
No related branches found
No related tags found
3 merge requests!32Merge 2.4.4 UI to main,!31WS-2903: Sort tiles on jobspec name,!30WS-2903: Sorting tiles by their order in the jobspec name
......@@ -89,12 +89,13 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
}
refreshTiles(newTiles: Tile[]) {
// Sort newTiles by name before they're stored on this component
this.tiles = new Map<string, Tile>(
newTiles
.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))
.map(tile => [tile.name, tile])
);
if (this.job.jobspec_name.includes('_')) {
// Sort newTiles by their order in the jobspec name before they're stored on this component
const tileOrder: string[] = this.job.jobspec_name.split('_')[1].split('.');
newTiles = newTiles.sort((a, b) => tileOrder.indexOf(a.name) - tileOrder.indexOf(b.name));
}
this.tiles = new Map<string, Tile>(newTiles.map(tile => [tile.name, tile]));
for (const controlName in this.tilesFormGroup.controls) {
this.tilesFormGroup.removeControl(controlName);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment