@c8y/ngx-components 1017.0.63 → 1017.0.65
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.
- package/esm2020/repository/software/device-tab/device-software-list.component.mjs +19 -57
- package/esm2020/repository/software/device-tab/device-software.service.mjs +93 -0
- package/esm2020/repository/software/device-tab/index.mjs +2 -1
- package/esm2020/repository/software/device-tab/software-device-tab.component.mjs +21 -12
- package/fesm2015/c8y-ngx-components-repository-software.mjs +113 -56
- package/fesm2015/c8y-ngx-components-repository-software.mjs.map +1 -1
- package/fesm2020/c8y-ngx-components-repository-software.mjs +111 -57
- package/fesm2020/c8y-ngx-components-repository-software.mjs.map +1 -1
- package/package.json +2 -2
- package/repository/software/device-tab/device-software-list.component.d.ts +8 -7
- package/repository/software/device-tab/device-software.service.d.ts +33 -0
- package/repository/software/device-tab/index.d.ts +1 -0
- package/repository/software/device-tab/software-device-tab.component.d.ts +3 -1
|
@@ -9,7 +9,7 @@ import { PRODUCT_EXPERIENCE, RepositoryType, SoftwareTypeComponent, SharedReposi
|
|
|
9
9
|
import * as i4$1 from '@ngx-translate/core';
|
|
10
10
|
import * as i1 from 'ngx-bootstrap/modal';
|
|
11
11
|
import * as i5 from '@angular/forms';
|
|
12
|
-
import { isUndefined, assign, get, cloneDeep, uniqBy, property,
|
|
12
|
+
import { isUndefined, assign, get, cloneDeep, uniqBy, property, set, filter, has } from 'lodash-es';
|
|
13
13
|
import { BehaviorSubject, from, NEVER, pipe, Observable, Subject, merge, of, combineLatest } from 'rxjs';
|
|
14
14
|
import { tap, debounceTime, distinctUntilChanged, switchMap, map, shareReplay, distinctUntilKeyChanged, withLatestFrom, takeUntil, take, share, mergeMap, filter as filter$1 } from 'rxjs/operators';
|
|
15
15
|
import * as i3 from '@angular/common';
|
|
@@ -769,9 +769,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
769
769
|
}]
|
|
770
770
|
}] });
|
|
771
771
|
|
|
772
|
-
class
|
|
772
|
+
class DeviceSoftwareService {
|
|
773
773
|
constructor(advancedSoftwareService) {
|
|
774
774
|
this.advancedSoftwareService = advancedSoftwareService;
|
|
775
|
+
this.reloadSubject$ = new BehaviorSubject(null);
|
|
776
|
+
this.loadingSubject$ = new Subject();
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Indicates whether device software data is currently being loaded.
|
|
780
|
+
*/
|
|
781
|
+
get loading$() {
|
|
782
|
+
return this.loadingSubject$.asObservable().pipe(share());
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Trigger device software data reload.
|
|
786
|
+
*/
|
|
787
|
+
reload() {
|
|
788
|
+
this.reloadSubject$.next();
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Retrieves the software list that is installed on a given device.
|
|
792
|
+
*
|
|
793
|
+
* @param deviceId ID of the device to retrieve software data for
|
|
794
|
+
* @param filterCriteria Criteria that software items are filtered by.
|
|
795
|
+
* @param legacySoftwareList If provided no data will be fetched from backend. The provided software list
|
|
796
|
+
* will be filtered by the specified filter criteria.
|
|
797
|
+
*
|
|
798
|
+
* @returns The software items installed on the specified device filtered by the specified criteria.
|
|
799
|
+
*/
|
|
800
|
+
getSoftwareList(deviceId, filterCriteria, legacySoftwareList) {
|
|
801
|
+
this.loadingSubject$.next(true);
|
|
802
|
+
return this.reloadSubject$.pipe(switchMap(() => {
|
|
803
|
+
const softwareList$ = !!legacySoftwareList
|
|
804
|
+
? this.getLegacySoftwareList(legacySoftwareList, filterCriteria)
|
|
805
|
+
: this.getAdvancedSoftwareList(deviceId, filterCriteria);
|
|
806
|
+
return softwareList$.then(resultList => {
|
|
807
|
+
this.loadingSubject$.next(false);
|
|
808
|
+
return resultList;
|
|
809
|
+
});
|
|
810
|
+
}), share());
|
|
811
|
+
}
|
|
812
|
+
getAdvancedSoftwareList(deviceId, filterCriteria) {
|
|
813
|
+
const queryFilter = {
|
|
814
|
+
deviceId,
|
|
815
|
+
currentPage: 1,
|
|
816
|
+
pageSize: 50,
|
|
817
|
+
withTotalPages: true
|
|
818
|
+
};
|
|
819
|
+
if (filterCriteria?.name) {
|
|
820
|
+
set(queryFilter, 'name', `*${filterCriteria.name}*`);
|
|
821
|
+
}
|
|
822
|
+
if (filterCriteria?.softwareType) {
|
|
823
|
+
set(queryFilter, 'type', `${filterCriteria.softwareType}`);
|
|
824
|
+
}
|
|
825
|
+
return this.advancedSoftwareService.list(queryFilter);
|
|
826
|
+
}
|
|
827
|
+
getLegacySoftwareList(legacySoftwareList, filterCriteria) {
|
|
828
|
+
const data = filterCriteria
|
|
829
|
+
? legacySoftwareList.filter(item => {
|
|
830
|
+
let match = true;
|
|
831
|
+
if (filterCriteria?.name) {
|
|
832
|
+
match = match && item.name?.includes(filterCriteria.name);
|
|
833
|
+
}
|
|
834
|
+
if (filterCriteria?.softwareType) {
|
|
835
|
+
match = match && item.softwareType === filterCriteria.softwareType;
|
|
836
|
+
}
|
|
837
|
+
return match;
|
|
838
|
+
})
|
|
839
|
+
: legacySoftwareList;
|
|
840
|
+
return Promise.resolve({
|
|
841
|
+
data,
|
|
842
|
+
res: null,
|
|
843
|
+
paging: {
|
|
844
|
+
totalPages: data.length
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
DeviceSoftwareService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareService, deps: [{ token: i2.AdvancedSoftwareService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
850
|
+
DeviceSoftwareService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareService, providedIn: 'root' });
|
|
851
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareService, decorators: [{
|
|
852
|
+
type: Injectable,
|
|
853
|
+
args: [{
|
|
854
|
+
providedIn: 'root'
|
|
855
|
+
}]
|
|
856
|
+
}], ctorParameters: function () { return [{ type: i2.AdvancedSoftwareService }]; } });
|
|
857
|
+
|
|
858
|
+
class DeviceSoftwareListComponent {
|
|
859
|
+
constructor(deviceSoftwareService) {
|
|
860
|
+
this.deviceSoftwareService = deviceSoftwareService;
|
|
775
861
|
this.PRODUCT_EXPERIENCE = PRODUCT_EXPERIENCE;
|
|
776
862
|
this.filterCriteria$ = of(null);
|
|
777
863
|
this.update = new EventEmitter();
|
|
@@ -781,6 +867,7 @@ class DeviceSoftwareListComponent {
|
|
|
781
867
|
this.supportsSoftwareOperations = false;
|
|
782
868
|
this.operationTypes = ['c8y_SoftwareUpdate', 'c8y_SoftwareList', 'c8y_Software'];
|
|
783
869
|
this.legacySoftwareList$ = new BehaviorSubject([]);
|
|
870
|
+
this.destroyed$ = new Subject();
|
|
784
871
|
}
|
|
785
872
|
set softwareList(softwareList) {
|
|
786
873
|
if (softwareList !== null) {
|
|
@@ -791,20 +878,12 @@ class DeviceSoftwareListComponent {
|
|
|
791
878
|
this.softwareItems$ = combineLatest([
|
|
792
879
|
this.filterCriteria$.pipe(debounceTime(300), distinctUntilChanged()),
|
|
793
880
|
this.legacySoftwareList$
|
|
794
|
-
]).pipe(switchMap(([filterCriteria, legacySoftwareList]) =>
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
else {
|
|
799
|
-
return this.getAdvancedSoftwareList(filterCriteria).then(resultList => ({
|
|
800
|
-
resultList,
|
|
801
|
-
filterCriteria
|
|
802
|
-
}));
|
|
803
|
-
}
|
|
804
|
-
}), tap(({ resultList, filterCriteria }) => {
|
|
881
|
+
]).pipe(switchMap(([filterCriteria, legacySoftwareList]) => this.deviceSoftwareService
|
|
882
|
+
.getSoftwareList(this.device?.id, filterCriteria, legacySoftwareList)
|
|
883
|
+
.pipe(map(resultList => ({ resultList, filterCriteria })))), tap(({ resultList, filterCriteria }) => {
|
|
805
884
|
this.notifyListEmpty(!resultList?.paging?.totalPages && !filterCriteria);
|
|
806
885
|
this.noSearchResults = !resultList?.paging?.totalPages && !!filterCriteria;
|
|
807
|
-
}), map(({ resultList }) => resultList), share());
|
|
886
|
+
}), map(({ resultList }) => resultList), share(), takeUntil(this.destroyed$));
|
|
808
887
|
const supportedOperations = get(this.device, 'c8y_SupportedOperations', []);
|
|
809
888
|
this.supportsSoftwareOperations = this.operationTypes.some(operationType => supportedOperations.indexOf(operationType) > -1);
|
|
810
889
|
}
|
|
@@ -816,53 +895,21 @@ class DeviceSoftwareListComponent {
|
|
|
816
895
|
const relevantChanges = filter(this.deviceSoftwareChanges, software);
|
|
817
896
|
return relevantChanges.length > 0;
|
|
818
897
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
currentPage: 1,
|
|
823
|
-
pageSize: 50,
|
|
824
|
-
withTotalPages: true
|
|
825
|
-
};
|
|
826
|
-
if (filterCriteria?.name) {
|
|
827
|
-
set(queryFilter, 'name', `*${filterCriteria.name}*`);
|
|
828
|
-
}
|
|
829
|
-
if (filterCriteria?.softwareType) {
|
|
830
|
-
set(queryFilter, 'type', `${filterCriteria.softwareType}`);
|
|
831
|
-
}
|
|
832
|
-
return this.advancedSoftwareService.list(queryFilter);
|
|
833
|
-
}
|
|
834
|
-
getLegacySoftwareList(filterCriteria) {
|
|
835
|
-
const data = filterCriteria
|
|
836
|
-
? this.legacySoftwareList$.value.filter(item => {
|
|
837
|
-
let match = true;
|
|
838
|
-
if (filterCriteria?.name) {
|
|
839
|
-
match = match && item.name?.includes(filterCriteria.name);
|
|
840
|
-
}
|
|
841
|
-
if (filterCriteria?.softwareType) {
|
|
842
|
-
match = match && item.softwareType === filterCriteria.softwareType;
|
|
843
|
-
}
|
|
844
|
-
return match;
|
|
845
|
-
})
|
|
846
|
-
: this.legacySoftwareList$.value;
|
|
847
|
-
return {
|
|
848
|
-
data,
|
|
849
|
-
res: null,
|
|
850
|
-
paging: {
|
|
851
|
-
totalPages: data.length
|
|
852
|
-
}
|
|
853
|
-
};
|
|
898
|
+
ngOnDestroy() {
|
|
899
|
+
this.destroyed$.next();
|
|
900
|
+
this.destroyed$.complete();
|
|
854
901
|
}
|
|
855
902
|
notifyListEmpty(isEmpty) {
|
|
856
903
|
this.emptyList = isEmpty;
|
|
857
904
|
this.onListEmpty.emit(isEmpty);
|
|
858
905
|
}
|
|
859
906
|
}
|
|
860
|
-
DeviceSoftwareListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareListComponent, deps: [{ token:
|
|
907
|
+
DeviceSoftwareListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareListComponent, deps: [{ token: DeviceSoftwareService }], target: i0.ɵɵFactoryTarget.Component });
|
|
861
908
|
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" }] });
|
|
862
909
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: DeviceSoftwareListComponent, decorators: [{
|
|
863
910
|
type: Component,
|
|
864
911
|
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" }]
|
|
865
|
-
}], ctorParameters: function () { return [{ type:
|
|
912
|
+
}], ctorParameters: function () { return [{ type: DeviceSoftwareService }]; }, propDecorators: { softwareList: [{
|
|
866
913
|
type: Input
|
|
867
914
|
}], device: [{
|
|
868
915
|
type: Input
|
|
@@ -1109,10 +1156,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
1109
1156
|
}] } });
|
|
1110
1157
|
|
|
1111
1158
|
class SoftwareDeviceTabComponent {
|
|
1112
|
-
constructor(route, repository, inventory, advancedSoftwareService) {
|
|
1159
|
+
constructor(route, repository, inventory, deviceSoftwareService, advancedSoftwareService) {
|
|
1113
1160
|
this.route = route;
|
|
1114
1161
|
this.repository = repository;
|
|
1115
1162
|
this.inventory = inventory;
|
|
1163
|
+
this.deviceSoftwareService = deviceSoftwareService;
|
|
1116
1164
|
this.advancedSoftwareService = advancedSoftwareService;
|
|
1117
1165
|
this.deviceId = this.route.snapshot.parent.data.contextData.id;
|
|
1118
1166
|
this.device$ = new BehaviorSubject(this.route.snapshot.parent.data.contextData);
|
|
@@ -1120,7 +1168,7 @@ class SoftwareDeviceTabComponent {
|
|
|
1120
1168
|
const deviceTypeQuery = this.repository.getDeviceTypeQuery(RepositoryType.SOFTWARE, device);
|
|
1121
1169
|
return this.repository.getSoftwareTypeQuery(device, deviceTypeQuery);
|
|
1122
1170
|
}));
|
|
1123
|
-
this.list$ = this.device$.pipe(
|
|
1171
|
+
this.list$ = this.device$.pipe(switchMap(device => this.advancedSoftwareService
|
|
1124
1172
|
.isASMAvailable()
|
|
1125
1173
|
.then(isASMAvailable => ({ isASMAvailable, device }))), map(({ isASMAvailable, device }) =>
|
|
1126
1174
|
// with ASM available software items will be retrieved directly in the
|
|
@@ -1161,7 +1209,13 @@ class SoftwareDeviceTabComponent {
|
|
|
1161
1209
|
}
|
|
1162
1210
|
async loadDevice() {
|
|
1163
1211
|
this.reloading = true;
|
|
1164
|
-
|
|
1212
|
+
this.deviceSoftwareService.reload();
|
|
1213
|
+
const device = await Promise.all([
|
|
1214
|
+
this.deviceSoftwareService.loading$
|
|
1215
|
+
.pipe(filter$1(loading => !loading), take(1))
|
|
1216
|
+
.toPromise(),
|
|
1217
|
+
this.inventory.detail(this.deviceId, { withChildren: false }).then(result => result.data)
|
|
1218
|
+
]).then(([_, device]) => device);
|
|
1165
1219
|
this.device$.next(device);
|
|
1166
1220
|
this.reloading = false;
|
|
1167
1221
|
}
|
|
@@ -1196,12 +1250,12 @@ class SoftwareDeviceTabComponent {
|
|
|
1196
1250
|
return (operation && [OperationStatus.PENDING, OperationStatus.EXECUTING].includes(operation.status));
|
|
1197
1251
|
}
|
|
1198
1252
|
}
|
|
1199
|
-
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 });
|
|
1253
|
+
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 });
|
|
1200
1254
|
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" }] });
|
|
1201
1255
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: SoftwareDeviceTabComponent, decorators: [{
|
|
1202
1256
|
type: Component,
|
|
1203
1257
|
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" }]
|
|
1204
|
-
}], ctorParameters: function () { return [{ type: i5$1.ActivatedRoute }, { type: i2.RepositoryService }, { type: i2$1.InventoryService }, { type: i2.AdvancedSoftwareService }]; } });
|
|
1258
|
+
}], ctorParameters: function () { return [{ type: i5$1.ActivatedRoute }, { type: i2.RepositoryService }, { type: i2$1.InventoryService }, { type: DeviceSoftwareService }, { type: i2.AdvancedSoftwareService }]; } });
|
|
1205
1259
|
|
|
1206
1260
|
class SoftwareDeviceTabGuard {
|
|
1207
1261
|
constructor() {
|
|
@@ -1301,5 +1355,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
|
|
|
1301
1355
|
* Generated bundle index. Do not edit.
|
|
1302
1356
|
*/
|
|
1303
1357
|
|
|
1304
|
-
export { AddSoftwareModalComponent, DeviceSoftwareChangesComponent, DeviceSoftwareListComponent, InstalledSoftwareComponent, SoftwareDetailsComponent, SoftwareDeviceTabComponent, SoftwareDeviceTabGuard, SoftwareListComponent, SoftwareRepositoryDeviceTabModule, SoftwareRepositoryListModule, SoftwareRepositoryModule };
|
|
1358
|
+
export { AddSoftwareModalComponent, DeviceSoftwareChangesComponent, DeviceSoftwareListComponent, DeviceSoftwareService, InstalledSoftwareComponent, SoftwareDetailsComponent, SoftwareDeviceTabComponent, SoftwareDeviceTabGuard, SoftwareListComponent, SoftwareRepositoryDeviceTabModule, SoftwareRepositoryListModule, SoftwareRepositoryModule };
|
|
1305
1359
|
//# sourceMappingURL=c8y-ngx-components-repository-software.mjs.map
|