@things-factory/kpi 1.0.0-alpha.5 → 9.0.9

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 (309) hide show
  1. package/README.md +74 -0
  2. package/client/pages/kpi/kpi-list-page.ts +97 -47
  3. package/client/pages/kpi/kpi-overview-sample.ts +260 -0
  4. package/client/pages/kpi/kpi-overview.ts +271 -0
  5. package/client/pages/kpi-category/kpi-category-list-page.ts +39 -50
  6. package/client/pages/kpi-dashboard/kpi-alert-panel.ts +114 -0
  7. package/client/pages/kpi-dashboard/kpi-dashboard.ts +285 -0
  8. package/client/pages/kpi-dashboard/kpi-grade-visualization.ts +75 -0
  9. package/client/pages/kpi-dashboard/kpi-history-viewer.ts +58 -0
  10. package/client/pages/kpi-dashboard/kpi-list-summary.ts +100 -0
  11. package/client/pages/kpi-dashboard/kpi-performance-summary.ts +124 -0
  12. package/client/pages/kpi-dashboard/kpi-value-entry.ts +78 -0
  13. package/client/pages/kpi-grade/kpi-grade-list-page.ts +58 -68
  14. package/client/pages/kpi-history/kpi-history-list-page.ts +146 -0
  15. package/client/pages/kpi-metric/kpi-metric-list-page.ts +67 -63
  16. package/client/pages/kpi-value/kpi-value-list-page.ts +73 -72
  17. package/client/pages/kpi-value/kpi-value-manual-entry-form.ts +168 -0
  18. package/client/pages/kpi-value/kpi-value-manual-entry-page.ts +173 -0
  19. package/client/route.ts +35 -0
  20. package/dist-client/pages/kpi/kpi-importer.js +16 -17
  21. package/dist-client/pages/kpi/kpi-importer.js.map +1 -1
  22. package/dist-client/pages/kpi/kpi-list-page.js +128 -68
  23. package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
  24. package/dist-client/pages/kpi/kpi-overview-sample.d.ts +36 -0
  25. package/dist-client/pages/kpi/kpi-overview-sample.js +264 -0
  26. package/dist-client/pages/kpi/kpi-overview-sample.js.map +1 -0
  27. package/dist-client/pages/kpi/kpi-overview.d.ts +14 -0
  28. package/dist-client/pages/kpi/kpi-overview.js +290 -0
  29. package/dist-client/pages/kpi/kpi-overview.js.map +1 -0
  30. package/dist-client/pages/kpi-category/kpi-category-importer.js +16 -17
  31. package/dist-client/pages/kpi-category/kpi-category-importer.js.map +1 -1
  32. package/dist-client/pages/kpi-category/kpi-category-list-page.js +70 -71
  33. package/dist-client/pages/kpi-category/kpi-category-list-page.js.map +1 -1
  34. package/dist-client/pages/kpi-dashboard/kpi-alert-panel.d.ts +18 -0
  35. package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js +128 -0
  36. package/dist-client/pages/kpi-dashboard/kpi-alert-panel.js.map +1 -0
  37. package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +24 -0
  38. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +305 -0
  39. package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -0
  40. package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.d.ts +12 -0
  41. package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js +82 -0
  42. package/dist-client/pages/kpi-dashboard/kpi-grade-visualization.js.map +1 -0
  43. package/dist-client/pages/kpi-dashboard/kpi-history-viewer.d.ts +11 -0
  44. package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js +65 -0
  45. package/dist-client/pages/kpi-dashboard/kpi-history-viewer.js.map +1 -0
  46. package/dist-client/pages/kpi-dashboard/kpi-list-summary.d.ts +13 -0
  47. package/dist-client/pages/kpi-dashboard/kpi-list-summary.js +115 -0
  48. package/dist-client/pages/kpi-dashboard/kpi-list-summary.js.map +1 -0
  49. package/dist-client/pages/kpi-dashboard/kpi-performance-summary.d.ts +15 -0
  50. package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js +139 -0
  51. package/dist-client/pages/kpi-dashboard/kpi-performance-summary.js.map +1 -0
  52. package/dist-client/pages/kpi-dashboard/kpi-value-entry.d.ts +7 -0
  53. package/dist-client/pages/kpi-dashboard/kpi-value-entry.js +86 -0
  54. package/dist-client/pages/kpi-dashboard/kpi-value-entry.js.map +1 -0
  55. package/dist-client/pages/kpi-grade/kpi-grade-importer.js +16 -17
  56. package/dist-client/pages/kpi-grade/kpi-grade-importer.js.map +1 -1
  57. package/dist-client/pages/kpi-grade/kpi-grade-list-page.js +89 -89
  58. package/dist-client/pages/kpi-grade/kpi-grade-list-page.js.map +1 -1
  59. package/dist-client/pages/kpi-history/kpi-history-list-page.d.ts +16 -0
  60. package/dist-client/pages/kpi-history/kpi-history-list-page.js +155 -0
  61. package/dist-client/pages/kpi-history/kpi-history-list-page.js.map +1 -0
  62. package/dist-client/pages/kpi-metric/kpi-metric-importer.js +16 -17
  63. package/dist-client/pages/kpi-metric/kpi-metric-importer.js.map +1 -1
  64. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +98 -84
  65. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
  66. package/dist-client/pages/kpi-value/kpi-value-importer.js +16 -17
  67. package/dist-client/pages/kpi-value/kpi-value-importer.js.map +1 -1
  68. package/dist-client/pages/kpi-value/kpi-value-list-page.js +104 -93
  69. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
  70. package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.d.ts +14 -0
  71. package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.js +201 -0
  72. package/dist-client/pages/kpi-value/kpi-value-manual-entry-form.js.map +1 -0
  73. package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.d.ts +41 -0
  74. package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.js +180 -0
  75. package/dist-client/pages/kpi-value/kpi-value-manual-entry-page.js.map +1 -0
  76. package/dist-client/route.d.ts +1 -1
  77. package/dist-client/route.js +27 -0
  78. package/dist-client/route.js.map +1 -1
  79. package/dist-client/tsconfig.tsbuildinfo +1 -1
  80. package/dist-server/index.d.ts +2 -1
  81. package/dist-server/index.js +2 -1
  82. package/dist-server/index.js.map +1 -1
  83. package/dist-server/migrations/1752188906708-SeedKpiCategory.d.ts +5 -0
  84. package/dist-server/migrations/1752188906708-SeedKpiCategory.js +56 -0
  85. package/dist-server/migrations/1752188906708-SeedKpiCategory.js.map +1 -0
  86. package/dist-server/migrations/1752190849681-SeedKpi.d.ts +5 -0
  87. package/dist-server/migrations/1752190849681-SeedKpi.js +107 -0
  88. package/dist-server/migrations/1752190849681-SeedKpi.js.map +1 -0
  89. package/dist-server/migrations/1752191090459-SeedKpiGrade.d.ts +5 -0
  90. package/dist-server/migrations/1752191090459-SeedKpiGrade.js +271 -0
  91. package/dist-server/migrations/1752191090459-SeedKpiGrade.js.map +1 -0
  92. package/dist-server/migrations/index.d.ts +1 -0
  93. package/dist-server/migrations/index.js +12 -0
  94. package/dist-server/migrations/index.js.map +1 -0
  95. package/dist-server/routes.d.ts +1 -0
  96. package/dist-server/routes.js +48 -0
  97. package/dist-server/routes.js.map +1 -1
  98. package/dist-server/service/index.d.ts +3 -4
  99. package/dist-server/service/index.js +4 -6
  100. package/dist-server/service/index.js.map +1 -1
  101. package/dist-server/service/kpi/aggregate-kpi.d.ts +8 -0
  102. package/dist-server/service/kpi/aggregate-kpi.js +88 -0
  103. package/dist-server/service/kpi/aggregate-kpi.js.map +1 -0
  104. package/dist-server/service/kpi/event-subscriber.d.ts +2 -0
  105. package/dist-server/service/kpi/event-subscriber.js +10 -0
  106. package/dist-server/service/kpi/event-subscriber.js.map +1 -1
  107. package/dist-server/service/kpi/index.d.ts +2 -1
  108. package/dist-server/service/kpi/kpi-formula.service.d.ts +24 -0
  109. package/dist-server/service/kpi/kpi-formula.service.js +64 -0
  110. package/dist-server/service/kpi/kpi-formula.service.js.map +1 -0
  111. package/dist-server/service/kpi/kpi-history.d.ts +6 -2
  112. package/dist-server/service/kpi/kpi-history.js +29 -11
  113. package/dist-server/service/kpi/kpi-history.js.map +1 -1
  114. package/dist-server/service/kpi/kpi-mutation.d.ts +2 -0
  115. package/dist-server/service/kpi/kpi-mutation.js +215 -10
  116. package/dist-server/service/kpi/kpi-mutation.js.map +1 -1
  117. package/dist-server/service/kpi/kpi-query.d.ts +10 -0
  118. package/dist-server/service/kpi/kpi-query.js +87 -3
  119. package/dist-server/service/kpi/kpi-query.js.map +1 -1
  120. package/dist-server/service/kpi/kpi-type.d.ts +14 -3
  121. package/dist-server/service/kpi/kpi-type.js +81 -18
  122. package/dist-server/service/kpi/kpi-type.js.map +1 -1
  123. package/dist-server/service/kpi/kpi.d.ts +14 -3
  124. package/dist-server/service/kpi/kpi.js +96 -19
  125. package/dist-server/service/kpi/kpi.js.map +1 -1
  126. package/dist-server/service/kpi-alert/index.d.ts +2 -0
  127. package/dist-server/service/kpi-alert/index.js +6 -0
  128. package/dist-server/service/kpi-alert/index.js.map +1 -0
  129. package/dist-server/service/kpi-alert/kpi-alert-query.d.ts +4 -0
  130. package/dist-server/service/kpi-alert/kpi-alert-query.js +71 -0
  131. package/dist-server/service/kpi-alert/kpi-alert-query.js.map +1 -0
  132. package/dist-server/service/kpi-alert/kpi-alert-type.d.ts +8 -0
  133. package/dist-server/service/kpi-alert/kpi-alert-type.js +33 -0
  134. package/dist-server/service/kpi-alert/kpi-alert-type.js.map +1 -0
  135. package/dist-server/service/kpi-category/kpi-category-mutation.d.ts +1 -1
  136. package/dist-server/service/kpi-category/kpi-category-mutation.js +36 -10
  137. package/dist-server/service/kpi-category/kpi-category-mutation.js.map +1 -1
  138. package/dist-server/service/kpi-category/kpi-category-query.d.ts +2 -0
  139. package/dist-server/service/kpi-category/kpi-category-query.js +18 -2
  140. package/dist-server/service/kpi-category/kpi-category-query.js.map +1 -1
  141. package/dist-server/service/kpi-category/kpi-category-type.d.ts +3 -5
  142. package/dist-server/service/kpi-category/kpi-category-type.js +16 -20
  143. package/dist-server/service/kpi-category/kpi-category-type.js.map +1 -1
  144. package/dist-server/service/kpi-category/kpi-category.d.ts +7 -9
  145. package/dist-server/service/kpi-category/kpi-category.js +40 -38
  146. package/dist-server/service/kpi-category/kpi-category.js.map +1 -1
  147. package/dist-server/service/kpi-grade/index.d.ts +1 -2
  148. package/dist-server/service/kpi-grade/index.js +2 -4
  149. package/dist-server/service/kpi-grade/index.js.map +1 -1
  150. package/dist-server/service/kpi-grade/kpi-grade-mutation.d.ts +1 -1
  151. package/dist-server/service/kpi-grade/kpi-grade-mutation.js +33 -10
  152. package/dist-server/service/kpi-grade/kpi-grade-mutation.js.map +1 -1
  153. package/dist-server/service/kpi-grade/kpi-grade-query.js +2 -2
  154. package/dist-server/service/kpi-grade/kpi-grade-query.js.map +1 -1
  155. package/dist-server/service/kpi-grade/kpi-grade-type.d.ts +13 -4
  156. package/dist-server/service/kpi-grade/kpi-grade-type.js +54 -18
  157. package/dist-server/service/kpi-grade/kpi-grade-type.js.map +1 -1
  158. package/dist-server/service/kpi-grade/kpi-grade.d.ts +8 -8
  159. package/dist-server/service/kpi-grade/kpi-grade.js +48 -40
  160. package/dist-server/service/kpi-grade/kpi-grade.js.map +1 -1
  161. package/dist-server/service/kpi-metric/aggregate-kpi-metric.d.ts +8 -0
  162. package/dist-server/service/kpi-metric/aggregate-kpi-metric.js +134 -0
  163. package/dist-server/service/kpi-metric/aggregate-kpi-metric.js.map +1 -0
  164. package/dist-server/service/kpi-metric/index.d.ts +1 -2
  165. package/dist-server/service/kpi-metric/index.js +2 -4
  166. package/dist-server/service/kpi-metric/index.js.map +1 -1
  167. package/dist-server/service/kpi-metric/kpi-metric-mutation.d.ts +1 -1
  168. package/dist-server/service/kpi-metric/kpi-metric-mutation.js +139 -13
  169. package/dist-server/service/kpi-metric/kpi-metric-mutation.js.map +1 -1
  170. package/dist-server/service/kpi-metric/kpi-metric-query.js +3 -3
  171. package/dist-server/service/kpi-metric/kpi-metric-query.js.map +1 -1
  172. package/dist-server/service/kpi-metric/kpi-metric-type.d.ts +17 -4
  173. package/dist-server/service/kpi-metric/kpi-metric-type.js +69 -11
  174. package/dist-server/service/kpi-metric/kpi-metric-type.js.map +1 -1
  175. package/dist-server/service/kpi-metric/kpi-metric.d.ts +11 -8
  176. package/dist-server/service/kpi-metric/kpi-metric.js +62 -37
  177. package/dist-server/service/kpi-metric/kpi-metric.js.map +1 -1
  178. package/dist-server/service/kpi-value/kpi-value-mutation.js +66 -11
  179. package/dist-server/service/kpi-value/kpi-value-mutation.js.map +1 -1
  180. package/dist-server/service/kpi-value/kpi-value-query.d.ts +2 -0
  181. package/dist-server/service/kpi-value/kpi-value-query.js +15 -2
  182. package/dist-server/service/kpi-value/kpi-value-query.js.map +1 -1
  183. package/dist-server/service/kpi-value/kpi-value-type.d.ts +19 -10
  184. package/dist-server/service/kpi-value/kpi-value-type.js +87 -24
  185. package/dist-server/service/kpi-value/kpi-value-type.js.map +1 -1
  186. package/dist-server/service/kpi-value/kpi-value.d.ts +15 -9
  187. package/dist-server/service/kpi-value/kpi-value.js +86 -32
  188. package/dist-server/service/kpi-value/kpi-value.js.map +1 -1
  189. package/dist-server/tsconfig.tsbuildinfo +1 -1
  190. package/implement-plan/01-entity-type-resolver.md +57 -0
  191. package/implement-plan/02-dataset-integration.md +35 -0
  192. package/implement-plan/03-kpivalue-automation.md +34 -0
  193. package/implement-plan/04-version-history.md +33 -0
  194. package/implement-plan/05-grade-visualization.md +33 -0
  195. package/implement-plan/06-graphql-frontend.md +30 -0
  196. package/implement-plan/07-test-docs.md +35 -0
  197. package/implement-plan/TODO.md +41 -0
  198. package/package.json +18 -6
  199. package/server/index.ts +2 -1
  200. package/server/migrations/1752188906708-SeedKpiCategory.ts +61 -0
  201. package/server/migrations/1752190849681-SeedKpi.ts +112 -0
  202. package/server/migrations/1752191090459-SeedKpiGrade.ts +270 -0
  203. package/server/migrations/index.ts +9 -0
  204. package/server/routes.ts +55 -0
  205. package/server/service/index.ts +4 -6
  206. package/server/service/kpi/aggregate-kpi.ts +82 -0
  207. package/server/service/kpi/event-subscriber.ts +12 -0
  208. package/server/service/kpi/kpi-formula.service.ts +63 -0
  209. package/server/service/kpi/kpi-history.ts +29 -21
  210. package/server/service/kpi/kpi-mutation.ts +194 -12
  211. package/server/service/kpi/kpi-query.ts +57 -2
  212. package/server/service/kpi/kpi-type.ts +72 -19
  213. package/server/service/kpi/kpi.ts +96 -20
  214. package/server/service/kpi-alert/index.ts +3 -0
  215. package/server/service/kpi-alert/kpi-alert-query.ts +59 -0
  216. package/server/service/kpi-alert/kpi-alert-type.ts +20 -0
  217. package/server/service/kpi-category/kpi-category-mutation.ts +17 -4
  218. package/server/service/kpi-category/kpi-category-query.ts +20 -3
  219. package/server/service/kpi-category/kpi-category-type.ts +17 -19
  220. package/server/service/kpi-category/kpi-category.ts +39 -37
  221. package/server/service/kpi-grade/index.ts +2 -4
  222. package/server/service/kpi-grade/kpi-grade-mutation.ts +13 -4
  223. package/server/service/kpi-grade/kpi-grade-query.ts +5 -2
  224. package/server/service/kpi-grade/kpi-grade-type.ts +46 -19
  225. package/server/service/kpi-grade/kpi-grade.ts +44 -38
  226. package/server/service/kpi-metric/aggregate-kpi-metric.ts +128 -0
  227. package/server/service/kpi-metric/index.ts +2 -4
  228. package/server/service/kpi-metric/kpi-metric-mutation.ts +123 -7
  229. package/server/service/kpi-metric/kpi-metric-query.ts +9 -3
  230. package/server/service/kpi-metric/kpi-metric-type.ts +56 -13
  231. package/server/service/kpi-metric/kpi-metric.ts +55 -35
  232. package/server/service/kpi-value/kpi-value-mutation.ts +52 -14
  233. package/server/service/kpi-value/kpi-value-query.ts +12 -2
  234. package/server/service/kpi-value/kpi-value-type.ts +80 -25
  235. package/server/service/kpi-value/kpi-value.ts +81 -29
  236. package/things-factory.config.js +12 -4
  237. package/translations/en.json +12 -1
  238. package/translations/ja.json +12 -1
  239. package/translations/ko.json +12 -1
  240. package/translations/ms.json +12 -1
  241. package/translations/zh.json +12 -1
  242. package/client/pages/kpe-metric/kpe-metric-importer.ts +0 -90
  243. package/client/pages/kpe-metric/kpe-metric-list-page.ts +0 -398
  244. package/client/pages/kpi-formula/kpi-formula-importer.ts +0 -90
  245. package/client/pages/kpi-formula/kpi-formula-list-page.ts +0 -398
  246. package/client/pages/metric/metric-importer.ts +0 -90
  247. package/client/pages/metric/metric-list-page.ts +0 -398
  248. package/dist-client/pages/kpe-metric/kpe-metric-importer.d.ts +0 -23
  249. package/dist-client/pages/kpe-metric/kpe-metric-importer.js +0 -93
  250. package/dist-client/pages/kpe-metric/kpe-metric-importer.js.map +0 -1
  251. package/dist-client/pages/kpe-metric/kpe-metric-list-page.d.ts +0 -66
  252. package/dist-client/pages/kpe-metric/kpe-metric-list-page.js +0 -370
  253. package/dist-client/pages/kpe-metric/kpe-metric-list-page.js.map +0 -1
  254. package/dist-client/pages/kpi-formula/kpi-formula-importer.d.ts +0 -23
  255. package/dist-client/pages/kpi-formula/kpi-formula-importer.js +0 -93
  256. package/dist-client/pages/kpi-formula/kpi-formula-importer.js.map +0 -1
  257. package/dist-client/pages/kpi-formula/kpi-formula-list-page.d.ts +0 -66
  258. package/dist-client/pages/kpi-formula/kpi-formula-list-page.js +0 -370
  259. package/dist-client/pages/kpi-formula/kpi-formula-list-page.js.map +0 -1
  260. package/dist-client/pages/metric/metric-importer.d.ts +0 -23
  261. package/dist-client/pages/metric/metric-importer.js +0 -93
  262. package/dist-client/pages/metric/metric-importer.js.map +0 -1
  263. package/dist-client/pages/metric/metric-list-page.d.ts +0 -66
  264. package/dist-client/pages/metric/metric-list-page.js +0 -370
  265. package/dist-client/pages/metric/metric-list-page.js.map +0 -1
  266. package/dist-server/service/kpi-formula/event-subscriber.d.ts +0 -7
  267. package/dist-server/service/kpi-formula/event-subscriber.js +0 -21
  268. package/dist-server/service/kpi-formula/event-subscriber.js.map +0 -1
  269. package/dist-server/service/kpi-formula/index.d.ts +0 -7
  270. package/dist-server/service/kpi-formula/index.js +0 -12
  271. package/dist-server/service/kpi-formula/index.js.map +0 -1
  272. package/dist-server/service/kpi-formula/kpi-formula-history.d.ts +0 -25
  273. package/dist-server/service/kpi-formula/kpi-formula-history.js +0 -128
  274. package/dist-server/service/kpi-formula/kpi-formula-history.js.map +0 -1
  275. package/dist-server/service/kpi-formula/kpi-formula-mutation.d.ts +0 -10
  276. package/dist-server/service/kpi-formula/kpi-formula-mutation.js +0 -128
  277. package/dist-server/service/kpi-formula/kpi-formula-mutation.js.map +0 -1
  278. package/dist-server/service/kpi-formula/kpi-formula-query.d.ts +0 -11
  279. package/dist-server/service/kpi-formula/kpi-formula-query.js +0 -79
  280. package/dist-server/service/kpi-formula/kpi-formula-query.js.map +0 -1
  281. package/dist-server/service/kpi-formula/kpi-formula-type.d.ts +0 -20
  282. package/dist-server/service/kpi-formula/kpi-formula-type.js +0 -77
  283. package/dist-server/service/kpi-formula/kpi-formula-type.js.map +0 -1
  284. package/dist-server/service/kpi-formula/kpi-formula.d.ts +0 -24
  285. package/dist-server/service/kpi-formula/kpi-formula.js +0 -109
  286. package/dist-server/service/kpi-formula/kpi-formula.js.map +0 -1
  287. package/dist-server/service/kpi-grade/event-subscriber.d.ts +0 -7
  288. package/dist-server/service/kpi-grade/event-subscriber.js +0 -21
  289. package/dist-server/service/kpi-grade/event-subscriber.js.map +0 -1
  290. package/dist-server/service/kpi-grade/kpi-grade-history.d.ts +0 -25
  291. package/dist-server/service/kpi-grade/kpi-grade-history.js +0 -128
  292. package/dist-server/service/kpi-grade/kpi-grade-history.js.map +0 -1
  293. package/dist-server/service/kpi-metric/event-subscriber.d.ts +0 -7
  294. package/dist-server/service/kpi-metric/event-subscriber.js +0 -21
  295. package/dist-server/service/kpi-metric/event-subscriber.js.map +0 -1
  296. package/dist-server/service/kpi-metric/kpi-metric-history.d.ts +0 -25
  297. package/dist-server/service/kpi-metric/kpi-metric-history.js +0 -128
  298. package/dist-server/service/kpi-metric/kpi-metric-history.js.map +0 -1
  299. package/server/service/kpi-formula/event-subscriber.ts +0 -17
  300. package/server/service/kpi-formula/index.ts +0 -9
  301. package/server/service/kpi-formula/kpi-formula-history.ts +0 -116
  302. package/server/service/kpi-formula/kpi-formula-mutation.ts +0 -137
  303. package/server/service/kpi-formula/kpi-formula-query.ts +0 -48
  304. package/server/service/kpi-formula/kpi-formula-type.ts +0 -55
  305. package/server/service/kpi-formula/kpi-formula.ts +0 -95
  306. package/server/service/kpi-grade/event-subscriber.ts +0 -17
  307. package/server/service/kpi-grade/kpi-grade-history.ts +0 -116
  308. package/server/service/kpi-metric/event-subscriber.ts +0 -17
  309. package/server/service/kpi-metric/kpi-metric-history.ts +0 -116
