@c8y/ngx-components 1017.0.63 → 1017.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import * as i4 from '@c8y/ngx-components';
5
5
  import { gettext, BaseColumn, getBasicInputArrayFormFieldConfig, TypeaheadComponent, memoize, Status, NavigatorNode, hookNavigator, hookRoute, CoreModule, FormsModule, ModalSelectionMode, ViewContext } from '@c8y/ngx-components';
6
6
  import * as i2 from '@c8y/ngx-components/repository/shared';
7
7
  import { PRODUCT_EXPERIENCE, RepositoryType, SoftwareTypeComponent, SharedRepositoryModule, RepositorySelectModalComponent } from '@c8y/ngx-components/repository/shared';
8
- import { isUndefined, assign, get, cloneDeep, uniqBy, property, filter, set, has } from 'lodash-es';
8
+ import { isUndefined, assign, get, cloneDeep, uniqBy, property, set, filter, has } from 'lodash-es';
9
9
  import { BehaviorSubject, from, NEVER, pipe, Observable, Subject, merge, of, combineLatest } from 'rxjs';
10
10
  import { tap, debounceTime, distinctUntilChanged, switchMap, map, shareReplay, distinctUntilKeyChanged, withLatestFrom, takeUntil, take, share, mergeMap, filter as filter$1 } from 'rxjs/operators';
11
11
  import * as i1 from 'ngx-bootstrap/modal';
@@ -775,9 +775,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
775
775
  }]
776
776
  }] });
777
777
 
