@c8y/ngx-components 1021.49.12 → 1021.50.0

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.
Files changed (108) hide show
  1. package/core/i18n/pattern-messages.data.d.ts +18 -0
  2. package/core/i18n/pattern-messages.data.d.ts.map +1 -1
  3. package/esm2022/alarms/alarms-type-filter.component.mjs +3 -3
  4. package/esm2022/core/i18n/pattern-messages.data.mjs +19 -1
  5. package/esm2022/datapoints-export-selector/datapoints-export-selector-modal/datapoints-export-selector-file-exporter/data-fetching.service.mjs +2 -2
  6. package/esm2022/device-list/add-smart-group.component.mjs +3 -3
  7. package/esm2022/operations/bulk-operation-list-item/bulk-operation-list-item.service.mjs +5 -4
  8. package/esm2022/operations/operation-details/operation-details.module.mjs +7 -7
  9. package/esm2022/operations/operations-list/device-control.feature.mjs +20 -0
  10. package/esm2022/operations/operations-list/index.mjs +4 -3
  11. package/esm2022/operations/operations-list/operations-list-item.component.mjs +11 -9
  12. package/esm2022/operations/operations-list/operations-list.component.mjs +15 -10
  13. package/esm2022/operations/operations-list/operations-list.module.mjs +16 -41
  14. package/esm2022/operations/operations-list/operations-list.service.mjs +4 -3
  15. package/esm2022/operations/operations.module.mjs +21 -14
  16. package/esm2022/operations/shared/operations.service.mjs +4 -3
  17. package/esm2022/services/index.mjs +14 -3
  18. package/esm2022/services/service-command-tab/c8y-ngx-components-services-service-command-tab.mjs +5 -0
  19. package/esm2022/services/service-command-tab/index.mjs +3 -0
  20. package/esm2022/services/service-command-tab/service-command-tab.component.mjs +33 -0
  21. package/esm2022/services/service-command-tab/service-command.feature.mjs +14 -0
  22. package/esm2022/services/services-device-tab/index.mjs +9 -3
  23. package/esm2022/services/services-device-tab/services-device-tab.component.mjs +3 -4
  24. package/esm2022/services/services-device-tab/services-device-tab.guard.mjs +2 -2
  25. package/esm2022/services/services-device-tab/services.breadcrumb-factory.mjs +13 -1
  26. package/esm2022/services/services.module.mjs +4 -2
  27. package/esm2022/services/shared/c8y-ngx-components-services-shared.mjs +5 -0
  28. package/esm2022/services/shared/index.mjs +3 -0
  29. package/esm2022/services/shared/service-command.service.mjs +118 -0
  30. package/esm2022/services/shared/services.model.mjs +23 -0
  31. package/fesm2022/c8y-ngx-components-alarms.mjs +2 -2
  32. package/fesm2022/c8y-ngx-components-alarms.mjs.map +1 -1
  33. package/fesm2022/c8y-ngx-components-datapoints-export-selector.mjs +1 -1
  34. package/fesm2022/c8y-ngx-components-datapoints-export-selector.mjs.map +1 -1
  35. package/fesm2022/c8y-ngx-components-device-list.mjs +2 -2
  36. package/fesm2022/c8y-ngx-components-device-list.mjs.map +1 -1
  37. package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs +3 -2
  38. package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs.map +1 -1
  39. package/fesm2022/c8y-ngx-components-operations-operation-details.mjs +5 -5
  40. package/fesm2022/c8y-ngx-components-operations-operation-details.mjs.map +1 -1
  41. package/fesm2022/c8y-ngx-components-operations-operations-list.mjs +57 -52
  42. package/fesm2022/c8y-ngx-components-operations-operations-list.mjs.map +1 -1
  43. package/fesm2022/c8y-ngx-components-operations-shared.mjs +3 -2
  44. package/fesm2022/c8y-ngx-components-operations-shared.mjs.map +1 -1
  45. package/fesm2022/c8y-ngx-components-operations.mjs +42 -35
  46. package/fesm2022/c8y-ngx-components-operations.mjs.map +1 -1
  47. package/fesm2022/c8y-ngx-components-services-service-command-tab.mjs +49 -0
  48. package/fesm2022/c8y-ngx-components-services-service-command-tab.mjs.map +1 -0
  49. package/fesm2022/c8y-ngx-components-services-shared.mjs +145 -0
  50. package/fesm2022/c8y-ngx-components-services-shared.mjs.map +1 -0
  51. package/fesm2022/c8y-ngx-components-services.mjs +20 -113
  52. package/fesm2022/c8y-ngx-components-services.mjs.map +1 -1
  53. package/fesm2022/c8y-ngx-components.mjs +18 -0
  54. package/fesm2022/c8y-ngx-components.mjs.map +1 -1
  55. package/locales/de.po +12 -14
  56. package/locales/es.po +12 -14
  57. package/locales/fr.po +11 -13
  58. package/locales/ja_JP.po +13 -17
  59. package/locales/ko.po +13 -10
  60. package/locales/locales.pot +19 -6
  61. package/locales/nl.po +12 -14
  62. package/locales/pl.po +12 -14
  63. package/locales/pt_BR.po +11 -13
  64. package/locales/zh_CN.po +12 -9
  65. package/locales/zh_TW.po +12 -9
  66. package/operations/bulk-operation-list-item/bulk-operation-list-item.service.d.ts +2 -2
  67. package/operations/bulk-operation-list-item/bulk-operation-list-item.service.d.ts.map +1 -1
  68. package/operations/operation-details/operation-details.module.d.ts +1 -1
  69. package/operations/operations-list/device-control.feature.d.ts +4 -0
  70. package/operations/operations-list/device-control.feature.d.ts.map +1 -0
  71. package/operations/operations-list/index.d.ts +3 -2
  72. package/operations/operations-list/index.d.ts.map +1 -1
  73. package/operations/operations-list/operations-list-item.component.d.ts +1 -1
  74. package/operations/operations-list/operations-list-item.component.d.ts.map +1 -1
  75. package/operations/operations-list/operations-list.component.d.ts +3 -1
  76. package/operations/operations-list/operations-list.component.d.ts.map +1 -1
  77. package/operations/operations-list/operations-list.module.d.ts +3 -9
  78. package/operations/operations-list/operations-list.module.d.ts.map +1 -1
  79. package/operations/operations.module.d.ts +1 -2
  80. package/operations/operations.module.d.ts.map +1 -1
  81. package/package.json +1 -1
  82. package/services/index.d.ts +13 -2
  83. package/services/index.d.ts.map +1 -1
  84. package/services/service-command-tab/c8y-ngx-components-services-service-command-tab.d.ts.map +1 -0
  85. package/services/service-command-tab/index.d.ts +3 -0
  86. package/services/service-command-tab/index.d.ts.map +1 -0
  87. package/services/service-command-tab/service-command-tab.component.d.ts +12 -0
  88. package/services/service-command-tab/service-command-tab.component.d.ts.map +1 -0
  89. package/services/service-command-tab/service-command.feature.d.ts +3 -0
  90. package/services/service-command-tab/service-command.feature.d.ts.map +1 -0
  91. package/services/services-device-tab/index.d.ts +8 -2
  92. package/services/services-device-tab/index.d.ts.map +1 -1
  93. package/services/services-device-tab/services-device-tab.component.d.ts +2 -2
  94. package/services/services-device-tab/services-device-tab.component.d.ts.map +1 -1
  95. package/services/services-device-tab/services.breadcrumb-factory.d.ts.map +1 -1
  96. package/services/services.module.d.ts.map +1 -1
  97. package/services/shared/c8y-ngx-components-services-shared.d.ts.map +1 -0
  98. package/services/shared/index.d.ts +3 -0
  99. package/services/shared/index.d.ts.map +1 -0
  100. package/services/{services-device-tab → shared}/service-command.service.d.ts +10 -7
  101. package/services/shared/service-command.service.d.ts.map +1 -0
  102. package/services/shared/services.model.d.ts +31 -0
  103. package/services/shared/services.model.d.ts.map +1 -0
  104. package/esm2022/services/services-device-tab/service-command.service.mjs +0 -113
  105. package/esm2022/services/services-device-tab/service-device-tab.model.mjs +0 -2
  106. package/services/services-device-tab/service-command.service.d.ts.map +0 -1
  107. package/services/services-device-tab/service-device-tab.model.d.ts +0 -11
  108. package/services/services-device-tab/service-device-tab.model.d.ts.map +0 -1
