Skip to content

Commit

Permalink
feat: grid area overview - status filter
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmajgaard committed Oct 24, 2024
1 parent 805ad99 commit 5e015f3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@
"Dk2": "DK2"
},
"areaTypePlaceholder": "Vælg type",
"statusTypePlaceholder": "Vælg status",
"status": {
"Created": "Oprettet",
"Active": "Aktiv",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
"Dk2": "DK2"
},
"areaTypePlaceholder": "Choose type",
"statusTypePlaceholder": "Choolse status",
"status": {
"Created": "Created",
"Active": "Active",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3>{{ t("topBarTitle") }}</h3>
}}</watt-button>
</vater-stack>

<vater-stack align="flex-start" gap="m">
<vater-stack direction="row" align="flex-start" gap="m">
<watt-dropdown
sortDirection="asc"
dhDropdownTranslator
Expand All @@ -39,6 +39,16 @@ <h3>{{ t("topBarTitle") }}</h3>
[(ngModel)]="selectedGridAreaType"
[placeholder]="t('areaTypePlaceholder')"
/>
<watt-dropdown
sortDirection="asc"
dhDropdownTranslator
translateKey="marketParticipant.gridAreas.status"
[options]="gridAreaStatusOptions"
[multiple]="true"
[chipMode]="true"
[(ngModel)]="selectedGridAreaStatusOptions"
[placeholder]="t('statusTypePlaceholder')"
/>
</vater-stack>
<vater-flex fill="vertical" scrollable>
<watt-table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,25 @@ export class DhMarketParticipantGridAreaOverviewComponent {

gridAreaTypeOptions = dhEnumToWattDropdownOptions(GridAreaType, [GridAreaType.NotSet]);

gridAreaStatusOptions = Object.keys(GridAreaStatus).map((key) => ({
displayValue: key,
value: key,
}));

selectedGridAreaStatusOptions = signal<GridAreaStatus[] | null>([GridAreaStatus.Active]);

selectedGridAreaType = signal<GridAreaType | null>(null);

readonly dataSource = new WattTableDataSource<GridAreaOverviewRow>();

constructor() {
effect(() => {
this.dataSource.data = this.gridAreas()?.filter(
(x) => x.type === this.selectedGridAreaType() || this.selectedGridAreaType() === null
);
const statuses = this.selectedGridAreaStatusOptions();
return (this.dataSource.data = this.gridAreas()?.filter(
(x) =>
(x.type === this.selectedGridAreaType() || this.selectedGridAreaType() === null) &&
(statuses === null || statuses.includes(x.status))
));
});
}

Expand Down

0 comments on commit 5e015f3

Please sign in to comment.