778
- class DeviceSoftwareListComponent {
778
+ class DeviceSoftwareService {
779
779
  constructor(advancedSoftwareService) {
780
780
  this.advancedSoftwareService = advancedSoftwareService;
781
+ this.reloadSubject$ = new BehaviorSubject(null);
782
+ this.loadingSubject$ = new Subject();
783
+ }
784
+ /**
785
+ * Indicates whether device software data is currently being loaded.
786
+ */
787
+ get loading$() {
788
+ return this.loadingSubject$.asObservable().pipe(share());
789
+ }
790
+ /**
791
+ * Trigger device software data reload.
792
+ */
793
+ reload() {
794
+ this.reloadSubject$.next();
795
+ }
796
+ /**
797
+ * Retrieves the software list that is installed on a given device.
798
+ *
799
+ * @param deviceId ID of the device to retrieve software data for
800
+ * @param filterCriteria Criteria that software items are filtered by.
801
+ * @param legacySoftwareList If provided no data will be fetched from backend. The provided software list
802
+ * will be filtered by the specified filter criteria.
803
+ *
804
+ * @returns The software items installed on the specified device filtered by the specified criteria.
805
+ */
806
+ getSoftwareList(deviceId, filterCriteria, legacySoftwareList) {
807
+ this.loadingSubject$.next(true);
808
+ return this.reloadSubject$.pipe(switchMap(() => {
809
+ const softwareList$ = !!legacySoftwareList
810
+ ? this.getLegacySoftwareList(legacySoftwareList, filterCriteria)
811
+ : this.getAdvancedSoftwareList(deviceId, filterCriteria);
812
+ return softwareList$.then(resultList => {
813
+ this.loadingSubject$.next(false);
814
+ return resultList;
815
+ });
816
+ }), share());
817
+ }
818
+ getAdvancedSoftwareList(deviceId, filterCriteria) {
819
+ const queryFilter = {
820
+ deviceId,
821
+ currentPage: 1,
822
+ pageSize: 50,
823
+ withTotalPages: true
824
+ };
825
+ if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.name) {
826
+ set(queryFilter, 'name', `*${filterCriteria.name}*`);
827
+ }
828
+ if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.softwareType) {
829
+ set(queryFilter, 'type', `${filterCriteria.softwareType}`);
830
+ }
831
+ return this.advancedSoftwareService.list(queryFilter);
832
+ }
833
+ getLegacySoftwareList(legacySoftwareList, filterCriteria) {
834
+ const data = filterCriteria
835
+ ? legacySoftwareList.filter(item => {
836
+ var _a;
837
+ let match = true;
838
+ if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.name) {
839
+ match = match && ((_a = item.name) === null || _a === void 0 ? void 0 : _a.includes(filterCriteria.name));
840
+ }
841
+ if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.softwareType) {
842
+ match = match && item.softwareType === filterCriteria.softwareType;
843
+ }
844
+ return match;
845
+ })
846
+ : legacySoftwareList;
847
+ return Promise.resolve({
848
+ data,
849
+ res: null,
850
+ paging: {
851
+ totalPages: data.length
852
+ }
853
+ });
854
+ }
855
+ }
856
+ DeviceSoftwareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareService, deps: [{ token: i2.AdvancedSoftwareService }], target: i0.ɵɵFactoryTarget.Injectable });
857
+ DeviceSoftwareService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareService, providedIn: 'root' });
858
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareService, decorators: [{
859
+ type: Injectable,
860
+ args: [{
861
+ providedIn: 'root'
862
+ }]
863
+ }], ctorParameters: function () { return [{ type: i2.AdvancedSoftwareService }]; } });
864
+
865
+ class DeviceSoftwareListComponent {
866
+ constructor(deviceSoftwareService) {
867
+ this.deviceSoftwareService = deviceSoftwareService;
781
868
  this.PRODUCT_EXPERIENCE = PRODUCT_EXPERIENCE;
782
869
  this.filterCriteria$ = of(null);
783
870
  this.update = new EventEmitter();
@@ -787,6 +874,7 @@ class DeviceSoftwareListComponent {
787
874
  this.supportsSoftwareOperations = false;
788
875
  this.operationTypes = ['c8y_SoftwareUpdate', 'c8y_SoftwareList', 'c8y_Software'];
789
876
  this.legacySoftwareList$ = new BehaviorSubject([]);
877
+ this.destroyed$ = new Subject();
790
878
  }
791
879
  set softwareList(softwareList) {
792
880
  if (softwareList !== null) {
@@ -798,20 +886,15 @@ class DeviceSoftwareListComponent {
798
886
  this.filterCriteria$.pipe(debounceTime(300), distinctUntilChanged()),
799
887
  this.legacySoftwareList$
800
888
  ]).pipe(switchMap(([filterCriteria, legacySoftwareList]) => {
801
- if (legacySoftwareList) {
802
- return of(this.getLegacySoftwareList(filterCriteria)).pipe(map(resultList => ({ resultList, filterCriteria })));
803
- }
804
- else {
805
- return this.getAdvancedSoftwareList(filterCriteria).then(resultList => ({
806
- resultList,
807
- filterCriteria
808
- }));
809
- }
889
+ var _a;
890
+ return this.deviceSoftwareService
891
+ .getSoftwareList((_a = this.device) === null || _a === void 0 ? void 0 : _a.id, filterCriteria, legacySoftwareList)
892
+ .pipe(map(resultList => ({ resultList, filterCriteria })));
810
893
  }), tap(({ resultList, filterCriteria }) => {
811
894
  var _a, _b;
812
895
  this.notifyListEmpty(!((_a = resultList === null || resultList === void 0 ? void 0 : resultList.paging) === null || _a === void 0 ? void 0 : _a.totalPages) && !filterCriteria);
813
896
  this.noSearchResults = !((_b = resultList === null || resultList === void 0 ? void 0 : resultList.paging) === null || _b === void 0 ? void 0 : _b.totalPages) && !!filterCriteria;
814
- }), map(({ resultList }) => resultList), share());
897
+ }), map(({ resultList }) => resultList), share(), takeUntil(this.destroyed$));
815
898
  const supportedOperations = get(this.device, 'c8y_SupportedOperations', []);
816
899
  this.supportsSoftwareOperations = this.operationTypes.some(operationType => supportedOperations.indexOf(operationType) > -1);
817
900
  }
@@ -823,54 +906,21 @@ class DeviceSoftwareListComponent {
823
906
  const relevantChanges = filter(this.deviceSoftwareChanges, software);
824
907
  return relevantChanges.length > 0;
825
908
  }
