Feature/consider availability of date range selector and filters in assistant per view (#3824)

* Consider availability of date range selector and filters in assistant per view

* Update changelog
This commit is contained in:
Thomas Kaul
2024-09-28 18:25:06 +02:00
committed by GitHub
parent 33de8a10bb
commit e8f0d2bb14
7 changed files with 62 additions and 4 deletions

View File

@@ -110,6 +110,8 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
@Input() deviceType: string;
@Input() hasPermissionToAccessAdminControl: boolean;
@Input() hasPermissionToChangeDateRange: boolean;
@Input() hasPermissionToChangeFilters: boolean;
@Input() user: User;
@Output() closed = new EventEmitter<void>();
@@ -254,8 +256,20 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
{ label: $localize`Max`, value: 'max' }
]);
this.dateRangeFormControl.disable({ emitEvent: false });
if (this.hasPermissionToChangeDateRange) {
this.dateRangeFormControl.enable({ emitEvent: false });
}
this.dateRangeFormControl.setValue(this.user?.settings?.dateRange ?? null);
this.filterForm.disable({ emitEvent: false });
if (this.hasPermissionToChangeFilters) {
this.filterForm.enable({ emitEvent: false });
}
this.filterForm.setValue(
{
account: this.user?.settings?.['filters.accounts']?.[0] ?? null,

View File

@@ -150,7 +150,9 @@
<button
i18n
mat-button
[disabled]="!hasFilter(filterForm.value)"
[disabled]="
!hasFilter(filterForm.value) || !hasPermissionToChangeFilters
"
(click)="onResetFilters()"
>
Reset Filters
@@ -160,7 +162,7 @@
color="primary"
i18n
mat-flat-button
[disabled]="!filterForm.dirty"
[disabled]="!filterForm.dirty || !hasPermissionToChangeFilters"
(click)="onApplyFilters()"
>
Apply Filters