Browse Source

Merge pull request #13299 from vvlladd28/improvement/dashboard-autocomplete/error-hadler

Improved dashboard autocomplete  component
pull/13344/head
Igor Kulikov 1 year ago
committed by GitHub
parent
commit
df810d7801
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  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