826
- getAdvancedSoftwareList(filterCriteria) {
827
- const queryFilter = {
828
- deviceId: this.device.id,
829
- currentPage: 1,
830
- pageSize: 50,
831
- withTotalPages: true
832
- };
833
- if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.name) {
834
- set(queryFilter, 'name', `*${filterCriteria.name}*`);
835
- }
836
- if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.softwareType) {
837
- set(queryFilter, 'type', `${filterCriteria.softwareType}`);
838
- }
839
- return this.advancedSoftwareService.list(queryFilter);
840
- }
841
- getLegacySoftwareList(filterCriteria) {
842
- const data = filterCriteria
843
- ? this.legacySoftwareList$.value.filter(item => {
844
- var _a;
845
- let match = true;
846
- if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.name) {
847
- match = match && ((_a = item.name) === null || _a === void 0 ? void 0 : _a.includes(filterCriteria.name));
848
- }
849
- if (filterCriteria === null || filterCriteria === void 0 ? void 0 : filterCriteria.softwareType) {
850
- match = match && item.softwareType === filterCriteria.softwareType;
851
- }
852
- return match;
853
- })
854
- : this.legacySoftwareList$.value;
855
- return {
856
- data,
857
- res: null,
858
- paging: {
859
- totalPages: data.length
860
- }
861
- };
909
+ ngOnDestroy() {
910
+ this.destroyed$.next();
911
+ this.destroyed$.complete();
862
912
  }
863
913
  notifyListEmpty(isEmpty) {
864
914
  this.emptyList = isEmpty;
865
915
  this.onListEmpty.emit(isEmpty);
866
916
  }
867
917
  }
