UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

165 lines (160 loc) 7.88 kB
import * as i0 from '@angular/core'; import { Injectable, NgModule } from '@angular/core'; import * as i1 from '@angular/router'; import { gettext } from '@c8y/ngx-components/gettext'; import { CoreModule, hookTab } 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 { deviceControlOverviewFeatureProviderFactory, deviceControlTabFeatureProviderFactory } from '@c8y/ngx-components/operations/operations-list'; class BulkOperationsTabsFactory { constructor(router) { this.router = router; } get() { const tabs = []; if (this.router.url.match(/devicecontrol/g)) { 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: "20.3.19", ngImport: i0, type: BulkOperationsTabsFactory, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: BulkOperationsTabsFactory }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: BulkOperationsTabsFactory, decorators: [{ type: Injectable }], ctorParameters: () => [{ type: i1.Router }] }); /** * 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: "20.3.19", ngImport: i0, type: OperationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: OperationsModule, imports: [CoreModule, BulkOperationFromSingleModule, BulkOperationsListModule, BulkOperationsServiceModule, BulkOperationsStepperContainerModule, StepperBulkTypeConfigurationModule, StepperBulkTypeFirmwareModule, StepperBulkTypeSoftwareModule, StepperBulkTypeDeviceProfileModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: OperationsModule, providers: [ hookTab(BulkOperationsTabsFactory), deviceControlOverviewFeatureProviderFactory(), deviceControlTabFeatureProviderFactory() ], imports: [CoreModule, BulkOperationFromSingleModule, BulkOperationsListModule, BulkOperationsServiceModule, BulkOperationsStepperContainerModule, StepperBulkTypeConfigurationModule, StepperBulkTypeFirmwareModule, StepperBulkTypeSoftwareModule, StepperBulkTypeDeviceProfileModule] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: OperationsModule, decorators: [{ type: NgModule, args: [{ imports: [ CoreModule, BulkOperationFromSingleModule, BulkOperationsListModule, BulkOperationsServiceModule, BulkOperationsStepperContainerModule, StepperBulkTypeConfigurationModule, StepperBulkTypeFirmwareModule, StepperBulkTypeSoftwareModule, StepperBulkTypeDeviceProfileModule ], providers: [ hookTab(BulkOperationsTabsFactory), deviceControlOverviewFeatureProviderFactory(), deviceControlTabFeatureProviderFactory() ] }] }] }); /** * Generated bundle index. Do not edit. */ export { BulkOperationsTabsFactory, OperationsModule }; //# sourceMappingURL=c8y-ngx-components-operations.mjs.map