@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.
Files changed (345) hide show
  1. package/.browserslistrc +16 -0
  2. package/NOTICES +41743 -0
  3. package/cumulocity.config.ts +643 -0
  4. package/package.json +22 -0
  5. package/src/__mocks/README.md +73 -0
  6. package/src/__mocks/global-mocks/inventory.interceptor.ts +145 -0
  7. package/src/__mocks/global-mocks/measurements.interceptor.ts +58 -0
  8. package/src/__mocks/index.ts +5 -0
  9. package/src/__mocks/mock.model.ts +76 -0
  10. package/src/__mocks/mock.module.ts +121 -0
  11. package/src/__mocks/mock.realtime-subject.ts +68 -0
  12. package/src/__mocks/mock.realtime.ts +31 -0
  13. package/src/__mocks/mock.service.ts +113 -0
  14. package/src/__mocks/scoped-mocks/boilerplate.ts +54 -0
  15. package/src/__mocks/scoped-mocks/context-dashboard.ts +47 -0
  16. package/src/__mocks/scoped-mocks/device-data-grid.ts +44 -0
  17. package/src/__mocks/scoped-mocks/named-context-dashboard.ts +42 -0
  18. package/src/__mocks/scoped-mocks/server-side-data-grid.ts +47 -0
  19. package/src/__mocks/scoped-mocks/service-dashboard.ts +42 -0
  20. package/src/__mocks/utils/clean.realtime.ts +23 -0
  21. package/src/__mocks/utils/common.ts +114 -0
  22. package/src/__mocks/utils/generators/alarms.ts +30 -0
  23. package/src/__mocks/utils/generators/events.ts +14 -0
  24. package/src/__mocks/utils/generators/managedObjects.ts +208 -0
  25. package/src/__mocks/utils/generators/measurement.ts +22 -0
  26. package/src/__mocks/utils/generators/operations.ts +67 -0
  27. package/src/__mocks/utils/grid.ts +87 -0
  28. package/src/__mocks/utils/realtime.ts +59 -0
  29. package/src/alert/alert-example.components.html +110 -0
  30. package/src/alert/alert-example.components.ts +77 -0
  31. package/src/alert/alert-example.module.ts +21 -0
  32. package/src/app/app.module.ts +72 -0
  33. package/src/bootstrap.ts +19 -0
  34. package/src/branding/branding.less +78 -0
  35. package/src/client-interceptor/client-interceptor.module.ts +12 -0
  36. package/src/client-interceptor/client-interceptor.service.ts +61 -0
  37. package/src/client-interceptor/index.ts +1 -0
  38. package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.component.css +17 -0
  39. package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.component.ts +11 -0
  40. package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.module.ts +26 -0
  41. package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.component.less +14 -0
  42. package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.component.ts +11 -0
  43. package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.module.ts +26 -0
  44. package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.scss +13 -0
  45. package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.ts +11 -0
  46. package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.module.ts +26 -0
  47. package/src/dashboard/context-dashboard/context-dashboard.component.ts +32 -0
  48. package/src/dashboard/context-dashboard/context-dashboard.module.ts +22 -0
  49. package/src/dashboard/custom-dashboard/custom-dashboard.component.html +180 -0
  50. package/src/dashboard/custom-dashboard/custom-dashboard.component.ts +52 -0
  51. package/src/dashboard/custom-dashboard/custom-dashboard.module.ts +22 -0
  52. package/src/dashboard/index.ts +4 -0
  53. package/src/dashboard/named-context-dashboard/named-context-dashboard.component.ts +51 -0
  54. package/src/dashboard/named-context-dashboard/named-context-dashboard.module.ts +37 -0
  55. package/src/dashboard/service-dashboard/service-dashboard.component.ts +51 -0
  56. package/src/dashboard/service-dashboard/service-dashboard.module.ts +35 -0
  57. package/src/dashboard/widget-dashboard/widget-dashboard.component.ts +65 -0
  58. package/src/dashboard/widget-dashboard/widget-dashboard.module.ts +22 -0
  59. package/src/date-time-range/date-time-range-example.component.ts +109 -0
  60. package/src/date-time-range/date-time-range-example.module.ts +21 -0
  61. package/src/dynamic-forms/custom-element-example/custom-element-example.component.ts +70 -0
  62. package/src/dynamic-forms/custom-element-example/custom-element-example.module.ts +38 -0
  63. package/src/dynamic-forms/custom-element-example/types/checkbox/checkbox.type.component.html +26 -0
  64. package/src/dynamic-forms/custom-element-example/types/checkbox/checkbox.type.component.ts +21 -0
  65. package/src/dynamic-forms/dynamic-forms.module.ts +16 -0
  66. package/src/dynamic-forms/index.ts +2 -0
  67. package/src/dynamic-forms/introduction-example/introduction-example.component.ts +116 -0
  68. package/src/dynamic-forms/introduction-example/introduction-example.module.ts +24 -0
  69. package/src/dynamic-forms/json-schema-example/json-schema-example.component.html +33 -0
  70. package/src/dynamic-forms/json-schema-example/json-schema-example.component.ts +102 -0
  71. package/src/dynamic-forms/json-schema-example/json-schema-example.module.ts +24 -0
  72. package/src/for-of-directive/for-of-example.component.html +19 -0
  73. package/src/for-of-directive/for-of-example.component.ts +39 -0
  74. package/src/for-of-directive/for-of.module.ts +18 -0
  75. package/src/forms/form-validation/forms-validation.component.html +105 -0
  76. package/src/forms/form-validation/forms-validation.component.ts +52 -0
  77. package/src/forms/form-validation/forms.module.ts +22 -0
  78. package/src/forms/index.ts +1 -0
  79. package/src/grids/client-grid-example/client-grid-example.component.html +16 -0
  80. package/src/grids/client-grid-example/client-grid-example.component.ts +166 -0
  81. package/src/grids/client-grid-example/client-grid-example.module.ts +24 -0
  82. package/src/grids/client-grid-example/data.ts +427 -0
  83. package/src/grids/device-grid-example/device-grid-example.component.html +58 -0
  84. package/src/grids/device-grid-example/device-grid-example.component.ts +134 -0
  85. package/src/grids/device-grid-example/device-grid-example.module.ts +24 -0
  86. package/src/grids/grids-tabs.ts +37 -0
  87. package/src/grids/grids.module.ts +17 -0
  88. package/src/grids/index.ts +1 -0
  89. package/src/grids/server-grid-example/server-grid-example.component.html +26 -0
  90. package/src/grids/server-grid-example/server-grid-example.component.ts +121 -0
  91. package/src/grids/server-grid-example/server-grid-example.module.ts +24 -0
  92. package/src/grids/server-grid-example/server-grid-example.service.ts +266 -0
  93. package/src/grids/server-grid-example/type-data-grid-column/type.cell-renderer.component.ts +31 -0
  94. package/src/grids/server-grid-example/type-data-grid-column/type.data-grid-column.ts +47 -0
  95. package/src/grids/server-grid-example/type-data-grid-column/type.filtering-form-renderer.component.ts +107 -0
  96. package/src/grids/server-grid-example/type-data-grid-column/type.header-cell-renderer.component.ts +20 -0
  97. package/src/hello/hello.component.ts +55 -0
  98. package/src/hello/hello.module.ts +20 -0
  99. package/src/hello/index.ts +1 -0
  100. package/src/help/help-example.component.ts +23 -0
  101. package/src/help/help-example.module.ts +20 -0
  102. package/src/hooks/action/action.module.ts +34 -0
  103. package/src/hooks/action/action.ts +41 -0
  104. package/src/hooks/action/basic-view/basic-view.component.html +8 -0
  105. package/src/hooks/action/basic-view/basic-view.component.ts +18 -0
  106. package/src/hooks/action/index.ts +1 -0
  107. package/src/hooks/action/logout-action/logout-action.component.ts +18 -0
  108. package/src/hooks/action-bar/action-bar.module.ts +34 -0
  109. package/src/hooks/action-bar/action-bar.ts +28 -0
  110. package/src/hooks/action-bar/basic-view/basic-view.component.html +8 -0
  111. package/src/hooks/action-bar/basic-view/basic-view.component.ts +18 -0
  112. package/src/hooks/action-bar/index.ts +1 -0
  113. package/src/hooks/action-bar/refresh-element/refresh-element.component.html +15 -0
  114. package/src/hooks/action-bar/refresh-element/refresh-element.component.ts +21 -0
  115. package/src/hooks/breadcrumbs/basic-view/basic-view.component.html +7 -0
  116. package/src/hooks/breadcrumbs/basic-view/basic-view.component.ts +18 -0
  117. package/src/hooks/breadcrumbs/breadcrumbs.module.ts +34 -0
  118. package/src/hooks/breadcrumbs/breadcrumbs.ts +93 -0
  119. package/src/hooks/breadcrumbs/index.ts +1 -0
  120. package/src/hooks/component/basic-view/basic-view.component.html +11 -0
  121. package/src/hooks/component/basic-view/basic-view.component.ts +16 -0
  122. package/src/hooks/component/basic-view/simple.component.ts +8 -0
  123. package/src/hooks/component/component.module.ts +38 -0
  124. package/src/hooks/component/index.ts +1 -0
  125. package/src/hooks/drawer/index.ts +2 -0
  126. package/src/hooks/drawer/left-drawer-tutorial/left-drawer-tutorial.component.ts +8 -0
  127. package/src/hooks/drawer/left-drawer-tutorial/left-drawer.module.ts +10 -0
  128. package/src/hooks/drawer/right-drawer-tutorial/right-drawer-tutorial.component.ts +8 -0
  129. package/src/hooks/drawer/right-drawer-tutorial/right-drawer.module.ts +10 -0
  130. package/src/hooks/generic-wizard/index.ts +1 -0
  131. package/src/hooks/generic-wizard/minimal-setup/minimal-setup.component.ts +12 -0
  132. package/src/hooks/generic-wizard/minimal-setup/multiple-entries-one.component.ts +25 -0
  133. package/src/hooks/generic-wizard/minimal-setup/multiple-entries-two.component.ts +25 -0
  134. package/src/hooks/generic-wizard/minimal-setup/stepper-example.component.html +38 -0
  135. package/src/hooks/generic-wizard/minimal-setup/stepper-example.component.ts +33 -0
  136. package/src/hooks/generic-wizard/wizard-tabs.ts +22 -0
  137. package/src/hooks/generic-wizard/wizard.component.html +51 -0
  138. package/src/hooks/generic-wizard/wizard.component.ts +86 -0
  139. package/src/hooks/generic-wizard/wizard.module.ts +79 -0
  140. package/src/hooks/hooks.module.ts +19 -0
  141. package/src/hooks/index.ts +1 -0
  142. package/src/hooks/navigator/index.ts +1 -0
  143. package/src/hooks/navigator/navigator.module.ts +21 -0
  144. package/src/hooks/navigator/navigator.ts +35 -0
  145. package/src/hooks/navigator/time-navigator-node/time-navigator-node.component.ts +19 -0
  146. package/src/hooks/navigator-route/basic-view/basic-view.component.html +7 -0
  147. package/src/hooks/navigator-route/basic-view/basic-view.component.ts +18 -0
  148. package/src/hooks/navigator-route/index.ts +1 -0
  149. package/src/hooks/navigator-route/navigator-route.module.ts +27 -0
  150. package/src/hooks/route/device/device-info.component.html +2 -0
  151. package/src/hooks/route/device/device-info.component.ts +13 -0
  152. package/src/hooks/route/device/device-tab-context.component.html +15 -0
  153. package/src/hooks/route/device/device-tab-context.component.ts +13 -0
  154. package/src/hooks/route/index.ts +1 -0
  155. package/src/hooks/route/random.guard.ts +12 -0
  156. package/src/hooks/route/route.module.ts +51 -0
  157. package/src/hooks/state/hook-state.module.ts +25 -0
  158. package/src/hooks/state/hook-with-service-example.component.html +29 -0
  159. package/src/hooks/state/hook-with-service-example.component.ts +36 -0
  160. package/src/hooks/stepper/basic-view/basic-view.component.html +17 -0
  161. package/src/hooks/stepper/basic-view/basic-view.component.ts +31 -0
  162. package/src/hooks/stepper/index.ts +4 -0
  163. package/src/hooks/stepper/stepper-hook.module.ts +53 -0
  164. package/src/hooks/stepper/steps/step1.component.html +24 -0
  165. package/src/hooks/stepper/steps/step1.component.ts +18 -0
  166. package/src/hooks/stepper/steps/step2.component.html +7 -0
  167. package/src/hooks/stepper/steps/step2.component.ts +11 -0
  168. package/src/hooks/tabs/awesome/awesome.component.html +7 -0
  169. package/src/hooks/tabs/awesome/awesome.component.ts +21 -0
  170. package/src/hooks/tabs/index.ts +1 -0
  171. package/src/hooks/tabs/outstanding/outstanding.component.html +22 -0
  172. package/src/hooks/tabs/outstanding/outstanding.component.ts +27 -0
  173. package/src/hooks/tabs/tab.ts +44 -0
  174. package/src/hooks/tabs/tabs.module.ts +37 -0
  175. package/src/hooks/version/custom-version-factory.service.ts +49 -0
  176. package/src/hooks/version/index.ts +1 -0
  177. package/src/hooks/version/version.module.ts +11 -0
  178. package/src/i18n.ts +18 -0
  179. package/src/input/range-input-example.component.ts +29 -0
  180. package/src/input/range-input-example.module.ts +19 -0
  181. package/src/lazy/component-one.component.ts +28 -0
  182. package/src/lazy/component-two.component.ts +17 -0
  183. package/src/lazy/index.ts +1 -0
  184. package/src/lazy/lazy-loaded.module.ts +21 -0
  185. package/src/lazy/lazy-routing.module.ts +21 -0
  186. package/src/lazy/lazy.hooks.ts +24 -0
  187. package/src/lazy-widget/index.ts +1 -0
  188. package/src/lazy-widget/lazy-widget-config/index.ts +1 -0
  189. package/src/lazy-widget/lazy-widget-config/lazy-widget-config.component.ts +10 -0
  190. package/src/lazy-widget/lazy-widget-view/index.ts +1 -0
  191. package/src/lazy-widget/lazy-widget-view/lazy-widget-view.component.ts +10 -0
  192. package/src/lazy-widget/lazy-widget.module.ts +27 -0
  193. package/src/list/index.ts +1 -0
  194. package/src/list/list/list-check/list-check.component.html +35 -0
  195. package/src/list/list/list-check/list-check.component.ts +47 -0
  196. package/src/list/list/list-check/list-check.module.ts +21 -0
  197. package/src/list/list/list-timeline/list-timeline.component.html +30 -0
  198. package/src/list/list/list-timeline/list-timeline.component.ts +46 -0
  199. package/src/list/list/list-timeline/list-timeline.module.ts +21 -0
  200. package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.html +105 -0
  201. package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.ts +70 -0
  202. package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.module.ts +22 -0
  203. package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.html +37 -0
  204. package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.ts +69 -0
  205. package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.module.ts +24 -0
  206. package/src/list/lists.module.ts +17 -0
  207. package/src/main.ts +23 -0
  208. package/src/maps/cluster-map/cluster-map-example.component.html +60 -0
  209. package/src/maps/cluster-map/cluster-map-example.component.ts +39 -0
  210. package/src/maps/cluster-map/cluster-map-example.module.ts +24 -0
  211. package/src/maps/cluster-map-root-node/cluster-map-root-node-example.component.html +54 -0
  212. package/src/maps/cluster-map-root-node/cluster-map-root-node-example.component.ts +54 -0
  213. package/src/maps/cluster-map-root-node/cluster-map-root-node-example.module.ts +26 -0
  214. package/src/maps/map-examples.module.ts +18 -0
  215. package/src/maps/map-popup/map-popup-example.component.html +34 -0
  216. package/src/maps/map-popup/map-popup-example.component.ts +43 -0
  217. package/src/maps/map-popup/map-popup-example.module.ts +24 -0
  218. package/src/maps/simple-map/simple-map-example.component.html +59 -0
  219. package/src/maps/simple-map/simple-map-example.component.ts +70 -0
  220. package/src/maps/simple-map/simple-map-example.module.ts +24 -0
  221. package/src/modal/confirm-modal/confirm-modal-example.component.ts +69 -0
  222. package/src/modal/confirm-modal/confirm-modal-example.module.ts +22 -0
  223. package/src/modal/ngx-modal/ngx-modal-example.component.ts +34 -0
  224. package/src/modal/ngx-modal/ngx-modal-example.module.ts +22 -0
  225. package/src/modal/simple-modal/modal-example.component.ts +34 -0
  226. package/src/modal/simple-modal/modal.example.module.ts +21 -0
  227. package/src/polyfills.ts +33 -0
  228. package/src/popconfirm/pop-confirm-example.component.ts +61 -0
  229. package/src/popconfirm/pop-confirm-example.module.ts +23 -0
  230. package/src/properties-list/properties-list-example.component.ts +49 -0
  231. package/src/properties-list/properties-list-example.module.ts +21 -0
  232. package/src/provider-configuration/index.ts +3 -0
  233. package/src/provider-configuration/introduction-example/introduction.component.ts +69 -0
  234. package/src/provider-configuration/introduction-example/introduction.module.ts +21 -0
  235. package/src/provider-configuration/provider-configuration-example/demo-provider.guard.ts +9 -0
  236. package/src/provider-configuration/provider-configuration-example/provider-configuration.module.ts +48 -0
  237. package/src/quick-link/quick-link-example.component.ts +39 -0
  238. package/src/quick-link/quick-link-example.module.ts +23 -0
  239. package/src/realtime/index.ts +1 -0
  240. package/src/realtime/realtime-tutorial.component.html +52 -0
  241. package/src/realtime/realtime-tutorial.component.ts +91 -0
  242. package/src/realtime/realtime-tutorial.module.ts +21 -0
  243. package/src/redirect-to-last-route/index.ts +1 -0
  244. package/src/redirect-to-last-route/redirect-to-last-route-guard.service.ts +16 -0
  245. package/src/redirect-to-last-route/redirect-to-last-route.module.ts +20 -0
  246. package/src/redirect-to-last-route/view-context-redirect.service.ts +53 -0
  247. package/src/selector/asset-selector-example/child-devices/asset-selector-child-devices.component.ts +49 -0
  248. package/src/selector/asset-selector-example/child-devices/asset-selector-child-devices.module.ts +24 -0
  249. package/src/selector/asset-selector-example/column-header/asset-selector-column-header.component.ts +46 -0
  250. package/src/selector/asset-selector-example/column-header/asset-selector-column-header.module.ts +24 -0
  251. package/src/selector/asset-selector-example/different-root/asset-selector-different-root.component.ts +87 -0
  252. package/src/selector/asset-selector-example/different-root/asset-selector-different-root.module.ts +24 -0
  253. package/src/selector/asset-selector-example/general-example/asset-selector-example.component.html +342 -0
  254. package/src/selector/asset-selector-example/general-example/asset-selector-example.component.ts +34 -0
  255. package/src/selector/asset-selector-example/general-example/asset-selector-example.module.ts +22 -0
  256. package/src/selector/asset-selector-example/global-search/asset-selector-global-search.component.ts +50 -0
  257. package/src/selector/asset-selector-example/global-search/asset-selector-global-search.module.ts +24 -0
  258. package/src/selector/asset-selector-example/miller-columns-options/asset-selector-miller-example.component.ts +85 -0
  259. package/src/selector/asset-selector-example/miller-columns-options/asset-selector-miller-example.module.ts +26 -0
  260. package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.component.ts +50 -0
  261. package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.module.ts +24 -0
  262. package/src/selector/asset-selector-example/only-devices/asset-selector-only-devices.component.ts +44 -0
  263. package/src/selector/asset-selector-example/only-devices/asset-selector-only-devices.module.ts +24 -0
  264. package/src/selector/asset-selector-example/single-search/asset-selector-single-search.component.ts +71 -0
  265. package/src/selector/asset-selector-example/single-search/asset-selector-single-search.module.ts +24 -0
  266. package/src/selector/asset-selector-example/single-select/asset-selector-single-select.component.ts +47 -0
  267. package/src/selector/asset-selector-example/single-select/asset-single-select.module.ts +24 -0
  268. package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.component.ts +62 -0
  269. package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.module.ts +24 -0
  270. package/src/selector/asset-selector-example/tree-options/asset-selector-tree-example.component.ts +83 -0
  271. package/src/selector/asset-selector-example/tree-options/asset-selector-tree-example.module.ts +26 -0
  272. package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.component.ts +75 -0
  273. package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.module.ts +24 -0
  274. package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.component.ts +66 -0
  275. package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.module.ts +24 -0
  276. package/src/selector/datapoint-selection-example/context-example/datapoint-selection-context-example.component.ts +54 -0
  277. package/src/selector/datapoint-selection-example/context-example/datapoint-selection-context-example.module.ts +24 -0
  278. package/src/selector/datapoint-selection-example/dragdrop-example/datapoint-selection-dragdrop-example.component.ts +43 -0
  279. package/src/selector/datapoint-selection-example/dragdrop-example/datapoint-selection-dragdrop-example.module.ts +24 -0
  280. package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.component.html +202 -0
  281. package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.component.ts +51 -0
  282. package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.module.ts +24 -0
  283. package/src/selector/datapoint-selection-example/list-example/datapoint-selection-list-example.component.ts +42 -0
  284. package/src/selector/datapoint-selection-example/list-example/datapoint-selection-list-example.module.ts +24 -0
  285. package/src/selector/datapoint-selection-example/modal-example/datapoint-selection-modal-example.component.ts +51 -0
  286. package/src/selector/datapoint-selection-example/modal-example/datapoint-selection-modal-example.module.ts +24 -0
  287. package/src/selector/datapoint-selection-example/no-templates-example/datapoint-selection-notemplates-example.component.ts +43 -0
  288. package/src/selector/datapoint-selection-example/no-templates-example/datapoint-selection-notemplates-example.module.ts +24 -0
  289. package/src/selector/datapoint-selection-example/selector/datapoint-selection-selector-example.component.ts +43 -0
  290. package/src/selector/datapoint-selection-example/selector/datapoint-selection-selector-example.module.ts +24 -0
  291. package/src/selector/datapoint-selection-example/validation-example/datapoint-selection-validation-example.component.ts +46 -0
  292. package/src/selector/datapoint-selection-example/validation-example/datapoint-selection-validation-example.module.ts +24 -0
  293. package/src/standalone-demo/index.ts +1 -0
  294. package/src/standalone-demo/standalone-component/standalone-component.component.html +4 -0
  295. package/src/standalone-demo/standalone-component/standalone-component.component.ts +11 -0
  296. package/src/standalone-demo/standalone-demo.module.ts +23 -0
  297. package/src/stepper/device-stepper.component.html +70 -0
  298. package/src/stepper/device-stepper.component.ts +98 -0
  299. package/src/stepper/device.model.ts +5 -0
  300. package/src/stepper/index.ts +1 -0
  301. package/src/stepper/stepper.component.ts +19 -0
  302. package/src/stepper/stepper.module.ts +24 -0
  303. package/src/stepper/stepper.service.ts +32 -0
  304. package/src/time/time-picker-example.component.ts +19 -0
  305. package/src/time/time-picker-example.module.ts +21 -0
  306. package/src/translations/date-translation/c8y-translation/c8y-date-translation.component.ts +23 -0
  307. package/src/translations/date-translation/c8y-translation/c8y-date-translation.module.ts +22 -0
  308. package/src/translations/date-translation/ng-translation/date-translation.component.ts +17 -0
  309. package/src/translations/date-translation/ng-translation/date-translation.module.ts +22 -0
  310. package/src/translations/dynamic-form-translation/dynamic-form-translation.component.ts +58 -0
  311. package/src/translations/dynamic-form-translation/dynamic-form-translation.module.ts +22 -0
  312. package/src/translations/index.ts +1 -0
  313. package/src/translations/locales/it.po +18 -0
  314. package/src/translations/locales/pt_BR.po +33 -0
  315. package/src/translations/new-language/new-language.component.html +45 -0
  316. package/src/translations/new-language/new-language.component.ts +19 -0
  317. package/src/translations/new-language/new-language.module.ts +21 -0
  318. package/src/translations/new-translate/new-translation.component.html +92 -0
  319. package/src/translations/new-translate/new-translation.component.ts +9 -0
  320. package/src/translations/new-translate/new-translation.module.ts +22 -0
  321. package/src/translations/text-translation/gettext-translation/text-translation-gettext.component.ts +18 -0
  322. package/src/translations/text-translation/gettext-translation/text-translation-gettext.module.ts +22 -0
  323. package/src/translations/text-translation/ngNonBindable-translation/text-translation-ngnonbindable.component.ts +22 -0
  324. package/src/translations/text-translation/ngNonBindable-translation/text-translation-ngnonbindable.module.ts +24 -0
  325. package/src/translations/text-translation/service-translation/text-translation-by-service.component.ts +38 -0
  326. package/src/translations/text-translation/service-translation/text-translation-by-service.module.ts +24 -0
  327. package/src/translations/translation-tabs.ts +50 -0
  328. package/src/translations/translations.module.ts +18 -0
  329. package/src/user-menu/index.ts +1 -0
  330. package/src/user-menu/user-menu.module.ts +13 -0
  331. package/src/user-menu/user-menu.ts +26 -0
  332. package/src/widget/demo-widget-config.component.ts +81 -0
  333. package/src/widget/demo-widget.component.ts +35 -0
  334. package/src/widget/demo-widget.module.ts +47 -0
  335. package/src/widget/index.ts +1 -0
  336. package/src/widget-resolvers/alternative-event.resolver.ts +21 -0
  337. package/src/widget-resolvers/event-property.resolver.ts +52 -0
  338. package/src/widget-resolvers/event.resolver.ts +100 -0
  339. package/src/widget-resolvers/index.ts +1 -0
  340. package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.html +31 -0
  341. package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.ts +67 -0
  342. package/src/widget-resolvers/widget-resolvers.component.html +13 -0
  343. package/src/widget-resolvers/widget-resolvers.component.ts +37 -0
  344. package/src/widget-resolvers/widget-resolvers.module.ts +50 -0
  345. package/tsconfig.app.json +18 -0
