Merge pull request #12208 from ArtemDzhereleiko/AD/hot-fix/ota-autocomplete-device-profile
Fixed error toast when editing device details
This commit is contained in:
commit
f5ea88d708
@ -31,7 +31,7 @@ import { OtaPackageService } from '@core/http/ota-package.service';
|
|||||||
import { PageLink } from '@shared/models/page/page-link';
|
import { PageLink } from '@shared/models/page/page-link';
|
||||||
import { Direction } from '@shared/models/page/sort-order';
|
import { Direction } from '@shared/models/page/sort-order';
|
||||||
import { emptyPageData } from '@shared/models/page/page-data';
|
import { emptyPageData } from '@shared/models/page/page-data';
|
||||||
import { getEntityDetailsPageURL } from '@core/utils';
|
import { getEntityDetailsPageURL, isDefinedAndNotNull } from '@core/utils';
|
||||||
import { AuthUser } from '@shared/models/user.model';
|
import { AuthUser } from '@shared/models/user.model';
|
||||||
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
||||||
import { Authority } from '@shared/models/authority.enum';
|
import { Authority } from '@shared/models/authority.enum';
|
||||||
@ -64,19 +64,19 @@ export class OtaPackageAutocompleteComponent implements ControlValueAccessor, On
|
|||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private deviceProfile: string;
|
private deviceProfileIdValue: string;
|
||||||
|
|
||||||
get deviceProfileId(): string {
|
get deviceProfileId(): string {
|
||||||
return this.deviceProfile;
|
return this.deviceProfileIdValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set deviceProfileId(value: string) {
|
set deviceProfileId(value: string) {
|
||||||
if (this.deviceProfile !== value) {
|
if (this.deviceProfileIdValue !== value) {
|
||||||
if (this.deviceProfile) {
|
if (this.deviceProfileIdValue) {
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
this.deviceProfile = value;
|
this.deviceProfileIdValue = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,6 +257,7 @@ export class OtaPackageAutocompleteComponent implements ControlValueAccessor, On
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetchPackages(searchText?: string): Observable<Array<OtaPackageInfo>> {
|
fetchPackages(searchText?: string): Observable<Array<OtaPackageInfo>> {
|
||||||
|
if (isDefinedAndNotNull(this.deviceProfileId)) {
|
||||||
this.searchText = searchText;
|
this.searchText = searchText;
|
||||||
const pageLink = new PageLink(50, 0, searchText, {
|
const pageLink = new PageLink(50, 0, searchText, {
|
||||||
property: 'title',
|
property: 'title',
|
||||||
@ -267,6 +268,9 @@ export class OtaPackageAutocompleteComponent implements ControlValueAccessor, On
|
|||||||
catchError(() => of(emptyPageData<OtaPackageInfo>())),
|
catchError(() => of(emptyPageData<OtaPackageInfo>())),
|
||||||
map((data) => data && data.data.length ? data.data : null)
|
map((data) => data && data.data.length ? data.data : null)
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return of([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user