868
- DeviceSoftwareListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareListComponent, deps: [{ token: i2.AdvancedSoftwareService }], target: i0.ɵɵFactoryTarget.Component });
918
+ DeviceSoftwareListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareListComponent, deps: [{ token: DeviceSoftwareService }], target: i0.ɵɵFactoryTarget.Component });
869
919
  DeviceSoftwareListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: DeviceSoftwareListComponent, selector: "c8y-device-software-list", inputs: { softwareList: "softwareList", device: "device", deviceSoftwareChanges: "deviceSoftwareChanges", filterCriteria$: "filterCriteria$" }, outputs: { update: "update", remove: "remove", onListEmpty: "onListEmpty" }, ngImport: i0, template: "<c8y-list-group class=\"no-border-2nd-last\">\n <c8y-li\n [ngClass]=\"{ disabled: isSoftwareGoingToBeChanged(software) }\"\n *c8yFor=\"let software of softwareItems$\"\n >\n <!-- SOFTWARE ICON -->\n <c8y-li-icon>\n <i c8yIcon=\"c8y-tools\"></i>\n </c8y-li-icon>\n\n <c8y-li-body class=\"content-flex-20\">\n <div title=\"{{ software.name }}\" class=\"col-9\">\n <p class=\"d-flex\">\n <!-- SOFTWARE NAME -->\n <span class=\"text-truncate\">\n {{ software.name }}\n </span>\n <!-- SOFTWARE TYPE-->\n <span class=\"text-truncate\">\n <span class=\"label label-primary m-l-8\">{{ software.softwareType }}</span>\n </span>\n </p>\n <!-- SOFTWARE VERSION -->\n <p class=\"d-flex a-i-center\">\n <span class=\"text-truncate text-label-small m-r-4\" translate>Version</span>\n <span class=\"text-truncate m-r-4\" title=\"{{ software.version }}\">\n {{ software.version }}\n </span>\n <i\n *ngIf=\"software.installed\"\n c8yIcon=\"warning\"\n class=\"text-warning a-s-center\"\n [tooltip]=\"\n alreadyInstalledMessage\n | translate: { name: software.name, version: software.version }\n \"\n container=\"body\"\n placement=\"top\"\n [delay]=\"500\"\n ></i>\n </p>\n </div>\n\n <div\n *ngIf=\"supportsSoftwareOperations && (showUpdate || showRemove)\"\n class=\"col-3 text-right m-0 flex-grow d-flex a-i-center\"\n >\n <!-- UPDATE SOFTWARE -->\n <button\n *ngIf=\"showUpdate && !isSoftwareGoingToBeChanged(software)\"\n class=\"btn btn-default btn-xs m-l-auto m-r-4\"\n (click)=\"update.emit(software)\"\n title=\"{{ 'Update`software,verb`' | translate }}\"\n type=\"button\"\n c8yProductExperience\n [actionName]=\"PRODUCT_EXPERIENCE.SOFTWARE.EVENTS.DEVICE_TAB\"\n [actionData]=\"{\n component: PRODUCT_EXPERIENCE.SOFTWARE.COMPONENTS.DEVICE_SOFTWARE_LIST,\n action: PRODUCT_EXPERIENCE.SOFTWARE.ACTIONS.OPEN_UPDATE_SOFTWARE\n }\"\n >\n {{ 'Update`software,verb`' | translate }}\n </button>\n\n <!-- REMOVE SOFTWARE -->\n <button\n *ngIf=\"showRemove && !isSoftwareGoingToBeChanged(software)\"\n class=\"btn btn-dot btn-dot--danger m-l-4\"\n (click)=\"remove.emit(software)\"\n tooltip=\"{{ 'Remove`software,verb`' | translate }}\"\n [attr.aria-label]=\"'Remove`software,verb`' | translate\"\n placement=\"bottom\"\n container=\"body\"\n [delay]=\"500\"\n type=\"button\"\n c8yProductExperience\n [actionName]=\"PRODUCT_EXPERIENCE.SOFTWARE.EVENTS.DEVICE_TAB\"\n [actionData]=\"{\n component: PRODUCT_EXPERIENCE.SOFTWARE.COMPONENTS.DEVICE_SOFTWARE_LIST,\n action: PRODUCT_EXPERIENCE.SOFTWARE.ACTIONS.DELETE_SOFTWARE\n }\"\n >\n <i c8yIcon=\"minus-circle\"></i>\n </button>\n </div>\n </c8y-li-body>\n </c8y-li>\n</c8y-list-group>\n<!-- NO SEARCH RESULTS STATE -->\n<div class=\"card-block\" *ngIf=\"noSearchResults || emptyList\">\n <ng-content *ngIf=\"emptyList\" select=\".c8y-empty-state:not(.c8y-no-results-state)\"></ng-content>\n <ng-content *ngIf=\"noSearchResults\" select=\".c8y-no-results-state\"></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i4.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i4.ForOfDirective, selector: "[c8yFor]", inputs: ["c8yForOf", "c8yForLoadMore", "c8yForPipe", "c8yForNotFound", "c8yForMaxIterations", "c8yForLoadingTemplate", "c8yForLoadNextLabel", "c8yForRealtime", "c8yForRealtimeOptions", "c8yForComparator", "c8yForEnableVirtualScroll", "c8yForVirtualScrollElementSize", "c8yForVirtualScrollStrategy", "c8yForVirtualScrollContainerHeight"], outputs: ["c8yForCount"] }, { kind: "component", type: i4.ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: i4.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "emptyActions", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: i4.ListItemIconComponent, selector: "c8y-list-item-icon, c8y-li-icon", inputs: ["icon", "status"] }, { kind: "component", type: i4.ListItemBodyComponent, selector: "c8y-list-item-body, c8y-li-body", inputs: ["body"] }, { kind: "directive", type: i4.ProductExperienceDirective, selector: "[c8yProductExperience]", inputs: ["actionName", "actionData", "inherit"] }, { kind: "directive", type: i10.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "pipe", type: i4.C8yTranslatePipe, name: "translate" }] });