@@ -4,22 +4,46 @@ import { getRepository } from '@things-factory/shell'
4
4
 
5
5
  import { KpiValue } from './kpi-value'
6
6
  import { NewKpiValue, KpiValuePatch } from './kpi-value-type'
7
+ import { Kpi } from '../kpi/kpi'
8
+ import { KpiValueInputType } from './kpi-value'
7
9
 
8
10
  @Resolver(KpiValue)
9
11
  export class KpiValueMutation {
10
12
  @Directive('@transaction')
11
- @Mutation(returns => KpiValue, { description: 'To create new KpiValue' })
12
- async createKpiValue(@Arg('kpiValue') kpiValue: NewKpiValue, @Ctx() context: ResolverContext): Promise<KpiValue> {
13
+ @Mutation(returns => KpiValue, { description: 'Create a new KPI value with the provided details.' })
14
+ async createKpiValue(
15
+ @Arg('kpiValue', { description: 'Input object containing details for the new KPI value.' }) kpiValue: NewKpiValue,
16
+ @Ctx() context: ResolverContext
17
+ ): Promise<KpiValue> {
13
18
  const { domain, user, tx } = context.state
14
19
 
15
- const result = await getRepository(KpiValue, tx).save({
16
- ...kpiValue,
17
- domain,
20
+ let kpi = kpiValue.kpiId ? await getRepository(Kpi).findOne({ where: { id: kpiValue.kpiId } }) : undefined
21
+
22
+ let inputType: KpiValueInputType | undefined = undefined
23
+ if (kpiValue.inputType) {
24
+ if (typeof kpiValue.inputType === 'string') {
25
+ inputType = KpiValueInputType[kpiValue.inputType as keyof typeof KpiValueInputType]
26
+ } else {
27
+ inputType = kpiValue.inputType
28
+ }
29
+ }
30
+
31
+ const entity: Partial<KpiValue> = {
32
+ kpi,
33
+ kpiId: kpiValue.kpiId,
34
+ version: kpiValue.version,
35
+ valueDate: kpiValue.valueDate,
36
+ value: kpiValue.value,
37
+ groupId: kpiValue.groupId,
38
+ groupType: kpiValue.groupType,
39
+ source: kpiValue.source,
40
+ domain: domain,
18
41
  creator: user,
19
42
  updater: user
20
- })
43
+ }
44
+ if (inputType) entity.inputType = inputType
21
45
 
22
- return result
46
+ return await getRepository(KpiValue, tx).save(entity)
23
47
  }
24
48
 
25
49
  @Directive('@transaction')
@@ -36,13 +60,28 @@ export class KpiValueMutation {
36
60
  where: { domain: { id: domain.id }, id }
37
61
  })
38
62
 
39
- const result = await repository.save({
63
+ let kpi = patch.kpiId ? await getRepository(Kpi).findOne({ where: { id: patch.kpiId } }) : kpiValue.kpi
64
+
65
+ let inputType: KpiValueInputType | undefined = undefined
66
+ if (patch.inputType) {
67
+ if (typeof patch.inputType === 'string') {
68
+ inputType = KpiValueInputType[patch.inputType as keyof typeof KpiValueInputType]
69
+ } else {
70
+ inputType = patch.inputType
71
+ }
72
+ } else {
73
+ inputType = kpiValue.inputType
74
+ }
75
+
76
+ const entity: any = {
40
77
  ...kpiValue,
41
78
  ...patch,
79
+ kpi,
42
80
  updater: user
43
- })
81
+ }
82
+ if (inputType) entity.inputType = inputType
44
83
 
45
- return result
84
+ return await repository.save(entity)
46
85
  }
