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

Merge branch 'ws2903-sort_tiles_on_jobspec_name' into 'development'

WS-2903: Sorting tiles by their order in the jobspec name

See merge request !30
parents 8e0ca6ba 90aa5588
No related branches found
No related tags found
1 merge request!30WS-2903: Sorting tiles by their order in the jobspec name
...@@ -89,12 +89,13 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges { ...@@ -89,12 +89,13 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
} }
refreshTiles(newTiles: Tile[]) { refreshTiles(newTiles: Tile[]) {
// Sort newTiles by name before they're stored on this component if (this.job.jobspec_name.includes('_')) {
this.tiles = new Map<string, Tile>( // Sort newTiles by their order in the jobspec name before they're stored on this component
newTiles const tileOrder: string[] = this.job.jobspec_name.split('_')[1].split('.');
.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true })) newTiles = newTiles.sort((a, b) => tileOrder.indexOf(a.name) - tileOrder.indexOf(b.name));
.map(tile => [tile.name, tile]) }
);
this.tiles = new Map<string, Tile>(newTiles.map(tile => [tile.name, tile]));
for (const controlName in this.tilesFormGroup.controls) { for (const controlName in this.tilesFormGroup.controls) {
this.tilesFormGroup.removeControl(controlName); this.tilesFormGroup.removeControl(controlName);
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<button class="btn btn-link p-0" (click)="toggleDetails()">{{ job.jobspec_name }}</button> <button class="btn btn-link p-0" (click)="toggleDetails()">{{ job.jobspec_name }}</button>
</ng-container> </ng-container>
<ng-template #notHomeTabName> <ng-template #notHomeTabName>
<a [routerLink]="['/jobs']" [queryParams]="{pattern: job.jobspec_id, queue: jobspec.queueName}">{{job.jobspec_name}}</a> <a [routerLink]="['/jobs']" [queryParams]="{pattern: job.jobspec_id, queue: jobspec?.queueName}">{{job.jobspec_name}}</a>
<button class="btn btn-xs btn-outline-primary border-0 ml-2" (click)="toggleDetails()"> <button class="btn btn-xs btn-outline-primary border-0 ml-2" (click)="toggleDetails()">
<fa-icon [icon]="faCaretDown" *ngIf="!detailsExposed"></fa-icon> <fa-icon [icon]="faCaretDown" *ngIf="!detailsExposed"></fa-icon>
<fa-icon [icon]="faCaretUp" *ngIf="detailsExposed"></fa-icon> <fa-icon [icon]="faCaretUp" *ngIf="detailsExposed"></fa-icon>
......
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