@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,34 @@
|
|
|
1
|
+
import { Component, TemplateRef } from '@angular/core';
|
|
2
|
+
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ngx-modal-example',
|
|
6
|
+
template: `<button class="btn btn-primary" type="button" (click)="openModal(template)">
|
|
7
|
+
Create template modal
|
|
8
|
+
</button>
|
|
9
|
+
|
|
10
|
+
<ng-template #template>
|
|
11
|
+
<div class="modal-header">
|
|
12
|
+
<h4 class="modal-title pull-left">Modal</h4>
|
|
13
|
+
<button
|
|
14
|
+
class="btn-close close pull-right"
|
|
15
|
+
aria-label="Close"
|
|
16
|
+
type="button"
|
|
17
|
+
(click)="modalRef?.hide()"
|
|
18
|
+
>
|
|
19
|
+
<span class="visually-hidden" aria-hidden="true">×</span>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="modal-body">This is a modal.</div>
|
|
23
|
+
</ng-template>`,
|
|
24
|
+
standalone: true,
|
|
25
|
+
imports: []
|
|
26
|
+
})
|
|
27
|
+
export class NgxModalExampleComponent {
|
|
28
|
+
modalRef?: BsModalRef;
|
|
29
|
+
constructor(private modalService: BsModalService) {}
|
|
30
|
+
|
|
31
|
+
openModal(template: TemplateRef<any>) {
|
|
32
|
+
this.modalRef = this.modalService.show(template);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'modal/ngx-modal',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./ngx-modal-example.component').then(m => m.NgxModalExampleComponent)
|
|
10
|
+
}),
|
|
11
|
+
hookNavigator(
|
|
12
|
+
new NavigatorNode({
|
|
13
|
+
label: 'Ngx modal',
|
|
14
|
+
path: '/modal/ngx-modal',
|
|
15
|
+
icon: 'list-alt',
|
|
16
|
+
priority: 10,
|
|
17
|
+
parent: 'Modal'
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
export class NgxModalExampleModule {}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ModalLabels, ModalModule } from '@c8y/ngx-components';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'modal-example',
|
|
7
|
+
template: `
|
|
8
|
+
<c8y-modal
|
|
9
|
+
title="CustomTitle"
|
|
10
|
+
(onClose)="onClose($event)"
|
|
11
|
+
(onDismiss)="onDismiss($event)"
|
|
12
|
+
[labels]="labels"
|
|
13
|
+
[disabled]="true"
|
|
14
|
+
>
|
|
15
|
+
<!--! will disable ok button -->
|
|
16
|
+
<span>I am body of modal</span>
|
|
17
|
+
<span>For simple string use body="string"</span>
|
|
18
|
+
</c8y-modal>
|
|
19
|
+
`,
|
|
20
|
+
standalone: true,
|
|
21
|
+
imports: [ModalModule]
|
|
22
|
+
})
|
|
23
|
+
export class ModalExampleComponent {
|
|
24
|
+
closeSubject: Subject<boolean> = new Subject();
|
|
25
|
+
labels: ModalLabels = { ok: 'customOK', cancel: 'customCancel' };
|
|
26
|
+
|
|
27
|
+
onDismiss(event) {
|
|
28
|
+
this.closeSubject.next(!event);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onClose(event) {
|
|
32
|
+
this.closeSubject.next(event);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'modal/simple-modal',
|
|
8
|
+
loadComponent: () => import('./modal-example.component').then(m => m.ModalExampleComponent)
|
|
9
|
+
}),
|
|
10
|
+
hookNavigator(
|
|
11
|
+
new NavigatorNode({
|
|
12
|
+
label: 'Simple Modal',
|
|
13
|
+
path: '/modal/simple-modal',
|
|
14
|
+
icon: 'list-alt',
|
|
15
|
+
priority: 2,
|
|
16
|
+
parent: 'Modal'
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class ModalExampleModule {}
|
package/src/polyfills.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
3
|
+
* You can add your own extra polyfills to this file.
|
|
4
|
+
*
|
|
5
|
+
* This file is divided into 2 sections:
|
|
6
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
7
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
8
|
+
* file.
|
|
9
|
+
*
|
|
10
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
11
|
+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
12
|
+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
13
|
+
*
|
|
14
|
+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/***************************************************************************************************
|
|
18
|
+
* BROWSER POLYFILLS
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* By default, zone.js will patch all possible macroTask and DomEvents
|
|
23
|
+
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
(window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
|
27
|
+
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
|
28
|
+
(window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove', 'message'];
|
|
29
|
+
|
|
30
|
+
/***************************************************************************************************
|
|
31
|
+
* Zone JS is required by default for Angular itself.
|
|
32
|
+
*/
|
|
33
|
+
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
CommonModule,
|
|
4
|
+
gettext,
|
|
5
|
+
HeaderModule,
|
|
6
|
+
ModalModule,
|
|
7
|
+
PopoverConfirmButtons,
|
|
8
|
+
PopoverConfirmComponent
|
|
9
|
+
} from '@c8y/ngx-components';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'pop-confirm-example',
|
|
13
|
+
template: `<c8y-title>Popover confirm</c8y-title>
|
|
14
|
+
<div class="p-24">
|
|
15
|
+
<button
|
|
16
|
+
class="btn btn-dot btn-dot--danger m-l-auto"
|
|
17
|
+
title="{{ 'Delete' | translate }}"
|
|
18
|
+
type="button"
|
|
19
|
+
(click)="triggerPopover(poConfirm)"
|
|
20
|
+
>
|
|
21
|
+
<c8y-popover-confirm
|
|
22
|
+
[title]="'Delete item' | translate"
|
|
23
|
+
[placement]="'right'"
|
|
24
|
+
[outsideClick]="true"
|
|
25
|
+
#poConfirm
|
|
26
|
+
></c8y-popover-confirm>
|
|
27
|
+
<i c8yIcon="minus-circle"></i>
|
|
28
|
+
</button>
|
|
29
|
+
</div>`,
|
|
30
|
+
standalone: true,
|
|
31
|
+
imports: [ModalModule, CommonModule, HeaderModule]
|
|
32
|
+
})
|
|
33
|
+
export class PopConfirmExampleComponent {
|
|
34
|
+
// you can provide custom buttons
|
|
35
|
+
confirmRemoveColumnButtons: PopoverConfirmButtons[] = [
|
|
36
|
+
{
|
|
37
|
+
label: gettext('Cancel'),
|
|
38
|
+
action: () => Promise.resolve(false)
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: gettext('Delete'),
|
|
42
|
+
status: 'danger',
|
|
43
|
+
action: () => Promise.resolve(true)
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
async triggerPopover(poConfirm: PopoverConfirmComponent): Promise<void> {
|
|
48
|
+
// to set the message
|
|
49
|
+
poConfirm.message = gettext('This action is irreversible.');
|
|
50
|
+
try {
|
|
51
|
+
const remove = await poConfirm.show(this.confirmRemoveColumnButtons);
|
|
52
|
+
if (!remove) {
|
|
53
|
+
console.log('You clicked "Cancel"!');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
console.log('You successfully deleted the item!');
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// do nothing or display "deletion failed" message
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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: 'popconfirm',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./pop-confirm-example.component').then(m => m.PopConfirmExampleComponent)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
path: '/popconfirm',
|
|
16
|
+
label: 'Pop confirm',
|
|
17
|
+
icon: 'hand-o-right',
|
|
18
|
+
priority: 80
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
})
|
|
23
|
+
export class PopConfirmExampleModule {}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule, gettext, PropertiesListItem } from '@c8y/ngx-components';
|
|
3
|
+
import { IManifest } from '@c8y/client';
|
|
4
|
+
// import { packageProperties } from '@c8y/ngx-components/ecosystem/shared';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'properties-list-example',
|
|
8
|
+
template: `
|
|
9
|
+
<c8y-properties-list
|
|
10
|
+
[title]="'Application properties'"
|
|
11
|
+
[data]="archiveManifest"
|
|
12
|
+
[emptyLabel]="'--'"
|
|
13
|
+
[properties]="packageVersionProperties"
|
|
14
|
+
>
|
|
15
|
+
</c8y-properties-list>
|
|
16
|
+
`,
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [CoreModule]
|
|
19
|
+
})
|
|
20
|
+
export class PropertiesListExampleComponent {
|
|
21
|
+
archiveManifest: Partial<IManifest> = {
|
|
22
|
+
author: 'Cumulocity IoT',
|
|
23
|
+
version: '10.20.0.0',
|
|
24
|
+
requiredPlatformVersion: '10.18.0.0',
|
|
25
|
+
homepage: 'https://cumulocity.com/guides/web/overview/'
|
|
26
|
+
};
|
|
27
|
+
// Optionally you can use predefined package properties.
|
|
28
|
+
// readonly packageVersionProperties: PropertiesListItem[] = packageProperties;
|
|
29
|
+
readonly packageVersionProperties: PropertiesListItem[] = [
|
|
30
|
+
{
|
|
31
|
+
label: gettext('Version'),
|
|
32
|
+
key: 'version'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: gettext('Author'),
|
|
36
|
+
key: 'author'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: gettext('Required platform version'),
|
|
40
|
+
key: 'requiredPlatformVersion'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: gettext('Homepage'),
|
|
44
|
+
key: 'homepage',
|
|
45
|
+
type: 'link',
|
|
46
|
+
action: (e, link: string) => window.open(link, '_blank', 'noopener,noreferrer')
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'properties-list',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./properties-list-example.component').then(m => m.PropertiesListExampleComponent)
|
|
10
|
+
}),
|
|
11
|
+
hookNavigator(
|
|
12
|
+
new NavigatorNode({
|
|
13
|
+
label: 'Properties list',
|
|
14
|
+
path: '/properties-list',
|
|
15
|
+
icon: 'th-list',
|
|
16
|
+
priority: 0
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class PropertiesListExampleModule {}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
import { PopoverModule } from 'ngx-bootstrap/popover';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'c8y-introduction',
|
|
7
|
+
template: `<c8y-title>Provider configuration</c8y-title>
|
|
8
|
+
<div class="card">
|
|
9
|
+
<div class="card-header separator">
|
|
10
|
+
<h4 class="card-title">Introduction</h4>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="card-block">
|
|
13
|
+
<p>
|
|
14
|
+
This sample demonstrates how you can utilize the
|
|
15
|
+
<code>ProviderConfigurationModule</code> to compose your own configuration UI.
|
|
16
|
+
</p>
|
|
17
|
+
<p>
|
|
18
|
+
To configure the
|
|
19
|
+
<strong
|
|
20
|
+
><a href="#provider-configuration/provider-configuration-example"
|
|
21
|
+
>Demo provider</a
|
|
22
|
+
></strong
|
|
23
|
+
>
|
|
24
|
+
in the next section you first need to define the URLs for your
|
|
25
|
+
<code>definitions</code> and <code>configuration</code> endpoints. To do this you need to
|
|
26
|
+
provide the URLs in the configuration object passed to the <code>config</code> method of
|
|
27
|
+
the <code>ProviderConfigurationModule</code> in the <code>imports</code> array of
|
|
28
|
+
<code>provider-configuration/provider-configuration.module.ts</code>:
|
|
29
|
+
</p>
|
|
30
|
+
<br />
|
|
31
|
+
<pre><code [innerHTML]="sampleConfig"></code></pre>
|
|
32
|
+
<p>
|
|
33
|
+
Once you have configured the endpoints you can proceed to the
|
|
34
|
+
<strong
|
|
35
|
+
><a href="#provider-configuration/provider-configuration-example"
|
|
36
|
+
>Demo provider</a
|
|
37
|
+
></strong
|
|
38
|
+
>
|
|
39
|
+
section. In the <strong>Demo provider</strong> (you can additionally configure custom
|
|
40
|
+
labels and messages for your UI) dropdown you will see the list of providers returned by
|
|
41
|
+
your <code>definitions</code> endpoint. After you select a provider a form will be shown
|
|
42
|
+
displaying the fields configured in the JSON Schema for the provider. If there is an
|
|
43
|
+
existing configuration for the selected provider, it will be displayed. The form provides
|
|
44
|
+
options to create, update and delete provider configurations. Currently only one active
|
|
45
|
+
configuration is supported.
|
|
46
|
+
</p>
|
|
47
|
+
</div>
|
|
48
|
+
</div>`,
|
|
49
|
+
standalone: true,
|
|
50
|
+
imports: [PopoverModule, CoreModule]
|
|
51
|
+
})
|
|
52
|
+
export class IntroductionComponent {
|
|
53
|
+
sampleConfig = `ProviderConfigurationModule.config([
|
|
54
|
+
{
|
|
55
|
+
navigation: { ... },
|
|
56
|
+
layout: { ... },
|
|
57
|
+
endpoint: {
|
|
58
|
+
definitionsEndpoint: {
|
|
59
|
+
baseUrl: 'service/demo/providers', // replace with your provider definitions base URL part
|
|
60
|
+
listUrl: 'definitions' // replace with your provider definitions list URL part
|
|
61
|
+
},
|
|
62
|
+
configurationEndpoint: {
|
|
63
|
+
baseUrl: 'service/demo/providers', // replace with your provider configuration base URL part
|
|
64
|
+
listUrl: 'configuration' // replace with your provider configuration list URL part
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
])`;
|
|
69
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'provider-configuration/introduction-example',
|
|
8
|
+
loadComponent: () => import('./introduction.component').then(m => m.IntroductionComponent)
|
|
9
|
+
}),
|
|
10
|
+
hookNavigator(
|
|
11
|
+
new NavigatorNode({
|
|
12
|
+
label: 'Introduction',
|
|
13
|
+
path: '/provider-configuration/introduction-example',
|
|
14
|
+
icon: 'list-alt',
|
|
15
|
+
priority: 3,
|
|
16
|
+
parent: 'Provider configuration'
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class IntroductionModule {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
@Injectable({ providedIn: 'root' })
|
|
5
|
+
export class DemoProviderGuard implements CanActivate {
|
|
6
|
+
canActivate(_route: ActivatedRouteSnapshot, _state: RouterStateSnapshot): Promise<boolean> {
|
|
7
|
+
return Promise.resolve(true);
|
|
8
|
+
}
|
|
9
|
+
}
|
package/src/provider-configuration/provider-configuration-example/provider-configuration.module.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { ProviderConfigurationModule } from '@c8y/ngx-components';
|
|
3
|
+
import { DemoProviderGuard } from './demo-provider.guard';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
// important
|
|
7
|
+
imports: [
|
|
8
|
+
ProviderConfigurationModule.config([
|
|
9
|
+
{
|
|
10
|
+
navigation: {
|
|
11
|
+
label: 'Demo provider',
|
|
12
|
+
path: 'provider-configuration/provider-configuration-example',
|
|
13
|
+
icon: 'bell-o',
|
|
14
|
+
parent: 'Provider configuration',
|
|
15
|
+
priority: 2,
|
|
16
|
+
canActivate: [DemoProviderGuard]
|
|
17
|
+
},
|
|
18
|
+
layout: {
|
|
19
|
+
pageTitle: 'Demo provider',
|
|
20
|
+
cardTitle: 'Credentials',
|
|
21
|
+
description:
|
|
22
|
+
'You can provide your own text here, e.g. to explain the user what this provider does. If the dropdown below contains no providers you may have not configured your endpoints properly. Check in the Introduction section for a more detailed explanation on how to configure the module properly.',
|
|
23
|
+
providerName: 'Demo provider',
|
|
24
|
+
providerNamePlaceholder: 'Select or type to filter providers',
|
|
25
|
+
providerNameNoMatchesHint: 'Select one of the existing providers.',
|
|
26
|
+
deleteBtnLabel: 'Delete',
|
|
27
|
+
saveBtnLabel: 'Save',
|
|
28
|
+
configurationUpdatedSuccessMsg: 'Credentials updated.',
|
|
29
|
+
deleteConfigurationModalTitle: 'Delete credentials',
|
|
30
|
+
deleteConfigurationModalBody: `You are about to delete provider credentials. Do you want to proceed?`,
|
|
31
|
+
deleteConfigurationModalOkBtnLabel: 'Delete',
|
|
32
|
+
configurationDeletedSuccessMsg: 'Credentials deleted.'
|
|
33
|
+
},
|
|
34
|
+
endpoint: {
|
|
35
|
+
definitionsEndpoint: {
|
|
36
|
+
baseUrl: 'service/demo/providers', // replace with your provider definitions base URL part
|
|
37
|
+
listUrl: 'definitions' // replace with your provider definitions list URL part
|
|
38
|
+
},
|
|
39
|
+
configurationEndpoint: {
|
|
40
|
+
baseUrl: 'service/demo/providers', // replace with your provider configuration base URL part
|
|
41
|
+
listUrl: 'configuration' // replace with your provider configuration list URL part
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
])
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
export class ProviderConfigurationTutorialModule {}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule, DocLink, DocsService, gettext, QuickLinkModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'quick-link-example',
|
|
6
|
+
template: `<c8y-title>Quick link</c8y-title>
|
|
7
|
+
<button
|
|
8
|
+
class="btn-clean card text-pre-normal"
|
|
9
|
+
*ngFor="let link of quickLinks"
|
|
10
|
+
(click)="link.click ? link.click() : false"
|
|
11
|
+
c8yProductExperience
|
|
12
|
+
[actionName]="'welcomeWidgetClicked'"
|
|
13
|
+
[actionData]="{ link: link.label }"
|
|
14
|
+
>
|
|
15
|
+
<c8y-quick-link [icon]="link.icon" [label]="link.label"></c8y-quick-link>
|
|
16
|
+
</button>`,
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [QuickLinkModule, CoreModule]
|
|
19
|
+
})
|
|
20
|
+
export class QuickLinkExampleComponent {
|
|
21
|
+
quickLinks = [];
|
|
22
|
+
|
|
23
|
+
constructor(private docs: DocsService) {
|
|
24
|
+
this.createQuicklinkUserGuide();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private createQuicklinkUserGuide() {
|
|
28
|
+
const userGuide: Partial<DocLink> = {
|
|
29
|
+
icon: 'c8y-user',
|
|
30
|
+
label: gettext('User documentation'),
|
|
31
|
+
url: '/docs/section/getting_started',
|
|
32
|
+
click: () => {
|
|
33
|
+
const userGuideURL = this.docs.getUserGuideLink(userGuide.url) as string;
|
|
34
|
+
window.open(userGuideURL);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
this.quickLinks.push(userGuide);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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: 'quick-link',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./quick-link-example.component').then(m => m.QuickLinkExampleComponent)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
path: '/quick-link',
|
|
16
|
+
label: 'Quick link',
|
|
17
|
+
icon: 'c8y-css',
|
|
18
|
+
priority: 85
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
})
|
|
23
|
+
export class QuickLinkExampleModule {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './realtime-tutorial.module';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<c8y-title>Realtime</c8y-title>
|
|
2
|
+
|
|
3
|
+
<c8y-action-bar-item itemClass="navbar-form" placement="right">
|
|
4
|
+
<div class="form-group">
|
|
5
|
+
<label for="bufferSizeOptions" translate>Maximum buffer size of notifications</label>
|
|
6
|
+
<div class="c8y-select-wrapper">
|
|
7
|
+
<select
|
|
8
|
+
id="bufferSizeOptions"
|
|
9
|
+
class="form-control"
|
|
10
|
+
[(ngModel)]="bufferSize"
|
|
11
|
+
>
|
|
12
|
+
<option [ngValue]="option" *ngFor="let option of bufferSizeOptions">{{ option }} Items</option>
|
|
13
|
+
</select>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</c8y-action-bar-item>
|
|
17
|
+
|
|
18
|
+
<div class="card">
|
|
19
|
+
<div class="card-block">
|
|
20
|
+
<ul>
|
|
21
|
+
<li *ngFor="let service of services">
|
|
22
|
+
<c8y-realtime-btn [service]="service.instance" [title]="'Toggle ' + service.className" [label]="service.className"></c8y-realtime-btn>
|
|
23
|
+
</li>
|
|
24
|
+
</ul>
|
|
25
|
+
<p>
|
|
26
|
+
Below you can find the latest {{ bufferSize }} notifications received from your tenant.
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<ng-container *ngIf="(allAPIsRealtime$ | async) as notificationBuffer; else waiting">
|
|
32
|
+
<ng-container *ngIf="notificationBuffer.length; else waiting">
|
|
33
|
+
<div class="card" *ngFor="let realtimeItem of notificationBuffer; let i = index">
|
|
34
|
+
<div class="card-header separator">
|
|
35
|
+
<h4 class="card-title">{{ i + 1 }}. RealtimeMessage in buffer</h4>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="card-block">
|
|
38
|
+
<pre><code>{{ realtimeItem | json }}</code></pre>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</ng-container>
|
|
42
|
+
</ng-container>
|
|
43
|
+
|
|
44
|
+
<ng-template #waiting>
|
|
45
|
+
<div class="card">
|
|
46
|
+
<div class="card-header separator">
|
|
47
|
+
<h4 class="card-title"><i c8yIcon="spinner" class="icon-spin"></i> Waiting for the first notification to be received.</h4>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</ng-template>
|
|
51
|
+
|
|
52
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, inject } from '@angular/core';
|
|
3
|
+
import {
|
|
4
|
+
AlarmRealtimeService,
|
|
5
|
+
CoreModule,
|
|
6
|
+
EventRealtimeService,
|
|
7
|
+
ManagedObjectRealtimeService,
|
|
8
|
+
MeasurementRealtimeService,
|
|
9
|
+
OperationBulkRealtimeService,
|
|
10
|
+
OperationRealtimeService,
|
|
11
|
+
RealtimeMessage
|
|
12
|
+
} from '@c8y/ngx-components';
|
|
13
|
+
import { Observable, merge } from 'rxjs';
|
|
14
|
+
import { map, scan } from 'rxjs/operators';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'cmp-realtime-tutorial',
|
|
18
|
+
templateUrl: './realtime-tutorial.component.html',
|
|
19
|
+
providers: [
|
|
20
|
+
ManagedObjectRealtimeService,
|
|
21
|
+
OperationRealtimeService,
|
|
22
|
+
OperationBulkRealtimeService,
|
|
23
|
+
MeasurementRealtimeService,
|
|
24
|
+
AlarmRealtimeService,
|
|
25
|
+
EventRealtimeService
|
|
26
|
+
],
|
|
27
|
+
standalone: true,
|
|
28
|
+
imports: [CommonModule, CoreModule]
|
|
29
|
+
})
|
|
30
|
+
export class RealtimeTutorialComponent {
|
|
31
|
+
allAPIsRealtime$: ReturnType<RealtimeTutorialComponent['setupAllAPIsRealtime$']>;
|
|
32
|
+
services: ReturnType<RealtimeTutorialComponent['setupServices']>;
|
|
33
|
+
bufferSize = 10;
|
|
34
|
+
bufferSizeOptions = [1, 5, 10, 25, 50, 100];
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
this.services = this.setupServices();
|
|
38
|
+
this.allAPIsRealtime$ = this.setupAllAPIsRealtime$();
|
|
39
|
+
|
|
40
|
+
// disable every service except the first one
|
|
41
|
+
this.services.forEach((service, index) => {
|
|
42
|
+
if (index) {
|
|
43
|
+
service.instance.stop();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private setupAllAPIsRealtime$(): Observable<RealtimeMessage<any>[]> {
|
|
49
|
+
/**
|
|
50
|
+
* Always subscribing for all realtime notifications might generate a lot of traffic/load.
|
|
51
|
+
* For that reason try to provide your entityId where ever it is possible in your production code.
|
|
52
|
+
*/
|
|
53
|
+
const observables = this.services.map(service => service.instance.onAll$());
|
|
54
|
+
return merge(...observables).pipe(
|
|
55
|
+
scan((acc, val) => {
|
|
56
|
+
acc.push(val);
|
|
57
|
+
return acc.slice(this.bufferSize * -1);
|
|
58
|
+
}, []),
|
|
59
|
+
map(messages => [...messages].reverse())
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private setupServices() {
|
|
64
|
+
return [
|
|
65
|
+
{
|
|
66
|
+
className: 'ManagedObjectRealtimeService',
|
|
67
|
+
instance: inject(ManagedObjectRealtimeService)
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
className: 'OperationRealtimeService',
|
|
71
|
+
instance: inject(OperationRealtimeService)
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
className: 'OperationBulkRealtimeService',
|
|
75
|
+
instance: inject(OperationBulkRealtimeService)
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
className: 'MeasurementRealtimeService',
|
|
79
|
+
instance: inject(MeasurementRealtimeService)
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
className: 'AlarmRealtimeService',
|
|
83
|
+
instance: inject(AlarmRealtimeService)
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
className: 'EventRealtimeService',
|
|
87
|
+
instance: inject(EventRealtimeService)
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
}
|