47
86
 
48
87
  @Directive('@transaction')
@@ -67,7 +106,7 @@ export class KpiValueMutation {
67
106
  domain,
68
107
  creator: user,
69
108
  updater: user
70
- })
109
+ } as any)
71
110
 
72
111
  results.push({ ...result, cuFlag: '+' })
73
112
  }
@@ -82,7 +121,7 @@ export class KpiValueMutation {
82
121
  ...kpiValue,
83
122
  ...updateRecord,
84
123
  updater: user
85
- })
124
+ } as any)
86
125
 
87
126
  results.push({ ...result, cuFlag: 'M' })
88
127
  }
@@ -114,7 +153,6 @@ export class KpiValueMutation {
114
153
  id: In(ids)
115
154
  })
116
155
 
117
-
118
156
  return true
119
157
  }
120
158
 
@@ -128,7 +166,7 @@ export class KpiValueMutation {
128
166
 
129
167
  await Promise.all(
130
168
  kpiValues.map(async (kpiValue: KpiValuePatch) => {
131
- const createdKpiValue: KpiValue = await getRepository(KpiValue, tx).save({ domain, ...kpiValue })
169
+ const createdKpiValue: KpiValue = await getRepository(KpiValue, tx).save({ domain, ...kpiValue } as any)
132
170
  })
133
171
  )
134
172
 
@@ -3,11 +3,15 @@ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from
3
3
  import { User } from '@things-factory/auth-base'
4
4
  import { KpiValue } from './kpi-value'
5
5
  import { KpiValueList } from './kpi-value-type'
6
+ import { Kpi } from '../kpi/kpi'
6
7
 
7
8
  @Resolver(KpiValue)
8
9
  export class KpiValueQuery {
9
- @Query(returns => KpiValue!, { nullable: true, description: 'To fetch a KpiValue' })
10
- async kpiValue(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<KpiValue> {
10
+ @Query(returns => KpiValue!, { nullable: true, description: 'Fetch a single KPI value by its unique identifier.' })
11
+ async kpiValue(
12
+ @Arg('id', { description: 'Unique identifier of the KPI value to fetch.' }) id: string,
13
+ @Ctx() context: ResolverContext
14
+ ): Promise<KpiValue> {
11
15
  const { domain } = context.state
12
16
 
13
17
  return await getRepository(KpiValue).findOne({
@@ -45,4 +49,10 @@ export class KpiValueQuery {
45
49
  async creator(@Root() kpiValue: KpiValue): Promise<User> {
46
50
  return kpiValue.creatorId && (await getRepository(User).findOneBy({ id: kpiValue.creatorId }))
47
51
  }
52
+
53
+ @FieldResolver(type => Kpi)
54
+ async kpi(@Root() kpiValue: KpiValue): Promise<Kpi | null> {
55
+ if (!kpiValue.kpiId) return null
56
+ return await getRepository(Kpi).findOneBy({ id: kpiValue.kpiId })
57
+ }
48
58
  }
@@ -1,47 +1,102 @@
1
1
  import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
2
2
  import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
3
- import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
3
+ import { ObjectType, Field, InputType, Int, ID, registerEnumType, Float } from 'type-graphql'
4
4
 
5
5
  import { ObjectRef, ScalarObject } from '@things-factory/shell'
6
6
 
7
- import { KpiValue, KpiValueStatus } from './kpi-value'
7
+ import { KpiValue, KpiValueInputType } from './kpi-value'
8
8
 
9
- @InputType()
9
+ @InputType({ description: 'Input type for creating a new KPI value. Used in mutations to provide KPI value details.' })
10
10
  export class NewKpiValue {
11
- @Field()
12
- name: string
11
+ @Field(type => ID, { description: 'ID of the KPI to which this value belongs.' })
12
+ kpiId: string
13
13
 
14
- @Field({ nullable: true })
15
- description?: string
14
+ @Field(type => Int, { description: 'Version of the KPI definition at the time this value is calculated.' })
15
+ version: number
16
16
 
17
- @Field(type => KpiValueStatus, { nullable: true })
18
- state?: KpiValueStatus
17
+ @Field({ description: 'Date or period for which this KPI value is recorded (e.g., day, month, quarter).' })
18
+ valueDate: string
19
19
 
20
- @Field({ nullable: true })
21
- active?: boolean
20
+ @Field(type => Float, { description: 'The calculated numeric value for this KPI and period.' })
21
+ value: number
22
22
 
23
- @Field({ nullable: true })
24
- params?: string
23
+ @Field(type => ScalarObject, {
24
+ nullable: true,
25
+ description:
26
+ 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'
27
+ })
28
+ meta?: any
29
+
30
+ @Field({
31
+ nullable: true,
32
+ description: 'ID of the group (organization, department, project, etc.) this value is associated with.'
33
+ })
34
+ groupId?: string
35
+
36
+ @Field({ nullable: true, description: 'Type of the group (e.g., USER, DEPT, PROJECT) for this value.' })
37
+ groupType?: string
38
+
39
+ @Field(type => KpiValueInputType, {
40
+ nullable: true,
41
+ description: 'Indicates whether this value was entered manually or generated automatically.'
42
+ })
43
+ inputType?: KpiValueInputType
44
+
45
+ @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })
46
+ source?: string
25
47
  }
26
48
 
27
- @InputType()
49
+ @InputType({
50
+ description: 'Input type for updating an existing KPI value. Used in mutations to patch KPI value details.'
51
+ })
28
52
  export class KpiValuePatch {
29
- @Field(type => ID, { nullable: true })
53
+ @Field(type => ID, { nullable: true, description: 'ID of the KPI value to update.' })
30
54
  id?: string
31
55
 
32
- @Field({ nullable: true })
33
- name?: string
56
+ @Field(type => ID, { nullable: true, description: 'ID of the KPI to which this value belongs.' })
57
+ kpiId?: string
58
+
59
+ @Field(type => Int, {
60
+ nullable: true,
61
+ description: 'Version of the KPI definition at the time this value is calculated.'
62
+ })
63
+ version?: number
64
+
65
+ @Field({
66
+ nullable: true,
67
+ description: 'Date or period for which this KPI value is recorded (e.g., day, month, quarter).'
68
+ })
69
+ valueDate?: string
70
+
71
+ @Field(type => Float, { nullable: true, description: 'The calculated numeric value for this KPI and period.' })
72
+ value?: number
73
+
74
+ @Field(type => ScalarObject, {
75
+ nullable: true,
76
+ description:
77
+ 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'
78
+ })
79
+ meta?: any
80
+
81
+ @Field({
82
+ nullable: true,
83
+ description: 'ID of the group (organization, department, project, etc.) this value is associated with.'
84
+ })
85
+ groupId?: string
86
+
87
+ @Field({ nullable: true, description: 'Type of the group (e.g., USER, DEPT, PROJECT) for this value.' })
88
+ groupType?: string
34
89
 
35
- @Field({ nullable: true })
36
- description?: string
90
+ @Field(type => KpiValueInputType, {
91
+ nullable: true,
92
+ description: 'Indicates whether this value was entered manually or generated automatically.'
93
+ })
94
+ inputType?: KpiValueInputType
37
95
 
38
- @Field(type => KpiValueStatus, { nullable: true })
39
- state?: KpiValueStatus
96
+ @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })
97
+ source?: string
40
98
 
41
- @Field({ nullable: true })
42
- active?: boolean
43
-
44
- @Field({ nullable: true })
99
+ @Field({ nullable: true, description: 'Custom flag for update operations (internal use).' })
45
100
  cuFlag?: string
46
101
  }
47
102
 
@@ -8,77 +8,129 @@ import {
8
8
  ManyToOne,
9
9
  PrimaryGeneratedColumn
10
10
  } from 'typeorm'
11
- import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
11
+ import { ObjectType, Field, Int, ID, registerEnumType, Float } from 'type-graphql'
12
12
 
13
- import { Domain } from '@things-factory/shell'
14
13
  import { User } from '@things-factory/auth-base'
14
+ import { Domain, ScalarObject, json5Transformer } from '@things-factory/shell'
15
+ import { config } from '@things-factory/env'
16
+ import { Kpi } from '../kpi/kpi'
15
17
 
16
- export enum KpiValueStatus {
17
- STATUS_A = 'STATUS_A',
18
- STATUS_B = 'STATUS_B'
18
+ const ORMCONFIG = config.get('ormconfig', {})
19
+ const DATABASE_TYPE = ORMCONFIG.type
20
+
21
+ export enum KpiValueInputType {
22
+ MANUAL = 'MANUAL',
23
+ AUTO = 'AUTO'
19
24
  }
20
25
 
21
- registerEnumType(KpiValueStatus, {
22
- name: 'KpiValueStatus',
23
- description: 'state enumeration of a kpiValue'
26
+ registerEnumType(KpiValueInputType, {
27
+ name: 'KpiValueInputType',
28
+ description: 'Type of the input (Manual or Auto)'
24
29
  })
25
30
 
26
31
  @Entity()
27
- @Index('ix_kpi_value_0', (kpiValue: KpiValue) => [kpiValue.domain, kpiValue.name], {
28
- unique: true
29
- })
32
+ @Index('ix_kpi_value_latest', ['domain', 'kpi', 'valueDate', 'groupId', 'groupType', 'version'], { unique: true })
33
+ @Index('ix_kpi_value_latest_for_query', ['domain', 'kpi', 'valueDate', 'groupId', 'groupType'], { unique: false })
30
34
  @ObjectType({ description: 'Entity for KpiValue' })
31
35
  export class KpiValue {
32
36
  @PrimaryGeneratedColumn('uuid')
33
- @Field(type => ID)
37
+ @Field(type => ID, { description: 'Unique identifier for this KPI value record.' })
34
38
  readonly id: string
35
39
 
36
40
  @ManyToOne(type => Domain)
37
- @Field({ nullable: true })
41
+ @Field({ nullable: true, description: 'Domain (tenant) to which this KPI value belongs.' })
38
42
  domain?: Domain
39
43
 
40
44
  @RelationId((kpiValue: KpiValue) => kpiValue.domain)
45
+ @Field({ nullable: true, description: 'ID of the domain (tenant) for this KPI value.' })
41
46
  domainId?: string
42
47
 
43
- @Column()
44
- @Field({ nullable: true })
45
- name?: string
48
+ @ManyToOne(() => Kpi)
49
+ @Field(type => Kpi, {
50
+ nullable: true,
51
+ description: 'Reference to the KPI definition for which this value is calculated.'
52
+ })
53
+ kpi: Kpi
54
+
55
+ @RelationId((kpiValue: KpiValue) => kpiValue.kpi)
56
+ @Field({ description: 'ID of the referenced KPI.' })
57
+ kpiId: string
58
+
59
+ @Column('int')
60
+ @Field(type => Int, { description: 'Version of the KPI definition at the time this value was calculated.' })
61
+ version: number
62
+
63
+ @Column({ type: 'date' })
64
+ @Field({ description: 'Date or period for which this KPI value is recorded (e.g., day, month, quarter).' })
65
+ valueDate: string
66
+
67
+ @Column('float')
68
+ @Field(type => Float, { description: 'The calculated numeric value for this KPI and period.' })
69
+ value: number
46
70
 
47
71
  @Column({ nullable: true })
48
- @Field({ nullable: true })
49
- description?: string
72
+ @Field({
73
+ nullable: true,
74
+ description: 'ID of the group (organization, department, project, etc.) this value is associated with.'
75
+ })
76
+ groupId?: string
50
77
 
51
- @Column({ nullable: false, default: false })
52
- @Field({ nullable: true })
53
- active?: boolean
78
+ @Column({ nullable: true })
79
+ @Field({ nullable: true, description: 'Type of the group (e.g., USER, DEPT, PROJECT) for this value.' })
80
+ groupType?: string
54
81
 
55
82
  @Column({ nullable: true })
56
- @Field({ nullable: true })
57
- state?: KpiValueStatus
83
+ @Field({
84
+ nullable: true,
85
+ description: 'Indicates whether this value was entered manually or generated automatically.'
86
+ })
87
+ inputType?: KpiValueInputType
58
88
 
59
89
  @Column({ nullable: true })
60
- @Field({ nullable: true })
61
- params?: string
90
+ @Field({ nullable: true, description: 'Source of the value (e.g., system, user, external integration).' })
91
+ source?: string
92
+
93
+ @Column({
94
+ nullable: true,
95
+ type:
96
+ DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
97
+ ? 'longtext'
98
+ : DATABASE_TYPE == 'oracle'
99
+ ? 'clob'
100
+ : DATABASE_TYPE == 'mssql'
101
+ ? 'nvarchar'
102
+ : 'varchar',
103
+ length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined,
104
+ transformer: json5Transformer
105
+ })
106
+ @Field(type => ScalarObject, {
107
+ nullable: true,
108
+ description:
109
+ 'Extended or non-numeric information related to this KPI value, stored as JSON5. Can include grade, status, comments, or other metadata.'
110
+ })
111
+ meta?: any
62
112
 
63
113
  @CreateDateColumn()
64
- @Field({ nullable: true })
114
+ @Field({ nullable: true, description: 'Timestamp when this KPI value record was created.' })
65
115
  createdAt?: Date
66
116
 
67
117
  @UpdateDateColumn()
68
- @Field({ nullable: true })
118
+ @Field({ nullable: true, description: 'Timestamp when this KPI value record was last updated.' })
69
119
  updatedAt?: Date
70
120
 
71
121
  @ManyToOne(type => User, { nullable: true })
72
- @Field(type => User, { nullable: true })
122
+ @Field(type => User, { nullable: true, description: 'User who created this KPI value record.' })
73
123
  creator?: User
74
124
 
75
125
  @RelationId((kpiValue: KpiValue) => kpiValue.creator)
126
+ @Field({ nullable: true, description: 'ID of the user who created this KPI value record.' })
76
127
  creatorId?: string
77
128
 
78
129
  @ManyToOne(type => User, { nullable: true })
79
- @Field(type => User, { nullable: true })
130
+ @Field(type => User, { nullable: true, description: 'User who last updated this KPI value record.' })
80
131
  updater?: User
81
132
 
82
133
  @RelationId((kpiValue: KpiValue) => kpiValue.updater)
134
+ @Field({ nullable: true, description: 'ID of the user who last updated this KPI value record.' })
83
135
  updaterId?: string
84
136
  }
@@ -1,10 +1,18 @@
1
1
  import route from './dist-client/route'
2
- import bootstrap from './dist-client/bootstrap'
2
+ // import bootstrap from './dist-client/bootstrap'
3
3
 
4
4
  export default {
5
5
  route,
6
6
  routes: [
7
- { tagname: 'kpi-main', page: 'kpi-main' }
8
- ],
9
- bootstrap
7
+ { tagname: 'kpi-overview', page: 'kpi-overview' },
8
+ { tagname: 'kpi-dashboard', page: 'kpi-dashboard' },
9
+ { tagname: 'kpi-list-page', page: 'kpi-list' },
10
+ { tagname: 'kpi-category-list-page', page: 'kpi-category-list' },
11
+ { tagname: 'kpi-metric-list-page', page: 'kpi-metric-list' },
12
+ { tagname: 'kpi-value-list-page', page: 'kpi-value-list' },
13
+ { tagname: 'kpi-value-manual-entry-page', page: 'kpi-value-manual-entry' },
14
+ { tagname: 'kpi-grade-list-page', page: 'kpi-grade-list' },
15
+ { tagname: 'kpi-history-list-page', page: 'kpi-history-list' }
16
+ ]
17
+ // bootstrap
10
18
  }
@@ -1 +1,12 @@
1
- {}
1
+ {
2
+ "title.kpi list": "KPI List",
3
+ "title.kpi category list": "KPI Catogory List",
4
+ "title.kpi grade list": "KPI Grade List",
5
+ "title.kpi metric list": "KPI Metric List",
6
+ "title.kpi value list": "KPI Value List",
7
+ "title.kpi performance board": "KPI Performance Board",
8
+ "title.kpi management center": "KPI Management Center",
9
+ "title.kpi overview": "KPI Overview",
10
+ "title.kpi value manual entry": "KPI Value Manual Entry",
11
+ "button.enter-kpi-value": "Enter KPI Value"
12
+ }
@@ -1 +1,12 @@
1
- {}
1
+ {
2
+ "title.kpi list": "KPI リスト",
3
+ "title.kpi category list": "KPI カテゴリ リスト",
4
+ "title.kpi grade list": "KPI グレード リスト",
5
+ "title.kpi metric list": "KPI メトリック リスト",
6
+ "title.kpi value list": "KPI 値 リスト",
7
+ "title.kpi performance board": "KPI パフォーマンス ボード",
8
+ "title.kpi management center": "KPI 管理 センター",
9
+ "title.kpi overview": "KPI 概要",
10
+ "title.kpi value manual entry": "KPI 値 手入力",
11
+ "button.enter-kpi-value": "KPI 値 入力"
12
+ }
@@ -1 +1,12 @@
1
- {}
1
+ {
2
+ "title.kpi list": "KPI 목록",
3
+ "title.kpi category list": "KPI 카테고리 목록",
4
+ "title.kpi grade list": "KPI 등급 목록",
5
+ "title.kpi metric list": "KPI 지표 목록",
6
+ "title.kpi value list": "KPI 값 목록",
7
+ "title.kpi performance board": "KPI 성과 보드",
8
+ "title.kpi management center": "KPI 관리 센터",
9
+ "title.kpi overview": "KPI 개요",
10
+ "title.kpi value manual entry": "KPI 값 수기 입력",
11
+ "button.enter-kpi-value": "KPI 값 입력"
12
+ }
@@ -1 +1,12 @@
1
- {}
1
+ {
2
+ "title.kpi list": "Senarai KPI",
3
+ "title.kpi category list": "Senarai Kategori KPI",
4
+ "title.kpi grade list": "Senarai Gred KPI",
5
+ "title.kpi metric list": "Senarai Metrik KPI",
6
+ "title.kpi value list": "Senarai Nilai KPI",
7
+ "title.kpi performance board": "Papan KPI",
8
+ "title.kpi management center": "Pusat Pengurusan KPI",
9
+ "title.kpi overview": "Pengenalan KPI",
10
+ "title.kpi value manual entry": "KPI 値 手入力",
11
+ "button.enter-kpi-value": "KPI 値 入力"
12
+ }
@@ -1 +1,12 @@
1
- {}
1
+ {
2
+ "title.kpi list": "KPI 列表",
3
+ "title.kpi category list": "KPI 分类列表",
4
+ "title.kpi grade list": "KPI 等级列表",
5
+ "title.kpi metric list": "KPI 指标列表",
6
+ "title.kpi value list": "KPI 值列表",
7
+ "title.kpi performance board": "KPI 绩效看板",
8
+ "title.kpi management center": "KPI 管理中心",
9
+ "title.kpi overview": "KPI 概述",
10
+ "title.kpi value manual entry": "KPI 值手动输入",
11
+ "button.enter-kpi-value": "KPI 值手动输入"
12
+ }
@@ -1,90 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/data-grist'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { property } from 'lit/decorators.js'
7
-
8
- import { client } from '@operato/graphql'
9
- import { i18next } from '@operato/i18n'
10
- import { isMobileDevice } from '@operato/utils'
11
- import { ButtonContainerStyles } from '@operato/styles'
12
-
13
- export class KpeMetricImporter extends LitElement {
14
- static styles = [
15
- ButtonContainerStyles,
16
- css`
17
- :host {
18
- display: flex;
19
- flex-direction: column;
20
-
21
- background-color: #fff;
22
- }
23
-
24
- ox-grist {
25
- flex: 1;
26
- }
27
- `
28
- ]
29
-
30
- @property({ type: Array }) kpeMetrics: any[] = []
31
- @property({ type: Object }) columns = {
32
- list: { fields: ['name', 'description'] },
33
- pagination: { infinite: true },
34
- columns: [
35
- {
36
- type: 'string',
37
- name: 'name',
38
- header: i18next.t('field.name'),
39
- width: 150
40
- },
41
- {
42
- type: 'string',
43
- name: 'description',
44
- header: i18next.t('field.description'),
45
- width: 200
46
- },
47
- {
48
- type: 'checkbox',
49
- name: 'active',
50
- header: i18next.t('field.active'),
51
- width: 60
52
- }
53
- ]
54
- }
55
-
56
-
57
- render() {
58
- return html`
59
- <ox-grist
60
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
61
- .config=${this.columns}
62
- .data=${
63
- {
64
- records: this.kpeMetrics
65
- }
66
- }
67
- ></ox-grist>
68
-
69
- <div class="button-container">
70
- <button @click="${this.save.bind(this)}"><md-icon>save</md-icon>${i18next.t('button.save')}</button>
71
- </div>
72
- `
73
- }
74
-
75
- async save() {
76
- const response = await client.mutate({
77
- mutation: gql`
78
- mutation importKpeMetrics($kpeMetrics: [KpeMetricPatch!]!) {
79
- importKpeMetrics(kpeMetrics: $kpeMetrics)
80
- }
81
- `,
82
- variables: { kpeMetrics: this.kpeMetrics }
83
- })
84
-
85
- if (response.errors?.length) return
86
-
87
- this.dispatchEvent(new CustomEvent('imported'))
88
- }
89
- }
90
-