@c8y/tutorial 1019.0.3
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/.browserslistrc +16 -0
- package/NOTICES +41743 -0
- package/cumulocity.config.ts +643 -0
- package/package.json +22 -0
- package/src/__mocks/README.md +73 -0
- package/src/__mocks/global-mocks/inventory.interceptor.ts +145 -0
- package/src/__mocks/global-mocks/measurements.interceptor.ts +58 -0
- package/src/__mocks/index.ts +5 -0
- package/src/__mocks/mock.model.ts +76 -0
- package/src/__mocks/mock.module.ts +121 -0
- package/src/__mocks/mock.realtime-subject.ts +68 -0
- package/src/__mocks/mock.realtime.ts +31 -0
- package/src/__mocks/mock.service.ts +113 -0
- package/src/__mocks/scoped-mocks/boilerplate.ts +54 -0
- package/src/__mocks/scoped-mocks/context-dashboard.ts +47 -0
- package/src/__mocks/scoped-mocks/device-data-grid.ts +44 -0
- package/src/__mocks/scoped-mocks/named-context-dashboard.ts +42 -0
- package/src/__mocks/scoped-mocks/server-side-data-grid.ts +47 -0
- package/src/__mocks/scoped-mocks/service-dashboard.ts +42 -0
- package/src/__mocks/utils/clean.realtime.ts +23 -0
- package/src/__mocks/utils/common.ts +114 -0
- package/src/__mocks/utils/generators/alarms.ts +30 -0
- package/src/__mocks/utils/generators/events.ts +14 -0
- package/src/__mocks/utils/generators/managedObjects.ts +208 -0
- package/src/__mocks/utils/generators/measurement.ts +22 -0
- package/src/__mocks/utils/generators/operations.ts +67 -0
- package/src/__mocks/utils/grid.ts +87 -0
- package/src/__mocks/utils/realtime.ts +59 -0
- package/src/alert/alert-example.components.html +110 -0
- package/src/alert/alert-example.components.ts +77 -0
- package/src/alert/alert-example.module.ts +21 -0
- package/src/app/app.module.ts +72 -0
- package/src/bootstrap.ts +19 -0
- package/src/branding/branding.less +78 -0
- package/src/client-interceptor/client-interceptor.module.ts +12 -0
- package/src/client-interceptor/client-interceptor.service.ts +61 -0
- package/src/client-interceptor/index.ts +1 -0
- package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.component.css +17 -0
- package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.component.ts +11 -0
- package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.module.ts +26 -0
- package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.component.less +14 -0
- package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.component.ts +11 -0
- package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.module.ts +26 -0
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.scss +13 -0
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.ts +11 -0
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.module.ts +26 -0
- package/src/dashboard/context-dashboard/context-dashboard.component.ts +32 -0
- package/src/dashboard/context-dashboard/context-dashboard.module.ts +22 -0
- package/src/dashboard/custom-dashboard/custom-dashboard.component.html +180 -0
- package/src/dashboard/custom-dashboard/custom-dashboard.component.ts +52 -0
- package/src/dashboard/custom-dashboard/custom-dashboard.module.ts +22 -0
- package/src/dashboard/index.ts +4 -0
- package/src/dashboard/named-context-dashboard/named-context-dashboard.component.ts +51 -0
- package/src/dashboard/named-context-dashboard/named-context-dashboard.module.ts +37 -0
- package/src/dashboard/service-dashboard/service-dashboard.component.ts +51 -0
- package/src/dashboard/service-dashboard/service-dashboard.module.ts +35 -0
- package/src/dashboard/widget-dashboard/widget-dashboard.component.ts +65 -0
- package/src/dashboard/widget-dashboard/widget-dashboard.module.ts +22 -0
- package/src/date-time-range/date-time-range-example.component.ts +109 -0
- package/src/date-time-range/date-time-range-example.module.ts +21 -0
- package/src/dynamic-forms/custom-element-example/custom-element-example.component.ts +70 -0
- package/src/dynamic-forms/custom-element-example/custom-element-example.module.ts +38 -0
- package/src/dynamic-forms/custom-element-example/types/checkbox/checkbox.type.component.html +26 -0
- package/src/dynamic-forms/custom-element-example/types/checkbox/checkbox.type.component.ts +21 -0
- package/src/dynamic-forms/dynamic-forms.module.ts +16 -0
- package/src/dynamic-forms/index.ts +2 -0
- package/src/dynamic-forms/introduction-example/introduction-example.component.ts +116 -0
- package/src/dynamic-forms/introduction-example/introduction-example.module.ts +24 -0
- package/src/dynamic-forms/json-schema-example/json-schema-example.component.html +33 -0
- package/src/dynamic-forms/json-schema-example/json-schema-example.component.ts +102 -0
- package/src/dynamic-forms/json-schema-example/json-schema-example.module.ts +24 -0
- package/src/for-of-directive/for-of-example.component.html +19 -0
- package/src/for-of-directive/for-of-example.component.ts +39 -0
- package/src/for-of-directive/for-of.module.ts +18 -0
- package/src/forms/form-validation/forms-validation.component.html +105 -0
- package/src/forms/form-validation/forms-validation.component.ts +52 -0
- package/src/forms/form-validation/forms.module.ts +22 -0
- package/src/forms/index.ts +1 -0
- package/src/grids/client-grid-example/client-grid-example.component.html +16 -0
- package/src/grids/client-grid-example/client-grid-example.component.ts +166 -0
- package/src/grids/client-grid-example/client-grid-example.module.ts +24 -0
- package/src/grids/client-grid-example/data.ts +427 -0
- package/src/grids/device-grid-example/device-grid-example.component.html +58 -0
- package/src/grids/device-grid-example/device-grid-example.component.ts +134 -0
- package/src/grids/device-grid-example/device-grid-example.module.ts +24 -0
- package/src/grids/grids-tabs.ts +37 -0
- package/src/grids/grids.module.ts +17 -0
- package/src/grids/index.ts +1 -0
- package/src/grids/server-grid-example/server-grid-example.component.html +26 -0
- package/src/grids/server-grid-example/server-grid-example.component.ts +121 -0
- package/src/grids/server-grid-example/server-grid-example.module.ts +24 -0
- package/src/grids/server-grid-example/server-grid-example.service.ts +266 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.cell-renderer.component.ts +31 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.data-grid-column.ts +47 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.filtering-form-renderer.component.ts +107 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.header-cell-renderer.component.ts +20 -0
- package/src/hello/hello.component.ts +55 -0
- package/src/hello/hello.module.ts +20 -0
- package/src/hello/index.ts +1 -0
- package/src/help/help-example.component.ts +23 -0
- package/src/help/help-example.module.ts +20 -0
- package/src/hooks/action/action.module.ts +34 -0
- package/src/hooks/action/action.ts +41 -0
- package/src/hooks/action/basic-view/basic-view.component.html +8 -0
- package/src/hooks/action/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/action/index.ts +1 -0
- package/src/hooks/action/logout-action/logout-action.component.ts +18 -0
- package/src/hooks/action-bar/action-bar.module.ts +34 -0
- package/src/hooks/action-bar/action-bar.ts +28 -0
- package/src/hooks/action-bar/basic-view/basic-view.component.html +8 -0
- package/src/hooks/action-bar/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/action-bar/index.ts +1 -0
- package/src/hooks/action-bar/refresh-element/refresh-element.component.html +15 -0
- package/src/hooks/action-bar/refresh-element/refresh-element.component.ts +21 -0
- package/src/hooks/breadcrumbs/basic-view/basic-view.component.html +7 -0
- package/src/hooks/breadcrumbs/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/breadcrumbs/breadcrumbs.module.ts +34 -0
- package/src/hooks/breadcrumbs/breadcrumbs.ts +93 -0
- package/src/hooks/breadcrumbs/index.ts +1 -0
- package/src/hooks/component/basic-view/basic-view.component.html +11 -0
- package/src/hooks/component/basic-view/basic-view.component.ts +16 -0
- package/src/hooks/component/basic-view/simple.component.ts +8 -0
- package/src/hooks/component/component.module.ts +38 -0
- package/src/hooks/component/index.ts +1 -0
- package/src/hooks/drawer/index.ts +2 -0
- package/src/hooks/drawer/left-drawer-tutorial/left-drawer-tutorial.component.ts +8 -0
- package/src/hooks/drawer/left-drawer-tutorial/left-drawer.module.ts +10 -0
- package/src/hooks/drawer/right-drawer-tutorial/right-drawer-tutorial.component.ts +8 -0
- package/src/hooks/drawer/right-drawer-tutorial/right-drawer.module.ts +10 -0
- package/src/hooks/generic-wizard/index.ts +1 -0
- package/src/hooks/generic-wizard/minimal-setup/minimal-setup.component.ts +12 -0
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-one.component.ts +25 -0
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-two.component.ts +25 -0
- package/src/hooks/generic-wizard/minimal-setup/stepper-example.component.html +38 -0
- package/src/hooks/generic-wizard/minimal-setup/stepper-example.component.ts +33 -0
- package/src/hooks/generic-wizard/wizard-tabs.ts +22 -0
- package/src/hooks/generic-wizard/wizard.component.html +51 -0
- package/src/hooks/generic-wizard/wizard.component.ts +86 -0
- package/src/hooks/generic-wizard/wizard.module.ts +79 -0
- package/src/hooks/hooks.module.ts +19 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigator/index.ts +1 -0
- package/src/hooks/navigator/navigator.module.ts +21 -0
- package/src/hooks/navigator/navigator.ts +35 -0
- package/src/hooks/navigator/time-navigator-node/time-navigator-node.component.ts +19 -0
- package/src/hooks/navigator-route/basic-view/basic-view.component.html +7 -0
- package/src/hooks/navigator-route/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/navigator-route/index.ts +1 -0
- package/src/hooks/navigator-route/navigator-route.module.ts +27 -0
- package/src/hooks/route/device/device-info.component.html +2 -0
- package/src/hooks/route/device/device-info.component.ts +13 -0
- package/src/hooks/route/device/device-tab-context.component.html +15 -0
- package/src/hooks/route/device/device-tab-context.component.ts +13 -0
- package/src/hooks/route/index.ts +1 -0
- package/src/hooks/route/random.guard.ts +12 -0
- package/src/hooks/route/route.module.ts +51 -0
- package/src/hooks/state/hook-state.module.ts +25 -0
- package/src/hooks/state/hook-with-service-example.component.html +29 -0
- package/src/hooks/state/hook-with-service-example.component.ts +36 -0
- package/src/hooks/stepper/basic-view/basic-view.component.html +17 -0
- package/src/hooks/stepper/basic-view/basic-view.component.ts +31 -0
- package/src/hooks/stepper/index.ts +4 -0
- package/src/hooks/stepper/stepper-hook.module.ts +53 -0
- package/src/hooks/stepper/steps/step1.component.html +24 -0
- package/src/hooks/stepper/steps/step1.component.ts +18 -0
- package/src/hooks/stepper/steps/step2.component.html +7 -0
- package/src/hooks/stepper/steps/step2.component.ts +11 -0
- package/src/hooks/tabs/awesome/awesome.component.html +7 -0
- package/src/hooks/tabs/awesome/awesome.component.ts +21 -0
- package/src/hooks/tabs/index.ts +1 -0
- package/src/hooks/tabs/outstanding/outstanding.component.html +22 -0
- package/src/hooks/tabs/outstanding/outstanding.component.ts +27 -0
- package/src/hooks/tabs/tab.ts +44 -0
- package/src/hooks/tabs/tabs.module.ts +37 -0
- package/src/hooks/version/custom-version-factory.service.ts +49 -0
- package/src/hooks/version/index.ts +1 -0
- package/src/hooks/version/version.module.ts +11 -0
- package/src/i18n.ts +18 -0
- package/src/input/range-input-example.component.ts +29 -0
- package/src/input/range-input-example.module.ts +19 -0
- package/src/lazy/component-one.component.ts +28 -0
- package/src/lazy/component-two.component.ts +17 -0
- package/src/lazy/index.ts +1 -0
- package/src/lazy/lazy-loaded.module.ts +21 -0
- package/src/lazy/lazy-routing.module.ts +21 -0
- package/src/lazy/lazy.hooks.ts +24 -0
- package/src/lazy-widget/index.ts +1 -0
- package/src/lazy-widget/lazy-widget-config/index.ts +1 -0
- package/src/lazy-widget/lazy-widget-config/lazy-widget-config.component.ts +10 -0
- package/src/lazy-widget/lazy-widget-view/index.ts +1 -0
- package/src/lazy-widget/lazy-widget-view/lazy-widget-view.component.ts +10 -0
- package/src/lazy-widget/lazy-widget.module.ts +27 -0
- package/src/list/index.ts +1 -0
- package/src/list/list/list-check/list-check.component.html +35 -0
- package/src/list/list/list-check/list-check.component.ts +47 -0
- package/src/list/list/list-check/list-check.module.ts +21 -0
- package/src/list/list/list-timeline/list-timeline.component.html +30 -0
- package/src/list/list/list-timeline/list-timeline.component.ts +46 -0
- package/src/list/list/list-timeline/list-timeline.module.ts +21 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.html +105 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.ts +70 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.module.ts +22 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.html +37 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.ts +69 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.module.ts +24 -0
- package/src/list/lists.module.ts +17 -0
- package/src/main.ts +23 -0
- package/src/maps/cluster-map/cluster-map-example.component.html +60 -0
- package/src/maps/cluster-map/cluster-map-example.component.ts +39 -0
- package/src/maps/cluster-map/cluster-map-example.module.ts +24 -0
- package/src/maps/cluster-map-root-node/cluster-map-root-node-example.component.html +54 -0
- package/src/maps/cluster-map-root-node/cluster-map-root-node-example.component.ts +54 -0
- package/src/maps/cluster-map-root-node/cluster-map-root-node-example.module.ts +26 -0
- package/src/maps/map-examples.module.ts +18 -0
- package/src/maps/map-popup/map-popup-example.component.html +34 -0
- package/src/maps/map-popup/map-popup-example.component.ts +43 -0
- package/src/maps/map-popup/map-popup-example.module.ts +24 -0
- package/src/maps/simple-map/simple-map-example.component.html +59 -0
- package/src/maps/simple-map/simple-map-example.component.ts +70 -0
- package/src/maps/simple-map/simple-map-example.module.ts +24 -0
- package/src/modal/confirm-modal/confirm-modal-example.component.ts +69 -0
- package/src/modal/confirm-modal/confirm-modal-example.module.ts +22 -0
- package/src/modal/ngx-modal/ngx-modal-example.component.ts +34 -0
- package/src/modal/ngx-modal/ngx-modal-example.module.ts +22 -0
- package/src/modal/simple-modal/modal-example.component.ts +34 -0
- package/src/modal/simple-modal/modal.example.module.ts +21 -0
- package/src/polyfills.ts +33 -0
- package/src/popconfirm/pop-confirm-example.component.ts +61 -0
- package/src/popconfirm/pop-confirm-example.module.ts +23 -0
- package/src/properties-list/properties-list-example.component.ts +49 -0
- package/src/properties-list/properties-list-example.module.ts +21 -0
- package/src/provider-configuration/index.ts +3 -0
- package/src/provider-configuration/introduction-example/introduction.component.ts +69 -0
- package/src/provider-configuration/introduction-example/introduction.module.ts +21 -0
- package/src/provider-configuration/provider-configuration-example/demo-provider.guard.ts +9 -0
- package/src/provider-configuration/provider-configuration-example/provider-configuration.module.ts +48 -0
- package/src/quick-link/quick-link-example.component.ts +39 -0
- package/src/quick-link/quick-link-example.module.ts +23 -0
- package/src/realtime/index.ts +1 -0
- package/src/realtime/realtime-tutorial.component.html +52 -0
- package/src/realtime/realtime-tutorial.component.ts +91 -0
- package/src/realtime/realtime-tutorial.module.ts +21 -0
- package/src/redirect-to-last-route/index.ts +1 -0
- package/src/redirect-to-last-route/redirect-to-last-route-guard.service.ts +16 -0
- package/src/redirect-to-last-route/redirect-to-last-route.module.ts +20 -0
- package/src/redirect-to-last-route/view-context-redirect.service.ts +53 -0
- package/src/selector/asset-selector-example/child-devices/asset-selector-child-devices.component.ts +49 -0
- package/src/selector/asset-selector-example/child-devices/asset-selector-child-devices.module.ts +24 -0
- package/src/selector/asset-selector-example/column-header/asset-selector-column-header.component.ts +46 -0
- package/src/selector/asset-selector-example/column-header/asset-selector-column-header.module.ts +24 -0
- package/src/selector/asset-selector-example/different-root/asset-selector-different-root.component.ts +87 -0
- package/src/selector/asset-selector-example/different-root/asset-selector-different-root.module.ts +24 -0
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.html +342 -0
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.ts +34 -0
- package/src/selector/asset-selector-example/general-example/asset-selector-example.module.ts +22 -0
- package/src/selector/asset-selector-example/global-search/asset-selector-global-search.component.ts +50 -0
- package/src/selector/asset-selector-example/global-search/asset-selector-global-search.module.ts +24 -0
- package/src/selector/asset-selector-example/miller-columns-options/asset-selector-miller-example.component.ts +85 -0
- package/src/selector/asset-selector-example/miller-columns-options/asset-selector-miller-example.module.ts +26 -0
- package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.component.ts +50 -0
- package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.module.ts +24 -0
- package/src/selector/asset-selector-example/only-devices/asset-selector-only-devices.component.ts +44 -0
- package/src/selector/asset-selector-example/only-devices/asset-selector-only-devices.module.ts +24 -0
- package/src/selector/asset-selector-example/single-search/asset-selector-single-search.component.ts +71 -0
- package/src/selector/asset-selector-example/single-search/asset-selector-single-search.module.ts +24 -0
- package/src/selector/asset-selector-example/single-select/asset-selector-single-select.component.ts +47 -0
- package/src/selector/asset-selector-example/single-select/asset-single-select.module.ts +24 -0
- package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.component.ts +62 -0
- package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.module.ts +24 -0
- package/src/selector/asset-selector-example/tree-options/asset-selector-tree-example.component.ts +83 -0
- package/src/selector/asset-selector-example/tree-options/asset-selector-tree-example.module.ts +26 -0
- package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.component.ts +75 -0
- package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.module.ts +24 -0
- package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.component.ts +66 -0
- package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.module.ts +24 -0
- package/src/selector/datapoint-selection-example/context-example/datapoint-selection-context-example.component.ts +54 -0
- package/src/selector/datapoint-selection-example/context-example/datapoint-selection-context-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/dragdrop-example/datapoint-selection-dragdrop-example.component.ts +43 -0
- package/src/selector/datapoint-selection-example/dragdrop-example/datapoint-selection-dragdrop-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.component.html +202 -0
- package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.component.ts +51 -0
- package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/list-example/datapoint-selection-list-example.component.ts +42 -0
- package/src/selector/datapoint-selection-example/list-example/datapoint-selection-list-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/modal-example/datapoint-selection-modal-example.component.ts +51 -0
- package/src/selector/datapoint-selection-example/modal-example/datapoint-selection-modal-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/no-templates-example/datapoint-selection-notemplates-example.component.ts +43 -0
- package/src/selector/datapoint-selection-example/no-templates-example/datapoint-selection-notemplates-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/selector/datapoint-selection-selector-example.component.ts +43 -0
- package/src/selector/datapoint-selection-example/selector/datapoint-selection-selector-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/validation-example/datapoint-selection-validation-example.component.ts +46 -0
- package/src/selector/datapoint-selection-example/validation-example/datapoint-selection-validation-example.module.ts +24 -0
- package/src/standalone-demo/index.ts +1 -0
- package/src/standalone-demo/standalone-component/standalone-component.component.html +4 -0
- package/src/standalone-demo/standalone-component/standalone-component.component.ts +11 -0
- package/src/standalone-demo/standalone-demo.module.ts +23 -0
- package/src/stepper/device-stepper.component.html +70 -0
- package/src/stepper/device-stepper.component.ts +98 -0
- package/src/stepper/device.model.ts +5 -0
- package/src/stepper/index.ts +1 -0
- package/src/stepper/stepper.component.ts +19 -0
- package/src/stepper/stepper.module.ts +24 -0
- package/src/stepper/stepper.service.ts +32 -0
- package/src/time/time-picker-example.component.ts +19 -0
- package/src/time/time-picker-example.module.ts +21 -0
- package/src/translations/date-translation/c8y-translation/c8y-date-translation.component.ts +23 -0
- package/src/translations/date-translation/c8y-translation/c8y-date-translation.module.ts +22 -0
- package/src/translations/date-translation/ng-translation/date-translation.component.ts +17 -0
- package/src/translations/date-translation/ng-translation/date-translation.module.ts +22 -0
- package/src/translations/dynamic-form-translation/dynamic-form-translation.component.ts +58 -0
- package/src/translations/dynamic-form-translation/dynamic-form-translation.module.ts +22 -0
- package/src/translations/index.ts +1 -0
- package/src/translations/locales/it.po +18 -0
- package/src/translations/locales/pt_BR.po +33 -0
- package/src/translations/new-language/new-language.component.html +45 -0
- package/src/translations/new-language/new-language.component.ts +19 -0
- package/src/translations/new-language/new-language.module.ts +21 -0
- package/src/translations/new-translate/new-translation.component.html +92 -0
- package/src/translations/new-translate/new-translation.component.ts +9 -0
- package/src/translations/new-translate/new-translation.module.ts +22 -0
- package/src/translations/text-translation/gettext-translation/text-translation-gettext.component.ts +18 -0
- package/src/translations/text-translation/gettext-translation/text-translation-gettext.module.ts +22 -0
- package/src/translations/text-translation/ngNonBindable-translation/text-translation-ngnonbindable.component.ts +22 -0
- package/src/translations/text-translation/ngNonBindable-translation/text-translation-ngnonbindable.module.ts +24 -0
- package/src/translations/text-translation/service-translation/text-translation-by-service.component.ts +38 -0
- package/src/translations/text-translation/service-translation/text-translation-by-service.module.ts +24 -0
- package/src/translations/translation-tabs.ts +50 -0
- package/src/translations/translations.module.ts +18 -0
- package/src/user-menu/index.ts +1 -0
- package/src/user-menu/user-menu.module.ts +13 -0
- package/src/user-menu/user-menu.ts +26 -0
- package/src/widget/demo-widget-config.component.ts +81 -0
- package/src/widget/demo-widget.component.ts +35 -0
- package/src/widget/demo-widget.module.ts +47 -0
- package/src/widget/index.ts +1 -0
- package/src/widget-resolvers/alternative-event.resolver.ts +21 -0
- package/src/widget-resolvers/event-property.resolver.ts +52 -0
- package/src/widget-resolvers/event.resolver.ts +100 -0
- package/src/widget-resolvers/index.ts +1 -0
- package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.html +31 -0
- package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.ts +67 -0
- package/src/widget-resolvers/widget-resolvers.component.html +13 -0
- package/src/widget-resolvers/widget-resolvers.component.ts +37 -0
- package/src/widget-resolvers/widget-resolvers.module.ts +50 -0
- package/tsconfig.app.json +18 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IOperation,
|
|
3
|
+
IOperationBulk,
|
|
4
|
+
IOperationBulkProgress,
|
|
5
|
+
OperationBulkGeneralStatus,
|
|
6
|
+
OperationBulkStatus,
|
|
7
|
+
OperationStatus
|
|
8
|
+
} from '@c8y/client';
|
|
9
|
+
import { generateId } from '../common';
|
|
10
|
+
|
|
11
|
+
// Operation
|
|
12
|
+
export function getFakeOperation(): IOperation {
|
|
13
|
+
return {
|
|
14
|
+
id: generateId(),
|
|
15
|
+
deviceId: generateId(),
|
|
16
|
+
status: getRandomOperationStatus(),
|
|
17
|
+
customFragment: 'customData'
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getRandomOperationStatus(): OperationStatus {
|
|
22
|
+
const statuses = Object.values(OperationStatus) as OperationStatus[];
|
|
23
|
+
return statuses[Math.floor(Math.random() * statuses.length)];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// OperationBulk
|
|
27
|
+
export function getFakeOperationBulk(): IOperationBulk {
|
|
28
|
+
return {
|
|
29
|
+
id: generateId(),
|
|
30
|
+
groupId: generateId(),
|
|
31
|
+
startDate: new Date().toISOString(),
|
|
32
|
+
creationRamp: Math.floor(Math.random() * 10),
|
|
33
|
+
operationPrototype: getFakeOperation(),
|
|
34
|
+
status: getRandomOperationBulkStatus(),
|
|
35
|
+
generalStatus: getRandomOperationBulkGeneralStatus(),
|
|
36
|
+
progress: getFakeOperationBulkProgress(),
|
|
37
|
+
failedParentId: generateId(),
|
|
38
|
+
note: `This is a note ${Math.floor(Math.random() * 1000000000).toString()}`,
|
|
39
|
+
self: 'http://example.com/self/...'
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getRandomOperationBulkStatus(): OperationBulkStatus {
|
|
44
|
+
const statuses = Object.values(OperationBulkStatus) as OperationBulkStatus[];
|
|
45
|
+
return statuses[Math.floor(Math.random() * statuses.length)];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getRandomOperationBulkGeneralStatus(): OperationBulkGeneralStatus {
|
|
49
|
+
const statuses = Object.values(OperationBulkGeneralStatus) as OperationBulkGeneralStatus[];
|
|
50
|
+
return statuses[Math.floor(Math.random() * statuses.length)];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getFakeOperationBulkProgress(): IOperationBulkProgress {
|
|
54
|
+
const all = Math.floor(Math.random() * 100);
|
|
55
|
+
const successful = Math.floor(Math.random() * all);
|
|
56
|
+
const failed = Math.floor(Math.random() * (all - successful));
|
|
57
|
+
const executing = Math.floor(Math.random() * (all - successful - failed));
|
|
58
|
+
const pending = all - successful - failed - executing;
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
all,
|
|
62
|
+
successful,
|
|
63
|
+
failed,
|
|
64
|
+
executing,
|
|
65
|
+
pending
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { IManagedObject } from '@c8y/client';
|
|
2
|
+
|
|
3
|
+
/** Defines possible filter types extracted from the query */
|
|
4
|
+
interface QueryFilters {
|
|
5
|
+
name?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
hasEntries: string[];
|
|
8
|
+
typesEntries: string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Parse query and returns filters
|
|
13
|
+
*/
|
|
14
|
+
function parseQuery(query: string): QueryFilters {
|
|
15
|
+
return {
|
|
16
|
+
name: extractFromQuery(query, /name eq '\*([^*]+)\*'/),
|
|
17
|
+
id: extractFromQuery(query, /id eq '\*([^*]+)\*'/),
|
|
18
|
+
hasEntries: extractMultipleFromQuery(query, /has\(([^)]+)\)/g),
|
|
19
|
+
typesEntries: extractMultipleFromQuery(query, /type eq '([^']+)'/g)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Extracts a single match from query using provided regex pattern
|
|
25
|
+
*/
|
|
26
|
+
function extractFromQuery(query: string, pattern: RegExp): string | undefined {
|
|
27
|
+
const match = pattern.exec(query);
|
|
28
|
+
return match ? match[1] : undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Extracts all matches from query using provided regex pattern
|
|
33
|
+
*/
|
|
34
|
+
function extractMultipleFromQuery(query: string, pattern: RegExp): string[] {
|
|
35
|
+
let match;
|
|
36
|
+
const results = [];
|
|
37
|
+
while ((match = pattern.exec(query)) !== null) {
|
|
38
|
+
results.push(match[1]);
|
|
39
|
+
}
|
|
40
|
+
return results;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Filters objects based on provided filters
|
|
45
|
+
*/
|
|
46
|
+
export function filterObjects(objects: IManagedObject[], query: string): IManagedObject[] {
|
|
47
|
+
const isEmptyQuery = /"query":"\s*"/.test(query);
|
|
48
|
+
if (isEmptyQuery) {
|
|
49
|
+
return objects;
|
|
50
|
+
}
|
|
51
|
+
const filters = parseQuery(query);
|
|
52
|
+
return objects.filter(
|
|
53
|
+
object =>
|
|
54
|
+
filterByName(object, filters.name) &&
|
|
55
|
+
filterById(object, filters.id) &&
|
|
56
|
+
filterByProperties(object, filters.hasEntries) &&
|
|
57
|
+
filterByType(object, filters.typesEntries)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Filters object by name
|
|
63
|
+
*/
|
|
64
|
+
function filterByName(object: IManagedObject, name?: string): boolean {
|
|
65
|
+
return name ? object.name.includes(name) : true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Filters object by id
|
|
70
|
+
*/
|
|
71
|
+
function filterById(object: IManagedObject, id?: string): boolean {
|
|
72
|
+
return id ? object.id.includes(id) : true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Filters object by existence of certain properties
|
|
77
|
+
*/
|
|
78
|
+
function filterByProperties(object: IManagedObject, properties: string[]): boolean {
|
|
79
|
+
return properties.length > 0 ? properties.some(prop => object.hasOwnProperty(prop)) : true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Filters object by type
|
|
84
|
+
*/
|
|
85
|
+
function filterByType(object: IManagedObject, types: string[]): boolean {
|
|
86
|
+
return types.length > 0 ? types.some(type => object.type.includes(type.replace('*', ''))) : true;
|
|
87
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { RealtimeAction, RealtimeMessage } from '@c8y/ngx-components';
|
|
2
|
+
import { Channels, IAnyData } from '../mock.model';
|
|
3
|
+
import { getFakeAlarm } from './generators/alarms';
|
|
4
|
+
import { getFakeEvent } from './generators/events';
|
|
5
|
+
import { generateRealtimeDeviceMO } from './generators/managedObjects';
|
|
6
|
+
import { getFakeMeasurement } from './generators/measurement';
|
|
7
|
+
import { getFakeOperation, getFakeOperationBulk } from './generators/operations';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Map of generators for various channels. Each generator function generates a mock data of specific type.
|
|
11
|
+
*/
|
|
12
|
+
const generators = {
|
|
13
|
+
[Channels.ManagedObjects]: generateRealtimeDeviceMO,
|
|
14
|
+
[Channels.MangedObjectsMap]: generateRealtimeDeviceMO,
|
|
15
|
+
[Channels.Operations]: getFakeOperation,
|
|
16
|
+
[Channels.BulkOperations]: getFakeOperationBulk,
|
|
17
|
+
[Channels.Measurements]: getFakeMeasurement,
|
|
18
|
+
[Channels.Alarms]: getFakeAlarm,
|
|
19
|
+
[Channels.Events]: getFakeEvent
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Function to generate fake data for a given channel.
|
|
24
|
+
*
|
|
25
|
+
* @param channel - The channel for which the fake data is to be generated.
|
|
26
|
+
* @returns - The generated fake data wrapped in a RealtimeMessage object.
|
|
27
|
+
* @throws - Throws an error if there's no generator available for the given channel.
|
|
28
|
+
*/
|
|
29
|
+
export function getFakeData<T>(channel: string): RealtimeMessage<T> {
|
|
30
|
+
const generator = generators[channel];
|
|
31
|
+
if (!generator) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`No fake data generator for channel ${channel}, either stay with the supported mocked channels (${Object.keys(
|
|
34
|
+
generators
|
|
35
|
+
)}), provide a generator for your channel or remove the "noLogin" query parameter and login.`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const data: IAnyData = generator();
|
|
39
|
+
const message: RealtimeMessage<T> = {
|
|
40
|
+
id: (data?.id).toString(),
|
|
41
|
+
channel: data?.id ? channel.replace('*', (data?.id).toString()) : channel,
|
|
42
|
+
realtimeAction: getRandomRealtimeAction(),
|
|
43
|
+
data: data as unknown as T
|
|
44
|
+
};
|
|
45
|
+
return message;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Function to generate a random RealtimeAction.
|
|
50
|
+
* It returns 'UPDATE' in 80% of the cases, otherwise, it returns either 'CREATE' or 'DELETE' randomly.
|
|
51
|
+
*
|
|
52
|
+
* @returns The randomly generated RealtimeAction.
|
|
53
|
+
*/
|
|
54
|
+
function getRandomRealtimeAction(): RealtimeAction {
|
|
55
|
+
if (Math.random() <= 0.8) {
|
|
56
|
+
return 'UPDATE';
|
|
57
|
+
}
|
|
58
|
+
return Math.random() < 0.5 ? 'CREATE' : 'DELETE';
|
|
59
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<c8y-title>Alert</c8y-title>
|
|
2
|
+
<!-- important -->
|
|
3
|
+
<p class="text-medium m-b-8 m-t-24">Basic toast</p>
|
|
4
|
+
<div
|
|
5
|
+
class="d-flex gap-16"
|
|
6
|
+
role="group"
|
|
7
|
+
>
|
|
8
|
+
<button
|
|
9
|
+
class="btn btn-default"
|
|
10
|
+
type="button"
|
|
11
|
+
(click)="successAlert()"
|
|
12
|
+
>
|
|
13
|
+
Success
|
|
14
|
+
</button>
|
|
15
|
+
|
|
16
|
+
<button
|
|
17
|
+
class="btn btn-default"
|
|
18
|
+
type="button"
|
|
19
|
+
(click)="warningAlert()"
|
|
20
|
+
>
|
|
21
|
+
Warning
|
|
22
|
+
</button>
|
|
23
|
+
|
|
24
|
+
<button
|
|
25
|
+
class="btn btn-default"
|
|
26
|
+
type="button"
|
|
27
|
+
(click)="dangerAlert()"
|
|
28
|
+
>
|
|
29
|
+
Danger
|
|
30
|
+
</button>
|
|
31
|
+
|
|
32
|
+
<button
|
|
33
|
+
class="btn btn-default"
|
|
34
|
+
type="button"
|
|
35
|
+
(click)="infoAlert()"
|
|
36
|
+
>
|
|
37
|
+
Info
|
|
38
|
+
</button>
|
|
39
|
+
|
|
40
|
+
<button
|
|
41
|
+
class="btn btn-default"
|
|
42
|
+
type="button"
|
|
43
|
+
(click)="systemAlert()"
|
|
44
|
+
>
|
|
45
|
+
System
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<p class="text-medium m-b-8 m-t-24">Advanced toasts</p>
|
|
50
|
+
<div
|
|
51
|
+
class="btn-group gap-16 flex-wrap"
|
|
52
|
+
role="group"
|
|
53
|
+
>
|
|
54
|
+
<button
|
|
55
|
+
class="btn btn-default"
|
|
56
|
+
type="button"
|
|
57
|
+
(click)="dangerWithDetails()"
|
|
58
|
+
>
|
|
59
|
+
Error toast with details
|
|
60
|
+
</button>
|
|
61
|
+
|
|
62
|
+
<button
|
|
63
|
+
class="btn btn-default"
|
|
64
|
+
type="button"
|
|
65
|
+
(click)="dangerAlertByText()"
|
|
66
|
+
>
|
|
67
|
+
Warning toast by text
|
|
68
|
+
</button>
|
|
69
|
+
|
|
70
|
+
<button
|
|
71
|
+
class="btn btn-default"
|
|
72
|
+
type="button"
|
|
73
|
+
(click)="addAlertByAlertObject()"
|
|
74
|
+
>
|
|
75
|
+
System toast by Alert object
|
|
76
|
+
</button>
|
|
77
|
+
|
|
78
|
+
<button
|
|
79
|
+
class="btn btn-default"
|
|
80
|
+
type="button"
|
|
81
|
+
(click)="addAlertWithHtml()"
|
|
82
|
+
>
|
|
83
|
+
Success toast with html
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
<button
|
|
87
|
+
class="btn btn-default"
|
|
88
|
+
type="button"
|
|
89
|
+
(click)="alertWithTemplateRef()"
|
|
90
|
+
>
|
|
91
|
+
Info toast with template reference
|
|
92
|
+
</button>
|
|
93
|
+
|
|
94
|
+
<button
|
|
95
|
+
class="btn btn-default"
|
|
96
|
+
type="button"
|
|
97
|
+
(click)="addAlertWithCallbacks()"
|
|
98
|
+
>
|
|
99
|
+
Warning toast with callbacks
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<ng-template #templateRef>
|
|
104
|
+
<h4>This is a template ref</h4>
|
|
105
|
+
<p class="m-b-8 m-t-8">Add your own content to an alert, you can even include</p>
|
|
106
|
+
<button class="btn btn-default btn-sm">Buttons</button>
|
|
107
|
+
<p class="m-t-8">and other interactive elements.</p>
|
|
108
|
+
</ng-template>
|
|
109
|
+
|
|
110
|
+
<!-- /important -->
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Component, TemplateRef, ViewChild } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { AlertService, CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'c8y-alert-example',
|
|
8
|
+
templateUrl: './alert-example.components.html',
|
|
9
|
+
standalone: true,
|
|
10
|
+
imports: [CommonModule, FormsModule, CoreModule]
|
|
11
|
+
})
|
|
12
|
+
export class AlertExampleComponents {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
@ViewChild('templateRef', { read: TemplateRef }) templateRef: TemplateRef<any>;
|
|
15
|
+
|
|
16
|
+
constructor(private alertService: AlertService) {}
|
|
17
|
+
|
|
18
|
+
successAlert() {
|
|
19
|
+
this.alertService.success('Success toast');
|
|
20
|
+
}
|
|
21
|
+
dangerAlert() {
|
|
22
|
+
this.alertService.danger('Danger toast');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
infoAlert() {
|
|
26
|
+
this.alertService.info('Info toast');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
warningAlert() {
|
|
30
|
+
this.alertService.warning('Warning toast');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
systemAlert() {
|
|
34
|
+
this.alertService.addByText('system', 'This is a system toast');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
dangerWithDetails() {
|
|
38
|
+
this.alertService.danger('Error toast', ' Error toast details');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
dangerAlertByText() {
|
|
42
|
+
this.alertService.addByText('warning', 'This is a warning toast', ' with details');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
addAlertByAlertObject() {
|
|
46
|
+
this.alertService.add({
|
|
47
|
+
type: 'system',
|
|
48
|
+
text: 'System toast',
|
|
49
|
+
timeout: 5000,
|
|
50
|
+
detailedData: ' Alert details'
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
addAlertWithHtml() {
|
|
55
|
+
this.alertService.add({
|
|
56
|
+
text: '<p>This is a <b>toast</b> with <code>HTML</code> content</p>',
|
|
57
|
+
allowHtml: true,
|
|
58
|
+
type: 'success'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
alertWithTemplateRef() {
|
|
63
|
+
this.alertService.add({ type: 'info', text: this.templateRef });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
addAlertWithCallbacks() {
|
|
67
|
+
this.alertService.add({
|
|
68
|
+
type: 'warning',
|
|
69
|
+
text: 'Console log on close or show details.',
|
|
70
|
+
detailedData: ' Alert details',
|
|
71
|
+
// eslint-disable-next-line no-console
|
|
72
|
+
onClose: () => console.log('Alert closed'),
|
|
73
|
+
// eslint-disable-next-line no-console
|
|
74
|
+
onDetail: () => console.log('Details opened.')
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [CommonModule],
|
|
7
|
+
providers: [
|
|
8
|
+
hookRoute({
|
|
9
|
+
path: 'alert',
|
|
10
|
+
loadComponent: () => import('./alert-example.components').then(m => m.AlertExampleComponents)
|
|
11
|
+
}),
|
|
12
|
+
hookNavigator(
|
|
13
|
+
new NavigatorNode({
|
|
14
|
+
path: 'alert',
|
|
15
|
+
icon: 'notification',
|
|
16
|
+
label: 'Alert'
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class AlertExampleModule {}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
3
|
+
import { BootstrapComponent, CoreModule, RouterModule, VersionModule } from '@c8y/ngx-components';
|
|
4
|
+
import { BulkOperationSchedulerModule } from '@c8y/ngx-components/operations/bulk-operation-scheduler';
|
|
5
|
+
import { WidgetsModule } from '@c8y/ngx-components/widgets';
|
|
6
|
+
import { cockpitDefaultWidgets } from '@c8y/ngx-components/widgets/cockpit';
|
|
7
|
+
import { deviceManagementDefaultWidgets } from '@c8y/ngx-components/widgets/device-management';
|
|
8
|
+
import { BsModalRef } from 'ngx-bootstrap/modal';
|
|
9
|
+
import { ClientInterceptorModule } from '../client-interceptor';
|
|
10
|
+
import { DynamicFormsTutorialModule } from '../dynamic-forms';
|
|
11
|
+
import { GridsModule } from '../grids';
|
|
12
|
+
import { HelloModule } from '../hello';
|
|
13
|
+
import { HooksModule } from '../hooks';
|
|
14
|
+
import { NavigatorModule } from '../hooks/navigator';
|
|
15
|
+
import { RouteModule } from '../hooks/route';
|
|
16
|
+
import { LazyRoutingModule } from '../lazy';
|
|
17
|
+
import { LazyWidgetModule } from '../lazy-widget';
|
|
18
|
+
import { ListsModule } from '../list';
|
|
19
|
+
import { MapExamplesModule } from '../maps/map-examples.module';
|
|
20
|
+
import { RedirectToLastRouteModule } from '../redirect-to-last-route';
|
|
21
|
+
import { UserMenuModule } from '../user-menu';
|
|
22
|
+
import { DashboardWidgetDemoModule } from '../widget';
|
|
23
|
+
import { WidgetResolversModule } from '../widget-resolvers';
|
|
24
|
+
import { MockModule } from '../__mocks';
|
|
25
|
+
import { IntroductionModule } from '../provider-configuration';
|
|
26
|
+
import { TranslationsModule } from '../translations';
|
|
27
|
+
|
|
28
|
+
@NgModule({
|
|
29
|
+
declarations: [],
|
|
30
|
+
imports: [
|
|
31
|
+
BrowserAnimationsModule,
|
|
32
|
+
RouterModule.forRoot([]),
|
|
33
|
+
// Import the CoreModule to add c8y functionality
|
|
34
|
+
CoreModule.forRoot(),
|
|
35
|
+
|
|
36
|
+
// The following modules show examples of how to
|
|
37
|
+
HelloModule,
|
|
38
|
+
RouteModule,
|
|
39
|
+
DashboardWidgetDemoModule,
|
|
40
|
+
HooksModule,
|
|
41
|
+
NavigatorModule,
|
|
42
|
+
ListsModule,
|
|
43
|
+
GridsModule,
|
|
44
|
+
LazyRoutingModule,
|
|
45
|
+
BulkOperationSchedulerModule,
|
|
46
|
+
IntroductionModule,
|
|
47
|
+
DynamicFormsTutorialModule,
|
|
48
|
+
WidgetResolversModule,
|
|
49
|
+
UserMenuModule,
|
|
50
|
+
ClientInterceptorModule,
|
|
51
|
+
MapExamplesModule,
|
|
52
|
+
TranslationsModule,
|
|
53
|
+
// Get rid of a default version factory
|
|
54
|
+
VersionModule.config({ disableWebSDKPluginVersionFactory: true }),
|
|
55
|
+
LazyWidgetModule,
|
|
56
|
+
WidgetsModule.config({
|
|
57
|
+
widgets: [...cockpitDefaultWidgets, ...deviceManagementDefaultWidgets]
|
|
58
|
+
}),
|
|
59
|
+
RedirectToLastRouteModule,
|
|
60
|
+
MockModule
|
|
61
|
+
],
|
|
62
|
+
|
|
63
|
+
providers: [BsModalRef],
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Bootstrap your application with the BootstrapComponent which will use the `<c8y-bootstrap>`
|
|
67
|
+
* component to initialize the root application. Alternatively you can bootstrap
|
|
68
|
+
* a component of your choice and include that tag into its template or only reuse the given components
|
|
69
|
+
*/
|
|
70
|
+
bootstrap: [BootstrapComponent]
|
|
71
|
+
})
|
|
72
|
+
export class AppModule {}
|
package/src/bootstrap.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './polyfills';
|
|
2
|
+
|
|
3
|
+
import { enableProdMode } from '@angular/core';
|
|
4
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
5
|
+
import { AppModule } from './app/app.module';
|
|
6
|
+
|
|
7
|
+
import './translations/locales/pt_BR.po';
|
|
8
|
+
import './translations/locales/it.po';
|
|
9
|
+
|
|
10
|
+
declare const __MODE__: string;
|
|
11
|
+
if (__MODE__ === 'production') {
|
|
12
|
+
enableProdMode();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function bootstrap() {
|
|
16
|
+
return platformBrowserDynamic()
|
|
17
|
+
.bootstrapModule(AppModule)
|
|
18
|
+
.catch(err => console.log(err));
|
|
19
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@import '~@c8y/style/extend.less';
|
|
2
|
+
|
|
3
|
+
// // to hide the Cumulocity IoT logo on top of navigator
|
|
4
|
+
// // set @extending to true
|
|
5
|
+
@extending: false;
|
|
6
|
+
|
|
7
|
+
// Replace and uncomment each variable as you need them
|
|
8
|
+
|
|
9
|
+
/* COLORS */
|
|
10
|
+
// @brand-color: #53cd61; // main color
|
|
11
|
+
// @brand-primary: @brand-color;
|
|
12
|
+
// @brand-complementary: #a8b3b5;
|
|
13
|
+
// @brand-primary-light: lighten(@brand-primary, 20%);
|
|
14
|
+
// // status colors
|
|
15
|
+
// @status-success: #5cb85c;
|
|
16
|
+
// @status-info: @brand-color;
|
|
17
|
+
// @status-warning: #f0ad4e;
|
|
18
|
+
// @status-danger: #d9534f;
|
|
19
|
+
// @danger: #d90000;
|
|
20
|
+
// @warning: #fdc000;
|
|
21
|
+
// @status-warning-dark: #ff8000;
|
|
22
|
+
// @success: #5cb85c;
|
|
23
|
+
// grays
|
|
24
|
+
// @text-color: #444;
|
|
25
|
+
// @gray-30: #3b4748;
|
|
26
|
+
// @gray-40: #49595b;
|
|
27
|
+
// @gray-40: #6d7a7c;
|
|
28
|
+
// // @gray: #8a9596;
|
|
29
|
+
// @gray-80: #cacece;
|
|
30
|
+
// @gray-90: #f8f8f8;
|
|
31
|
+
// @gray-100: #fcfcfc;
|
|
32
|
+
// @text-muted: @gray-50;
|
|
33
|
+
|
|
34
|
+
// @body-background-color: #f8f8f8; // page background color - always use a light background
|
|
35
|
+
|
|
36
|
+
/* HEADER */
|
|
37
|
+
// @headerColor: white;
|
|
38
|
+
// @header-text-color: @gray-40;
|
|
39
|
+
// @header-text-color-hover: @brand-primary;
|
|
40
|
+
// @header-color-active: darken(@gray-40, 15%);
|
|
41
|
+
|
|
42
|
+
/* NAVIGATOR */
|
|
43
|
+
// @navColor: @gray-10;
|
|
44
|
+
// @navColorHeader: @gray-10;
|
|
45
|
+
// @navigator-header-color: white;
|
|
46
|
+
// @navigator-text-color: @gray-100;
|
|
47
|
+
// @navigator-separator-color: fade(white, 5%);
|
|
48
|
+
// @navigator-font-family: @headings-font-family;
|
|
49
|
+
// @navigator-font-size: 13px;
|
|
50
|
+
// @navigator-color-active: white;
|
|
51
|
+
// @navigator-active-bg: @brand-primary;
|
|
52
|
+
// when set adds a vertical gradient in the navigator background
|
|
53
|
+
// @grad-top: "";
|
|
54
|
+
// @grad-bottom: "";
|
|
55
|
+
|
|
56
|
+
/* TYPOGRAPHY */
|
|
57
|
+
// @font-family-sans-serif: "Lato",Arial, Verdana, sans-serif;
|
|
58
|
+
// @font-family-base: @font-family-sans-serif;
|
|
59
|
+
// @headings-font-family: "Roboto",Arial, Verdana, sans-serif;
|
|
60
|
+
|
|
61
|
+
/* BUTTONS */
|
|
62
|
+
// @component-border-radius-base-base: 2px;
|
|
63
|
+
// @component-border-radius-base-large: @component-border-radius-base-base;
|
|
64
|
+
// @component-border-radius-base-small: @component-border-radius-base-base;
|
|
65
|
+
// @btn-shadow: none;
|
|
66
|
+
|
|
67
|
+
/* COMPONENTS */
|
|
68
|
+
// @spinner-color: lighten(@brand-primary, 30%);
|
|
69
|
+
// @link-color: #337ab7;
|
|
70
|
+
// @link-color-hover: darken(@link-color, 15%);
|
|
71
|
+
// @form-control-border-color-focus: #66afe9;
|
|
72
|
+
|
|
73
|
+
// @body-background-pattern: "";
|
|
74
|
+
// @darker-header: @gray-30;
|
|
75
|
+
// @appswitcher-background: none;
|
|
76
|
+
// @component-background-hover: fade(black, 1.5%);
|
|
77
|
+
// @header-app-name: @header-text-color;
|
|
78
|
+
// @image-path: 'img/';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { ApiService, DataModule } from '@c8y/ngx-components/api';
|
|
3
|
+
import { ClientInterceptorService } from './client-interceptor.service';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [DataModule]
|
|
7
|
+
})
|
|
8
|
+
export class ClientInterceptorModule {
|
|
9
|
+
constructor(apiService: ApiService, interceptor: ClientInterceptorService) {
|
|
10
|
+
apiService.addInterceptor(interceptor, 'tutorialAppDemoInterceptor');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { IFetchOptions, IFetchResponse, IManagedObject } from '@c8y/client';
|
|
3
|
+
import { ApiCall, HttpHandler, HttpInterceptor } from '@c8y/ngx-components/api';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { get, set } from 'lodash-es';
|
|
6
|
+
import { switchMap } from 'rxjs/operators';
|
|
7
|
+
|
|
8
|
+
@Injectable({ providedIn: 'root' })
|
|
9
|
+
export class ClientInterceptorService implements HttpInterceptor {
|
|
10
|
+
private headerPath = 'options.headers';
|
|
11
|
+
|
|
12
|
+
intercept(req: ApiCall, next: HttpHandler): Observable<IFetchResponse> {
|
|
13
|
+
this.addACustomHeaderToAllRequests(req);
|
|
14
|
+
this.adjustAllNewManagedObjects(req);
|
|
15
|
+
return next
|
|
16
|
+
.handle(req)
|
|
17
|
+
.pipe(switchMap(response => this.modifyResponseBodyForManagedObjects(response)));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private async modifyResponseBodyForManagedObjects(
|
|
21
|
+
response: IFetchResponse
|
|
22
|
+
): Promise<IFetchResponse> {
|
|
23
|
+
if (
|
|
24
|
+
!response ||
|
|
25
|
+
!response.ok ||
|
|
26
|
+
(!response.url.endsWith('inventory/managedObjects') &&
|
|
27
|
+
!response.url.includes('inventory/managedObjects?'))
|
|
28
|
+
) {
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
31
|
+
const body = await response.json();
|
|
32
|
+
if (body?.managedObjects && Array.isArray(body.managedObjects)) {
|
|
33
|
+
const managedObjects: IManagedObject[] = body.managedObjects;
|
|
34
|
+
managedObjects.forEach(managedObject => {
|
|
35
|
+
managedObject['c8y_ReadByTutorialAppInterceptor'] = {};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
response.json = () => Promise.resolve(body);
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private addACustomHeaderToAllRequests(req: ApiCall): void {
|
|
43
|
+
const headers: IFetchOptions['headers'] = get(req, this.headerPath, {});
|
|
44
|
+
headers['TutorialAppInterceptorHeader'] = 'InterceptorValue';
|
|
45
|
+
set(req, this.headerPath, headers);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private adjustAllNewManagedObjects(req: ApiCall): void {
|
|
49
|
+
const { url, method } = req;
|
|
50
|
+
if (method !== 'POST' || !url.includes('inventory/managedObjects')) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { body } = req.options;
|
|
55
|
+
|
|
56
|
+
const managedObject: Partial<IManagedObject> = JSON.parse(body as string);
|
|
57
|
+
managedObject['c8y_CreatedByTutorialApp'] = {};
|
|
58
|
+
|
|
59
|
+
req.options.body = JSON.stringify(managedObject);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client-interceptor.module';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
:root{
|
|
2
|
+
--primary-color:#3bbfce;
|
|
3
|
+
--secundary-color:#2b9eab;
|
|
4
|
+
--margin:8px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
.content-navigation {
|
|
9
|
+
border-color: var(--secundary-color);
|
|
10
|
+
color: var(--secundary-color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.border {
|
|
14
|
+
padding: 8px;
|
|
15
|
+
margin: var(--margin);
|
|
16
|
+
border-color: #3bbfce;
|
|
17
|
+
}
|