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:
@@ -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,
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user