@c8y/ngx-components 1021.49.12 → 1021.51.1
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/core/aggregation/aggregation.model.d.ts.map +1 -0
- package/core/aggregation/aggregation.service.d.ts +44 -0
- package/core/aggregation/aggregation.service.d.ts.map +1 -0
- package/core/aggregation/index.d.ts +3 -0
- package/core/aggregation/index.d.ts.map +1 -0
- package/core/common/index.d.ts +0 -2
- package/core/common/index.d.ts.map +1 -1
- package/core/dashboard/wiget-time-context/aggregation-picker/aggregation-picker.component.d.ts +2 -2
- package/core/dashboard/wiget-time-context/aggregation-picker/aggregation-picker.component.d.ts.map +1 -1
- package/core/dashboard/wiget-time-context/widget-time-context-icon-bar/widget-time-context-icon-bar.component.d.ts +1 -1
- package/core/dashboard/wiget-time-context/widget-time-context-icon-bar/widget-time-context-icon-bar.component.d.ts.map +1 -1
- package/core/dashboard/wiget-time-context/widget-time-context.component.d.ts +1 -1
- package/core/dashboard/wiget-time-context/widget-time-context.component.d.ts.map +1 -1
- package/core/i18n/pattern-messages.data.d.ts +18 -0
- package/core/i18n/pattern-messages.data.d.ts.map +1 -1
- package/core/index.d.ts +1 -0
- package/core/index.d.ts.map +1 -1
- package/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/data-fetching.service.d.ts +54 -42
- package/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/data-fetching.service.d.ts.map +1 -1
- package/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.component.d.ts +28 -8
- package/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.component.d.ts.map +1 -1
- package/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.service.d.ts +3 -52
- package/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.service.d.ts.map +1 -1
- package/datapoints-export-selector/datapoints-export-selector.model.d.ts +5 -14
- package/datapoints-export-selector/datapoints-export-selector.model.d.ts.map +1 -1
- package/device-grid/device-grid.component.d.ts.map +1 -1
- package/device-grid/device-grid.service.d.ts +2 -0
- package/device-grid/device-grid.service.d.ts.map +1 -1
- package/esm2022/alarms/alarms-type-filter.component.mjs +3 -3
- package/esm2022/core/aggregation/aggregation.model.mjs +46 -0
- package/esm2022/core/aggregation/aggregation.service.mjs +76 -0
- package/esm2022/core/aggregation/index.mjs +3 -0
- package/esm2022/core/common/index.mjs +1 -3
- package/esm2022/core/dashboard/wiget-time-context/aggregation-picker/aggregation-picker.component.mjs +2 -2
- package/esm2022/core/dashboard/wiget-time-context/widget-time-context-icon-bar/widget-time-context-icon-bar.component.mjs +2 -2
- package/esm2022/core/dashboard/wiget-time-context/widget-time-context.component.mjs +4 -4
- package/esm2022/core/i18n/pattern-messages.data.mjs +19 -1
- package/esm2022/core/index.mjs +2 -1
- package/esm2022/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/data-fetching.service.mjs +166 -164
- package/esm2022/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.component.mjs +82 -48
- package/esm2022/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-export-selector-file-exporter.service.mjs +5 -95
- package/esm2022/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/datapoints-exports-selector-data-scope/datapoints-exports-selector-data-scope.component.mjs +3 -3
- package/esm2022/datapoints-export-selector/datapoints-export-selector.component.mjs +3 -3
- package/esm2022/datapoints-export-selector/datapoints-export-selector.model.mjs +1 -9
- package/esm2022/device-grid/device-grid.component.mjs +3 -3
- package/esm2022/device-grid/device-grid.service.mjs +16 -1
- package/esm2022/device-list/add-smart-group.component.mjs +3 -3
- package/esm2022/interval-picker/interval-picker.model.mjs +5 -1
- package/esm2022/operations/bulk-operation-list-item/bulk-operation-list-item.service.mjs +5 -4
- package/esm2022/operations/operation-details/operation-details.module.mjs +7 -7
- package/esm2022/operations/operations-list/device-control.feature.mjs +20 -0
- package/esm2022/operations/operations-list/index.mjs +4 -3
- package/esm2022/operations/operations-list/operations-list-item.component.mjs +11 -9
- package/esm2022/operations/operations-list/operations-list.component.mjs +15 -10
- package/esm2022/operations/operations-list/operations-list.module.mjs +16 -41
- package/esm2022/operations/operations-list/operations-list.service.mjs +4 -3
- package/esm2022/operations/operations.module.mjs +21 -14
- package/esm2022/operations/shared/operations.service.mjs +4 -3
- package/esm2022/services/index.mjs +14 -3
- package/esm2022/services/service-command-tab/c8y-ngx-components-services-service-command-tab.mjs +5 -0
- package/esm2022/services/service-command-tab/index.mjs +3 -0
- package/esm2022/services/service-command-tab/service-command-tab.component.mjs +33 -0
- package/esm2022/services/service-command-tab/service-command.feature.mjs +14 -0
- package/esm2022/services/services-device-tab/index.mjs +9 -3
- package/esm2022/services/services-device-tab/services-device-tab.component.mjs +3 -4
- package/esm2022/services/services-device-tab/services-device-tab.guard.mjs +2 -2
- package/esm2022/services/services-device-tab/services.breadcrumb-factory.mjs +13 -1
- package/esm2022/services/services.module.mjs +4 -2
- package/esm2022/services/shared/c8y-ngx-components-services-shared.mjs +5 -0
- package/esm2022/services/shared/index.mjs +3 -0
- package/esm2022/services/shared/service-command.service.mjs +118 -0
- package/esm2022/services/shared/services.model.mjs +23 -0
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table-config/datapoints-table-config.component.mjs +25 -41
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-reload/datapoints-reload.component.mjs +3 -3
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.component.mjs +55 -49
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.service.mjs +25 -73
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table-widget.model.mjs +20 -20
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table.service.mjs +19 -19
- package/fesm2022/c8y-ngx-components-alarms.mjs +2 -2
- package/fesm2022/c8y-ngx-components-alarms.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-datapoints-export-selector.mjs +248 -308
- package/fesm2022/c8y-ngx-components-datapoints-export-selector.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-device-grid.mjs +17 -2
- package/fesm2022/c8y-ngx-components-device-grid.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-device-list.mjs +2 -2
- package/fesm2022/c8y-ngx-components-device-list.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-interval-picker.mjs +5 -1
- package/fesm2022/c8y-ngx-components-interval-picker.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs +3 -2
- package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-operation-details.mjs +5 -5
- package/fesm2022/c8y-ngx-components-operations-operation-details.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-operations-list.mjs +57 -52
- package/fesm2022/c8y-ngx-components-operations-operations-list.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations-shared.mjs +3 -2
- package/fesm2022/c8y-ngx-components-operations-shared.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-operations.mjs +42 -35
- package/fesm2022/c8y-ngx-components-operations.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-services-service-command-tab.mjs +49 -0
- package/fesm2022/c8y-ngx-components-services-service-command-tab.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-services-shared.mjs +145 -0
- package/fesm2022/c8y-ngx-components-services-shared.mjs.map +1 -0
- package/fesm2022/c8y-ngx-components-services.mjs +20 -113
- package/fesm2022/c8y-ngx-components-services.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-table.mjs +1075 -1253
- package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-table.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +136 -76
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/interval-picker/interval-picker.model.d.ts +6 -0
- package/interval-picker/interval-picker.model.d.ts.map +1 -1
- package/locales/de.po +52 -41
- package/locales/es.po +52 -41
- package/locales/fr.po +51 -40
- package/locales/ja_JP.po +53 -43
- package/locales/ko.po +51 -34
- package/locales/locales.pot +42 -31
- package/locales/nl.po +52 -41
- package/locales/pl.po +52 -40
- package/locales/pt_BR.po +51 -40
- package/locales/zh_CN.po +50 -33
- package/locales/zh_TW.po +50 -33
- package/operations/bulk-operation-list-item/bulk-operation-list-item.service.d.ts +2 -2
- package/operations/bulk-operation-list-item/bulk-operation-list-item.service.d.ts.map +1 -1
- package/operations/operation-details/operation-details.module.d.ts +1 -1
- package/operations/operations-list/device-control.feature.d.ts +4 -0
- package/operations/operations-list/device-control.feature.d.ts.map +1 -0
- package/operations/operations-list/index.d.ts +3 -2
- package/operations/operations-list/index.d.ts.map +1 -1
- package/operations/operations-list/operations-list-item.component.d.ts +1 -1
- package/operations/operations-list/operations-list-item.component.d.ts.map +1 -1
- package/operations/operations-list/operations-list.component.d.ts +3 -1
- package/operations/operations-list/operations-list.component.d.ts.map +1 -1
- package/operations/operations-list/operations-list.module.d.ts +3 -9
- package/operations/operations-list/operations-list.module.d.ts.map +1 -1
- package/operations/operations.module.d.ts +1 -2
- package/operations/operations.module.d.ts.map +1 -1
- package/package.json +1 -1
- package/services/index.d.ts +13 -2
- package/services/index.d.ts.map +1 -1
- package/services/service-command-tab/c8y-ngx-components-services-service-command-tab.d.ts.map +1 -0
- package/services/service-command-tab/index.d.ts +3 -0
- package/services/service-command-tab/index.d.ts.map +1 -0
- package/services/service-command-tab/service-command-tab.component.d.ts +12 -0
- package/services/service-command-tab/service-command-tab.component.d.ts.map +1 -0
- package/services/service-command-tab/service-command.feature.d.ts +3 -0
- package/services/service-command-tab/service-command.feature.d.ts.map +1 -0
- package/services/services-device-tab/index.d.ts +8 -2
- package/services/services-device-tab/index.d.ts.map +1 -1
- package/services/services-device-tab/services-device-tab.component.d.ts +2 -2
- package/services/services-device-tab/services-device-tab.component.d.ts.map +1 -1
- package/services/services-device-tab/services.breadcrumb-factory.d.ts.map +1 -1
- package/services/services.module.d.ts.map +1 -1
- package/services/shared/c8y-ngx-components-services-shared.d.ts.map +1 -0
- package/services/shared/index.d.ts +3 -0
- package/services/shared/index.d.ts.map +1 -0
- package/services/{services-device-tab → shared}/service-command.service.d.ts +10 -7
- package/services/shared/service-command.service.d.ts.map +1 -0
- package/services/shared/services.model.d.ts +31 -0
- package/services/shared/services.model.d.ts.map +1 -0
- package/widgets/implementations/datapoints-table/datapoints-table-config/datapoints-table-config.component.d.ts +3 -5
- package/widgets/implementations/datapoints-table/datapoints-table-config/datapoints-table-config.component.d.ts.map +1 -1
- package/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.component.d.ts +7 -2
- package/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.component.d.ts.map +1 -1
- package/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.service.d.ts +7 -27
- package/widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.service.d.ts.map +1 -1
- package/widgets/implementations/datapoints-table/datapoints-table-widget.model.d.ts +4 -3
- package/widgets/implementations/datapoints-table/datapoints-table-widget.model.d.ts.map +1 -1
- package/widgets/implementations/datapoints-table/datapoints-table.service.d.ts +5 -5
- package/widgets/implementations/datapoints-table/datapoints-table.service.d.ts.map +1 -1
- package/core/common/aggregation/aggregation.model.d.ts.map +0 -1
- package/core/common/aggregation/aggregation.service.d.ts +0 -17
- package/core/common/aggregation/aggregation.service.d.ts.map +0 -1
- package/esm2022/core/common/aggregation/aggregation.model.mjs +0 -46
- package/esm2022/core/common/aggregation/aggregation.service.mjs +0 -34
- package/esm2022/services/services-device-tab/service-command.service.mjs +0 -113
- package/esm2022/services/services-device-tab/service-device-tab.model.mjs +0 -2
- package/esm2022/widgets/implementations/datapoints-table/datapoints-table-config/datapoints-table-config.service.mjs +0 -124
- package/services/services-device-tab/service-command.service.d.ts.map +0 -1
- package/services/services-device-tab/service-device-tab.model.d.ts +0 -11
- package/services/services-device-tab/service-device-tab.model.d.ts.map +0 -1
- package/widgets/implementations/datapoints-table/datapoints-table-config/datapoints-table-config.service.d.ts +0 -56
- package/widgets/implementations/datapoints-table/datapoints-table-config/datapoints-table-config.service.d.ts.map +0 -1
- /package/core/{common/aggregation → aggregation}/aggregation.model.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-operations-shared.mjs","sources":["../../operations/shared/operations.model.ts","../../operations/shared/operations.service.ts","../../operations/shared/operations-shared.module.ts","../../operations/shared/c8y-ngx-components-operations-shared.ts"],"sourcesContent":["import { OperationStatus } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components';\nimport { OperationStatusOption } from './status-option.model';\n\nexport const OPERATION_STATUS_LABELS = {\n PENDING: gettext('Pending'),\n EXECUTING: gettext('Executing'),\n FAILED: gettext('Failed'),\n SUCCESSFUL: gettext('Successful')\n};\n\nexport type OperationStatusOptionsMapShared = {\n [key in keyof typeof OperationStatus]?: OperationStatusOption;\n};\n\nexport const OPERATION_STATUS_OPTIONS_MAP: OperationStatusOptionsMapShared = {\n PENDING: {\n label: OPERATION_STATUS_LABELS.PENDING,\n status: OperationStatus.PENDING,\n icon: 'clock-o',\n styleClass: ''\n } as unknown as OperationStatusOption,\n EXECUTING: {\n label: OPERATION_STATUS_LABELS.EXECUTING,\n status: OperationStatus.EXECUTING,\n icon: 'refresh',\n styleClass: 'text-info'\n } as unknown as OperationStatusOption,\n SUCCESSFUL: {\n label: OPERATION_STATUS_LABELS.SUCCESSFUL,\n status: OperationStatus.SUCCESSFUL,\n icon: 'check-circle',\n styleClass: 'text-success'\n } as unknown as OperationStatusOption,\n FAILED: {\n label: OPERATION_STATUS_LABELS.FAILED,\n status: OperationStatus.FAILED,\n icon: 'exclamation-circle',\n styleClass: 'text-danger'\n } as unknown as OperationStatusOption\n};\n\nexport const CLEAN_KEYS = ['creationTime', 'deviceExternalIDs', 'id', 'self'];\n\nexport const CLEAN_KEYS_UPDATE = ['deviceId', 'deviceName', 'bulkOperationId'];\n\nexport const RESERVED_KEYS = CLEAN_KEYS.concat(['deviceId', 'deviceName', 'bulkOperationId']);\n\nexport const STANDARD_KEYS = {\n failureReason: gettext('Failure reason'),\n description: gettext('Description'),\n status: gettext('Status')\n};\n","import { Injectable } from '@angular/core';\nimport { IOperation, OperationService, OperationStatus } from '@c8y/client';\nimport { AlertService, gettext, ModalService, Status } from '@c8y/ngx-components';\nimport { assign, difference, has, includes, keys, pickBy, without } from 'lodash-es';\nimport { RESERVED_KEYS, STANDARD_KEYS } from './operations.model';\n\n@Injectable()\nexport class OperationsService {\n constructor(\n private operationService: OperationService,\n private modal: ModalService,\n private alertService: AlertService\n ) {}\n\n getStandardKeys(operation: IOperation) {\n return pickBy(STANDARD_KEYS, (_, key) => has(operation, key));\n }\n\n getNonStandardKeys(operation: IOperation, excluding: string[] = []) {\n return without(\n difference(this.getKeys(operation), keys(this.getStandardKeys(operation))),\n ...excluding\n );\n }\n\n async cancel(operation: Partial<IOperation>) {\n try {\n await this.modal.confirm(\n gettext('Cancel operation'),\n gettext('You are about to cancel the operation. Do you want to proceed?'),\n Status.DANGER\n );\n\n const operationAfterUpdate = (\n await this.operationService.update({\n id: operation.id,\n status: OperationStatus.FAILED,\n failureReason: gettext('Operation cancelled by user.')\n })\n ).data;\n assign(operation, operationAfterUpdate);\n this.alertService.success(gettext('Operation cancelled.'));\n } catch (er) {\n if (er) {\n this.alertService.addServerFailure(er);\n }\n }\n }\n\n private getKeys(managedObject) {\n return Object.keys({ ...managedObject }).filter(key => !includes(RESERVED_KEYS, key));\n }\n}\n","import { NgModule } from '@angular/core';\nimport { OperationsService } from './operations.service';\n\n@NgModule({\n providers: [OperationsService]\n})\nexport class OperationsSharedModule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BAA8B,CAAC;aACvD,CAAC,EACF,IAAI,CAAC;AACP,YAAA,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YACxC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;SAC5D;QAAC,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,EAAE;AACN,gBAAA,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;aACxC;SACF;KACF;AAEO,IAAA,OAAO,CAAC,aAAa,EAAA;QAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;KACvF;8GA5CU,iBAAiB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-operations-shared.mjs","sources":["../../operations/shared/operations.model.ts","../../operations/shared/operations.service.ts","../../operations/shared/operations-shared.module.ts","../../operations/shared/c8y-ngx-components-operations-shared.ts"],"sourcesContent":["import { OperationStatus } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components';\nimport { OperationStatusOption } from './status-option.model';\n\nexport const OPERATION_STATUS_LABELS = {\n PENDING: gettext('Pending'),\n EXECUTING: gettext('Executing'),\n FAILED: gettext('Failed'),\n SUCCESSFUL: gettext('Successful')\n};\n\nexport type OperationStatusOptionsMapShared = {\n [key in keyof typeof OperationStatus]?: OperationStatusOption;\n};\n\nexport const OPERATION_STATUS_OPTIONS_MAP: OperationStatusOptionsMapShared = {\n PENDING: {\n label: OPERATION_STATUS_LABELS.PENDING,\n status: OperationStatus.PENDING,\n icon: 'clock-o',\n styleClass: ''\n } as unknown as OperationStatusOption,\n EXECUTING: {\n label: OPERATION_STATUS_LABELS.EXECUTING,\n status: OperationStatus.EXECUTING,\n icon: 'refresh',\n styleClass: 'text-info'\n } as unknown as OperationStatusOption,\n SUCCESSFUL: {\n label: OPERATION_STATUS_LABELS.SUCCESSFUL,\n status: OperationStatus.SUCCESSFUL,\n icon: 'check-circle',\n styleClass: 'text-success'\n } as unknown as OperationStatusOption,\n FAILED: {\n label: OPERATION_STATUS_LABELS.FAILED,\n status: OperationStatus.FAILED,\n icon: 'exclamation-circle',\n styleClass: 'text-danger'\n } as unknown as OperationStatusOption\n};\n\nexport const CLEAN_KEYS = ['creationTime', 'deviceExternalIDs', 'id', 'self'];\n\nexport const CLEAN_KEYS_UPDATE = ['deviceId', 'deviceName', 'bulkOperationId'];\n\nexport const RESERVED_KEYS = CLEAN_KEYS.concat(['deviceId', 'deviceName', 'bulkOperationId']);\n\nexport const STANDARD_KEYS = {\n failureReason: gettext('Failure reason'),\n description: gettext('Description'),\n status: gettext('Status')\n};\n","import { Injectable } from '@angular/core';\nimport { IOperation, OperationService, OperationStatus } from '@c8y/client';\nimport { AlertService, gettext, ModalService, Status } from '@c8y/ngx-components';\nimport { assign, difference, has, includes, keys, pickBy, without } from 'lodash-es';\nimport { RESERVED_KEYS, STANDARD_KEYS } from './operations.model';\n\n@Injectable({ providedIn: 'root' })\nexport class OperationsService {\n constructor(\n private operationService: OperationService,\n private modal: ModalService,\n private alertService: AlertService\n ) {}\n\n getStandardKeys(operation: IOperation) {\n return pickBy(STANDARD_KEYS, (_, key) => has(operation, key));\n }\n\n getNonStandardKeys(operation: IOperation, excluding: string[] = []) {\n return without(\n difference(this.getKeys(operation), keys(this.getStandardKeys(operation))),\n ...excluding\n );\n }\n\n async cancel(operation: Partial<IOperation>) {\n try {\n await this.modal.confirm(\n gettext('Cancel operation'),\n gettext('You are about to cancel the operation. Do you want to proceed?'),\n Status.DANGER\n );\n\n const operationAfterUpdate = (\n await this.operationService.update({\n id: operation.id,\n status: OperationStatus.FAILED,\n failureReason: gettext('Operation cancelled by user.')\n })\n ).data;\n assign(operation, operationAfterUpdate);\n this.alertService.success(gettext('Operation cancelled.'));\n } catch (er) {\n if (er) {\n this.alertService.addServerFailure(er);\n }\n }\n }\n\n private getKeys(managedObject) {\n return Object.keys({ ...managedObject }).filter(key => !includes(RESERVED_KEYS, key));\n }\n}\n","import { NgModule } from '@angular/core';\nimport { OperationsService } from './operations.service';\n\n@NgModule({\n providers: [OperationsService]\n})\nexport class OperationsSharedModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAIa,MAAA,uBAAuB,GAAG;AACrC,IAAA,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;AAC3B,IAAA,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;AAC/B,IAAA,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;AACzB,IAAA,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC;EACjC;AAMW,MAAA,4BAA4B,GAAoC;AAC3E,IAAA,OAAO,EAAE;QACP,KAAK,EAAE,uBAAuB,CAAC,OAAO;QACtC,MAAM,EAAE,eAAe,CAAC,OAAO;AAC/B,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,UAAU,EAAE,EAAE;AACqB,KAAA;AACrC,IAAA,SAAS,EAAE;QACT,KAAK,EAAE,uBAAuB,CAAC,SAAS;QACxC,MAAM,EAAE,eAAe,CAAC,SAAS;AACjC,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,UAAU,EAAE,WAAW;AACY,KAAA;AACrC,IAAA,UAAU,EAAE;QACV,KAAK,EAAE,uBAAuB,CAAC,UAAU;QACzC,MAAM,EAAE,eAAe,CAAC,UAAU;AAClC,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,UAA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AA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,cADJ,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAD7B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;MCArB,sBAAsB,CAAA;8GAAtB,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;+GAAtB,sBAAsB,EAAA,CAAA,CAAA,EAAA;+GAAtB,sBAAsB,EAAA,SAAA,EAFtB,CAAC,iBAAiB,CAAC,EAAA,CAAA,CAAA,EAAA;;2FAEnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,SAAS,EAAE,CAAC,iBAAiB,CAAC;AAC/B,iBAAA,CAAA;;;ACLD;;AAEG;;;;"}
|
|
@@ -2,16 +2,39 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/router';
|
|
4
4
|
import { RouterModule } from '@angular/router';
|
|
5
|
-
import {
|
|
6
|
-
import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service';
|
|
7
|
-
import { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container';
|
|
5
|
+
import { NavigatorNode, gettext, CoreModule, hookTab, hookNavigator } from '@c8y/ngx-components';
|
|
8
6
|
import { BulkOperationFromSingleModule } from '@c8y/ngx-components/operations/bulk-operation-from-single';
|
|
9
7
|
import { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list';
|
|
8
|
+
import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service';
|
|
9
|
+
import { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container';
|
|
10
10
|
import { StepperBulkTypeConfigurationModule } from '@c8y/ngx-components/operations/stepper-bulk-type-configuration';
|
|
11
11
|
import { StepperBulkTypeDeviceProfileModule } from '@c8y/ngx-components/operations/stepper-bulk-type-device-profile';
|
|
12
12
|
import { StepperBulkTypeFirmwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-firmware';
|
|
13
13
|
import { StepperBulkTypeSoftwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-software';
|
|
14
|
-
import {
|
|
14
|
+
import { deviceControlOverviewFeatureProvider, deviceControlTabFeatureProvider } from '@c8y/ngx-components/operations/operations-list';
|
|
15
|
+
|
|
16
|
+
class OperationsNavigationFactory {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.navs = [];
|
|
19
|
+
}
|
|
20
|
+
async get() {
|
|
21
|
+
if (this.navs.length === 0) {
|
|
22
|
+
this.navs.push(new NavigatorNode({
|
|
23
|
+
label: gettext('Device control'),
|
|
24
|
+
path: 'devicecontrol/single',
|
|
25
|
+
icon: 'c8y-icon c8y-icon-device-control',
|
|
26
|
+
parent: gettext('Overviews'),
|
|
27
|
+
priority: 1360
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
return this.navs;
|
|
31
|
+
}
|
|
32
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsNavigationFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
33
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsNavigationFactory }); }
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsNavigationFactory, decorators: [{
|
|
36
|
+
type: Injectable
|
|
37
|
+
}] });
|
|
15
38
|
|
|
16
39
|
class OperationsTabsFactory {
|
|
17
40
|
constructor(router) {
|
|
@@ -44,29 +67,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
44
67
|
type: Injectable
|
|
45
68
|
}], ctorParameters: () => [{ type: i1.Router }] });
|
|
46
69
|
|
|
47
|
-
class OperationsNavigationFactory {
|
|
48
|
-
constructor() {
|
|
49
|
-
this.navs = [];
|
|
50
|
-
}
|
|
51
|
-
async get() {
|
|
52
|
-
if (this.navs.length === 0) {
|
|
53
|
-
this.navs.push(new NavigatorNode({
|
|
54
|
-
label: gettext('Device control'),
|
|
55
|
-
path: 'devicecontrol/single',
|
|
56
|
-
icon: 'c8y-icon c8y-icon-device-control',
|
|
57
|
-
parent: gettext('Overviews'),
|
|
58
|
-
priority: 1360
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
return this.navs;
|
|
62
|
-
}
|
|
63
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsNavigationFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
64
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsNavigationFactory }); }
|
|
65
|
-
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsNavigationFactory, decorators: [{
|
|
67
|
-
type: Injectable
|
|
68
|
-
}] });
|
|
69
|
-
|
|
70
70
|
const operationsRoutes = [
|
|
71
71
|
{
|
|
72
72
|
path: 'devicecontrol',
|
|
@@ -155,9 +155,13 @@ class OperationsModule {
|
|
|
155
155
|
StepperBulkTypeConfigurationModule,
|
|
156
156
|
StepperBulkTypeFirmwareModule,
|
|
157
157
|
StepperBulkTypeSoftwareModule,
|
|
158
|
-
StepperBulkTypeDeviceProfileModule
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
StepperBulkTypeDeviceProfileModule] }); }
|
|
159
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsModule, providers: [
|
|
160
|
+
hookTab(OperationsTabsFactory),
|
|
161
|
+
hookNavigator(OperationsNavigationFactory),
|
|
162
|
+
deviceControlOverviewFeatureProvider,
|
|
163
|
+
deviceControlTabFeatureProvider
|
|
164
|
+
], imports: [CoreModule,
|
|
161
165
|
RouterModule.forChild(operationsRoutes),
|
|
162
166
|
BulkOperationFromSingleModule,
|
|
163
167
|
BulkOperationsListModule,
|
|
@@ -166,8 +170,7 @@ class OperationsModule {
|
|
|
166
170
|
StepperBulkTypeConfigurationModule,
|
|
167
171
|
StepperBulkTypeFirmwareModule,
|
|
168
172
|
StepperBulkTypeSoftwareModule,
|
|
169
|
-
StepperBulkTypeDeviceProfileModule
|
|
170
|
-
OperationsListModule] }); }
|
|
173
|
+
StepperBulkTypeDeviceProfileModule] }); }
|
|
171
174
|
}
|
|
172
175
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsModule, decorators: [{
|
|
173
176
|
type: NgModule,
|
|
@@ -182,10 +185,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
182
185
|
StepperBulkTypeConfigurationModule,
|
|
183
186
|
StepperBulkTypeFirmwareModule,
|
|
184
187
|
StepperBulkTypeSoftwareModule,
|
|
185
|
-
StepperBulkTypeDeviceProfileModule
|
|
186
|
-
OperationsListModule
|
|
188
|
+
StepperBulkTypeDeviceProfileModule
|
|
187
189
|
],
|
|
188
|
-
providers: [
|
|
190
|
+
providers: [
|
|
191
|
+
hookTab(OperationsTabsFactory),
|
|
192
|
+
hookNavigator(OperationsNavigationFactory),
|
|
193
|
+
deviceControlOverviewFeatureProvider,
|
|
194
|
+
deviceControlTabFeatureProvider
|
|
195
|
+
]
|
|
189
196
|
}]
|
|
190
197
|
}] });
|
|
191
198
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-operations.mjs","sources":["../../operations/factories/
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-operations.mjs","sources":["../../operations/factories/nav.factory.ts","../../operations/factories/tabs.factory.ts","../../operations/operations.module.ts","../../operations/c8y-ngx-components-operations.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { gettext, NavigatorNode, NavigatorNodeFactory } from '@c8y/ngx-components';\n\n@Injectable()\nexport class OperationsNavigationFactory implements NavigatorNodeFactory {\n navs: NavigatorNode[] = [];\n\n async get() {\n if (this.navs.length === 0) {\n this.navs.push(\n new NavigatorNode({\n label: gettext('Device control'),\n path: 'devicecontrol/single',\n icon: 'c8y-icon c8y-icon-device-control',\n parent: gettext('Overviews'),\n priority: 1360\n })\n );\n }\n return this.navs;\n }\n}\n","import { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { gettext, Tab, TabFactory } from '@c8y/ngx-components';\r\n\r\n@Injectable()\r\nexport class OperationsTabsFactory implements TabFactory {\r\n constructor(public router: Router) {}\r\n get() {\r\n const tabs: Tab[] = [];\r\n if (this.router.url.match(/devicecontrol/g)) {\r\n tabs.push({\r\n path: 'devicecontrol/single',\r\n label: gettext('Single operations'),\r\n icon: 'c8y-icon c8y-icon-device-control',\r\n priority: 1100,\r\n orientation: 'horizontal'\r\n } as Tab);\r\n tabs.push({\r\n path: 'devicecontrol/bulk',\r\n label: gettext('Bulk operations'),\r\n icon: 'c8y-icon c8y-icon-energy',\r\n priority: 1050,\r\n orientation: 'horizontal'\r\n } as Tab);\r\n }\r\n\r\n return tabs;\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\nimport { CoreModule, hookNavigator, hookTab, Route } from '@c8y/ngx-components';\nimport { BulkOperationFromSingleModule } from '@c8y/ngx-components/operations/bulk-operation-from-single';\nimport { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list';\nimport { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service';\nimport { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container';\nimport { StepperBulkTypeConfigurationModule } from '@c8y/ngx-components/operations/stepper-bulk-type-configuration';\nimport { StepperBulkTypeDeviceProfileModule } from '@c8y/ngx-components/operations/stepper-bulk-type-device-profile';\nimport { StepperBulkTypeFirmwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-firmware';\nimport { StepperBulkTypeSoftwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-software';\n\nimport {\n deviceControlOverviewFeatureProvider,\n deviceControlTabFeatureProvider\n} from '@c8y/ngx-components/operations/operations-list';\nimport { OperationsNavigationFactory } from './factories/nav.factory';\nimport { OperationsTabsFactory } from './factories/tabs.factory';\n\nexport const operationsRoutes: Route[] = [\n {\n path: 'devicecontrol',\n redirectTo: 'devicecontrol/single',\n pathMatch: 'full'\n }\n];\n\n/**\n * This module sets up the 'Device control' view. By importing it in your custom application you will have:\n * - a 'Device control' tab in device details view\n * - a 'Device control' entry in the 'Overviews' section of navigator\n * - 'Bulk operations' tab on the 'Device control' page\n * - list view of existing bulk operations with expandable details and options to filter\n * - guided stepper dialogs to schedule new bulk operations of supported types\n * (Configuration update, Firmware update, Software update, Apply device profile).\n *\n * Additionaly you can use the modules imported by {@link OperationsModule} separately to achieve\n * the results you wish to have in your application, e.g.:\n * - import {@link BulkOperationsListModule} and {@link BulkOperationsServiceModule}\n * to have an overview of existing bulk operation with expandable details\n * - additionaly import {@link BulkOperationsStepperContainerModule} and any of the existing\n * `StepperBulkType*Module` modules ({@link StepperBulkTypeConfigurationModule},\n * {@link StepperBulkTypeFirmwareModule}, {@link StepperBulkTypeSoftwareModule},\n * {@link StepperBulkTypeDeviceProfileModule}) to have the option\n * to create new bulk operation in a guided stepper dialog.\n *\n * ```typescript\n * import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service';\n * import { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list';\n *\n * @NgModule({\n * imports: [\n * [...]\n * BulkOperationsServiceModule,\n * BulkOperationsListModule\n * ],\n * [...]\n * })\n * export class CustomOperationsModule {}```\n * respectively\n * ```typescript\n * import { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container';\n * import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service';\n * import { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list';\n * import { StepperBulkTypeSoftwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-software';\n *\n * @NgModule({\n * imports: [\n * [...]\n * BulkOperationsServiceModule,\n * BulkOperationsListModule,\n * BulkOperationsStepperContainerModule,\n * StepperBulkTypeSoftwareModule\n * ],\n * [...]\n * })\n * export class CustomOperationsModule {}```\n * You can provide your own bulk operation stepper by registering a component via the `hookListBulkType`:\n *\n * ```typescript\n * import {\n * hookListBulkType,\n * baseUrl\n * } from '@c8y/ngx-components/operations/bulk-operations-service';\n *\n * [...]\n *\n * providers: [\n * hookListBulkType({\n * type: 'my-bulk-op-type',\n * c8yIcon: 'c8y-tools',\n * name: 'My bulk op type',\n * path: `${baseUrl}my-type`,\n * component: StepperMyBulkTypeComponent,\n * fragments: ['c8y_MyType'],\n * selected: false\n * })\n * ]```\n */\n@NgModule({\n imports: [\n CoreModule,\n RouterModule.forChild(operationsRoutes),\n BulkOperationFromSingleModule,\n BulkOperationsListModule,\n BulkOperationsServiceModule,\n BulkOperationsStepperContainerModule,\n StepperBulkTypeConfigurationModule,\n StepperBulkTypeFirmwareModule,\n StepperBulkTypeSoftwareModule,\n StepperBulkTypeDeviceProfileModule\n ],\n providers: [\n hookTab(OperationsTabsFactory),\n hookNavigator(OperationsNavigationFactory),\n deviceControlOverviewFeatureProvider,\n deviceControlTabFeatureProvider\n ]\n})\nexport class Oper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AAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,EAPhB,SAAA,EAAA;YACT,OAAO,CAAC,qBAAqB,CAAC;YAC9B,aAAa,CAAC,2BAA2B,CAAC;YAC1C,oCAAoC;YACpC,+BAA+B;AAChC,SAAA,EAAA,OAAA,EAAA,CAhBC,UAAU;AACV,YAAA,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACvC,6BAA6B;YAC7B,wBAAwB;YACxB,2BAA2B;YAC3B,oCAAoC;YACpC,kCAAkC;YAClC,6BAA6B;YAC7B,6BAA6B;YAC7B,kCAAkC,CAAA,EAAA,CAAA,CAAA,EAAA;;2FASzB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBApB5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,UAAU;AACV,wBAAA,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;wBACvC,6BAA6B;wBAC7B,wBAAwB;wBACxB,2BAA2B;wBAC3B,oCAAoC;wBACpC,kCAAkC;wBAClC,6BAA6B;wBAC7B,6BAA6B;wBAC7B,kCAAkC;AACnC,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT,OAAO,CAAC,qBAAqB,CAAC;wBAC9B,aAAa,CAAC,2BAA2B,CAAC;wBAC1C,oCAAoC;wBACpC,+BAA+B;AAChC,qBAAA;AACF,iBAAA,CAAA;;;ACvHD;;AAEG;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { NgFor } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Component, makeEnvironmentProviders } from '@angular/core';
|
|
4
|
+
import * as i3 from '@angular/router';
|
|
5
|
+
import * as i2 from '@c8y/ngx-components';
|
|
6
|
+
import { IconDirective, ActionBarItemComponent, HelpModule, C8yTranslatePipe, hookRoute, ViewContext, gettext } from '@c8y/ngx-components';
|
|
7
|
+
import { OperationsListComponent } from '@c8y/ngx-components/operations/operations-list';
|
|
8
|
+
import * as i1 from '@c8y/ngx-components/services/shared';
|
|
9
|
+
|
|
10
|
+
class ServiceCommandTabComponent {
|
|
11
|
+
constructor(commandService, contextRouteService, activatedRoute) {
|
|
12
|
+
this.actions = [];
|
|
13
|
+
const { contextData } = contextRouteService.getContextData(activatedRoute);
|
|
14
|
+
this.service = contextData;
|
|
15
|
+
const commands = commandService.getAllSupportedCommands([contextData]);
|
|
16
|
+
this.actions = commandService.generateActionControls(commands);
|
|
17
|
+
}
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandTabComponent, deps: [{ token: i1.ServiceCommandService }, { token: i2.ContextRouteService }, { token: i3.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
19
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: ServiceCommandTabComponent, isStandalone: true, selector: "c8y-service-command-tab", ngImport: i0, template: "<c8y-action-bar-item\n *ngFor=\"let action of actions; let i = index\"\n [placement]=\"i < 3 ? 'right' : 'more'\"\n>\n <button\n class=\"d-flex a-i-center {{ i < 3 ? 'btn btn-link' : '' }}\"\n [title]=\"action.text | translate\"\n (click)=\"action.callback(service)\"\n style=\"max-width: {{ i < 3 ? '160px' : 'unset' }};\"\n >\n <i\n class=\"m-r-4\"\n [class]=\"action.iconClasses\"\n [c8yIcon]=\"action.icon\"\n ></i>\n <span\n class=\"text-truncate\"\n translate\n >\n {{ action.text }}\n </span>\n </button>\n</c8y-action-bar-item>\n\n<c8y-operations-list\n fragmentType=\"c8y_ServiceCommand\"\n [readOnlyItems]=\"true\"\n>\n <!-- TODO Add context help \n <c8y-help></c8y-help>\n -->\n</c8y-operations-list>\n", dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: OperationsListComponent, selector: "c8y-operations-list", inputs: ["fragmentType", "readOnlyItems"] }, { kind: "component", type: ActionBarItemComponent, selector: "c8y-action-bar-item", inputs: ["placement", "priority", "itemClass", "injector", "groupId", "inGroupPriority"] }, { kind: "ngmodule", type: HelpModule }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }] }); }
|
|
20
|
+
}
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandTabComponent, decorators: [{
|
|
22
|
+
type: Component,
|
|
23
|
+
args: [{ selector: 'c8y-service-command-tab', standalone: true, imports: [
|
|
24
|
+
NgFor,
|
|
25
|
+
IconDirective,
|
|
26
|
+
OperationsListComponent,
|
|
27
|
+
ActionBarItemComponent,
|
|
28
|
+
HelpModule,
|
|
29
|
+
C8yTranslatePipe
|
|
30
|
+
], template: "<c8y-action-bar-item\n *ngFor=\"let action of actions; let i = index\"\n [placement]=\"i < 3 ? 'right' : 'more'\"\n>\n <button\n class=\"d-flex a-i-center {{ i < 3 ? 'btn btn-link' : '' }}\"\n [title]=\"action.text | translate\"\n (click)=\"action.callback(service)\"\n style=\"max-width: {{ i < 3 ? '160px' : 'unset' }};\"\n >\n <i\n class=\"m-r-4\"\n [class]=\"action.iconClasses\"\n [c8yIcon]=\"action.icon\"\n ></i>\n <span\n class=\"text-truncate\"\n translate\n >\n {{ action.text }}\n </span>\n </button>\n</c8y-action-bar-item>\n\n<c8y-operations-list\n fragmentType=\"c8y_ServiceCommand\"\n [readOnlyItems]=\"true\"\n>\n <!-- TODO Add context help \n <c8y-help></c8y-help>\n -->\n</c8y-operations-list>\n" }]
|
|
31
|
+
}], ctorParameters: () => [{ type: i1.ServiceCommandService }, { type: i2.ContextRouteService }, { type: i3.ActivatedRoute }] });
|
|
32
|
+
|
|
33
|
+
const serviceCommandTabFeatureProvider = makeEnvironmentProviders([
|
|
34
|
+
hookRoute({
|
|
35
|
+
context: ViewContext.Service,
|
|
36
|
+
path: 'commands',
|
|
37
|
+
component: ServiceCommandTabComponent,
|
|
38
|
+
label: gettext('Commands'),
|
|
39
|
+
icon: 'sliders1',
|
|
40
|
+
priority: 600
|
|
41
|
+
})
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Generated bundle index. Do not edit.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
export { ServiceCommandTabComponent, serviceCommandTabFeatureProvider };
|
|
49
|
+
//# sourceMappingURL=c8y-ngx-components-services-service-command-tab.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-services-service-command-tab.mjs","sources":["../../services/service-command-tab/service-command-tab.component.ts","../../services/service-command-tab/service-command-tab.component.html","../../services/service-command-tab/service-command.feature.ts","../../services/service-command-tab/c8y-ngx-components-services-service-command-tab.ts"],"sourcesContent":["import { NgFor } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport {\n ActionBarItemComponent,\n ActionControl,\n C8yTranslatePipe,\n ContextRouteService,\n HelpModule,\n IconDirective\n} from '@c8y/ngx-components';\nimport { OperationsListComponent } from '@c8y/ngx-components/operations/operations-list';\nimport { Service, ServiceCommandService } from '@c8y/ngx-components/services/shared';\n\n@Component({\n selector: 'c8y-service-command-tab',\n standalone: true,\n imports: [\n NgFor,\n IconDirective,\n OperationsListComponent,\n ActionBarItemComponent,\n HelpModule,\n C8yTranslatePipe\n ],\n templateUrl: './service-command-tab.component.html'\n})\nexport class ServiceCommandTabComponent {\n service: Service;\n actions: ActionControl[] = [];\n\n constructor(\n commandService: ServiceCommandService,\n contextRouteService: ContextRouteService,\n activatedRoute: ActivatedRoute\n ) {\n const { contextData } = contextRouteService.getContextData(activatedRoute);\n this.service = <Service>contextData;\n const commands = commandService.getAllSupportedCommands([contextData as unknown as Service]);\n this.actions = commandService.generateActionControls(commands);\n }\n}\n","<c8y-action-bar-item\n *ngFor=\"let action of actions; let i = index\"\n [placement]=\"i < 3 ? 'right' : 'more'\"\n>\n <button\n class=\"d-flex a-i-center {{ i < 3 ? 'btn btn-link' : '' }}\"\n [title]=\"action.text | translate\"\n (click)=\"action.callback(service)\"\n style=\"max-width: {{ i < 3 ? '160px' : 'unset' }};\"\n >\n <i\n class=\"m-r-4\"\n [class]=\"action.iconClasses\"\n [c8yIcon]=\"action.icon\"\n ></i>\n <span\n class=\"text-truncate\"\n translate\n >\n {{ action.text }}\n </span>\n </button>\n</c8y-action-bar-item>\n\n<c8y-operations-list\n fragmentType=\"c8y_ServiceCommand\"\n [readOnlyItems]=\"true\"\n>\n <!-- TODO Add context help \n <c8y-help></c8y-help>\n -->\n</c8y-operations-list>\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\nimport { gettext, hookRoute, ViewContext } from '@c8y/ngx-components';\nimport { ServiceCommandTabComponent } from './service-command-tab.component';\n\nexport const serviceCommandTabFeatureProvider: EnvironmentProviders = makeEnvironmentProviders([\n hookRoute({\n context: ViewContext.Service,\n path: 'commands',\n component: ServiceCommandTabComponent,\n label: gettext('Commands'),\n icon: 'sliders1',\n priority: 600\n })\n]);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MA2Ba,0BAA0B,CAAA;AAIrC,IAAA,WAAA,CACE,cAAqC,EACrC,mBAAwC,EACxC,cAA8B,EAAA;QALhC,IAAO,CAAA,OAAA,GAAoB,EAAE,CAAC;QAO5B,MAAM,EAAE,WAAW,EAAE,GAAG,mBAAmB,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAC3E,QAAA,IAAI,CAAC,OAAO,GAAY,WAAW,CAAC;QACpC,MAAM,QAAQ,GAAG,cAAc,CAAC,uBAAuB,CA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EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,UAAU,0BACV,gBAAgB,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAIP,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAbtC,SAAS;+BACE,yBAAyB,EAAA,UAAA,EACvB,IAAI,EACP,OAAA,EAAA;wBACP,KAAK;wBACL,aAAa;wBACb,uBAAuB;wBACvB,sBAAsB;wBACtB,UAAU;wBACV,gBAAgB;AACjB,qBAAA,EAAA,QAAA,EAAA,8wBAAA,EAAA,CAAA;;;AEpBI,MAAM,gCAAgC,GAAyB,wBAAwB,CAAC;AAC7F,IAAA,SAAS,CAAC;QACR,OAAO,EAAE,WAAW,CAAC,OAAO;AAC5B,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,SAAS,EAAE,0BAA0B;AACrC,QAAA,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC;AAC1B,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,QAAQ,EAAE,GAAG;KACd,CAAC;AACH,CAAA;;ACbD;;AAEG;;;;"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import * as i1 from '@c8y/client';
|
|
4
|
+
import * as i2 from '@c8y/ngx-components';
|
|
5
|
+
import { gettext } from '@c8y/ngx-components';
|
|
6
|
+
import { map } from 'lodash-es';
|
|
7
|
+
|
|
8
|
+
const SERVICE_FRAGMENT = 'c8y_Service';
|
|
9
|
+
const SERVICE_COMMANDS_MAP = {
|
|
10
|
+
START: {
|
|
11
|
+
label: gettext('Start'),
|
|
12
|
+
command: 'START',
|
|
13
|
+
icon: 'play-circle',
|
|
14
|
+
styleClass: 'text-success'
|
|
15
|
+
},
|
|
16
|
+
STOP: {
|
|
17
|
+
label: gettext('Stop'),
|
|
18
|
+
command: 'STOP',
|
|
19
|
+
icon: 'stop-circle',
|
|
20
|
+
styleClass: 'text-danger'
|
|
21
|
+
},
|
|
22
|
+
RESTART: {
|
|
23
|
+
label: gettext('Restart'),
|
|
24
|
+
command: 'RESTART',
|
|
25
|
+
icon: 'refresh',
|
|
26
|
+
styleClass: 'text-info'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
class ServiceCommandService {
|
|
31
|
+
constructor(operationService, alertService) {
|
|
32
|
+
this.operationService = operationService;
|
|
33
|
+
this.alertService = alertService;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if the service supports service commands.
|
|
37
|
+
* @param service The service object containing supported operations.
|
|
38
|
+
* @returns boolean indicating if the service supports service commands.
|
|
39
|
+
*/
|
|
40
|
+
isServiceCommandSupported(service) {
|
|
41
|
+
return service.c8y_SupportedOperations?.includes('c8y_ServiceCommand');
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get the list of supported service commands for the given service object.
|
|
45
|
+
* @param service The service object containing the c8y_SupportedServiceCommands fragment.
|
|
46
|
+
* @returns Array of supported commands.
|
|
47
|
+
*/
|
|
48
|
+
getSupportedCommands(service) {
|
|
49
|
+
return service.c8y_SupportedServiceCommands || map(SERVICE_COMMANDS_MAP, 'command');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if a specific command is supported for the given service.
|
|
53
|
+
* @param service The service object.
|
|
54
|
+
* @param command The command to check (e.g., START, STOP).
|
|
55
|
+
* @returns boolean indicating if the command is supported.
|
|
56
|
+
*/
|
|
57
|
+
isCommandSupported(service, command) {
|
|
58
|
+
const supportedCommands = this.getSupportedCommands(service);
|
|
59
|
+
return supportedCommands.includes(command);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get all supported commands for a list of services.
|
|
63
|
+
* @param services The list of service objects to evaluate.
|
|
64
|
+
* @returns Array of all unique supported commands.
|
|
65
|
+
*/
|
|
66
|
+
getAllSupportedCommands(services) {
|
|
67
|
+
const allCommands = services
|
|
68
|
+
.filter(service => this.isServiceCommandSupported(service))
|
|
69
|
+
.flatMap(service => this.getSupportedCommands(service));
|
|
70
|
+
return Array.from(new Set(allCommands));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create an operation for the selected service command.
|
|
74
|
+
* @param service The service object the operation should target.
|
|
75
|
+
* @param command The command to execute (e.g., START, STOP).
|
|
76
|
+
* @returns Promise of the created operation.
|
|
77
|
+
*/
|
|
78
|
+
createOperation({ id, name, serviceType }, command) {
|
|
79
|
+
const operation = {
|
|
80
|
+
deviceId: id,
|
|
81
|
+
description: `${command} ${name}`,
|
|
82
|
+
c8y_ServiceCommand: {
|
|
83
|
+
command,
|
|
84
|
+
serviceName: name,
|
|
85
|
+
serviceType: serviceType
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return this.operationService.create(operation);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Generate a static list of action controls.
|
|
92
|
+
* The specific logic for each service is handled dynamically in showIf and callback.
|
|
93
|
+
* @returns Array of ActionControl objects.
|
|
94
|
+
*/
|
|
95
|
+
generateActionControls(commands) {
|
|
96
|
+
return commands.map(command => ({
|
|
97
|
+
type: command.toLowerCase(),
|
|
98
|
+
icon: this.getCommandIcon(command),
|
|
99
|
+
iconClasses: this.getCommandIconClass(command),
|
|
100
|
+
text: command,
|
|
101
|
+
showIf: (service) => this.isServiceCommandSupported(service) && this.isCommandSupported(service, command),
|
|
102
|
+
callback: async (service) => {
|
|
103
|
+
try {
|
|
104
|
+
await this.createOperation(service, command);
|
|
105
|
+
this.alertService.success(gettext('Operation created.'));
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
const alertMessage = gettext('Could not create operation.');
|
|
109
|
+
this.alertService.danger(alertMessage, error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the icon for a specific command.
|
|
116
|
+
* @param command The command name.
|
|
117
|
+
* @returns Icon string for the command.
|
|
118
|
+
*/
|
|
119
|
+
getCommandIcon(command) {
|
|
120
|
+
return SERVICE_COMMANDS_MAP[command]?.icon || 'console';
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get the icon class for a specific command.
|
|
124
|
+
* @param command The command name.
|
|
125
|
+
* @returns Icon class string for the command.
|
|
126
|
+
*/
|
|
127
|
+
getCommandIconClass(command) {
|
|
128
|
+
return SERVICE_COMMANDS_MAP[command]?.styleClass;
|
|
129
|
+
}
|
|
130
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandService, deps: [{ token: i1.OperationService }, { token: i2.AlertService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
131
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandService, providedIn: 'root' }); }
|
|
132
|
+
}
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandService, decorators: [{
|
|
134
|
+
type: Injectable,
|
|
135
|
+
args: [{
|
|
136
|
+
providedIn: 'root'
|
|
137
|
+
}]
|
|
138
|
+
}], ctorParameters: () => [{ type: i1.OperationService }, { type: i2.AlertService }] });
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Generated bundle index. Do not edit.
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
export { SERVICE_COMMANDS_MAP, SERVICE_FRAGMENT, ServiceCommandService };
|
|
145
|
+
//# sourceMappingURL=c8y-ngx-components-services-shared.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-services-shared.mjs","sources":["../../services/shared/services.model.ts","../../services/shared/service-command.service.ts","../../services/shared/c8y-ngx-components-services-shared.ts"],"sourcesContent":["import { gettext } from '@c8y/ngx-components';\n\nexport const SERVICE_FRAGMENT = 'c8y_Service';\n\nexport const SERVICE_COMMANDS_MAP = {\n START: {\n label: gettext('Start'),\n command: 'START',\n icon: 'play-circle',\n styleClass: 'text-success'\n },\n STOP: {\n label: gettext('Stop'),\n command: 'STOP',\n icon: 'stop-circle',\n styleClass: 'text-danger'\n },\n RESTART: {\n label: gettext('Restart'),\n command: 'RESTART',\n icon: 'refresh',\n styleClass: 'text-info'\n }\n};\n\nexport interface Service {\n id: string;\n name: string;\n serviceType: string;\n status: string;\n c8y_SupportedOperations?: string[];\n c8y_SupportedServiceCommands?: string[];\n [key: string]: unknown;\n}\n","import { Injectable } from '@angular/core';\nimport { IOperation, IResult, OperationService } from '@c8y/client';\nimport { ActionControl, AlertService, gettext } from '@c8y/ngx-components';\nimport { map } from 'lodash-es';\nimport { Service, SERVICE_COMMANDS_MAP } from './services.model';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ServiceCommandService {\n constructor(\n private operationService: OperationService,\n private alertService: AlertService\n ) {}\n\n /**\n * Check if the service supports service commands.\n * @param service The service object containing supported operations.\n * @returns boolean indicating if the service supports service commands.\n */\n isServiceCommandSupported(service: Service): boolean {\n return service.c8y_SupportedOperations?.includes('c8y_ServiceCommand');\n }\n\n /**\n * Get the list of supported service commands for the given service object.\n * @param service The service object containing the c8y_SupportedServiceCommands fragment.\n * @returns Array of supported commands.\n */\n getSupportedCommands(service: Service): string[] {\n return service.c8y_SupportedServiceCommands || map(SERVICE_COMMANDS_MAP, 'command');\n }\n\n /**\n * Check if a specific command is supported for the given service.\n * @param service The service object.\n * @param command The command to check (e.g., START, STOP).\n * @returns boolean indicating if the command is supported.\n */\n isCommandSupported(service: Service, command: string): boolean {\n const supportedCommands = this.getSupportedCommands(service);\n return supportedCommands.includes(command);\n }\n\n /**\n * Get all supported commands for a list of services.\n * @param services The list of service objects to evaluate.\n * @returns Array of all unique supported commands.\n */\n getAllSupportedCommands(services: Service[]): string[] {\n const allCommands = services\n .filter(service => this.isServiceCommandSupported(service))\n .flatMap(service => this.getSupportedCommands(service));\n\n return Array.from(new Set(allCommands));\n }\n\n /**\n * Create an operation for the selected service command.\n * @param service The service object the operation should target.\n * @param command The command to execute (e.g., START, STOP).\n * @returns Promise of the created operation.\n */\n createOperation(\n { id, name, serviceType }: Service,\n command: string\n ): Promise<IResult<IOperation>> {\n const operation: IOperation = {\n deviceId: id,\n description: `${command} ${name}`,\n c8y_ServiceCommand: {\n command,\n serviceName: name,\n serviceType: serviceType\n }\n };\n\n return this.operationService.create(operation);\n }\n\n /**\n * Generate a static list of action controls.\n * The specific logic for each service is handled dynamically in showIf and callback.\n * @returns Array of ActionControl objects.\n */\n generateActionControls(commands: string[]): ActionControl[] {\n return commands.map(command => ({\n type: command.toLowerCase(),\n icon: this.getCommandIcon(command),\n iconClasses: this.getCommandIconClass(command),\n text: command,\n showIf: (service: Service) =>\n this.isServiceCommandSupported(service) && this.isCommandSupported(service, command),\n callback: async (service: Service) => {\n try {\n await this.createOperation(service, command);\n this.alertService.success(gettext('Operation created.'));\n } catch (error) {\n const alertMessage = gettext('Could not create operation.');\n this.alertService.danger(alertMessage, error);\n }\n }\n }));\n }\n\n /**\n * Get the icon for a specific command.\n * @param command The command name.\n * @returns Icon string for the command.\n */\n private getCommandIcon(command: string): string {\n return SERVICE_COMMANDS_MAP[command]?.icon || 'console';\n }\n\n /**\n * Get the icon class for a specific command.\n * @param command The command name.\n * @returns Icon class string for the command.\n */\n private getCommandIconClass(command: string): string {\n return SERVICE_COMMANDS_MAP[command]?.styleClass;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,gBAAgB,GAAG,cAAc;AAEjC,MAAA,oBAAoB,GAAG;AAClC,IAAA,KAAK,EAAE;AACL,QAAA,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;AACvB,QAAA,OAAO,EAAE,OAAO;AAChB,QAAA,IAAI,EAAE,aAAa;AACnB,QAAA,UAAU,EAAE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