Browse Source

UI: Improved dashboard autocomplete - ignoreError and add error handling

pull/13299/head
Vladyslav_Prykhodko 1 year ago
parent
commit
357a1512e8
  1. 13
      ui-ngx/src/app/shared/components/dashboard-autocomplete.component.ts

13
ui-ngx/src/app/shared/components/dashboard-autocomplete.component.ts

@ -190,15 +190,22 @@ export class DashboardAutocompleteComponent implements ControlValueAccessor, OnI
this.searchText = '';
if (value != null) {
if (typeof value === 'string') {
this.dashboardService.getDashboardInfo(value).subscribe(
(dashboard) => {
this.dashboardService.getDashboardInfo(value, {ignoreLoading: true, ignoreErrors: true}).subscribe({
next: (dashboard) => {
this.modelValue = this.useIdValue ? dashboard.id.id : dashboard;
if (this.useDashboardLink) {
this.dashboardURL = getEntityDetailsPageURL(this.modelValue as string, EntityType.DASHBOARD);
}
this.selectDashboardFormGroup.get('dashboard').patchValue(dashboard, {emitEvent: false});
},
error: () => {
this.modelValue = null;
this.selectDashboardFormGroup.get('dashboard').patchValue('', {emitEvent: false});
if (this.required) {
this.propagateChange(this.modelValue);
}
}
);
});
} else {
this.modelValue = this.useIdValue ? value.id.id : value;
this.selectDashboardFormGroup.get('dashboard').patchValue(value, {emitEvent: false});

Loading…
Cancel
Save