@@ -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 { gettext, NavigatorNode, CoreModule, hookTab, hookNavigator } from '@c8y/ngx-components';
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 { OperationsListModule } from '@c8y/ngx-components/operations/operations-list';
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
- OperationsListModule] }); }
160
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OperationsModule, providers: [hookTab(OperationsTabsFactory), hookNavigator(OperationsNavigationFactory)], imports: [CoreModule,
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: [hookTab(OperationsTabsFactory), hookNavigator(OperationsNavigationFactory)]
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/tabs.factory.ts","../../operations/factories/nav.factory.ts","../../operations/operations.module.ts","../../operations/c8y-ngx-components-operations.ts"],"sourcesContent":["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 { 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 { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\nimport { CoreModule, hookTab, hookNavigator, Route } from '@c8y/ngx-components';\nimport { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service';\nimport { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container';\nimport { BulkOperationFromSingleModule } from '@c8y/ngx-components/operations/bulk-operation-from-single';\nimport { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list';\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';\nimport { OperationsListModule } from '@c8y/ngx-components/operations/operations-list';\n\nimport { OperationsTabsFactory } from './factories/tabs.factory';\nimport { OperationsNavigationFactory } from './factories/nav.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 OperationsListModule\n ],\n providers: [hookTab(OperationsTabsFactory), hookNavigator(OperationsNavigationFactory)]\n})\nexport class OperationsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MAKa,qBAAqB,CAAA;AAChC,IAAA,WAAA,CAAmB,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;KAAI;IACrC,GAAG,GAAA;QACD,MAAM,IAAI,GAAU,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE;YAC3C,IAAI,CAAC,IAAI,CAAC;AACR,gBAAA,IAAI,EAAE,sBAAsB;AAC5B,gBAAA,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC;AACnC,gBAAA,IAAI,EAAE,kCAAkC;AACxC,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,WAAW,EAAE,YAAY;AACnB,aAAA,CAAC,CAAC;YACV,IAAI,CAAC,IAAI,CAAC;AACR,gBAAA,IAAI,EAAE,oBAAoB;AAC1B,gBAAA,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC;AACjC,gBAAA,IAAI,EAAE,0BAA0B;AAChC,gBAAA,QAAQ,EAAE,IAAI;AACd,gBAAA,WAAW,EAAE,YAAY;AACnB,aAAA,CAAC,CAAC;SACX;AAED,QAAA,OAAO,IAAI,CAAC;KACb;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OAAO,CAAC,qBAAqB,CAAC,EAAE,aAAa,CAAC,2BAA2B,CAAC,CAAC;AACxF,iBAAA,CAAA;;;AChHD;;AAEG;;;;"}
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 OperationsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\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,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,CAAC,CAAC,WAAiC,CAAC,CAAC,CAAC;QAC7F,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;KAChE;8GAbU,0BAA0B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,qBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,IAAA,G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C7F,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,cAAc;AAC3B,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC;AACtB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,IAAI,EAAE,aAAa;AACnB,QAAA,UAAU,EAAE,aAAa;AAC1B,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC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AC,EAAE,IAAI,IAAI,SAAS,CAAC;KACzD;AAED;;;;AAIG;AACK,IAAA,mBAAmB,CAAC,OAAe,EAAA;AACzC,QAAA,OAAO,oBAAoB,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;KAClD;8GAhHU,qBAAqB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAArB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA,CAAA,EAAA;;2FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;ACRD;;AAEG;;;;"}
@@ -11,7 +11,9 @@ import * as i4 from 'ngx-bootstrap/tooltip';
11
11
  import { TooltipModule } from 'ngx-bootstrap/tooltip';
12
12
  import * as i1$2 from '@c8y/client';
13
13
  import { QueriesUtil } from '@c8y/client';
14
- import { from } from 'rxjs';
14
+ import * as i5 from '@c8y/ngx-components/services/shared';
15
+ import { SERVICE_FRAGMENT } from '@c8y/ngx-components/services/shared';
16
+ import { serviceCommandTabFeatureProvider } from '@c8y/ngx-components/services/service-command-tab';
15
17
 
16
18
  class LastUpdatedDateCellRendererComponent {
17
19
  constructor(context) {
@@ -336,114 +338,6 @@ class StatusGridColumn extends BaseColumn {
336
338
  }
337
339
  }
338
340
 
339
- const SERVICE_FRAGMENT = 'c8y_Service';
340
-
341
- class ServiceCommandService {
342
- constructor(operationService, alertService) {
343
- this.operationService = operationService;
344
- this.alertService = alertService;
345
- this.DEFAULT_COMMANDS = ['START', 'STOP', 'RESTART'];
346
- this.commandIcons = {
347
- START: 'play-circle',
348
- STOP: 'stop-circle',
349
- RESTART: 'refresh'
350
- };
351
- }
352
- /**
353
- * Check if the service supports service commands.
354
- * @param service The service object containing supported operations.
355
- * @returns boolean indicating if the service supports service commands.
356
- */
357
- isServiceCommandSupported(service) {
358
- return service.c8y_SupportedOperations?.includes('c8y_ServiceCommand');
359
- }
360
- /**
361
- * Get the list of supported service commands for the given service object.
362
- * @param service The service object containing the c8y_SupportedServiceCommands fragment.
363
- * @returns Array of supported commands.
364
- */
365
- getSupportedCommands(service) {
366
- return service.c8y_SupportedServiceCommands || this.DEFAULT_COMMANDS;
367
- }
368
- /**
369
- * Check if a specific command is supported for the given service.
370
- * @param service The service object.
371
- * @param command The command to check (e.g., START, STOP).
372
- * @returns boolean indicating if the command is supported.
373
- */
374
- isCommandSupported(service, command) {
375
- const supportedCommands = this.getSupportedCommands(service);
376
- return supportedCommands.includes(command);
377
- }
378
- /**
379
- * Get all supported commands for a list of services.
380
- * @param services The list of service objects to evaluate.
381
- * @returns Array of all unique supported commands.
382
- */
383
- getAllSupportedCommands(services) {
384
- const allCommands = services
385
- .filter(service => this.isServiceCommandSupported(service))
386
- .flatMap(service => this.getSupportedCommands(service));
387
- return Array.from(new Set(allCommands));
388
- }
389
- /**
390
- * Create an operation for the selected service command.
391
- * @param service The service object the operation should target.
392
- * @param command The command to execute (e.g., START, STOP).
393
- * @returns Observable of the created operation.
394
- */
395
- createOperation({ id, name, serviceType }, command) {
396
- const operation = {
397
- deviceId: id,
398
- c8y_ServiceCommand: {
399
- command,
400
- serviceName: name,
401
- serviceType: serviceType
402
- }
403
- };
404
- return from(this.operationService.create(operation));
405
- }
406
- /**
407
- * Generate a static list of action controls.
408
- * The specific logic for each service is handled dynamically in showIf and callback.
409
- * @returns Array of ActionControl objects.
410
- */
411
- generateActionControls(commands) {
412
- return commands.map(command => ({
413
- type: command.toLowerCase(),
414
- icon: this.getCommandIcon(command),
415
- text: command,
416
- showIf: (service) => this.isServiceCommandSupported(service) && this.isCommandSupported(service, command),
417
- callback: async (service) => {
418
- try {
419
- await this.createOperation(service, command).toPromise();
420
- this.alertService.success(gettext('Operation created.'));
421
- }
422
- catch (error) {
423
- const alertMessage = gettext('Could not create operaion.');
424
- this.alertService.danger(alertMessage, error);
425
- }
426
- }
427
- }));
428
- }
429
- /**
430
- * Get the icon for a specific command.
431
- * @param command The command name.
432
- * @returns Icon string for the command.
433
- */
434
- getCommandIcon(command) {
435
- return this.commandIcons[command] || 'console';
436
- }
437
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandService, deps: [{ token: i1$2.OperationService }, { token: i1.AlertService }], target: i0.ɵɵFactoryTarget.Injectable }); }
438
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandService, providedIn: 'root' }); }
439
- }
440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServiceCommandService, decorators: [{
441
- type: Injectable,
442
- args: [{
443
- providedIn: 'root'
444
- }]
445
- }], ctorParameters: () => [{ type: i1$2.OperationService }, { type: i1.AlertService }] });
446
-
447
341
  class ServicesDeviceTabComponent {
448
342
  constructor(route, inventoryService, gridService, statusOptionsService, serviceCommand) {
449
343
  this.route = route;
@@ -518,13 +412,13 @@ class ServicesDeviceTabComponent {
518
412
  trackByName(_index, column) {
519
413
  return column.name;
520
414
  }
521
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesDeviceTabComponent, deps: [{ token: i1$1.ActivatedRoute }, { token: i1$2.InventoryService }, { token: i1.DataGridService }, { token: StatusOptionsService }, { token: ServiceCommandService }], target: i0.ɵɵFactoryTarget.Component }); }
415
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesDeviceTabComponent, deps: [{ token: i1$1.ActivatedRoute }, { token: i1$2.InventoryService }, { token: i1.DataGridService }, { token: StatusOptionsService }, { token: i5.ServiceCommandService }], target: i0.ɵɵFactoryTarget.Component }); }
522
416
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: ServicesDeviceTabComponent, selector: "c8y-services-device-tab", ngImport: i0, template: "<div class=\"content-fullpage\">\n <c8y-data-grid\n [title]=\"'Services' | translate\"\n [refresh]=\"refresh$\"\n [actionControls]=\"actionControls\"\n [pagination]=\"pagination\"\n [columns]=\"columns\"\n [infiniteScroll]=\"'auto'\"\n [serverSideDataCallback]=\"serverSideDataCallback\"\n >\n <c8y-ui-empty-state\n [icon]=\"stats?.size > 0 ? 'search' : 'c8y-tools'\"\n [title]=\"stats?.size > 0 ? (noResultsMessage | translate) : (noDataMessage | translate)\"\n [subtitle]=\"stats?.size > 0 ? (noResultsSubtitle | translate) : null\"\n *emptyStateContext=\"let stats; isLoading as isLoading\"\n [horizontal]=\"stats?.size > 0\"\n ></c8y-ui-empty-state>\n <ng-container *ngFor=\"let column of columns; trackBy: trackByName\">\n <c8y-column [name]=\"column.name\"></c8y-column>\n </ng-container>\n </c8y-data-grid>\n</div>\n", dependencies: [{ kind: "component", type: i1.EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: i1.EmptyStateContextDirective, selector: "[emptyStateContext]" }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.ColumnDirective, selector: "c8y-column", inputs: ["name"] }, { kind: "component", type: i1.DataGridComponent, selector: "c8y-data-grid", inputs: ["title", "loadMoreItemsLabel", "loadingItemsLabel", "showSearch", "refresh", "columns", "rows", "pagination", "infiniteScroll", "serverSideDataCallback", "selectable", "singleSelection", "selectionPrimaryKey", "displayOptions", "actionControls", "bulkActionControls", "headerActionControls", "searchText", "configureColumnsEnabled", "showCounterWarning", "activeClassName", "expandableRows"], outputs: ["rowMouseOver", "rowMouseLeave", "rowClick", "onConfigChange", "onBeforeFilter", "onBeforeSearch", "onFilter", "itemsSelect", "onReload", "onAddCustomColumn", "onRemoveCustomColumn", "onColumnFilterReset", "onSort", "onPageSizeChange", "onColumnReordered", "onColumnVisibilityChange"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }] }); }
523
417
  }