870
920
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareListComponent, decorators: [{
871
921
  type: Component,
872
922
  args: [{ selector: 'c8y-device-software-list', template: "<c8y-list-group class=\"no-border-2nd-last\">\n <c8y-li\n [ngClass]=\"{ disabled: isSoftwareGoingToBeChanged(software) }\"\n *c8yFor=\"let software of softwareItems$\"\n >\n <!-- SOFTWARE ICON -->\n <c8y-li-icon>\n <i c8yIcon=\"c8y-tools\"></i>\n </c8y-li-icon>\n\n <c8y-li-body class=\"content-flex-20\">\n <div title=\"{{ software.name }}\" class=\"col-9\">\n <p class=\"d-flex\">\n <!-- SOFTWARE NAME -->\n <span class=\"text-truncate\">\n {{ software.name }}\n </span>\n <!-- SOFTWARE TYPE-->\n <span class=\"text-truncate\">\n <span class=\"label label-primary m-l-8\">{{ software.softwareType }}</span>\n </span>\n </p>\n <!-- SOFTWARE VERSION -->\n <p class=\"d-flex a-i-center\">\n <span class=\"text-truncate text-label-small m-r-4\" translate>Version</span>\n <span class=\"text-truncate m-r-4\" title=\"{{ software.version }}\">\n {{ software.version }}\n </span>\n <i\n *ngIf=\"software.installed\"\n c8yIcon=\"warning\"\n class=\"text-warning a-s-center\"\n [tooltip]=\"\n alreadyInstalledMessage\n | translate: { name: software.name, version: software.version }\n \"\n container=\"body\"\n placement=\"top\"\n [delay]=\"500\"\n ></i>\n </p>\n </div>\n\n <div\n *ngIf=\"supportsSoftwareOperations && (showUpdate || showRemove)\"\n class=\"col-3 text-right m-0 flex-grow d-flex a-i-center\"\n >\n <!-- UPDATE SOFTWARE -->\n <button\n *ngIf=\"showUpdate && !isSoftwareGoingToBeChanged(software)\"\n class=\"btn btn-default btn-xs m-l-auto m-r-4\"\n (click)=\"update.emit(software)\"\n title=\"{{ 'Update`software,verb`' | translate }}\"\n type=\"button\"\n c8yProductExperience\n [actionName]=\"PRODUCT_EXPERIENCE.SOFTWARE.EVENTS.DEVICE_TAB\"\n [actionData]=\"{\n component: PRODUCT_EXPERIENCE.SOFTWARE.COMPONENTS.DEVICE_SOFTWARE_LIST,\n action: PRODUCT_EXPERIENCE.SOFTWARE.ACTIONS.OPEN_UPDATE_SOFTWARE\n }\"\n >\n {{ 'Update`software,verb`' | translate }}\n </button>\n\n <!-- REMOVE SOFTWARE -->\n <button\n *ngIf=\"showRemove && !isSoftwareGoingToBeChanged(software)\"\n class=\"btn btn-dot btn-dot--danger m-l-4\"\n (click)=\"remove.emit(software)\"\n tooltip=\"{{ 'Remove`software,verb`' | translate }}\"\n [attr.aria-label]=\"'Remove`software,verb`' | translate\"\n placement=\"bottom\"\n container=\"body\"\n [delay]=\"500\"\n type=\"button\"\n c8yProductExperience\n [actionName]=\"PRODUCT_EXPERIENCE.SOFTWARE.EVENTS.DEVICE_TAB\"\n [actionData]=\"{\n component: PRODUCT_EXPERIENCE.SOFTWARE.COMPONENTS.DEVICE_SOFTWARE_LIST,\n action: PRODUCT_EXPERIENCE.SOFTWARE.ACTIONS.DELETE_SOFTWARE\n }\"\n >\n <i c8yIcon=\"minus-circle\"></i>\n </button>\n </div>\n </c8y-li-body>\n </c8y-li>\n</c8y-list-group>\n<!-- NO SEARCH RESULTS STATE -->\n<div class=\"card-block\" *ngIf=\"noSearchResults || emptyList\">\n <ng-content *ngIf=\"emptyList\" select=\".c8y-empty-state:not(.c8y-no-results-state)\"></ng-content>\n <ng-content *ngIf=\"noSearchResults\" select=\".c8y-no-results-state\"></ng-content>\n</div>\n" }]
873
- }], ctorParameters: function () { return [{ type: i2.AdvancedSoftwareService }]; }, propDecorators: { softwareList: [{
923
+ }], ctorParameters: function () { return [{ type: DeviceSoftwareService }]; }, propDecorators: { softwareList: [{
874
924
  type: Input
875
925
  }], device: [{
876
926
  type: Input
@@ -1108,10 +1158,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
1108
1158
  }] } });
1109
1159
 
