This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(volumes): fix volumes sorting (#1065)
Closes #949
- Loading branch information
Darya Baklanova
authored
Apr 28, 2018
1 parent
4322870
commit 5249ed3
Showing
5 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/app/volume/volume-list/volume-grouped-list.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Component } from '@angular/core'; | ||
import { GroupedListComponent } from '../../shared/components/grouped-list/grouped-list.component'; | ||
import { volumeTypeNames } from '../../shared/models'; | ||
|
||
@Component({ | ||
selector: 'cs-volume-grouped-list', | ||
template: ` | ||
<ng-container *ngFor="let child of tree"> | ||
<div class="grouped-section" *ngIf="child.name; else leaf"> | ||
<h4>{{ child.name | translate }}</h4> | ||
<cs-volume-grouped-list | ||
[component]="component" | ||
[groupings]="groupings" | ||
[level]="level + 1" | ||
[list]="child.items" | ||
[dynamicInputs]="dynamicInputs" | ||
[dynamicOutputs]="dynamicOutputs" | ||
></cs-volume-grouped-list> | ||
</div> | ||
<ng-template #leaf> | ||
<mat-list> | ||
<ndc-dynamic | ||
*ngFor="let item of child.items" | ||
[ndcDynamicComponent]="component" | ||
[ndcDynamicInputs]="leafInputs(item)" | ||
[ndcDynamicOutputs]="dynamicOutputs" | ||
></ndc-dynamic> | ||
</mat-list> | ||
</ng-template> | ||
</ng-container> | ||
`, | ||
styleUrls: ['../../shared/components/grouped-list/grouped-list.component.scss'] | ||
}) | ||
export class VolumeGroupedListComponent extends GroupedListComponent { | ||
protected sortGroups(group1, group2) { | ||
return group1.name === volumeTypeNames['ROOT'] | ||
? -1 | ||
: group1.name === volumeTypeNames['DATADISK'] | ||
? 1 | ||
: group1.name.localeCompare(group2.name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<cs-grouped-list | ||
<cs-volume-grouped-list | ||
class="padding" | ||
[list]="volumes" | ||
[groupings]="groupings" | ||
[component]="itemComponent" | ||
[dynamicInputs]="inputs" | ||
[dynamicOutputs]="outputs" | ||
> | ||
</cs-grouped-list> | ||
</cs-volume-grouped-list> | ||
<cs-no-results *ngIf="!volumes?.length"></cs-no-results> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters