@c8y/ngx-components 1023.61.12 → 1023.63.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.
- package/device-shell/index.d.ts +18 -3
- package/device-shell/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-data-grid-columns-asset-type.mjs +2 -2
- package/fesm2022/c8y-ngx-components-data-grid-columns-asset-type.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-data-grid-columns.mjs +2 -2
- package/fesm2022/c8y-ngx-components-data-grid-columns.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-device-shell.mjs +61 -3
- package/fesm2022/c8y-ngx-components-device-shell.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-asset-table.mjs +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-asset-table.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs +192 -100
- package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +3 -6
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/locales/de.po +6 -0
- package/locales/es.po +6 -0
- package/locales/fr.po +6 -0
- package/locales/ja_JP.po +6 -0
- package/locales/ko.po +6 -0
- package/locales/locales.pot +27 -6
- package/locales/nl.po +6 -0
- package/locales/pl.po +6 -0
- package/locales/pt_BR.po +6 -0
- package/locales/zh_CN.po +6 -0
- package/locales/zh_TW.po +6 -0
- package/package.json +1 -1
- package/widgets/implementations/asset-table/index.d.ts +12 -18
- package/widgets/implementations/asset-table/index.d.ts.map +1 -1
package/device-shell/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { OptionsService, OperationRealtimeService, ManagedObjectRealtimeService,
|
|
|
9
9
|
import * as i3 from '@c8y/ngx-components/operations/operations-timeline';
|
|
10
10
|
import * as rxjs from 'rxjs';
|
|
11
11
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
12
|
-
import { OperationService, IResult, IOperation, IManagedObject, IResultList } from '@c8y/client';
|
|
12
|
+
import { OperationService, InventoryService, IResult, IOperation, IManagedObject, IResultList } from '@c8y/client';
|
|
13
13
|
|
|
14
14
|
declare function rootScopeCommandTemplateFactory($injector: Injector): any;
|
|
15
15
|
declare class CommandTemplatesComponent {
|
|
@@ -63,14 +63,29 @@ interface Command {
|
|
|
63
63
|
command: string;
|
|
64
64
|
category: string;
|
|
65
65
|
}
|
|
66
|
+
interface DeviceShellTemplate {
|
|
67
|
+
name: string;
|
|
68
|
+
text: string;
|
|
69
|
+
category?: string;
|
|
70
|
+
syntax?: string;
|
|
71
|
+
deviceType?: string;
|
|
72
|
+
}
|
|
66
73
|
|
|
67
74
|
declare class DeviceShellService {
|
|
68
75
|
private optionsService;
|
|
69
76
|
private operationService;
|
|
70
|
-
|
|
77
|
+
private inventoryService;
|
|
78
|
+
private readonly MO_TYPE;
|
|
79
|
+
constructor(optionsService: OptionsService, operationService: OperationService, inventoryService: InventoryService);
|
|
71
80
|
getDeliveryTypes(): DeliveryType[];
|
|
72
81
|
canSendCommandsViaSMS(): Promise<boolean>;
|
|
73
82
|
createCommandOperation(deviceId: string, command: Command, deliveryType: CommandDeliveryType): Promise<IResult<IOperation>>;
|
|
83
|
+
getCommandTemplatesForDeviceType(deviceTypes: string[]): Promise<DeviceShellTemplate[]>;
|
|
84
|
+
private getStaticCommandTemplates;
|
|
85
|
+
private getCommandTemplatesForDeviceTypeInMemory;
|
|
86
|
+
private getDynamicCommandTemplates;
|
|
87
|
+
private extractCommandTemplatesFromData;
|
|
88
|
+
private getExtendedTemplates;
|
|
74
89
|
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceShellService, never>;
|
|
75
90
|
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceShellService>;
|
|
76
91
|
}
|
|
@@ -118,5 +133,5 @@ declare class DeviceShellModule {
|
|
|
118
133
|
}
|
|
119
134
|
|
|
120
135
|
export { CommandDeliveryType, CommandTemplates, CommandTemplatesComponent, CommandTemplatesModule, DeviceShellComponent, DeviceShellGuard, DeviceShellModule, DeviceShellService, DeviceShellSharedModule, ShellModule, rootScopeCommandTemplateFactory };
|
|
121
|
-
export type { Command, DeliveryType };
|
|
136
|
+
export type { Command, DeliveryType, DeviceShellTemplate };
|
|
122
137
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../device-shell/command-templates/command-templates.component.ts","../../device-shell/command-templates/command-templates.directive.ts","../../device-shell/command-templates/command-templates.module.ts","../../device-shell/device-shell.guard.ts","../../device-shell/shared/device-shell-shared.module.ts","../../device-shell/shared/device-shell.model.ts","../../device-shell/shared/device-shell.service.ts","../../device-shell/shell/shell.component.ts","../../device-shell/shell/shell.module.ts","../../device-shell/device-shell.module.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;AAKA;AAIA;AAkBqB;AAFnB;AAEmB;;;AACpB;;ACzBD;AAGE;AAGA;AAEY;;;AAGb;;ACVD;;;;AAIsC;;ACLtC;AAEE;;;;AAOD;;ACTD;;;;AAGuC;;ACNvC;AACE;AACA;AACD;;;;AAKA;;;;;;;;AASA;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../device-shell/command-templates/command-templates.component.ts","../../device-shell/command-templates/command-templates.directive.ts","../../device-shell/command-templates/command-templates.module.ts","../../device-shell/device-shell.guard.ts","../../device-shell/shared/device-shell-shared.module.ts","../../device-shell/shared/device-shell.model.ts","../../device-shell/shared/device-shell.service.ts","../../device-shell/shell/shell.component.ts","../../device-shell/shell/shell.module.ts","../../device-shell/device-shell.module.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;AAKA;AAIA;AAkBqB;AAFnB;AAEmB;;;AACpB;;ACzBD;AAGE;AAGA;AAEY;;;AAGb;;ACVD;;;;AAIsC;;ACLtC;AAEE;;;;AAOD;;ACTD;;;;AAGuC;;ACNvC;AACE;AACA;AACD;;;;AAKA;;;;;;;;AASA;;;;;;;AAQA;;ACRD;AAII;AACA;AACA;AAJF;;;AAmBM;AAIN;;;AAmCA;;AAgCA;AAYA;;;AAOD;;ACxGD;AAsCW;AACA;AACP;AACA;AACA;AACA;AACA;;AAzBF;AACA;;AAAsE;;AAItE;AACA;AACA;AACA;AAMA;;;AAcM;;AAgDN;AAOM;AAgBN;;;AAID;;AC1ID;;;;AAW2B;;ACJ3B;;;;AAIiC;;;"}
|
|
@@ -38,11 +38,11 @@ class AssetTypeCellRendererComponent {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTypeCellRendererComponent, deps: [{ token: i1.CellRendererContext }, { token: i2.AssetNodeService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
41
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
41
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AssetTypeCellRendererComponent, isStandalone: true, selector: "c8y-asset-type-cell-renderer", ngImport: i0, template: "@if (isDevice) {\n <device-status [mo]=\"context.item\"></device-status>\n} @else {\n <i\n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"groupIcon | async\"\n title=\"{{ iconTitle | translate }}\"\n ></i>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: I18nModule }, { kind: "ngmodule", type: DeviceStatusModule }, { kind: "component", type: i1.DeviceStatusComponent, selector: "device-status, c8y-device-status", inputs: ["mo", "size"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] }); }
|
|
42
42
|
}
|
|
43
43
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTypeCellRendererComponent, decorators: [{
|
|
44
44
|
type: Component,
|
|
45
|
-
args: [{ standalone: true, imports: [CommonModule, I18nModule, DeviceStatusModule], selector: 'c8y-asset-type-cell-renderer', template: "<device-status
|
|
45
|
+
args: [{ standalone: true, imports: [CommonModule, I18nModule, DeviceStatusModule], selector: 'c8y-asset-type-cell-renderer', template: "@if (isDevice) {\n <device-status [mo]=\"context.item\"></device-status>\n} @else {\n <i\n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"groupIcon | async\"\n title=\"{{ iconTitle | translate }}\"\n ></i>\n}\n" }]
|
|
46
46
|
}], ctorParameters: () => [{ type: i1.CellRendererContext }, { type: i2.AssetNodeService }] });
|
|
47
47
|
|
|
48
48
|
class AssetTypeGridColumn extends BaseColumn {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-data-grid-columns-asset-type.mjs","sources":["../../data-grid-columns/asset-type/asset-type.cell-renderer.component.ts","../../data-grid-columns/asset-type/asset-type.cell-renderer.component.html","../../data-grid-columns/asset-type/asset-type-grid-column.ts","../../data-grid-columns/asset-type/c8y-ngx-components-data-grid-columns-asset-type.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport {\n CellRendererContext,\n I18nModule,\n CommonModule,\n DeviceStatusModule\n} from '@c8y/ngx-components';\nimport { AssetNodeService } from '@c8y/ngx-components/assets-navigator';\nimport { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';\n\n@Component({\n templateUrl: './asset-type.cell-renderer.component.html',\n standalone: true,\n imports: [CommonModule, I18nModule, DeviceStatusModule],\n selector: 'c8y-asset-type-cell-renderer'\n})\nexport class AssetTypeCellRendererComponent implements OnInit {\n groupIcon: Promise<string>;\n isAnyGroup: boolean;\n isDevice: boolean;\n isAsset: boolean;\n iconTitle: string;\n constructor(\n public context: CellRendererContext,\n protected assetNodeService: AssetNodeService\n ) {}\n\n async ngOnInit() {\n this.isAnyGroup = this.assetNodeService.isAnyGroup(this.context.item);\n this.groupIcon = this.assetNodeService.icon(this.context.item);\n this.isDevice = this.assetNodeService.isDevice(this.context.item);\n this.isAsset = this.assetNodeService.isAsset(this.context.item);\n this.iconTitle = this.getIconTitle(await this.groupIcon);\n }\n\n private getIconTitle(icon: SupportedIconsSuggestions): string {\n if (this.isAsset) {\n return this.context.item.type;\n }\n\n switch (icon) {\n case 'c8y-group':\n return gettext('Group');\n case 'c8y-group-smart':\n return gettext('Smart group');\n case 'c8y-group-remote-inactive':\n return 'Inactive remote group';\n case 'c8y-group-remote':\n return gettext('Remote group');\n case 'exchange':\n return gettext('Device');\n default:\n return gettext('Asset');\n }\n }\n}\n","<device-status
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-data-grid-columns-asset-type.mjs","sources":["../../data-grid-columns/asset-type/asset-type.cell-renderer.component.ts","../../data-grid-columns/asset-type/asset-type.cell-renderer.component.html","../../data-grid-columns/asset-type/asset-type-grid-column.ts","../../data-grid-columns/asset-type/c8y-ngx-components-data-grid-columns-asset-type.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport {\n CellRendererContext,\n I18nModule,\n CommonModule,\n DeviceStatusModule\n} from '@c8y/ngx-components';\nimport { AssetNodeService } from '@c8y/ngx-components/assets-navigator';\nimport { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';\n\n@Component({\n templateUrl: './asset-type.cell-renderer.component.html',\n standalone: true,\n imports: [CommonModule, I18nModule, DeviceStatusModule],\n selector: 'c8y-asset-type-cell-renderer'\n})\nexport class AssetTypeCellRendererComponent implements OnInit {\n groupIcon: Promise<string>;\n isAnyGroup: boolean;\n isDevice: boolean;\n isAsset: boolean;\n iconTitle: string;\n constructor(\n public context: CellRendererContext,\n protected assetNodeService: AssetNodeService\n ) {}\n\n async ngOnInit() {\n this.isAnyGroup = this.assetNodeService.isAnyGroup(this.context.item);\n this.groupIcon = this.assetNodeService.icon(this.context.item);\n this.isDevice = this.assetNodeService.isDevice(this.context.item);\n this.isAsset = this.assetNodeService.isAsset(this.context.item);\n this.iconTitle = this.getIconTitle(await this.groupIcon);\n }\n\n private getIconTitle(icon: SupportedIconsSuggestions): string {\n if (this.isAsset) {\n return this.context.item.type;\n }\n\n switch (icon) {\n case 'c8y-group':\n return gettext('Group');\n case 'c8y-group-smart':\n return gettext('Smart group');\n case 'c8y-group-remote-inactive':\n return 'Inactive remote group';\n case 'c8y-group-remote':\n return gettext('Remote group');\n case 'exchange':\n return gettext('Device');\n default:\n return gettext('Asset');\n }\n }\n}\n","@if (isDevice) {\n <device-status [mo]=\"context.item\"></device-status>\n} @else {\n <i\n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"groupIcon | async\"\n title=\"{{ iconTitle | translate }}\"\n ></i>\n}\n","import { gettext } from '@c8y/ngx-components/gettext';\nimport {\n BaseColumn,\n ColumnConfig,\n ColumnDataType,\n getBasicInputArrayFormFieldConfig\n} from '@c8y/ngx-components';\nimport { AssetTypeCellRendererComponent } from './asset-type.cell-renderer.component';\n\nexport class AssetTypeGridColumn extends BaseColumn {\n constructor(initialColumnConfig?: ColumnConfig) {\n super(initialColumnConfig);\n this.name = 'type';\n this.header = gettext('Type');\n this.dataType = ColumnDataType.Icon;\n this.cellRendererComponent = AssetTypeCellRendererComponent;\n this.sortable = true;\n this.sortingConfig = {\n pathSortingConfigs: [{ path: `c8y_IsDeviceGroup` }]\n };\n\n this.filterable = true;\n this.filteringConfig = {\n fields: getBasicInputArrayFormFieldConfig({\n key: 'types',\n label: gettext('Show items with type'),\n addText: gettext('Add next`type`'),\n tooltip: gettext('Use * as a wildcard character'),\n placeholder: gettext('building`e.g. house`')\n }),\n getFilter(model: any): any {\n const filter: any = {};\n if (model.types.length) {\n filter.type = { __in: model.types };\n }\n return filter;\n }\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAiBa,8BAA8B,CAAA;IAMzC,WAAA,CACS,OAA4B,EACzB,gBAAkC,EAAA;QADrC,IAAA,CAAA,OAAO,GAAP,OAAO;QACJ,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;IACzB;AAEH,IAAA,MAAM,QAAQ,GAAA;AACZ,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;AACrE,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;AAC9D,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;AACjE,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;AAC/D,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC;IAC1D;AAEQ,IAAA,YAAY,CAAC,IAA+B,EAAA;AAClD,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;QAC/B;QAEA,QAAQ,IAAI;AACV,YAAA,KAAK,WAAW;AACd,gBAAA,OAAO,OAAO,CAAC,OAAO,CAAC;AACzB,YAAA,KAAK,iBAAiB;AACpB,gBAAA,OAAO,OAAO,CAAC,aAAa,CAAC;AAC/B,YAAA,KAAK,2BAA2B;AAC9B,gBAAA,OAAO,uBAAuB;AAChC,YAAA,KAAK,kBAAkB;AACrB,gBAA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,11 @@ class AssetTypeCellRendererComponent {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTypeCellRendererComponent, deps: [{ token: i1.CellRendererContext }, { token: i2.AssetNodeService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
41
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
41
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.18", type: AssetTypeCellRendererComponent, isStandalone: true, selector: "c8y-asset-type-cell-renderer", ngImport: i0, template: "@if (isDevice) {\n <device-status [mo]=\"context.item\"></device-status>\n} @else {\n <i\n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"groupIcon | async\"\n title=\"{{ iconTitle | translate }}\"\n ></i>\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: I18nModule }, { kind: "ngmodule", type: DeviceStatusModule }, { kind: "component", type: i1.DeviceStatusComponent, selector: "device-status, c8y-device-status", inputs: ["mo", "size"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }] }); }
|
|
42
42
|
}
|
|
43
43
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: AssetTypeCellRendererComponent, decorators: [{
|
|
44
44
|
type: Component,
|
|
45
|
-
args: [{ standalone: true, imports: [CommonModule, I18nModule, DeviceStatusModule], selector: 'c8y-asset-type-cell-renderer', template: "<device-status
|
|
45
|
+
args: [{ standalone: true, imports: [CommonModule, I18nModule, DeviceStatusModule], selector: 'c8y-asset-type-cell-renderer', template: "@if (isDevice) {\n <device-status [mo]=\"context.item\"></device-status>\n} @else {\n <i\n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"groupIcon | async\"\n title=\"{{ iconTitle | translate }}\"\n ></i>\n}\n" }]
|
|
46
46
|
}], ctorParameters: () => [{ type: i1.CellRendererContext }, { type: i2.AssetNodeService }] });
|
|
47
47
|
|
|
48
48
|
class AssetTypeGridColumn extends BaseColumn {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-data-grid-columns.mjs","sources":["../../data-grid-columns/asset-type/asset-type.cell-renderer.component.ts","../../data-grid-columns/asset-type/asset-type.cell-renderer.component.html","../../data-grid-columns/asset-type/asset-type-grid-column.ts","../../data-grid-columns/c8y-ngx-components-data-grid-columns.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport {\n CellRendererContext,\n I18nModule,\n CommonModule,\n DeviceStatusModule\n} from '@c8y/ngx-components';\nimport { AssetNodeService } from '@c8y/ngx-components/assets-navigator';\nimport { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';\n\n@Component({\n templateUrl: './asset-type.cell-renderer.component.html',\n standalone: true,\n imports: [CommonModule, I18nModule, DeviceStatusModule],\n selector: 'c8y-asset-type-cell-renderer'\n})\nexport class AssetTypeCellRendererComponent implements OnInit {\n groupIcon: Promise<string>;\n isAnyGroup: boolean;\n isDevice: boolean;\n isAsset: boolean;\n iconTitle: string;\n constructor(\n public context: CellRendererContext,\n protected assetNodeService: AssetNodeService\n ) {}\n\n async ngOnInit() {\n this.isAnyGroup = this.assetNodeService.isAnyGroup(this.context.item);\n this.groupIcon = this.assetNodeService.icon(this.context.item);\n this.isDevice = this.assetNodeService.isDevice(this.context.item);\n this.isAsset = this.assetNodeService.isAsset(this.context.item);\n this.iconTitle = this.getIconTitle(await this.groupIcon);\n }\n\n private getIconTitle(icon: SupportedIconsSuggestions): string {\n if (this.isAsset) {\n return this.context.item.type;\n }\n\n switch (icon) {\n case 'c8y-group':\n return gettext('Group');\n case 'c8y-group-smart':\n return gettext('Smart group');\n case 'c8y-group-remote-inactive':\n return 'Inactive remote group';\n case 'c8y-group-remote':\n return gettext('Remote group');\n case 'exchange':\n return gettext('Device');\n default:\n return gettext('Asset');\n }\n }\n}\n","<device-status
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-data-grid-columns.mjs","sources":["../../data-grid-columns/asset-type/asset-type.cell-renderer.component.ts","../../data-grid-columns/asset-type/asset-type.cell-renderer.component.html","../../data-grid-columns/asset-type/asset-type-grid-column.ts","../../data-grid-columns/c8y-ngx-components-data-grid-columns.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport {\n CellRendererContext,\n I18nModule,\n CommonModule,\n DeviceStatusModule\n} from '@c8y/ngx-components';\nimport { AssetNodeService } from '@c8y/ngx-components/assets-navigator';\nimport { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';\n\n@Component({\n templateUrl: './asset-type.cell-renderer.component.html',\n standalone: true,\n imports: [CommonModule, I18nModule, DeviceStatusModule],\n selector: 'c8y-asset-type-cell-renderer'\n})\nexport class AssetTypeCellRendererComponent implements OnInit {\n groupIcon: Promise<string>;\n isAnyGroup: boolean;\n isDevice: boolean;\n isAsset: boolean;\n iconTitle: string;\n constructor(\n public context: CellRendererContext,\n protected assetNodeService: AssetNodeService\n ) {}\n\n async ngOnInit() {\n this.isAnyGroup = this.assetNodeService.isAnyGroup(this.context.item);\n this.groupIcon = this.assetNodeService.icon(this.context.item);\n this.isDevice = this.assetNodeService.isDevice(this.context.item);\n this.isAsset = this.assetNodeService.isAsset(this.context.item);\n this.iconTitle = this.getIconTitle(await this.groupIcon);\n }\n\n private getIconTitle(icon: SupportedIconsSuggestions): string {\n if (this.isAsset) {\n return this.context.item.type;\n }\n\n switch (icon) {\n case 'c8y-group':\n return gettext('Group');\n case 'c8y-group-smart':\n return gettext('Smart group');\n case 'c8y-group-remote-inactive':\n return 'Inactive remote group';\n case 'c8y-group-remote':\n return gettext('Remote group');\n case 'exchange':\n return gettext('Device');\n default:\n return gettext('Asset');\n }\n }\n}\n","@if (isDevice) {\n <device-status [mo]=\"context.item\"></device-status>\n} @else {\n <i\n class=\"c8y-icon-duocolor\"\n [c8yIcon]=\"groupIcon | async\"\n title=\"{{ iconTitle | translate }}\"\n ></i>\n}\n","import { gettext } from '@c8y/ngx-components/gettext';\nimport {\n BaseColumn,\n ColumnConfig,\n ColumnDataType,\n getBasicInputArrayFormFieldConfig\n} from '@c8y/ngx-components';\nimport { AssetTypeCellRendererComponent } from './asset-type.cell-renderer.component';\n\nexport class AssetTypeGridColumn extends BaseColumn {\n constructor(initialColumnConfig?: ColumnConfig) {\n super(initialColumnConfig);\n this.name = 'type';\n this.header = gettext('Type');\n this.dataType = ColumnDataType.Icon;\n this.cellRendererComponent = AssetTypeCellRendererComponent;\n this.sortable = true;\n this.sortingConfig = {\n pathSortingConfigs: [{ path: `c8y_IsDeviceGroup` }]\n };\n\n this.filterable = true;\n this.filteringConfig = {\n fields: getBasicInputArrayFormFieldConfig({\n key: 'types',\n label: gettext('Show items with type'),\n addText: gettext('Add next`type`'),\n tooltip: gettext('Use * as a wildcard character'),\n placeholder: gettext('building`e.g. house`')\n }),\n getFilter(model: any): any {\n const filter: any = {};\n if (model.types.length) {\n filter.type = { __in: model.types };\n }\n return filter;\n }\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAiBa,8BAA8B,CAAA;IAMzC,WAAA,CACS,OAA4B,EACzB,gBAAkC,EAAA;QADrC,IAAA,CAAA,OAAO,GAAP,OAAO;QACJ,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;IACzB;AAEH,IAAA,MAAM,QAAQ,GAAA;AACZ,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;AACrE,QAAA,IAAI,CAAC,SAAS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8BAA8B;AAC3D,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;QACpB,IAAI,CAAC,aAAa,GAAG;AACnB,YAAA,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAA,iBAAA,CAAmB,EAAE;SACnD;AAED,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;QACtB,IAAI,CAAC,eAAe,GAAG;YACrB,MAAM,EAAE,iCAAiC,CAAC;AACxC,gBAAA,GAAG,EAAE,OAAO;AACZ,gBAAA,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC;AACtC,gBAAA,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC;AAClC,gBAAA,OAAO,EAAE,OAAO,CAAC,+BAA+B,CAAC;AACjD,gBAAA,WAAW,EAAE,OAAO,CAAC,sBAAsB;aAC5C,CAAC;AACF,YAAA,SAAS,CAAC,KAAU,EAAA;gBAClB,MAAM,MAAM,GAAQ,EAAE;AACtB,gBAAA,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE;oBACtB,MAAM,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE;gBACrC;AACA,gBAAA,OAAO,MAAM;YACf;SACD;IACH;AACD;;ACvCD;;AAEG;;;;"}
|
|
@@ -107,9 +107,11 @@ var CommandDeliveryType;
|
|
|
107
107
|
})(CommandDeliveryType || (CommandDeliveryType = {}));
|
|
108
108
|
|
|
109
109
|
class DeviceShellService {
|
|
110
|
-
constructor(optionsService, operationService) {
|
|
110
|
+
constructor(optionsService, operationService, inventoryService) {
|
|
111
111
|
this.optionsService = optionsService;
|
|
112
112
|
this.operationService = operationService;
|
|
113
|
+
this.inventoryService = inventoryService;
|
|
114
|
+
this.MO_TYPE = 'c8y_DeviceShellTemplate';
|
|
113
115
|
}
|
|
114
116
|
getDeliveryTypes() {
|
|
115
117
|
return [
|
|
@@ -136,12 +138,68 @@ class DeviceShellService {
|
|
|
136
138
|
};
|
|
137
139
|
return this.operationService.create(operation);
|
|
138
140
|
}
|
|
139
|
-
|
|
141
|
+
async getCommandTemplatesForDeviceType(deviceTypes) {
|
|
142
|
+
const staticTemplates = await this.getStaticCommandTemplates(deviceTypes);
|
|
143
|
+
const dynamicTemplates = await this.getDynamicCommandTemplates(deviceTypes);
|
|
144
|
+
return [...staticTemplates, ...dynamicTemplates];
|
|
145
|
+
}
|
|
146
|
+
async getStaticCommandTemplates(deviceTypes) {
|
|
147
|
+
const templates = [];
|
|
148
|
+
deviceTypes.forEach(deviceType => {
|
|
149
|
+
const inMemory = this.getCommandTemplatesForDeviceTypeInMemory(deviceType);
|
|
150
|
+
if (inMemory) {
|
|
151
|
+
templates.push(...this.extractCommandTemplatesFromData(deviceType, inMemory));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return templates;
|
|
155
|
+
}
|
|
156
|
+
getCommandTemplatesForDeviceTypeInMemory(deviceType) {
|
|
157
|
+
const raw = localStorage.getItem('devicecommands');
|
|
158
|
+
if (!raw) {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const store = JSON.parse(raw);
|
|
163
|
+
return store?.[deviceType];
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async getDynamicCommandTemplates(deviceTypes) {
|
|
170
|
+
const query = {
|
|
171
|
+
__filter: {
|
|
172
|
+
type: this.MO_TYPE,
|
|
173
|
+
deviceType: { __in: deviceTypes }
|
|
174
|
+
},
|
|
175
|
+
__orderby: [{ creationTime: -1 }]
|
|
176
|
+
};
|
|
177
|
+
const resultList = await this.inventoryService.listQuery(query, { pageSize: 1000 });
|
|
178
|
+
const results = resultList.data;
|
|
179
|
+
return results.map(r => ({
|
|
180
|
+
...r,
|
|
181
|
+
deviceType: Array.isArray(r.deviceType) ? r.deviceType[0] : r.deviceType
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
extractCommandTemplatesFromData(deviceType, data) {
|
|
185
|
+
let templates;
|
|
186
|
+
if (Array.isArray(data)) {
|
|
187
|
+
templates = data.flatMap(d => this.getExtendedTemplates(d.templates, d.syntax, deviceType));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
templates = this.getExtendedTemplates(data.templates, data.syntax, deviceType);
|
|
191
|
+
}
|
|
192
|
+
return templates;
|
|
193
|
+
}
|
|
194
|
+
getExtendedTemplates(templates, syntax, deviceType) {
|
|
195
|
+
return (templates || []).map(t => ({ ...t, syntax, deviceType }));
|
|
196
|
+
}
|
|
197
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DeviceShellService, deps: [{ token: i2.OptionsService }, { token: i2$1.OperationService }, { token: i2$1.InventoryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
140
198
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DeviceShellService }); }
|
|
141
199
|
}
|
|
142
200
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DeviceShellService, decorators: [{
|
|
143
201
|
type: Injectable
|
|
144
|
-
}], ctorParameters: () => [{ type: i2.OptionsService }, { type: i2$1.OperationService }] });
|
|
202
|
+
}], ctorParameters: () => [{ type: i2.OptionsService }, { type: i2$1.OperationService }, { type: i2$1.InventoryService }] });
|
|
145
203
|
|
|
146
204
|
class DeviceShellSharedModule {
|
|
147
205
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: DeviceShellSharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-device-shell.mjs","sources":["../../device-shell/command-templates/command-templates.directive.ts","../../device-shell/command-templates/command-templates.component.ts","../../device-shell/command-templates/command-templates.module.ts","../../device-shell/device-shell.guard.ts","../../device-shell/shared/device-shell.model.ts","../../device-shell/shared/device-shell.service.ts","../../device-shell/shared/device-shell-shared.module.ts","../../device-shell/shell/shell.component.ts","../../device-shell/shell/shell.component.html","../../device-shell/shell/shell.module.ts","../../device-shell/device-shell.module.ts","../../device-shell/c8y-ngx-components-device-shell.ts"],"sourcesContent":["import { Directive, ElementRef, EventEmitter, Injector, Output } from '@angular/core';\nimport { UpgradeComponent } from '@angular/upgrade/static';\n\n@Directive({ selector: 'c8y-command-templates-directive' })\nexport class CommandTemplates extends UpgradeComponent {\n @Output()\n close: EventEmitter<void>;\n\n @Output()\n dismiss: EventEmitter<void>;\n\n constructor(elementRef: ElementRef, injector: Injector) {\n super('c8yCommandTemplates', elementRef, injector);\n }\n}\n","import { Component, EventEmitter, Injector } from '@angular/core';\nimport { BsModalRef } from 'ngx-bootstrap/modal';\nimport { CommandTemplates } from './command-templates.directive';\n\n/* https://stackoverflow.com/a/65290658 */\nexport function rootScopeCommandTemplateFactory($injector: Injector) {\n return $injector.get('$rootScope').$new();\n}\n\n@Component({\n selector: 'c8y-command-templates',\n template: `<c8y-command-templates-directive\n (close)=\"modalRef.hide(); onTemplateSelected.next($event)\"\n (dismiss)=\"modalRef.hide()\"\n ></c8y-command-templates-directive>`,\n providers: [\n {\n deps: ['$injector'],\n provide: '$scope',\n useFactory: rootScopeCommandTemplateFactory\n }\n ],\n imports: [CommandTemplates]\n})\nexport class CommandTemplatesComponent {\n onTemplateSelected: EventEmitter<object> = new EventEmitter();\n\n constructor(public modalRef: BsModalRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { CommandTemplatesComponent } from './command-templates.component';\nimport { CommandTemplates } from './command-templates.directive';\n\n@NgModule({\n imports: [CommandTemplates, CommandTemplatesComponent],\n exports: [CommandTemplatesComponent]\n})\nexport class CommandTemplatesModule {}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot } from '@angular/router';\n\n@Injectable()\nexport class DeviceShellGuard {\n private readonly operation = 'c8y_Command';\n\n canActivate(route: ActivatedRouteSnapshot) {\n const device = route.data.contextData || route.parent.data.contextData;\n const supportedOperations = (device && device.c8y_SupportedOperations) || [];\n return supportedOperations.indexOf(this.operation) >= 0;\n }\n}\n","export enum CommandDeliveryType {\n DEFAULT = 'Default',\n SMS = 'SMS'\n}\n\nexport interface DeliveryType {\n name: string;\n default?: boolean;\n}\n\nexport interface Command {\n id: string;\n name: string;\n text: string;\n deliveryTypes: string[];\n command: string;\n category: string;\n}\n","import { Injectable } from '@angular/core';\nimport { IOperation, IResult, OperationService } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { OptionsService } from '@c8y/ngx-components';\nimport { Command, CommandDeliveryType, DeliveryType } from './device-shell.model';\n\n@Injectable()\nexport class DeviceShellService {\n constructor(\n private optionsService: OptionsService,\n private operationService: OperationService\n ) {}\n\n getDeliveryTypes(): DeliveryType[] {\n return [\n {\n name: gettext(CommandDeliveryType.DEFAULT),\n default: true\n },\n {\n name: gettext(CommandDeliveryType.SMS)\n }\n ];\n }\n\n async canSendCommandsViaSMS(): Promise<boolean> {\n return !!(await this.optionsService.getSystemOption('messaging', 'provider', false));\n }\n\n createCommandOperation(\n deviceId: string,\n command: Command,\n deliveryType: CommandDeliveryType\n ): Promise<IResult<IOperation>> {\n const operation: IOperation = {\n deviceId,\n description: gettext('Execute shell command') + (command.name ? `: ${command.name}` : ''),\n deliveryType: deliveryType === CommandDeliveryType.SMS ? CommandDeliveryType.SMS : undefined,\n c8y_Command: {\n text: command.text\n }\n };\n return this.operationService.create(operation);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { DeviceShellService } from './device-shell.service';\n\n@NgModule({\n providers: [DeviceShellService]\n})\nexport class DeviceShellSharedModule {}\n","import { Component, OnDestroy, OnInit } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { IManagedObject, IOperation, IResultList, OperationService } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport {\n AlertService,\n ManagedObjectRealtimeService,\n OperationRealtimeService,\n ActionBarItemComponent,\n RealtimeButtonComponent,\n DeviceStatusComponent,\n C8yTranslateDirective,\n C8yTranslatePipe\n} from '@c8y/ngx-components';\nimport { includes, isEmpty } from 'lodash-es';\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\nimport { BehaviorSubject, Observable, of, pipe, Subject } from 'rxjs';\nimport { filter, map, startWith, takeUntil } from 'rxjs/operators';\nimport { CommandTemplatesComponent } from '../command-templates';\nimport { Command, CommandDeliveryType, DeliveryType, DeviceShellService } from '../shared';\nimport { FormsModule } from '@angular/forms';\nimport { NgFor, NgIf, AsyncPipe } from '@angular/common';\nimport { OperationsTimelineComponent } from '@c8y/ngx-components/operations/operations-timeline';\n\n@Component({\n selector: 'c8y-device-shell',\n templateUrl: 'shell.component.html',\n providers: [OperationRealtimeService, ManagedObjectRealtimeService],\n imports: [\n ActionBarItemComponent,\n RealtimeButtonComponent,\n DeviceStatusComponent,\n FormsModule,\n NgFor,\n NgIf,\n OperationsTimelineComponent,\n C8yTranslateDirective,\n AsyncPipe,\n C8yTranslatePipe\n ]\n})\nexport class DeviceShellComponent implements OnInit, OnDestroy {\n device: IManagedObject = this.route.snapshot.parent.data.contextData;\n device$: Observable<IManagedObject> = of({} as any);\n deliveryTypes: Array<DeliveryType & { isSupportedByCommand?: boolean }> = (\n this.service.getDeliveryTypes() || []\n ).map(deliveryType => ({ ...deliveryType, isSupportedByCommand: true }));\n command: Command = {} as Command;\n smsEnabled = false;\n sendingCommand$: BehaviorSubject<boolean> = new BehaviorSubject(false);\n operations: IResultList<IOperation>;\n filterPipe = pipe(\n map((operations: IOperation[]) =>\n (operations || []).filter((operation: IOperation) => !!operation.c8y_Command)\n )\n );\n\n executeViaLabel = gettext('Execute via ({{deliveryType}})');\n\n private destroyed$: Subject<void> = new Subject();\n\n constructor(\n public service: DeviceShellService,\n public operationRealtime: OperationRealtimeService,\n private moRealtime: ManagedObjectRealtimeService,\n private operationService: OperationService,\n private route: ActivatedRoute,\n private modalService: BsModalService,\n private alertService: AlertService\n ) {}\n\n async ngOnInit(): Promise<void> {\n this.smsEnabled = await this.service.canSendCommandsViaSMS();\n\n this.device$ = this.moRealtime.onUpdate$(this.device.id).pipe(startWith(this.device));\n\n this.operations = await this.operationService.list({\n deviceId: this.device.id,\n fragmentType: 'c8y_Command',\n dateFrom: new Date(0).toISOString(),\n dateTo: new Date().toISOString(),\n pageSize: 50,\n withTotalPages: true,\n revert: true\n });\n\n this.operationRealtime\n .onCreate$(this.device.id)\n .pipe(takeUntil(this.destroyed$))\n .subscribe(() => this.alertService.success(gettext('Command sent.')));\n\n this.operationRealtime\n .onUpdate$(this.device.id)\n .pipe(\n filter(op => op.failureReason !== 'Operation cancelled by user.'), // avoid duplicate alerts\n takeUntil(this.destroyed$)\n )\n .subscribe(() => this.alertService.success(gettext('Command status updated.')));\n }\n\n getPredefinedCommand() {\n const modal: BsModalRef<CommandTemplatesComponent> = this.modalService.show(\n CommandTemplatesComponent,\n {\n ariaDescribedby: 'modal-body',\n ariaLabelledBy: 'modal-title'\n }\n );\n modal.content.onTemplateSelected.pipe(takeUntil(this.destroyed$)).subscribe(result => {\n this.command = { ...(result as any).commandTemplate } as Command;\n this.deliveryTypes = this.deliveryTypes.map(deliveryType => ({\n ...deliveryType,\n isSupportedByCommand:\n isEmpty(this.command.deliveryTypes) ||\n includes(this.command.deliveryTypes, deliveryType.name)\n }));\n });\n }\n\n resetSupportedDeliveryTypes(): void {\n this.deliveryTypes = (this.service.getDeliveryTypes() || []).map(deliveryType => ({\n ...deliveryType,\n isSupportedByCommand: true\n }));\n }\n\n async execute(commandDeliveryType): Promise<void> {\n const useSMS = commandDeliveryType === CommandDeliveryType.SMS;\n if (useSMS && !this.smsEnabled) {\n this.alertService.warning(gettext('SMS transport is not configured.'));\n return;\n }\n this.sendingCommand$.next(true);\n\n await this.service.createCommandOperation(this.device.id, this.command, commandDeliveryType);\n\n this.command.text = '';\n this.command.name = '';\n this.resetSupportedDeliveryTypes();\n this.sendingCommand$.next(false);\n }\n\n ngOnDestroy(): void {\n this.destroyed$.next();\n this.destroyed$.complete();\n }\n}\n","<c8y-action-bar-item [placement]=\"'right'\">\n <c8y-realtime-btn [service]=\"operationRealtime\"></c8y-realtime-btn>\n</c8y-action-bar-item>\n\n<div class=\"card content-fullpage d-grid grid__col--6-6--md\">\n <div class=\"inner-scroll d-flex d-col bg-level-0\">\n <div class=\"card-header large-padding separator sticky-top\">\n <div class=\"card-title\">\n {{ 'Command' | translate }}\n </div>\n </div>\n\n <div class=\"card-block d-flex d-col flex-grow large-padding\">\n <div class=\"d-flex p-b-16\">\n <button\n class=\"btn btn-default btn-sm\"\n type=\"button\"\n (click)=\"getPredefinedCommand()\"\n [title]=\"'Display a list of predefined commands' | translate\"\n data-cy=\"shell--predefined-commands\"\n >\n {{ 'Predefined commands' | translate }}\n </button>\n\n <div class=\"m-l-auto\">\n <device-status [mo]=\"device$ | async\"></device-status>\n </div>\n </div>\n <textarea\n [attr.aria-label]=\"'Commands' | translate\"\n class=\"form-control inner-scroll flex-grow bg-level-2 text-monospace\"\n [(ngModel)]=\"command.text\"\n data-cy=\"shell-component--commands\"\n (ngModelChange)=\"$event || resetSupportedDeliveryTypes()\"\n placeholder=\"{{ 'Add commands or use predefined commands above.' | translate }}\"\n ></textarea>\n </div>\n\n <div class=\"card-footer large-padding separator\">\n <ng-container *ngFor=\"let deliveryType of deliveryTypes\">\n <button\n class=\"btn btn-primary\"\n type=\"button\"\n *ngIf=\"deliveryType.isSupportedByCommand\"\n [disabled]=\"!command?.text || (sendingCommand$ | async)\"\n (click)=\"execute(deliveryType.name)\"\n >\n <span\n [title]=\"\n deliveryType.default\n ? ('Execute' | translate)\n : (executeViaLabel | translate: { deliveryType: deliveryType.name })\n \"\n >\n {{\n deliveryType.default\n ? ('Execute' | translate)\n : (executeViaLabel | translate: { deliveryType: deliveryType.name })\n }}\n </span>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"inner-scroll bg-level-1\">\n <div class=\"card-header large-padding separator sticky-top\">\n <div class=\"card-title\">\n {{ 'Operations' | translate }}\n </div>\n </div>\n <div class=\"card-block large-padding\">\n <c8y-operations-timeline\n [operations]=\"operations\"\n [sourceId]=\"device.id\"\n [filterPipe]=\"filterPipe\"\n [bodyTemplate]=\"timelineItemBody\"\n [footerTemplates]=\"[timelineItemFooter]\"\n [propertiesToHide]=\"['c8y_Command']\"\n ></c8y-operations-timeline>\n <ng-template #timelineItemBody let-operation>\n <small>{{ operation.c8y_Command?.text || operation.description }}</small>\n </ng-template>\n <ng-template #timelineItemFooter let-operation>\n <div *ngIf=\"operation.c8y_Command?.text\">\n <div class=\"legend form-block\" translate>Command</div>\n <!-- Keep this in a single line since `pre-text` will preserve all whitespaces in the `pre` tag.-->\n <pre class=\"p-8 text-pre\"><code>{{operation.c8y_Command.text}}</code></pre>\n </div>\n <div *ngIf=\"operation.c8y_Command?.result\">\n <div class=\"legend form-block\" translate>Response</div>\n <!-- Keep this in a single line since `pre-text` will preserve all whitespaces in the `pre` tag.-->\n <pre class=\"p-8 text-pre\"><code>{{operation.c8y_Command.result}}</code></pre>\n </div>\n </ng-template>\n </div>\n </div>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { CoreModule } from '@c8y/ngx-components';\nimport { OperationsTimelineModule } from '@c8y/ngx-components/operations/operations-timeline';\nimport { CommandTemplatesModule } from '../command-templates';\nimport { DeviceShellSharedModule } from '../shared';\nimport { DeviceShellComponent } from './shell.component';\n\n@NgModule({\n imports: [\n CommonModule,\n CoreModule,\n OperationsTimelineModule,\n CommandTemplatesModule,\n DeviceShellSharedModule,\n DeviceShellComponent\n ],\n exports: [DeviceShellComponent]\n})\nexport class ShellModule {}\n","import { NgModule } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { hookRoute, Route, ViewContext } from '@c8y/ngx-components';\nimport { DeviceShellGuard } from './device-shell.guard';\nimport { DeviceShellComponent, ShellModule } from './shell';\n\nconst DEVICE_SHELL_ROUTE: Route = {\n path: 'shell',\n context: ViewContext.Device,\n component: DeviceShellComponent,\n label: gettext('Shell'),\n icon: 'terminal',\n canActivate: [DeviceShellGuard]\n};\n\n@NgModule({\n imports: [ShellModule],\n providers: [DeviceShellGuard, hookRoute(DEVICE_SHELL_ROUTE)]\n})\nexport class DeviceShellModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2","i1.DeviceShellService","i3","i5"],"mappings":";;;;;;;;;;;;;;;;;AAIM,MAAO,gBAAiB,SAAQ,gBAAgB,CAAA;IAOpD,WAAA,CAAY,UAAsB,EAAE,QAAkB,EAAA;AACpD,QAAA,KAAK,CAAC,qBAAqB,EAAE,UAAU,EAAE,QAAQ,CAAC;IACpD;+GATW,gBAAgB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,QAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iCAAA,EAAA,OAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,SAAS;mBAAC,EAAE,QAAQ,EAAE,iCAAiC,EAAE;;sBAEvD;;sBAGA;;;ACJH;AACM,SAAU,+BAA+B,CAAC,SAAmB,EAAA;IACjE,OAAO,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE;AAC3C;MAiBa,yBAAyB,CAAA;AAGpC,IAAA,WAAA,CAAmB,QAAoB,EAAA;QAApB,IAA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AE,CAAC,gBAAgB;CAC/B;MAMY,iBAAiB,CAAA;+GAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,YAHlB,WAAW,CAAA,EAAA,CAAA,CAAA;gHAGV,iBAAiB,EAAA,SAAA,EAFjB,CAAC,gBAAgB,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAA,OAAA,EAAA,CADlD,WAAW,CAAA,EAAA,CAAA,CAAA;;4FAGV,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,WAAW,CAAC;oBACtB,SAAS,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,kBAAkB,CAAC;AAC5D,iBAAA;;;AClBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-device-shell.mjs","sources":["../../device-shell/command-templates/command-templates.directive.ts","../../device-shell/command-templates/command-templates.component.ts","../../device-shell/command-templates/command-templates.module.ts","../../device-shell/device-shell.guard.ts","../../device-shell/shared/device-shell.model.ts","../../device-shell/shared/device-shell.service.ts","../../device-shell/shared/device-shell-shared.module.ts","../../device-shell/shell/shell.component.ts","../../device-shell/shell/shell.component.html","../../device-shell/shell/shell.module.ts","../../device-shell/device-shell.module.ts","../../device-shell/c8y-ngx-components-device-shell.ts"],"sourcesContent":["import { Directive, ElementRef, EventEmitter, Injector, Output } from '@angular/core';\nimport { UpgradeComponent } from '@angular/upgrade/static';\n\n@Directive({ selector: 'c8y-command-templates-directive' })\nexport class CommandTemplates extends UpgradeComponent {\n @Output()\n close: EventEmitter<void>;\n\n @Output()\n dismiss: EventEmitter<void>;\n\n constructor(elementRef: ElementRef, injector: Injector) {\n super('c8yCommandTemplates', elementRef, injector);\n }\n}\n","import { Component, EventEmitter, Injector } from '@angular/core';\nimport { BsModalRef } from 'ngx-bootstrap/modal';\nimport { CommandTemplates } from './command-templates.directive';\n\n/* https://stackoverflow.com/a/65290658 */\nexport function rootScopeCommandTemplateFactory($injector: Injector) {\n return $injector.get('$rootScope').$new();\n}\n\n@Component({\n selector: 'c8y-command-templates',\n template: `<c8y-command-templates-directive\n (close)=\"modalRef.hide(); onTemplateSelected.next($event)\"\n (dismiss)=\"modalRef.hide()\"\n ></c8y-command-templates-directive>`,\n providers: [\n {\n deps: ['$injector'],\n provide: '$scope',\n useFactory: rootScopeCommandTemplateFactory\n }\n ],\n imports: [CommandTemplates]\n})\nexport class CommandTemplatesComponent {\n onTemplateSelected: EventEmitter<object> = new EventEmitter();\n\n constructor(public modalRef: BsModalRef) {}\n}\n","import { NgModule } from '@angular/core';\nimport { CommandTemplatesComponent } from './command-templates.component';\nimport { CommandTemplates } from './command-templates.directive';\n\n@NgModule({\n imports: [CommandTemplates, CommandTemplatesComponent],\n exports: [CommandTemplatesComponent]\n})\nexport class CommandTemplatesModule {}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot } from '@angular/router';\n\n@Injectable()\nexport class DeviceShellGuard {\n private readonly operation = 'c8y_Command';\n\n canActivate(route: ActivatedRouteSnapshot) {\n const device = route.data.contextData || route.parent.data.contextData;\n const supportedOperations = (device && device.c8y_SupportedOperations) || [];\n return supportedOperations.indexOf(this.operation) >= 0;\n }\n}\n","export enum CommandDeliveryType {\n DEFAULT = 'Default',\n SMS = 'SMS'\n}\n\nexport interface DeliveryType {\n name: string;\n default?: boolean;\n}\n\nexport interface Command {\n id: string;\n name: string;\n text: string;\n deliveryTypes: string[];\n command: string;\n category: string;\n}\n\nexport interface DeviceShellTemplate {\n name: string;\n text: string;\n category?: string;\n syntax?: string;\n deviceType?: string;\n}\n","import { Injectable } from '@angular/core';\nimport {\n IManagedObject,\n InventoryService,\n IOperation,\n IResult,\n OperationService\n} from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { OptionsService } from '@c8y/ngx-components';\nimport {\n Command,\n CommandDeliveryType,\n DeliveryType,\n DeviceShellTemplate\n} from './device-shell.model';\n\n@Injectable()\nexport class DeviceShellService {\n private readonly MO_TYPE = 'c8y_DeviceShellTemplate';\n constructor(\n private optionsService: OptionsService,\n private operationService: OperationService,\n private inventoryService: InventoryService\n ) {}\n\n getDeliveryTypes(): DeliveryType[] {\n return [\n {\n name: gettext(CommandDeliveryType.DEFAULT),\n default: true\n },\n {\n name: gettext(CommandDeliveryType.SMS)\n }\n ];\n }\n\n async canSendCommandsViaSMS(): Promise<boolean> {\n return !!(await this.optionsService.getSystemOption('messaging', 'provider', false));\n }\n\n createCommandOperation(\n deviceId: string,\n command: Command,\n deliveryType: CommandDeliveryType\n ): Promise<IResult<IOperation>> {\n const operation: IOperation = {\n deviceId,\n description: gettext('Execute shell command') + (command.name ? `: ${command.name}` : ''),\n deliveryType: deliveryType === CommandDeliveryType.SMS ? CommandDeliveryType.SMS : undefined,\n c8y_Command: {\n text: command.text\n }\n };\n return this.operationService.create(operation);\n }\n\n async getCommandTemplatesForDeviceType(deviceTypes: string[]): Promise<DeviceShellTemplate[]> {\n const staticTemplates = await this.getStaticCommandTemplates(deviceTypes);\n const dynamicTemplates = await this.getDynamicCommandTemplates(deviceTypes);\n return [...staticTemplates, ...dynamicTemplates];\n }\n\n private async getStaticCommandTemplates(deviceTypes: string[]): Promise<DeviceShellTemplate[]> {\n const templates: DeviceShellTemplate[] = [];\n\n deviceTypes.forEach(deviceType => {\n const inMemory = this.getCommandTemplatesForDeviceTypeInMemory(deviceType);\n if (inMemory) {\n templates.push(...this.extractCommandTemplatesFromData(deviceType, inMemory));\n }\n });\n\n return templates;\n }\n\n private getCommandTemplatesForDeviceTypeInMemory(deviceType: string): any[] | undefined {\n const raw = localStorage.getItem('devicecommands');\n if (!raw) {\n return undefined;\n }\n\n try {\n const store = JSON.parse(raw);\n return store?.[deviceType];\n } catch {\n return undefined;\n }\n }\n\n private async getDynamicCommandTemplates(deviceTypes: string[]): Promise<any[]> {\n const query = {\n __filter: {\n type: this.MO_TYPE,\n deviceType: { __in: deviceTypes }\n },\n __orderby: [{ creationTime: -1 }]\n };\n\n const resultList = await this.inventoryService.listQuery(query, { pageSize: 1000 });\n const results: IManagedObject[] = resultList.data;\n\n return results.map(r => ({\n ...r,\n deviceType: Array.isArray(r.deviceType) ? r.deviceType[0] : r.deviceType\n }));\n }\n\n private extractCommandTemplatesFromData(deviceType: string, data: any): DeviceShellTemplate[] {\n let templates: DeviceShellTemplate[];\n\n if (Array.isArray(data)) {\n templates = data.flatMap(d => this.getExtendedTemplates(d.templates, d.syntax, deviceType));\n } else {\n templates = this.getExtendedTemplates(data.templates, data.syntax, deviceType);\n }\n\n return templates;\n }\n\n private getExtendedTemplates(\n templates: any[],\n syntax?: string,\n deviceType?: string\n ): DeviceShellTemplate[] {\n return (templates || []).map(t => ({ ...t, syntax, deviceType }));\n }\n}\n","import { NgModule } from '@angular/core';\nimport { DeviceShellService } from './device-shell.service';\n\n@NgModule({\n providers: [DeviceShellService]\n})\nexport class DeviceShellSharedModule {}\n","import { Component, OnDestroy, OnInit } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { IManagedObject, IOperation, IResultList, OperationService } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport {\n AlertService,\n ManagedObjectRealtimeService,\n OperationRealtimeService,\n ActionBarItemComponent,\n RealtimeButtonComponent,\n DeviceStatusComponent,\n C8yTranslateDirective,\n C8yTranslatePipe\n} from '@c8y/ngx-components';\nimport { includes, isEmpty } from 'lodash-es';\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\nimport { BehaviorSubject, Observable, of, pipe, Subject } from 'rxjs';\nimport { filter, map, startWith, takeUntil } from 'rxjs/operators';\nimport { CommandTemplatesComponent } from '../command-templates';\nimport { Command, CommandDeliveryType, DeliveryType, DeviceShellService } from '../shared';\nimport { FormsModule } from '@angular/forms';\nimport { NgFor, NgIf, AsyncPipe } from '@angular/common';\nimport { OperationsTimelineComponent } from '@c8y/ngx-components/operations/operations-timeline';\n\n@Component({\n selector: 'c8y-device-shell',\n templateUrl: 'shell.component.html',\n providers: [OperationRealtimeService, ManagedObjectRealtimeService],\n imports: [\n ActionBarItemComponent,\n RealtimeButtonComponent,\n DeviceStatusComponent,\n FormsModule,\n NgFor,\n NgIf,\n OperationsTimelineComponent,\n C8yTranslateDirective,\n AsyncPipe,\n C8yTranslatePipe\n ]\n})\nexport class DeviceShellComponent implements OnInit, OnDestroy {\n device: IManagedObject = this.route.snapshot.parent.data.contextData;\n device$: Observable<IManagedObject> = of({} as any);\n deliveryTypes: Array<DeliveryType & { isSupportedByCommand?: boolean }> = (\n this.service.getDeliveryTypes() || []\n ).map(deliveryType => ({ ...deliveryType, isSupportedByCommand: true }));\n command: Command = {} as Command;\n smsEnabled = false;\n sendingCommand$: BehaviorSubject<boolean> = new BehaviorSubject(false);\n operations: IResultList<IOperation>;\n filterPipe = pipe(\n map((operations: IOperation[]) =>\n (operations || []).filter((operation: IOperation) => !!operation.c8y_Command)\n )\n );\n\n executeViaLabel = gettext('Execute via ({{deliveryType}})');\n\n private destroyed$: Subject<void> = new Subject();\n\n constructor(\n public service: DeviceShellService,\n public operationRealtime: OperationRealtimeService,\n private moRealtime: ManagedObjectRealtimeService,\n private operationService: OperationService,\n private route: ActivatedRoute,\n private modalService: BsModalService,\n private alertService: AlertService\n ) {}\n\n async ngOnInit(): Promise<void> {\n this.smsEnabled = await this.service.canSendCommandsViaSMS();\n\n this.device$ = this.moRealtime.onUpdate$(this.device.id).pipe(startWith(this.device));\n\n this.operations = await this.operationService.list({\n deviceId: this.device.id,\n fragmentType: 'c8y_Command',\n dateFrom: new Date(0).toISOString(),\n dateTo: new Date().toISOString(),\n pageSize: 50,\n withTotalPages: true,\n revert: true\n });\n\n this.operationRealtime\n .onCreate$(this.device.id)\n .pipe(takeUntil(this.destroyed$))\n .subscribe(() => this.alertService.success(gettext('Command sent.')));\n\n this.operationRealtime\n .onUpdate$(this.device.id)\n .pipe(\n filter(op => op.failureReason !== 'Operation cancelled by user.'), // avoid duplicate alerts\n takeUntil(this.destroyed$)\n )\n .subscribe(() => this.alertService.success(gettext('Command status updated.')));\n }\n\n getPredefinedCommand() {\n const modal: BsModalRef<CommandTemplatesComponent> = this.modalService.show(\n CommandTemplatesComponent,\n {\n ariaDescribedby: 'modal-body',\n ariaLabelledBy: 'modal-title'\n }\n );\n modal.content.onTemplateSelected.pipe(takeUntil(this.destroyed$)).subscribe(result => {\n this.command = { ...(result as any).commandTemplate } as Command;\n this.deliveryTypes = this.deliveryTypes.map(deliveryType => ({\n ...deliveryType,\n isSupportedByCommand:\n isEmpty(this.command.deliveryTypes) ||\n includes(this.command.deliveryTypes, deliveryType.name)\n }));\n });\n }\n\n resetSupportedDeliveryTypes(): void {\n this.deliveryTypes = (this.service.getDeliveryTypes() || []).map(deliveryType => ({\n ...deliveryType,\n isSupportedByCommand: true\n }));\n }\n\n async execute(commandDeliveryType): Promise<void> {\n const useSMS = commandDeliveryType === CommandDeliveryType.SMS;\n if (useSMS && !this.smsEnabled) {\n this.alertService.warning(gettext('SMS transport is not configured.'));\n return;\n }\n this.sendingCommand$.next(true);\n\n await this.service.createCommandOperation(this.device.id, this.command, commandDeliveryType);\n\n this.command.text = '';\n this.command.name = '';\n this.resetSupportedDeliveryTypes();\n this.sendingCommand$.next(false);\n }\n\n ngOnDestroy(): void {\n this.destroyed$.next();\n this.destroyed$.complete();\n }\n}\n","<c8y-action-bar-item [placement]=\"'right'\">\n <c8y-realtime-btn [service]=\"operationRealtime\"></c8y-realtime-btn>\n</c8y-action-bar-item>\n\n<div class=\"card content-fullpage d-grid grid__col--6-6--md\">\n <div class=\"inner-scroll d-flex d-col bg-level-0\">\n <div class=\"card-header large-padding separator sticky-top\">\n <div class=\"card-title\">\n {{ 'Command' | translate }}\n </div>\n </div>\n\n <div class=\"card-block d-flex d-col flex-grow large-padding\">\n <div class=\"d-flex p-b-16\">\n <button\n class=\"btn btn-default btn-sm\"\n type=\"button\"\n (click)=\"getPredefinedCommand()\"\n [title]=\"'Display a list of predefined commands' | translate\"\n data-cy=\"shell--predefined-commands\"\n >\n {{ 'Predefined commands' | translate }}\n </button>\n\n <div class=\"m-l-auto\">\n <device-status [mo]=\"device$ | async\"></device-status>\n </div>\n </div>\n <textarea\n [attr.aria-label]=\"'Commands' | translate\"\n class=\"form-control inner-scroll flex-grow bg-level-2 text-monospace\"\n [(ngModel)]=\"command.text\"\n data-cy=\"shell-component--commands\"\n (ngModelChange)=\"$event || resetSupportedDeliveryTypes()\"\n placeholder=\"{{ 'Add commands or use predefined commands above.' | translate }}\"\n ></textarea>\n </div>\n\n <div class=\"card-footer large-padding separator\">\n <ng-container *ngFor=\"let deliveryType of deliveryTypes\">\n <button\n class=\"btn btn-primary\"\n type=\"button\"\n *ngIf=\"deliveryType.isSupportedByCommand\"\n [disabled]=\"!command?.text || (sendingCommand$ | async)\"\n (click)=\"execute(deliveryType.name)\"\n >\n <span\n [title]=\"\n deliveryType.default\n ? ('Execute' | translate)\n : (executeViaLabel | translate: { deliveryType: deliveryType.name })\n \"\n >\n {{\n deliveryType.default\n ? ('Execute' | translate)\n : (executeViaLabel | translate: { deliveryType: deliveryType.name })\n }}\n </span>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"inner-scroll bg-level-1\">\n <div class=\"card-header large-padding separator sticky-top\">\n <div class=\"card-title\">\n {{ 'Operations' | translate }}\n </div>\n </div>\n <div class=\"card-block large-padding\">\n <c8y-operations-timeline\n [operations]=\"operations\"\n [sourceId]=\"device.id\"\n [filterPipe]=\"filterPipe\"\n [bodyTemplate]=\"timelineItemBody\"\n [footerTemplates]=\"[timelineItemFooter]\"\n [propertiesToHide]=\"['c8y_Command']\"\n ></c8y-operations-timeline>\n <ng-template #timelineItemBody let-operation>\n <small>{{ operation.c8y_Command?.text || operation.description }}</small>\n </ng-template>\n <ng-template #timelineItemFooter let-operation>\n <div *ngIf=\"operation.c8y_Command?.text\">\n <div class=\"legend form-block\" translate>Command</div>\n <!-- Keep this in a single line since `pre-text` will preserve all whitespaces in the `pre` tag.-->\n <pre class=\"p-8 text-pre\"><code>{{operation.c8y_Command.text}}</code></pre>\n </div>\n <div *ngIf=\"operation.c8y_Command?.result\">\n <div class=\"legend form-block\" translate>Response</div>\n <!-- Keep this in a single line since `pre-text` will preserve all whitespaces in the `pre` tag.-->\n <pre class=\"p-8 text-pre\"><code>{{operation.c8y_Command.result}}</code></pre>\n </div>\n </ng-template>\n </div>\n </div>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { CoreModule } from '@c8y/ngx-components';\nimport { OperationsTimelineModule } from '@c8y/ngx-components/operations/operations-timeline';\nimport { CommandTemplatesModule } from '../command-templates';\nimport { DeviceShellSharedModule } from '../shared';\nimport { DeviceShellComponent } from './shell.component';\n\n@NgModule({\n imports: [\n CommonModule,\n CoreModule,\n OperationsTimelineModule,\n CommandTemplatesModule,\n DeviceShellSharedModule,\n DeviceShellComponent\n ],\n exports: [DeviceShellComponent]\n})\nexport class ShellModule {}\n","import { NgModule } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { hookRoute, Route, ViewContext } from '@c8y/ngx-components';\nimport { DeviceShellGuard } from './device-shell.guard';\nimport { DeviceShellComponent, ShellModule } from './shell';\n\nconst DEVICE_SHELL_ROUTE: Route = {\n path: 'shell',\n context: ViewContext.Device,\n component: DeviceShellComponent,\n label: gettext('Shell'),\n icon: 'terminal',\n canActivate: [DeviceShellGuard]\n};\n\n@NgModule({\n imports: [ShellModule],\n providers: [DeviceShellGuard, hookRoute(DEVICE_SHELL_ROUTE)]\n})\nexport class DeviceShellModule {}\n","/**\n * Generated bundle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,iBAAiB,YAHlB,WAAW,CAAA,EAAA,CAAA,CAAA;gHAGV,iBAAiB,EAAA,SAAA,EAFjB,CAAC,gBAAgB,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAA,OAAA,EAAA,CADlD,WAAW,CAAA,EAAA,CAAA,CAAA;;4FAGV,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,WAAW,CAAC;oBACtB,SAAS,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,kBAAkB,CAAC;AAC5D,iBAAA;;;AClBD;;AAEG;;;;"}
|
|
@@ -75,7 +75,7 @@ class AssetTableConfigFactory {
|
|
|
75
75
|
{
|
|
76
76
|
widgetId: defaultWidgetIds.ASSET_TABLE,
|
|
77
77
|
label: gettext('Asset properties'),
|
|
78
|
-
loadComponent: () => import('@c8y/ngx-components/widgets/implementations/asset-table').then(m => m.
|
|
78
|
+
loadComponent: () => import('@c8y/ngx-components/widgets/implementations/asset-table').then(m => m.AssetTableGridSettingsComponent),
|
|
79
79
|
priority: 50,
|
|
80
80
|
expanded: true
|
|
81
81
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-widgets-definitions-asset-table.mjs","sources":["../../widgets/definitions/asset-table/asset-table.factory.ts","../../widgets/definitions/asset-table/asset-table-config.factory.ts","../../widgets/definitions/asset-table/index.ts","../../widgets/definitions/asset-table/c8y-ngx-components-widgets-definitions-asset-table.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport {\n DynamicComponentDefinition,\n DynamicWidgetDefinition,\n ExtensionFactory,\n PreviewService\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';\nimport {\n exportConfigWithDevice,\n importConfigWithDevice\n} from '@c8y/ngx-components/widgets/import-export-config';\nimport { map, Observable } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssetTableWidgetFactory implements ExtensionFactory<DynamicComponentDefinition> {\n private readonly previewService = inject(PreviewService);\n private readonly baseWidgetDefinition: DynamicComponentDefinition = {\n id: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Asset table'),\n description: gettext('Displays a table of assets with configurable columns and filters.'),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/asset-table').then(\n m => m.AssetTableWidgetViewComponent\n ),\n previewImage: 'c8y-style-assets/asset-table-pr.png',\n data: {\n settings: {\n schema: () =>\n import(\n 'c8y-schema-loader?interfaceName=AssetTableWidgetConfig!@c8y/ngx-components/widgets/implementations/asset-table'\n ),\n export: exportConfigWithDevice,\n import: importConfigWithDevice,\n noNewWidgets: false,\n widgetDefaults: {\n _width: 8,\n _height: 6\n },\n ng1: {\n options: {\n noDeviceTarget: true,\n groupsSelectable: true\n }\n }\n },\n displaySettings: {\n globalTimeContext: true,\n globalAutoRefreshContext: true\n }\n }\n };\n\n get(): Observable<DynamicWidgetDefinition[]> {\n return this.previewService.getState$('ui.asset-table.v2').pipe(\n map(state => {\n if (state) {\n return [this.baseWidgetDefinition];\n }\n return [];\n })\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { ExtensionFactory, PreviewService } from '@c8y/ngx-components';\nimport {\n WidgetAssetSelectorComponent,\n WidgetConfigSectionDefinition\n} from '@c8y/ngx-components/context-dashboard';\nimport { map, Observable } from 'rxjs';\nimport { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssetTableConfigFactory implements ExtensionFactory<WidgetConfigSectionDefinition> {\n private readonly betaPreviewService = inject(PreviewService);\n private readonly baseWidgetConfigDefinition: WidgetConfigSectionDefinition[] = [\n {\n widgetId: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Asset selection'),\n loadComponent: () => Promise.resolve(WidgetAssetSelectorComponent),\n priority: 100,\n initialState: {\n isRequired: false,\n groupsSelectable: true\n }\n },\n {\n widgetId: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Asset properties'),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/asset-table').then(\n m => m.
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-widgets-definitions-asset-table.mjs","sources":["../../widgets/definitions/asset-table/asset-table.factory.ts","../../widgets/definitions/asset-table/asset-table-config.factory.ts","../../widgets/definitions/asset-table/index.ts","../../widgets/definitions/asset-table/c8y-ngx-components-widgets-definitions-asset-table.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport {\n DynamicComponentDefinition,\n DynamicWidgetDefinition,\n ExtensionFactory,\n PreviewService\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';\nimport {\n exportConfigWithDevice,\n importConfigWithDevice\n} from '@c8y/ngx-components/widgets/import-export-config';\nimport { map, Observable } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssetTableWidgetFactory implements ExtensionFactory<DynamicComponentDefinition> {\n private readonly previewService = inject(PreviewService);\n private readonly baseWidgetDefinition: DynamicComponentDefinition = {\n id: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Asset table'),\n description: gettext('Displays a table of assets with configurable columns and filters.'),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/asset-table').then(\n m => m.AssetTableWidgetViewComponent\n ),\n previewImage: 'c8y-style-assets/asset-table-pr.png',\n data: {\n settings: {\n schema: () =>\n import(\n 'c8y-schema-loader?interfaceName=AssetTableWidgetConfig!@c8y/ngx-components/widgets/implementations/asset-table'\n ),\n export: exportConfigWithDevice,\n import: importConfigWithDevice,\n noNewWidgets: false,\n widgetDefaults: {\n _width: 8,\n _height: 6\n },\n ng1: {\n options: {\n noDeviceTarget: true,\n groupsSelectable: true\n }\n }\n },\n displaySettings: {\n globalTimeContext: true,\n globalAutoRefreshContext: true\n }\n }\n };\n\n get(): Observable<DynamicWidgetDefinition[]> {\n return this.previewService.getState$('ui.asset-table.v2').pipe(\n map(state => {\n if (state) {\n return [this.baseWidgetDefinition];\n }\n return [];\n })\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport { ExtensionFactory, PreviewService } from '@c8y/ngx-components';\nimport {\n WidgetAssetSelectorComponent,\n WidgetConfigSectionDefinition\n} from '@c8y/ngx-components/context-dashboard';\nimport { map, Observable } from 'rxjs';\nimport { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssetTableConfigFactory implements ExtensionFactory<WidgetConfigSectionDefinition> {\n private readonly betaPreviewService = inject(PreviewService);\n private readonly baseWidgetConfigDefinition: WidgetConfigSectionDefinition[] = [\n {\n widgetId: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Asset selection'),\n loadComponent: () => Promise.resolve(WidgetAssetSelectorComponent),\n priority: 100,\n initialState: {\n isRequired: false,\n groupsSelectable: true\n }\n },\n {\n widgetId: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Asset properties'),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/asset-table').then(\n m => m.AssetTableGridSettingsComponent\n ),\n priority: 50,\n expanded: true\n },\n {\n widgetId: defaultWidgetIds.ASSET_TABLE,\n label: gettext('Settings'),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/asset-table').then(\n m => m.AssetTableWidgetConfigComponent\n ),\n priority: 0,\n expanded: true\n }\n ];\n\n get(): Observable<WidgetConfigSectionDefinition[]> {\n return this.betaPreviewService.getState$('ui.asset-table.v2').pipe(\n map(state => {\n if (state) {\n return this.baseWidgetConfigDefinition;\n }\n return [];\n })\n );\n }\n}\n","import { hookPreview, hookWidget } from '@c8y/ngx-components';\nimport { hookWidgetConfig } from '@c8y/ngx-components/context-dashboard';\nimport { AssetTableWidgetFactory } from './asset-table.factory';\nimport { AssetTableConfigFactory } from './asset-table-config.factory';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const assetTableWidgetProviders = [\n hookWidget(AssetTableWidgetFactory),\n hookWidgetConfig(AssetTableConfigFactory),\n hookPreview({\n key: 'ui.asset-table.v2',\n label: gettext('Asset table v2'),\n description: () =>\n import('@c8y/style/markdown-files/asset-table-widget-preview.md').then(m => m.default),\n settings: {\n reload: true\n }\n })\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAkBa,uBAAuB,CAAA;AAHpC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AACvC,QAAA,IAAA,CAAA,oBAAoB,GAA+B;YAClE,EAAE,EAAE,gBAAgB,CAAC,WAAW;AAChC,YAAA,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC;AAC7B,YAAA,WAAW,EAAE,OAAO,CAAC,mEAAmE,CAAC;AACzF,YAAA,aAAa,EAAE,MACb,OAAO,yDAAyD,CAAC,CAAC,IAAI,CACpE,CAAC,IAAI,CAAC,CAAC,6BAA6B,CACrC;AACH,YAAA,YAAY,EAAE,qCAAqC;AACnD,YAAA,IAAI,EAAE;AACJ,gBAAA,QAAQ,EAAE;AACR,oBAAA,MAAM,EAAE,MACN,OACE,gHAAgH,CACjH;AACH,oBAAA,MAAM,EAAE,sBAAsB;AAC9B,oBAAA,MAAM,EAAE,sBAAsB;AAC9B,oBAAA,YAAY,EAAE,KAAK;AACnB,oBAAA,cAAc,EAAE;AACd,wBAAA,MAAM,EAAE,CAAC;AACT,wBAAA,OAAO,EAAE;AACV,qBAAA;AACD,oBAAA,GAAG,EAAE;AACH,wBAAA,OAAO,EAAE;AACP,4BAAA,cAAc,EAAE,IAAI;AACpB,4BAAA,gBAAgB,EAAE;AACnB;AACF;AACF,iBAAA;AACD,gBAAA,eAAe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