@@ -0,0 +1,11 @@
1
+ import { Component } from '@angular/core';
2
+ import { HeaderModule } from '@c8y/ngx-components';
3
+
4
+ @Component({
5
+ selector: 'tut-cascading-style-sheets-example',
6
+ template: `<c8y-title>CSS component styles</c8y-title>`,
7
+ styleUrls: ['./cascading-style-sheets-example.component.css'],
8
+ standalone: true,
9
+ imports: [HeaderModule]
10
+ })
11
+ export class CascadingStyleSheetsExampleComponent {}
@@ -0,0 +1,26 @@
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: 'component-styles/css',
10
+ loadComponent: () =>
11
+ import('./cascading-style-sheets-example.component').then(
12
+ m => m.CascadingStyleSheetsExampleComponent
13
+ )
14
+ }),
15
+ hookNavigator(
16
+ new NavigatorNode({
17
+ path: '/component-styles/css',
18
+ label: 'CSS',
19
+ icon: 'c8y-css',
20
+ priority: 79,
21
+ parent: 'Component styles'
22
+ })
23
+ )
24
+ ]
25
+ })
26
+ export class CascadingStyleSheetsExampleModule {}
@@ -0,0 +1,14 @@
1
+ @primary-color:#3bbfce;
2
+ @secundary-color:#2b9eab;
3
+ @margin:8px;
4
+
5
+ .content-navigation {
6
+ border-color: @secundary-color;
7
+ color: @secundary-color;
8
+ }
9
+
10
+ .border {
11
+ padding: 8px;
12
+ margin: @margin;
13
+ border-color: #3bbfce;
14
+ }
@@ -0,0 +1,11 @@
1
+ import { Component } from '@angular/core';
2
+ import { HeaderModule } from '@c8y/ngx-components';
3
+
4
+ @Component({
5
+ selector: 'tut-leaner-style-sheets-example',
6
+ template: `<c8y-title>LESS component styles</c8y-title>`,
7
+ styleUrls: ['./leaner-style-sheets-example.component.less'],
8
+ standalone: true,
9
+ imports: [HeaderModule]
10
+ })
11
+ export class LeanerStyleSheetsExampleComponent {}
@@ -0,0 +1,26 @@
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: 'component-styles/less',
10
+ loadComponent: () =>
11
+ import('./leaner-style-sheets-example.component').then(
12
+ m => m.LeanerStyleSheetsExampleComponent
13
+ )
14
+ }),
15
+ hookNavigator(
16
+ new NavigatorNode({
17
+ path: '/component-styles/less',
18
+ label: 'LESS',
19
+ icon: 'c8y-css',
20
+ priority: 79,
21
+ parent: 'Component styles'
22
+ })
23
+ )
24
+ ]
25
+ })
26
+ export class LeanerStyleSheetsExampleModule {}
@@ -0,0 +1,13 @@
1
+ $primary-color: #3bbfce;
2
+ $margin: 16px;
3
+
4
+ .content-navigation {
5
+ border-color: $primary-color;
6
+ color: darken($primary-color, 10%);
7
+ }
8
+
9
+ .border {
10
+ padding: calc($margin / 2);
11
+ margin: calc($margin / 2);
12
+ border-color: $primary-color;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { Component } from '@angular/core';
2
+ import { HeaderModule } from '@c8y/ngx-components';
3
+
4
+ @Component({
5
+ selector: 'tut-syntactically-awesome-style-sheets-example',
6
+ template: `<c8y-title>SCSS component styles</c8y-title>`,
7
+ styleUrls: ['./syntactically-awesome-style-sheets-example.component.scss'],
8
+ standalone: true,
9
+ imports: [HeaderModule]
10
+ })
11
+ export class SyntacticallyAwesomeStyleSheetsExampleComponent {}
@@ -0,0 +1,26 @@
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: 'component-styles/sass',
10
+ loadComponent: () =>
11
+ import('./syntactically-awesome-style-sheets-example.component').then(
12
+ m => m.SyntacticallyAwesomeStyleSheetsExampleComponent
13
+ )
14
+ }),
15
+ hookNavigator(
16
+ new NavigatorNode({
17
+ path: '/component-styles/sass',
18
+ label: 'SASS',
19
+ icon: 'c8y-css',
20
+ priority: 79,
21
+ parent: 'Component styles'
22
+ })
23
+ )
24
+ ]
25
+ })
26
+ export class SyntacticallyAwesomeStyleSheetsExampleModule {}
@@ -0,0 +1,32 @@
1
+ import { Component } from '@angular/core';
2
+ import { CoreModule, Widget } from '@c8y/ngx-components';
3
+ import { ContextDashboardModule } from '@c8y/ngx-components/context-dashboard';
4
+ import { CommonModule } from '@angular/common';
5
+
6
+ @Component({
7
+ selector: 'app-context-dashboard',
8
+ template: `<c8y-title>Context dashboard</c8y-title>
9
+ <c8y-context-dashboard
10
+ name="example-widget"
11
+ [defaultWidgets]="defaultWidgets"
12
+ [canDelete]="false"
13
+ ></c8y-context-dashboard> `,
14
+ standalone: true,
15
+ imports: [ContextDashboardModule, CoreModule, CommonModule]
16
+ })
17
+ export class ContextDashboardComponent {
18
+ defaultWidgets: Widget[] = [
19
+ {
20
+ _x: 3,
21
+ _y: 0,
22
+ _width: 6,
23
+ _height: 6,
24
+ componentId: 'angular.widget.demo',
25
+ config: {
26
+ text: 'Welcome to a context dashboard'
27
+ },
28
+ title: 'Hello',
29
+ id: 'some_unique_id'
30
+ }
31
+ ];
32
+ }
@@ -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: 'dashboards/context',
8
+ loadComponent: () =>
9
+ import('./context-dashboard.component').then(m => m.ContextDashboardComponent)
10
+ }),
11
+ hookNavigator(
12
+ new NavigatorNode({
13
+ label: 'Context dashboard',
14
+ path: '/dashboards/context',
15
+ icon: 'th-list',
16
+ priority: 0,
17
+ parent: 'Dashboards'
18
+ })
19
+ )
20
+ ]
21
+ })
22
+ export class ContextDashboardModule {}
@@ -0,0 +1,180 @@
1
+ <c8y-title>Custom dashboard</c8y-title>
2
+
3
+ <!--TODO: align action bar-->
4
+ <c8y-action-bar-item [placement]="'right'">
5
+ <button
6
+ class="btn btn-link"
7
+ title="{{ 'Add random' | translate }}"
8
+ type="button"
9
+ (click)="addRandom()"
10
+ >
11
+ <i c8yIcon="plus-circle"></i>
12
+ {{ 'Add random' | translate }}
13
+ </button>
14
+ </c8y-action-bar-item>
15
+ <c8y-action-bar-item [placement]="'right'">
16
+ <button
17
+ class="btn btn-link"
18
+ title="{{ 'Toggle freeze' | translate }}"
19
+ (click)="isFrozen = !isFrozen"
20
+ >
21
+ <i [c8yIcon]="isFrozen ? 'lock' : 'unlock'"></i>
22
+ {{ 'Toggle freeze' | translate }}
23
+ </button>
24
+ </c8y-action-bar-item>
25
+
26
+ <c8y-help src="/docs/cockpit/working-with-dashboards/#working-with-dashboards"></c8y-help>
27
+
28
+ <c8y-dashboard (dashboardChange)="dashboardChange($event)">
29
+ <c8y-dashboard-child
30
+ [class]="{
31
+ 'panel-title-hidden': true
32
+ }"
33
+ title="dynamic"
34
+ [isFrozen]="isFrozen"
35
+ *ngFor="let widget of widgets"
36
+ [data]="widget"
37
+ [width]="widget.width"
38
+ [height]="widget.height"
39
+ #current
40
+ >
41
+ <div class="card-block">
42
+ x: {{ current.x }}
43
+ <br />
44
+ y: {{ current.y }}
45
+ <br />
46
+ width: {{ current.width }}
47
+ <br />
48
+ height: {{ current.height }}
49
+ <br />
50
+ </div>
51
+ </c8y-dashboard-child>
52
+ <c8y-dashboard-child
53
+ [class]="{
54
+ 'panel-content-branded': true,
55
+ 'panel-title-overlay': true
56
+ }"
57
+ #cpWidget
58
+ [isFrozen]="isFrozen"
59
+ [x]="0"
60
+ [y]="1"
61
+ [width]="3"
62
+ [height]="2"
63
+ >
64
+ <c8y-dashboard-child-title>
65
+ <span>World!</span>
66
+ </c8y-dashboard-child-title>
67
+ <div class="card-block">
68
+ x: {{ cpWidget.x }}
69
+ <br />
70
+ y: {{ cpWidget.y }}
71
+ <br />
72
+ width: {{ cpWidget.width }}
73
+ <br />
74
+ height: {{ cpWidget.height }}
75
+ <br />
76
+ </div>
77
+ </c8y-dashboard-child>
78
+ <c8y-dashboard-child
79
+ [class]="{ 'panel-content-dark': true }"
80
+ #cpWidget2
81
+ [isFrozen]="isFrozen"
82
+ [x]="8"
83
+ [y]="1"
84
+ [width]="4"
85
+ [height]="4"
86
+ >
87
+ <c8y-dashboard-child-title>
88
+ <span>Hello!</span>
89
+ </c8y-dashboard-child-title>
90
+ <c8y-dashboard-child-action>
91
+ <a
92
+ href=""
93
+ (click)="cpWidget2.isFrozen = !cpWidget2.isFrozen; (false)"
94
+ >
95
+ <i [c8yIcon]="cpWidget2.isFrozen ? 'lock' : 'unlock'"></i>
96
+ Toggle freeze
97
+ </a>
98
+ </c8y-dashboard-child-action>
99
+ <div class="card-block">
100
+ x: {{ cpWidget2.x }}
101
+ <br />
102
+ y: {{ cpWidget2.y }}
103
+ <br />
104
+ width: {{ cpWidget2.width }}
105
+ <br />
106
+ height: {{ cpWidget2.height }}
107
+ <br />
108
+ </div>
109
+ </c8y-dashboard-child>
110
+
111
+ <c8y-dashboard-child
112
+ [class]="{ 'panel-content-transparent': true }"
113
+ #cpWidget3
114
+ [isFrozen]="isFrozen"
115
+ [x]="0"
116
+ [y]="3"
117
+ [width]="8"
118
+ [height]="2"
119
+ >
120
+ <c8y-dashboard-child-title *ngIf="showTitle">
121
+ <span>Another!</span>
122
+ </c8y-dashboard-child-title>
123
+ <c8y-dashboard-child-action>
124
+ <a
125
+ href=""
126
+ (click)="showTitle = !showTitle; (false)"
127
+ >
128
+ <i [c8yIcon]="'heading'"></i>
129
+ Hide/show title
130
+ </a>
131
+ </c8y-dashboard-child-action>
132
+ <c8y-dashboard-child-action>
133
+ <a
134
+ href=""
135
+ (click)="cpWidget3.isFrozen = !cpWidget3.isFrozen; (false)"
136
+ >
137
+ <i [c8yIcon]="cpWidget3.isFrozen ? 'lock' : 'unlock'"></i>
138
+ Toggle freeze
139
+ </a>
140
+ </c8y-dashboard-child-action>
141
+ <div class="card-block">
142
+ x: {{ cpWidget3.x }}
143
+ <br />
144
+ y: {{ cpWidget3.y }}
145
+ <br />
146
+ width: {{ cpWidget3.width }}
147
+ <br />
148
+ height: {{ cpWidget3.height }}
149
+ <br />
150
+ </div>
151
+ </c8y-dashboard-child>
152
+
153
+ <!-- A dashboard child with a dynamic component -->
154
+ <c8y-dashboard-child
155
+ [isFrozen]="isFrozen"
156
+ [width]="10"
157
+ [height]="4"
158
+ >
159
+ <c8y-dashboard-child-title>
160
+ <span>Dynamic component demo</span>
161
+ </c8y-dashboard-child-title>
162
+ <c8y-dashboard-child-action>
163
+ <button
164
+ title="{{ 'Configure this widget' | translate }}"
165
+ type="button"
166
+ (click)="editComponent = !editComponent; (false)"
167
+ >
168
+ <i [c8yIcon]="'cog'"></i>
169
+ {{ 'Configure this widget' | translate }}
170
+ </button>
171
+ </c8y-dashboard-child-action>
172
+ <div class="card-block">
173
+ <c8y-dynamic-component
174
+ componentId="angular.widget.demo"
175
+ [config]="{ text: 'Hello world' }"
176
+ [mode]="editComponent ? 'config' : 'component'"
177
+ ></c8y-dynamic-component>
178
+ </div>
179
+ </c8y-dashboard-child>
180
+ </c8y-dashboard>
@@ -0,0 +1,52 @@
1
+ import { Component } from '@angular/core';
2
+ import { DashboardChildDimension, CoreModule } from '@c8y/ngx-components';
3
+ import { CommonModule } from '@angular/common';
4
+ import { AssetSelectorModule } from '@c8y/ngx-components/assets-navigator';
5
+ import { DatapointSelectorModule } from '@c8y/ngx-components/datapoint-selector';
6
+ import { DashboardWidgetDemoModule } from '../../widget';
7
+
8
+ @Component({
9
+ selector: 'custom-dashboard',
10
+ templateUrl: './custom-dashboard.component.html',
11
+ standalone: true,
12
+ imports: [
13
+ CommonModule,
14
+ CoreModule,
15
+ AssetSelectorModule,
16
+ DatapointSelectorModule,
17
+ // TODO: REMOVE ME
18
+ DashboardWidgetDemoModule
19
+ ]
20
+ })
21
+ export class CustomDashboardComponent {
22
+ widgets = [
23
+ { x: 0, y: 0, width: 12, height: 1 },
24
+ { x: 3, y: 1, width: 5, height: 2 }
25
+ ] as DashboardChildDimension[];
26
+ isFrozen = false;
27
+ showTitle = true;
28
+ editComponent = false;
29
+
30
+ /**
31
+ * Add a random child to the dashboard.
32
+ */
33
+ addRandom() {
34
+ let width = Math.round(Math.random() * 10);
35
+ if (width < 2) {
36
+ width += 2;
37
+ }
38
+
39
+ let height = Math.round(Math.random() * 10);
40
+ if (height < 1) {
41
+ height += 1;
42
+ }
43
+ this.widgets.push({ width, height });
44
+ }
45
+
46
+ /**
47
+ * Called when the user change the dashboard
48
+ */
49
+ dashboardChange(event) {
50
+ console.log(event);
51
+ }
52
+ }
@@ -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: 'dashboards/custom',
8
+ loadComponent: () =>
9
+ import('./custom-dashboard.component').then(m => m.CustomDashboardComponent)
10
+ }),
11
+ hookNavigator(
12
+ new NavigatorNode({
13
+ label: 'Custom dashboard',
14
+ path: '/dashboards/custom',
15
+ icon: 'th-large',
16
+ priority: 3,
17
+ parent: 'Dashboards'
18
+ })
19
+ )
20
+ ]
21
+ })
22
+ export class CustomDashboardModule {}
@@ -0,0 +1,4 @@
1
+ export * from './context-dashboard/context-dashboard.module';
2
+ export * from './custom-dashboard/custom-dashboard.module';
3
+ export * from './named-context-dashboard/named-context-dashboard.module';
4
+ export * from './widget-dashboard/widget-dashboard.module';
@@ -0,0 +1,51 @@
1
+ import { Component } from '@angular/core';
2
+ import { ActivatedRoute } from '@angular/router';
3
+ import { IManagedObject } from '@c8y/client';
4
+ import { CoreModule, Widget } from '@c8y/ngx-components';
5
+ import { CommonModule } from '@angular/common';
6
+ import { ContextDashboardModule } from '@c8y/ngx-components/context-dashboard';
7
+
8
+ @Component({
9
+ selector: 'app-named-context-dashboard',
10
+ template: `<c8y-title>Named context dashboard</c8y-title>
11
+ <!-- TODO: verify if device is found and everything is displaying properly -->
12
+ <c8y-context-dashboard
13
+ [name]="name"
14
+ [defaultWidgets]="defaultWidgets"
15
+ [context]="context"
16
+ [canDelete]="false"
17
+ ></c8y-context-dashboard> `,
18
+ standalone: true,
19
+ imports: [CommonModule, CoreModule, ContextDashboardModule]
20
+ })
21
+ export class NamedContextDashboardComponent {
22
+ context: any;
23
+ name = 'myCustomDeviceDashboardName';
24
+ defaultWidgets: Widget[] = [];
25
+
26
+ constructor(private route: ActivatedRoute) {
27
+ this.context = this.route.parent.snapshot.data;
28
+ if (this.context && this.context.contextData) {
29
+ const device: IManagedObject = this.context.contextData;
30
+ this.name = this.name + '-' + device.id;
31
+ this.defaultWidgets = [
32
+ {
33
+ _x: 3,
34
+ _y: 0,
35
+ _width: 6,
36
+ _height: 6,
37
+ componentId: 'angular.widget.demo',
38
+ config: {
39
+ device: {
40
+ id: device.id,
41
+ name: device.name
42
+ },
43
+ text: 'Welcome to a context dashboard'
44
+ },
45
+ title: 'Hello',
46
+ id: 'some_unique_id'
47
+ }
48
+ ];
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,37 @@
1
+ import { NgModule, inject } from '@angular/core';
2
+ import { EmptyComponent, ViewContext, hookNavigator, hookRoute } from '@c8y/ngx-components';
3
+ import { ViewContextRedirectService } from '../../redirect-to-last-route/view-context-redirect.service';
4
+
5
+ @NgModule({
6
+ providers: [
7
+ hookRoute([
8
+ {
9
+ label: 'Named context Dashboard',
10
+ icon: 'info',
11
+ path: 'named-context',
12
+ context: ViewContext.Device,
13
+ loadComponent: () =>
14
+ import('./named-context-dashboard.component').then(m => m.NamedContextDashboardComponent)
15
+ },
16
+ {
17
+ path: 'dashboards/named-context',
18
+ canActivate: [
19
+ () =>
20
+ inject(ViewContextRedirectService).redirectToFirstItemOf(
21
+ ViewContext.Device,
22
+ 'named-context'
23
+ )
24
+ ],
25
+ component: EmptyComponent
26
+ }
27
+ ]),
28
+ hookNavigator({
29
+ label: 'Named-context dashboard',
30
+ icon: 'list',
31
+ priority: 1,
32
+ path: `/dashboards/named-context`,
33
+ parent: 'Dashboards'
34
+ })
35
+ ]
36
+ })
37
+ export class NamedContextDashboardModule {}
@@ -0,0 +1,51 @@
1
+ import { Component } from '@angular/core';
2
+ import { ActivatedRoute } from '@angular/router';
3
+ import { IManagedObject } from '@c8y/client';
4
+ import { CoreModule, Widget } from '@c8y/ngx-components';
5
+ import { CommonModule } from '@angular/common';
6
+ import { ContextDashboardModule } from '@c8y/ngx-components/context-dashboard';
7
+
8
+ @Component({
9
+ selector: 'app-service-dashboard',
10
+ template: `<c8y-title>Service dashboard</c8y-title>
11
+ <!-- TODO: check what to do with this example -->
12
+ <c8y-context-dashboard
13
+ [name]="name"
14
+ [defaultWidgets]="defaultWidgets"
15
+ [context]="context"
16
+ [canDelete]="false"
17
+ ></c8y-context-dashboard>`,
18
+ standalone: true,
19
+ imports: [CommonModule, CoreModule, ContextDashboardModule]
20
+ })
21
+ export class ServiceDashboardComponent {
22
+ context: any;
23
+ name = 'myCustomDeviceDashboardName';
24
+ defaultWidgets: Widget[] = [];
25
+
26
+ constructor(private route: ActivatedRoute) {
27
+ this.context = this.route.parent.snapshot.data;
28
+ if (this.context && this.context.contextData) {
29
+ const device: IManagedObject = this.context.contextData;
30
+ this.name = this.name + '-' + device.id;
31
+ this.defaultWidgets = [
32
+ {
33
+ _x: 3,
34
+ _y: 0,
35
+ _width: 6,
36
+ _height: 6,
37
+ componentId: 'angular.widget.demo',
38
+ config: {
39
+ device: {
40
+ id: device.id,
41
+ name: device.name
42
+ },
43
+ text: 'Welcome to a context dashboard'
44
+ },
45
+ title: 'Hello',
46
+ id: 'some_unique_id'
47
+ }
48
+ ];
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,35 @@
1
+ import { NgModule, inject } from '@angular/core';
2
+ import { EmptyComponent, ViewContext, hookNavigator, hookRoute } from '@c8y/ngx-components';
3
+ import { ViewContextRedirectService } from '../../redirect-to-last-route/view-context-redirect.service';
4
+
5
+ @NgModule({
6
+ providers: [
7
+ hookRoute([
8
+ {
9
+ path: 'service-dashboard',
10
+ context: ViewContext.Service,
11
+ loadComponent: () =>
12
+ import('./service-dashboard.component').then(m => m.ServiceDashboardComponent)
13
+ },
14
+ {
15
+ path: 'dashboards/service-dashboard',
16
+ canActivate: [
17
+ () =>
18
+ inject(ViewContextRedirectService).redirectToFirstItemOf(
19
+ ViewContext.Service,
20
+ 'service-dashboard'
21
+ )
22
+ ],
23
+ component: EmptyComponent
24
+ }
25
+ ]),
26
+ hookNavigator({
27
+ label: 'Service dashboard',
28
+ path: '/dashboards/service-dashboard',
29
+ icon: 'th-list',
30
+ priority: -2,
31
+ parent: 'Dashboards'
32
+ })
33
+ ]
34
+ })
35
+ export class ServiceDashboardModule {}