1110
1160
  class SoftwareDeviceTabComponent {
1111
- constructor(route, repository, inventory, advancedSoftwareService) {
1161
+ constructor(route, repository, inventory, deviceSoftwareService, advancedSoftwareService) {
1112
1162
  this.route = route;
1113
1163
  this.repository = repository;
1114
1164
  this.inventory = inventory;
1165
+ this.deviceSoftwareService = deviceSoftwareService;
1115
1166
  this.advancedSoftwareService = advancedSoftwareService;
1116
1167
  this.deviceId = this.route.snapshot.parent.data.contextData.id;
1117
1168
  this.device$ = new BehaviorSubject(this.route.snapshot.parent.data.contextData);
@@ -1119,7 +1170,7 @@ class SoftwareDeviceTabComponent {
1119
1170
  const deviceTypeQuery = this.repository.getDeviceTypeQuery(RepositoryType.SOFTWARE, device);
1120
1171
  return this.repository.getSoftwareTypeQuery(device, deviceTypeQuery);
1121
1172
  }));
1122
- this.list$ = this.device$.pipe(distinctUntilKeyChanged('id'), switchMap(device => this.advancedSoftwareService
1173
+ this.list$ = this.device$.pipe(switchMap(device => this.advancedSoftwareService
1123
1174
  .isASMAvailable()
1124
1175
  .then(isASMAvailable => ({ isASMAvailable, device }))), map(({ isASMAvailable, device }) =>
1125
1176
  // with ASM available software items will be retrieved directly in the
@@ -1163,7 +1214,13 @@ class SoftwareDeviceTabComponent {
1163
1214
  loadDevice() {
1164
1215
  return __awaiter(this, void 0, void 0, function* () {
1165
1216
  this.reloading = true;
1166
- const device = (yield this.inventory.detail(this.deviceId, { withChildren: false })).data;
1217
+ this.deviceSoftwareService.reload();
1218
+ const device = yield Promise.all([
1219
+ this.deviceSoftwareService.loading$
1220
+ .pipe(filter$1(loading => !loading), take(1))
1221
+ .toPromise(),
1222
+ this.inventory.detail(this.deviceId, { withChildren: false }).then(result => result.data)
1223
+ ]).then(([_, device]) => device);
1167
1224
  this.device$.next(device);
1168
1225
  this.reloading = false;
1169
1226
  });
@@ -1207,12 +1264,12 @@ class SoftwareDeviceTabComponent {
1207
1264
  return (operation && [OperationStatus.PENDING, OperationStatus.EXECUTING].includes(operation.status));
1208
1265
  }
1209
1266
  }
1210
- SoftwareDeviceTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: SoftwareDeviceTabComponent, deps: [{ token: i5$1.ActivatedRoute }, { token: i2.RepositoryService }, { token: i2$1.InventoryService }, { token: i2.AdvancedSoftwareService }], target: i0.ɵɵFactoryTarget.Component });
1267
+ SoftwareDeviceTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: SoftwareDeviceTabComponent, deps: [{ token: i5$1.ActivatedRoute }, { token: i2.RepositoryService }, { token: i2$1.InventoryService }, { token: DeviceSoftwareService }, { token: i2.AdvancedSoftwareService }], target: i0.ɵɵFactoryTarget.Component });
1211
1268
  SoftwareDeviceTabComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: SoftwareDeviceTabComponent, selector: "c8y-software-device-tab", ngImport: i0, template: "<c8y-action-bar-item [placement]=\"'right'\">\n <button class=\"btn btn-link\" title=\"{{ 'Reload' | translate }}\" (click)=\"loadDevice()\">\n <i c8yIcon=\"refresh\" [ngClass]=\"{ 'icon-spin': reloading }\"></i>\n {{ 'Reload' | translate }}\n </button>\n</c8y-action-bar-item>\n\n<div class=\"card split-view--7-5 m-b-0\">\n <c8y-installed-software\n class=\"split-view__list\"\n [device]=\"device$ | async\"\n [typesQuery]=\"typesQuery$ | async\"\n [softwareList]=\"list$ | async\"\n [deviceSoftwareChanges]=\"changes$ | async\"\n [deviceSoftwareChangesOperation]=\"changesOperation$ | async\"\n [deviceSoftwareChangesInProgress]=\"changesInProgress$ | async\"\n (changes)=\"addChanges($event)\"\n (showSoftwareChanges)=\"showSoftwareChanges = true\"\n ></c8y-installed-software>\n <c8y-device-software-changes\n class=\"bg-level-1 split-view__detail\"\n [ngClass]=\"{ 'split-view__detail--selected': showSoftwareChanges }\"\n [changes]=\"changes$ | async\"\n [changesInProgress]=\"changesInProgress$ | async\"\n (clear)=\"clearChanges()\"\n (drop)=\"dropChange($event)\"\n (apply)=\"applyChanges()\"\n (hideSoftwareChanges)=\"showSoftwareChanges = false\"\n ></c8y-device-software-changes>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i4.ActionBarItemComponent, selector: "c8y-action-bar-item", inputs: ["placement", "priority", "itemClass", "injector", "groupId"] }, { kind: "directive", type: i4.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: InstalledSoftwareComponent, selector: "c8y-installed-software", inputs: ["device", "softwareList", "deviceSoftwareChanges", "deviceSoftwareChangesOperation", "deviceSoftwareChangesInProgress", "typesQuery"], outputs: ["changes", "showSoftwareChanges"] }, { kind: "component", type: DeviceSoftwareChangesComponent, selector: "c8y-device-software-changes", inputs: ["changes", "changesInProgress"], outputs: ["clear", "drop", "apply", "hideSoftwareChanges"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.C8yTranslatePipe, name: "translate" }] });
1212
1269
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: SoftwareDeviceTabComponent, decorators: [{
1213
1270
  type: Component,
1214
1271
  args: [{ selector: 'c8y-software-device-tab', template: "<c8y-action-bar-item [placement]=\"'right'\">\n <button class=\"btn btn-link\" title=\"{{ 'Reload' | translate }}\" (click)=\"loadDevice()\">\n <i c8yIcon=\"refresh\" [ngClass]=\"{ 'icon-spin': reloading }\"></i>\n {{ 'Reload' | translate }}\n </button>\n</c8y-action-bar-item>\n\n<div class=\"card split-view--7-5 m-b-0\">\n <c8y-installed-software\n class=\"split-view__list\"\n [device]=\"device$ | async\"\n [typesQuery]=\"typesQuery$ | async\"\n [softwareList]=\"list$ | async\"\n [deviceSoftwareChanges]=\"changes$ | async\"\n [deviceSoftwareChangesOperation]=\"changesOperation$ | async\"\n [deviceSoftwareChangesInProgress]=\"changesInProgress$ | async\"\n (changes)=\"addChanges($event)\"\n (showSoftwareChanges)=\"showSoftwareChanges = true\"\n ></c8y-installed-software>\n <c8y-device-software-changes\n class=\"bg-level-1 split-view__detail\"\n [ngClass]=\"{ 'split-view__detail--selected': showSoftwareChanges }\"\n [changes]=\"changes$ | async\"\n [changesInProgress]=\"changesInProgress$ | async\"\n (clear)=\"clearChanges()\"\n (drop)=\"dropChange($event)\"\n (apply)=\"applyChanges()\"\n (hideSoftwareChanges)=\"showSoftwareChanges = false\"\n ></c8y-device-software-changes>\n</div>\n" }]
1215
- }], ctorParameters: function () { return [{ type: i5$1.ActivatedRoute }, { type: i2.RepositoryService }, { type: i2$1.InventoryService }, { type: i2.AdvancedSoftwareService }]; } });
1272
+ }], ctorParameters: function () { return [{ type: i5$1.ActivatedRoute }, { type: i2.RepositoryService }, { type: i2$1.InventoryService }, { type: DeviceSoftwareService }, { type: i2.AdvancedSoftwareService }]; } });
1216
1273
 
1217
1274
  class SoftwareDeviceTabGuard {
1218
1275
  constructor() {
@@ -1312,5 +1369,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
1312
1369
  * Generated bundle index. Do not edit.
1313
1370
  */
1314
1371
 
1315
- export { AddSoftwareModalComponent, DeviceSoftwareChangesComponent, DeviceSoftwareListComponent, InstalledSoftwareComponent, SoftwareDetailsComponent, SoftwareDeviceTabComponent, SoftwareDeviceTabGuard, SoftwareListComponent, SoftwareRepositoryDeviceTabModule, SoftwareRepositoryListModule, SoftwareRepositoryModule };
1372
+ export { AddSoftwareModalComponent, DeviceSoftwareChangesComponent, DeviceSoftwareListComponent, DeviceSoftwareService, InstalledSoftwareComponent, SoftwareDetailsComponent, SoftwareDeviceTabComponent, SoftwareDeviceTabGuard, SoftwareListComponent, SoftwareRepositoryDeviceTabModule, SoftwareRepositoryListModule, SoftwareRepositoryModule };
1316
1373
  //# sourceMappingURL=c8y-ngx-components-repository-software.mjs.map