524
418
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesDeviceTabComponent, decorators: [{
525
419
  type: Component,
526
420
  args: [{ selector: 'c8y-services-device-tab', template: "<div class=\"content-fullpage\">\n <c8y-data-grid\n [title]=\"'Services' | translate\"\n [refresh]=\"refresh$\"\n [actionControls]=\"actionControls\"\n [pagination]=\"pagination\"\n [columns]=\"columns\"\n [infiniteScroll]=\"'auto'\"\n [serverSideDataCallback]=\"serverSideDataCallback\"\n >\n <c8y-ui-empty-state\n [icon]=\"stats?.size > 0 ? 'search' : 'c8y-tools'\"\n [title]=\"stats?.size > 0 ? (noResultsMessage | translate) : (noDataMessage | translate)\"\n [subtitle]=\"stats?.size > 0 ? (noResultsSubtitle | translate) : null\"\n *emptyStateContext=\"let stats; isLoading as isLoading\"\n [horizontal]=\"stats?.size > 0\"\n ></c8y-ui-empty-state>\n <ng-container *ngFor=\"let column of columns; trackBy: trackByName\">\n <c8y-column [name]=\"column.name\"></c8y-column>\n </ng-container>\n </c8y-data-grid>\n</div>\n" }]
527
- }], ctorParameters: () => [{ type: i1$1.ActivatedRoute }, { type: i1$2.InventoryService }, { type: i1.DataGridService }, { type: StatusOptionsService }, { type: ServiceCommandService }] });
421
+ }], ctorParameters: () => [{ type: i1$1.ActivatedRoute }, { type: i1$2.InventoryService }, { type: i1.DataGridService }, { type: StatusOptionsService }, { type: i5.ServiceCommandService }] });
528
422
 
