UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

205 lines (199 loc) 9.55 kB
import * as i0 from '@angular/core'; import { Injectable, NgModule } from '@angular/core'; import * as i1 from '@angular/router'; import { RouterModule } from '@angular/router'; import { NavigatorNode, gettext, CoreModule, hookTab, hookNavigator } from '@c8y/ngx-components'; import { BulkOperationFromSingleModule } from '@c8y/ngx-components/operations/bulk-operation-from-single'; import { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list'; import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service'; import { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container'; import { StepperBulkTypeConfigurationModule } from '@c8y/ngx-components/operations/stepper-bulk-type-configuration'; import { StepperBulkTypeDeviceProfileModule } from '@c8y/ngx-components/operations/stepper-bulk-type-device-profile'; import { StepperBulkTypeFirmwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-firmware'; import { StepperBulkTypeSoftwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-software'; import { deviceControlOverviewFeatureProvider, deviceControlTabFeatureProvider } from '@c8y/ngx-components/operations/operations-list'; class OperationsNavigationFactory { constructor() { this.navs = []; } async get() { if (this.navs.length === 0) { this.navs.push(new NavigatorNode({ label: gettext('Device control'), path: 'devicecontrol/single', icon: 'c8y-icon c8y-icon-device-control', parent: gettext('Overviews'), priority: 1360 })); } return this.navs; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsNavigationFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsNavigationFactory }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsNavigationFactory, decorators: [{ type: Injectable }] }); class OperationsTabsFactory { constructor(router) { this.router = router; } get() { const tabs = []; if (this.router.url.match(/devicecontrol/g)) { tabs.push({ path: 'devicecontrol/single', label: gettext('Single operations'), icon: 'c8y-icon c8y-icon-device-control', priority: 1100, orientation: 'horizontal' }); tabs.push({ path: 'devicecontrol/bulk', label: gettext('Bulk operations'), icon: 'c8y-icon c8y-icon-energy', priority: 1050, orientation: 'horizontal' }); } return tabs; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsTabsFactory, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsTabsFactory }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsTabsFactory, decorators: [{ type: Injectable }], ctorParameters: () => [{ type: i1.Router }] }); const operationsRoutes = [ { path: 'devicecontrol', redirectTo: 'devicecontrol/single', pathMatch: 'full' } ]; /** * This module sets up the 'Device control' view. By importing it in your custom application you will have: * - a 'Device control' tab in device details view * - a 'Device control' entry in the 'Overviews' section of navigator * - 'Bulk operations' tab on the 'Device control' page * - list view of existing bulk operations with expandable details and options to filter * - guided stepper dialogs to schedule new bulk operations of supported types * (Configuration update, Firmware update, Software update, Apply device profile). * * Additionaly you can use the modules imported by {@link OperationsModule} separately to achieve * the results you wish to have in your application, e.g.: * - import {@link BulkOperationsListModule} and {@link BulkOperationsServiceModule} * to have an overview of existing bulk operation with expandable details * - additionaly import {@link BulkOperationsStepperContainerModule} and any of the existing * `StepperBulkType*Module` modules ({@link StepperBulkTypeConfigurationModule}, * {@link StepperBulkTypeFirmwareModule}, {@link StepperBulkTypeSoftwareModule}, * {@link StepperBulkTypeDeviceProfileModule}) to have the option * to create new bulk operation in a guided stepper dialog. * * ```typescript * import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service'; * import { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list'; * * @NgModule({ * imports: [ * [...] * BulkOperationsServiceModule, * BulkOperationsListModule * ], * [...] * }) * export class CustomOperationsModule {}``` * respectively * ```typescript * import { BulkOperationsStepperContainerModule } from '@c8y/ngx-components/operations/bulk-operations-stepper-container'; * import { BulkOperationsServiceModule } from '@c8y/ngx-components/operations/bulk-operations-service'; * import { BulkOperationsListModule } from '@c8y/ngx-components/operations/bulk-operations-list'; * import { StepperBulkTypeSoftwareModule } from '@c8y/ngx-components/operations/stepper-bulk-type-software'; * * @NgModule({ * imports: [ * [...] * BulkOperationsServiceModule, * BulkOperationsListModule, * BulkOperationsStepperContainerModule, * StepperBulkTypeSoftwareModule * ], * [...] * }) * export class CustomOperationsModule {}``` * You can provide your own bulk operation stepper by registering a component via the `hookListBulkType`: * * ```typescript * import { * hookListBulkType, * baseUrl * } from '@c8y/ngx-components/operations/bulk-operations-service'; * * [...] * * providers: [ * hookListBulkType({ * type: 'my-bulk-op-type', * c8yIcon: 'c8y-tools', * name: 'My bulk op type', * path: `${baseUrl}my-type`, * component: StepperMyBulkTypeComponent, * fragments: ['c8y_MyType'], * selected: false * }) * ]``` */ class OperationsModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: OperationsModule, imports: [CoreModule, i1.RouterModule, BulkOperationFromSingleModule, BulkOperationsListModule, BulkOperationsServiceModule, BulkOperationsStepperContainerModule, StepperBulkTypeConfigurationModule, StepperBulkTypeFirmwareModule, StepperBulkTypeSoftwareModule, StepperBulkTypeDeviceProfileModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsModule, providers: [ hookTab(OperationsTabsFactory), hookNavigator(OperationsNavigationFactory), deviceControlOverviewFeatureProvider, deviceControlTabFeatureProvider ], imports: [CoreModule, RouterModule.forChild(operationsRoutes), BulkOperationFromSingleModule, BulkOperationsListModule, BulkOperationsServiceModule, BulkOperationsStepperContainerModule, StepperBulkTypeConfigurationModule, StepperBulkTypeFirmwareModule, StepperBulkTypeSoftwareModule, StepperBulkTypeDeviceProfileModule] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OperationsModule, decorators: [{ type: NgModule, args: [{ imports: [ CoreModule, RouterModule.forChild(operationsRoutes), BulkOperationFromSingleModule, BulkOperationsListModule, BulkOperationsServiceModule, BulkOperationsStepperContainerModule, StepperBulkTypeConfigurationModule, StepperBulkTypeFirmwareModule, StepperBulkTypeSoftwareModule, StepperBulkTypeDeviceProfileModule ], providers: [ hookTab(OperationsTabsFactory), hookNavigator(OperationsNavigationFactory), deviceControlOverviewFeatureProvider, deviceControlTabFeatureProvider ] }] }] }); /** * Generated bundle index. Do not edit. */ export { OperationsModule, OperationsNavigationFactory, OperationsTabsFactory, operationsRoutes }; //# sourceMappingURL=c8y-ngx-components-operations.mjs.map