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

Sorting tiles before they're stored on the component

parent 4c1de35a
No related branches found
No related tags found
2 merge requests!32Merge 2.4.4 UI to main,!29WS-2903 Sort tiles and planes checkboxes
......@@ -89,11 +89,16 @@ export class ExecutionDetailComponent implements OnInit, OnDestroy, OnChanges {
}
refreshTiles(newTiles: Tile[]) {
this.tiles = new Map<string, Tile>(newTiles.map(tile => {return [tile.name, tile]}));
for (const controlName in this.tilesFormGroup.controls) {
this.tilesFormGroup.removeControl(controlName);
}
Array.from(this.tiles.keys()).forEach(tile => this.tilesFormGroup.addControl(tile, new FormControl(true)));
// 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])
);
for (const controlName in this.tilesFormGroup.controls) {
this.tilesFormGroup.removeControl(controlName);
}
Array.from(this.tiles.keys()).forEach(tile => this.tilesFormGroup.addControl(tile, new FormControl(true)));
}
copyToClipboard(text: string): void {
......
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