529
423
  class ServicesDeviceTabGuard {
530
424
  constructor(inventoryService) {
@@ -559,6 +453,14 @@ class ServicesBreadcrumbFactory {
559
453
  const breadcrumbItems = [];
560
454
  const device = serviceMO?.additionParents?.references[0]?.managedObject;
561
455
  if (device) {
456
+ breadcrumbItems.push({
457
+ label: gettext('Devices'),
458
+ icon: 'exchange'
459
+ });
460
+ breadcrumbItems.push({
461
+ label: gettext('All devices'),
462
+ path: '/device'
463
+ });
562
464
  breadcrumbItems.push({
563
465
  label: device.name,
564
466
  path: `/device/${device.id}`
@@ -570,6 +472,10 @@ class ServicesBreadcrumbFactory {
570
472
  breadcrumbItems.push({
571
473
  label: serviceMO.name
572
474
  });
475
+ const label = routeConfig?.label;
476
+ if (!!label) {
477
+ breadcrumbItems.push({ label });
478
+ }
573
479
  }
574
480
  breadcrumb.items = breadcrumbItems;
575
481
  return breadcrumb;
@@ -631,11 +537,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
631
537
  class ServicesModule {
632
538
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
633
539
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: ServicesModule, imports: [CoreModule, ServicesDeviceTabModule] }); }
634
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesModule, imports: [CoreModule, ServicesDeviceTabModule] }); }
540
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesModule, providers: [serviceCommandTabFeatureProvider], imports: [CoreModule, ServicesDeviceTabModule] }); }
635
541
  }
636
542
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: ServicesModule, decorators: [{
637
543
  type: NgModule,
638
544
  args: [{
545
+ providers: [serviceCommandTabFeatureProvider],
639
546
  imports: [CoreModule, ServicesDeviceTabModule]
640
547
  }]
641
548
  }] });
@@ -644,5 +551,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
644
551
  * Generated bundle index. Do not edit.
645
552
  */
646
553
 
647
- export { HOOK_SERVICE_STATUS, LastUpdatedDateCellRendererComponent, LastUpdatedDateGridColumn, SERVICE_FRAGMENT, SERVICE_STATUS_OPTIONS, ServiceNameGridColumn, ServiceTypeGridColumn, ServicesDeviceTabComponent, ServicesDeviceTabGuard, ServicesDeviceTabModule, ServicesModule, ServicesNameCellRendererComponent, ServicesStatusCellRendererComponent, StatusGridColumn, StatusOptionsService, hookServiceStatus };
554
+ export { HOOK_SERVICE_STATUS, LastUpdatedDateCellRendererComponent, LastUpdatedDateGridColumn, SERVICE_STATUS_OPTIONS, ServiceNameGridColumn, ServiceTypeGridColumn, ServicesBreadcrumbFactory, ServicesDeviceTabComponent, ServicesDeviceTabGuard, ServicesDeviceTabModule, ServicesModule, ServicesNameCellRendererComponent, ServicesStatusCellRendererComponent, StatusGridColumn, StatusOptionsService, hookServiceStatus };
648
555
  //# sourceMappingURL=c8y-ngx-components-services.mjs.map