@things-factory/kpi 9.2.5 → 10.0.0-beta.10

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 (139) hide show
  1. package/client/pages/kpi/kpi-list-page.ts +339 -525
  2. package/client/pages/kpi/kpi-tree-page.ts +135 -207
  3. package/client/pages/kpi-metric/kpi-metric-list-page.ts +146 -226
  4. package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +187 -295
  5. package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +123 -194
  6. package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.ts +57 -91
  7. package/client/pages/kpi-statistic/kpi-statistic-editor-page.ts +180 -278
  8. package/client/pages/kpi-statistic/kpi-statistic-list-page.ts +186 -286
  9. package/client/pages/kpi-value/kpi-value-editor-page.ts +189 -292
  10. package/client/pages/kpi-value/kpi-value-list-page.ts +170 -264
  11. package/dist-client/pages/kpi/kpi-list-page.d.ts +0 -6
  12. package/dist-client/pages/kpi/kpi-list-page.js +150 -282
  13. package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
  14. package/dist-client/pages/kpi/kpi-tree-page.d.ts +1 -7
  15. package/dist-client/pages/kpi/kpi-tree-page.js +76 -127
  16. package/dist-client/pages/kpi/kpi-tree-page.js.map +1 -1
  17. package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +0 -6
  18. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +62 -116
  19. package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
  20. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +1 -7
  21. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +82 -140
  22. package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -1
  23. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +0 -6
  24. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +54 -98
  25. package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
  26. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +1 -7
  27. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +30 -57
  28. package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -1
  29. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +1 -7
  30. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +91 -153
  31. package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -1
  32. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +0 -6
  33. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +81 -155
  34. package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -1
  35. package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +1 -7
  36. package/dist-client/pages/kpi-value/kpi-value-editor-page.js +80 -136
  37. package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -1
  38. package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +0 -6
  39. package/dist-client/pages/kpi-value/kpi-value-list-page.js +73 -134
  40. package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
  41. package/dist-client/tsconfig.tsbuildinfo +1 -1
  42. package/dist-server/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +18 -18
  44. package/client/tsconfig.json +0 -11
  45. package/dist-server/tsconfig.json +0 -10
  46. package/server/@types/index.d.ts +0 -11
  47. package/server/calculator/evaluator.ts +0 -45
  48. package/server/calculator/functions.ts +0 -67
  49. package/server/calculator/index.ts +0 -4
  50. package/server/calculator/parser.ts +0 -137
  51. package/server/calculator/provider.ts +0 -10
  52. package/server/controllers/index.ts +0 -2
  53. package/server/controllers/kpi-metric-value-provider.ts +0 -79
  54. package/server/controllers/kpi-value-provider.ts +0 -51
  55. package/server/index.ts +0 -6
  56. package/server/migrations/1752190849680-seed-kpi-metrics.ts +0 -124
  57. package/server/migrations/1752190849681-seed-kpi.ts +0 -356
  58. package/server/migrations/1752192090123-add-grades-to-kpi.ts +0 -67
  59. package/server/migrations/1752192090124-add-kpi-statistics.ts +0 -719
  60. package/server/migrations/1752192090128-seed-kpi-org-scope.ts +0 -132
  61. package/server/migrations/1752192090129-seed-kpi-values.ts +0 -207
  62. package/server/migrations/grade-data/x11-performance-table.json +0 -962
  63. package/server/migrations/grade-data/x12-performance-table.json +0 -611
  64. package/server/migrations/grade-data/x14-performance-table.json +0 -42
  65. package/server/migrations/grade-data/x21-performance-table.json +0 -889
  66. package/server/migrations/grade-data/x22-performance-table.json +0 -1064
  67. package/server/migrations/grade-data/x23-performance-table.json +0 -42
  68. package/server/migrations/grade-data/x31-performance-table.json +0 -644
  69. package/server/migrations/grade-data/x32-performance-table.json +0 -993
  70. package/server/migrations/grade-data/x33-performance-table.json +0 -195
  71. package/server/migrations/grade-data/x34-performance-table.json +0 -12
  72. package/server/migrations/grade-data/x35-performance-table.json +0 -42
  73. package/server/migrations/grade-data/x41-performance-table.json +0 -825
  74. package/server/migrations/grade-data/x42-performance-table.json +0 -786
  75. package/server/migrations/grade-data/x43-performance-table.json +0 -12
  76. package/server/migrations/grade-data/x44-performance-table.json +0 -42
  77. package/server/migrations/grade-data/x51-performance-table.json +0 -924
  78. package/server/migrations/grade-data/x52-performance-table.json +0 -42
  79. package/server/migrations/grade-data/x61-performance-table.json +0 -261
  80. package/server/migrations/grade-data/x62-performance-table.json +0 -42
  81. package/server/migrations/index.ts +0 -9
  82. package/server/migrations/seed-data/kpi-metrics-seed.json +0 -454
  83. package/server/migrations/seed-data/kpi-org-scope-seed.json +0 -1676
  84. package/server/migrations/seed-data/kpi-scopes-seed.json +0 -121
  85. package/server/migrations/seed-data/kpi-values-seed.json +0 -402
  86. package/server/migrations/seed-data/kpis-seed.json +0 -488
  87. package/server/migrations/seed-data/scope-definitions-seed.json +0 -90
  88. package/server/routes.ts +0 -81
  89. package/server/service/index.ts +0 -51
  90. package/server/service/kpi/aggregate-kpi.ts +0 -103
  91. package/server/service/kpi/event-subscriber.ts +0 -29
  92. package/server/service/kpi/index.ts +0 -9
  93. package/server/service/kpi/kpi-formula.service.ts +0 -164
  94. package/server/service/kpi/kpi-grade.types.ts +0 -28
  95. package/server/service/kpi/kpi-history.ts +0 -126
  96. package/server/service/kpi/kpi-mutation.ts +0 -553
  97. package/server/service/kpi/kpi-query.ts +0 -224
  98. package/server/service/kpi/kpi-type.ts +0 -151
  99. package/server/service/kpi/kpi.ts +0 -254
  100. package/server/service/kpi-alert/index.ts +0 -3
  101. package/server/service/kpi-alert/kpi-alert-query.ts +0 -59
  102. package/server/service/kpi-alert/kpi-alert-type.ts +0 -20
  103. package/server/service/kpi-metric/aggregate-kpi-metric.ts +0 -132
  104. package/server/service/kpi-metric/index.ts +0 -7
  105. package/server/service/kpi-metric/kpi-metric-mutation.ts +0 -309
  106. package/server/service/kpi-metric/kpi-metric-query.ts +0 -70
  107. package/server/service/kpi-metric/kpi-metric-type.ts +0 -111
  108. package/server/service/kpi-metric/kpi-metric.ts +0 -134
  109. package/server/service/kpi-metric-value/index.ts +0 -7
  110. package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +0 -270
  111. package/server/service/kpi-metric-value/kpi-metric-value-query.ts +0 -62
  112. package/server/service/kpi-metric-value/kpi-metric-value-type.ts +0 -82
  113. package/server/service/kpi-metric-value/kpi-metric-value.ts +0 -93
  114. package/server/service/kpi-org-scope/index.ts +0 -6
  115. package/server/service/kpi-org-scope/kpi-org-scope-mutation.ts +0 -173
  116. package/server/service/kpi-org-scope/kpi-org-scope-query.ts +0 -127
  117. package/server/service/kpi-org-scope/kpi-org-scope-type.ts +0 -68
  118. package/server/service/kpi-org-scope/kpi-org-scope.ts +0 -123
  119. package/server/service/kpi-scope/index.ts +0 -11
  120. package/server/service/kpi-scope/kpi-scope-mutation.ts +0 -129
  121. package/server/service/kpi-scope/kpi-scope-query.ts +0 -63
  122. package/server/service/kpi-scope/kpi-scope-type.ts +0 -96
  123. package/server/service/kpi-scope/kpi-scope.ts +0 -143
  124. package/server/service/kpi-statistic/index.ts +0 -7
  125. package/server/service/kpi-statistic/kpi-statistic-batch.service.ts +0 -231
  126. package/server/service/kpi-statistic/kpi-statistic-calculation.service.ts +0 -410
  127. package/server/service/kpi-statistic/kpi-statistic-mutation.ts +0 -291
  128. package/server/service/kpi-statistic/kpi-statistic-query.ts +0 -146
  129. package/server/service/kpi-statistic/kpi-statistic-type.ts +0 -152
  130. package/server/service/kpi-statistic/kpi-statistic.ts +0 -199
  131. package/server/service/kpi-value/index.ts +0 -7
  132. package/server/service/kpi-value/kpi-value-mutation.ts +0 -432
  133. package/server/service/kpi-value/kpi-value-query.ts +0 -61
  134. package/server/service/kpi-value/kpi-value-score.service.ts +0 -106
  135. package/server/service/kpi-value/kpi-value-type.ts +0 -122
  136. package/server/service/kpi-value/kpi-value.ts +0 -160
  137. package/server/service/utils/value-date-util.ts +0 -119
  138. package/server/tsconfig.json +0 -10
  139. package/server/types/global.d.ts +0 -8
@@ -5,19 +5,17 @@ import './kpi-view'
5
5
  import gql from 'graphql-tag'
6
6
  import { css, html, PropertyValues } from 'lit'
7
7
  import { customElement, property, query, state } from 'lit/decorators.js'
8
- import { connect } from 'pwa-helpers/connect-mixin'
9
8
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
10
9
  import { client } from '@operato/graphql'
11
10
  import { i18next, localize } from '@operato/i18n'
12
11
  import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
13
- import { CustomAlert, PageView, store } from '@operato/shell'
12
+ import { CustomAlert, PageView } from '@operato/shell'
14
13
 
15
14
  import { KpiImporter } from './kpi-importer'
16
15
  import { KpiView } from './kpi-view'
17
16
 
18
17
  const SubKpiFragment = gql`
19
- fragment SubKpiFragment on Kpi {
20
- id
18
+ fragment SubKpiFragment on Kpi { id
21
19
  name
22
20
  description
23
21
  active
@@ -33,71 +31,60 @@ const SubKpiFragment = gql`
33
31
  timezone
34
32
  version
35
33
  isLeaf
36
- parent {
37
- id
34
+ parent { id
38
35
  name
39
- }
40
- updater {
41
- id
36
+ }
37
+ updater { id
42
38
  name
43
- }
39
+ }
44
40
  updatedAt
45
- creator {
46
- id
41
+ creator { id
47
42
  name
48
- }
43
+ }
49
44
  createdAt
50
- }
45
+ }
51
46
  `
52
47
 
53
48
  @customElement('kpi-tree-page')
54
- export class KpiTreePage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
55
- static styles = [
49
+ export class KpiTreePage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [
56
50
  CommonHeaderStyles,
57
51
  ScrollbarStyles,
58
52
  css`
59
- :host {
60
- display: flex;
53
+ :host { display: flex;
61
54
  flex-direction: column;
62
55
  width: 100%;
63
56
  overflow: auto;
64
- }
57
+ }
65
58
 
66
- content {
67
- flex: 1;
59
+ content { flex: 1;
68
60
  display: flex;
69
61
  flex-direction: row;
70
- }
62
+ }
71
63
 
72
- div[editor] {
73
- width: 400px;
64
+ div[editor] { width: 400px;
74
65
  display: flex;
75
66
  flex-direction: column;
76
67
  border-left: 1px solid var(--md-sys-color-outline-variant);
77
- }
68
+ }
78
69
 
79
- ox-tree-horizontal {
80
- flex: 1;
70
+ ox-tree-horizontal { flex: 1;
81
71
  overflow: auto;
82
- }
72
+ }
83
73
 
84
- kpi-view {
85
- flex: 1;
74
+ kpi-view { flex: 1;
86
75
  padding: var(--spacing-medium);
87
76
  background-color: var(--md-sys-color-surface-variant);
88
77
  overflow: auto;
89
- }
78
+ }
90
79
 
91
- .footer {
92
- display: flex;
80
+ .footer { display: flex;
93
81
  gap: var(--spacing-small);
94
82
  padding: var(--spacing-medium);
95
83
  border-top: 1px solid var(--md-sys-color-outline-variant);
96
84
  background-color: var(--md-sys-color-surface);
97
- }
85
+ }
98
86
 
99
- .footer button {
100
- display: flex;
87
+ .footer button { display: flex;
101
88
  align-items: center;
102
89
  gap: var(--spacing-small);
103
90
  padding: var(--spacing-small) var(--spacing-medium);
@@ -106,34 +93,28 @@ export class KpiTreePage extends connect(store)(localize(i18next)(ScopedElements
106
93
  background-color: var(--md-sys-color-surface);
107
94
  color: var(--md-sys-color-on-surface);
108
95
  cursor: pointer;
109
- }
96
+ }
110
97
 
111
- .footer button:hover {
112
- background-color: var(--md-sys-color-secondary-container);
113
- }
98
+ .footer button:hover { background-color: var(--md-sys-color-secondary-container);
99
+ }
114
100
 
115
- .footer button[disabled] {
116
- color: var(--md-sys-color-surface-dim);
101
+ .footer button[disabled] { color: var(--md-sys-color-surface-dim);
117
102
  background-color: transparent;
118
103
  cursor: not-allowed;
119
- }
104
+ }
120
105
 
121
- .footer button[done] {
122
- background-color: var(--md-sys-color-primary);
106
+ .footer button[done] { background-color: var(--md-sys-color-primary);
123
107
  color: var(--md-sys-color-on-primary);
124
- }
108
+ }
125
109
 
126
- .footer div[filler] {
127
- flex: 1;
128
- }
110
+ .footer div[filler] { flex: 1;
111
+ }
129
112
  `
130
113
  ]
131
114
 
132
- static get scopedElements() {
133
- return {
134
- 'kpi-importer': KpiImporter
135
- }
136
- }
115
+ static get scopedElements() { return { 'kpi-importer': KpiImporter
116
+ }
117
+ }
137
118
 
138
119
  @state() root?: any
139
120
  @state() selected?: any
@@ -143,33 +124,26 @@ export class KpiTreePage extends connect(store)(localize(i18next)(ScopedElements
143
124
 
144
125
  @query('kpi-view') kpiView!: KpiView
145
126
 
146
- get context() {
147
- return {
148
- title: i18next.t('title.kpi tree'),
127
+ get context() { return { title: i18next.t('title.kpi tree'),
149
128
  help: 'kpi/kpi',
150
129
  actions: [
151
- {
152
- icon: 'delete',
130
+ { icon: 'delete',
153
131
  title: i18next.t('button.delete'),
154
132
  action: this.delete.bind(this),
155
- emphasis: {
156
- danger: true
157
- }
158
- }
133
+ emphasis: { danger: true
134
+ }
135
+ }
159
136
  ].filter(Boolean),
160
- exportable: {
161
- name: i18next.t('title.kpi tree'),
137
+ exportable: { name: i18next.t('title.kpi tree'),
162
138
  data: this.exportHandler.bind(this)
163
- },
164
- importable: {
165
- handler: this.importHandler.bind(this)
166
- },
139
+ },
140
+ importable: { handler: this.importHandler.bind(this)
141
+ },
167
142
  toolbar: false
168
- }
169
- }
143
+ }
144
+ }
170
145
 
171
- render() {
172
- return html`
146
+ render() { return html`
173
147
  <div class="header">
174
148
  <ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
175
149
  </div>
@@ -187,11 +161,10 @@ export class KpiTreePage extends connect(store)(localize(i18next)(ScopedElements
187
161
  <div editor>
188
162
  <kpi-view
189
163
  .kpi=${this.kpi}
190
- @property-change=${(e: CustomEvent) => {
191
- const { name } = e.detail || {}
164
+ @property-change=${(e: CustomEvent) => { const { name } = e.detail || {}
192
165
  this.modified = true
193
166
  this.appendable = name && name !== this.selected?.name
194
- }}
167
+ }}
195
168
  ></kpi-view>
196
169
  <div class="footer">
197
170
  <button @click=${this.reset.bind(this)}>
@@ -211,199 +184,154 @@ export class KpiTreePage extends connect(store)(localize(i18next)(ScopedElements
211
184
  </div>
212
185
  </content>
213
186
  `
214
- }
187
+ }
215
188
 
216
- updated(changes: PropertyValues<this>) {
217
- if (changes.has('selected')) {
218
- this.modified = false
189
+ updated(changes: PropertyValues<this>) { if (changes.has('selected')) { this.modified = false
219
190
  this.kpi = { ...this.selected }
220
- }
221
- }
191
+ }
192
+ }
222
193
 
223
- onSelect(e: CustomEvent) {
224
- this.selected = e.detail
194
+ onSelect(e: CustomEvent) { this.selected = e.detail
225
195
  this.updateContext()
226
- }
196
+ }
227
197
 
228
- reset() {
229
- if (this.kpiView) {
230
- this.kpiView.kpi = {}
231
- }
232
- }
198
+ reset() { if (this.kpiView) { this.kpiView.kpi = {}
199
+ }
200
+ }
233
201
 
234
- async create() {
235
- const { id: parentId } = this.selected || {}
202
+ async create() { const { id: parentId } = this.selected || {}
236
203
  const { name, description, formula, active, isLeaf, weight } = this.kpi || {}
237
204
 
238
- const kpi = {
239
- name,
205
+ const kpi = { name,
240
206
  description,
241
207
  formula,
242
208
  active: active !== false,
243
209
  isLeaf: isLeaf !== false,
244
210
  weight: weight || 1
245
- } as any
246
-
247
- if (parentId) {
248
- kpi.parent = { id: parentId }
249
- }
250
-
251
- const response = await client.mutate({
252
- mutation: gql`
253
- mutation ($kpi: NewKpi!) {
254
- createKpi(kpi: $kpi) {
255
- ...SubKpiFragment
256
- }
257
- }
211
+ } as any
212
+
213
+ if (parentId) { kpi.parent = { id: parentId }
214
+ }
215
+
216
+ const response = await client.mutate({ mutation: gql`
217
+ mutation ($kpi: NewKpi!) { createKpi(kpi: $kpi) { ...SubKpiFragment
218
+ }
219
+ }
258
220
  ${SubKpiFragment}
259
221
  `,
260
- variables: {
261
- kpi
262
- }
263
- })
222
+ variables: { kpi
223
+ }
224
+ })
264
225
 
265
226
  this.selected = response.data.createKpi
266
227
  this.updateContext()
267
228
 
268
229
  await this.fetch()
269
- }
230
+ }
270
231
 
271
- async save() {
272
- const { id, name, description, formula, active, isLeaf, weight } = this.kpi || {}
232
+ async save() { const { id, name, description, formula, active, isLeaf, weight } = this.kpi || {}
273
233
 
274
- if (!id) {
275
- await CustomAlert({
276
- type: 'warning',
234
+ if (!id) { await CustomAlert({ type: 'warning',
277
235
  title: i18next.t('message.kpi_not_selected'),
278
236
  text: i18next.t('message.select_kpi_first'),
279
237
  confirmButton: { text: i18next.t('button.confirm') }
280
- })
238
+ })
281
239
  return
282
- }
240
+ }
283
241
 
284
- const patch = {
285
- name,
242
+ const patch = { name,
286
243
  description,
287
244
  formula,
288
245
  active,
289
246
  isLeaf,
290
247
  weight
291
- } as any
292
-
293
- const response = await client.mutate({
294
- mutation: gql`
295
- mutation ($id: String!, $patch: KpiPatch!) {
296
- updateKpi(id: $id, patch: $patch) {
297
- ...SubKpiFragment
298
- }
299
- }
248
+ } as any
249
+
250
+ const response = await client.mutate({ mutation: gql`
251
+ mutation ($id: String!, $patch: KpiPatch!) { updateKpi(id: $id, patch: $patch) { ...SubKpiFragment
252
+ }
253
+ }
300
254
  ${SubKpiFragment}
301
255
  `,
302
- variables: {
303
- id,
256
+ variables: { id,
304
257
  patch
305
- }
306
- })
258
+ }
259
+ })
307
260
 
308
261
  this.selected = response.data.updateKpi
309
262
  this.fetch()
310
- }
263
+ }
311
264
 
312
- async delete() {
313
- if (!this.selected) {
314
- await CustomAlert({
315
- type: 'warning',
265
+ async delete() { if (!this.selected) { await CustomAlert({ type: 'warning',
316
266
  title: i18next.t('message.kpi_not_selected'),
317
267
  text: i18next.t('message.select_kpi_first'),
318
268
  confirmButton: { text: i18next.t('button.confirm') }
319
- })
269
+ })
320
270
  return
321
- }
271
+ }
322
272
 
323
273
  const children = this.selected?.children
324
- if (children && children.length > 0) {
325
- await CustomAlert({
326
- type: 'warning',
274
+ if (children && children.length > 0) { await CustomAlert({ type: 'warning',
327
275
  title: i18next.t('message.kpis_with_children_cannot_be_deleted'),
328
276
  text: i18next.t('message.kpi_having_children_cannot_be_deleted'),
329
277
  confirmButton: { text: i18next.t('button.confirm') }
330
- })
278
+ })
331
279
  return
332
- }
280
+ }
333
281
 
334
- if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
335
- const { id } = this.selected || {}
282
+ if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const { id } = this.selected || {}
336
283
 
337
- await client.mutate({
338
- mutation: gql`
339
- mutation ($ids: [String!]!) {
340
- deleteKpis(ids: $ids)
341
- }
284
+ await client.mutate({ mutation: gql`
285
+ mutation ($ids: [String!]!) { deleteKpis(ids: $ids)
286
+ }
342
287
  `,
343
- variables: {
344
- ids: [id]
345
- }
346
- })
288
+ variables: { ids: [id]
289
+ }
290
+ })
347
291
 
348
292
  this.selected = {}
349
293
  this.updateContext()
350
294
  await this.fetch()
351
- }
352
- }
353
-
354
- async pageInitialized(lifecycle: any) {
355
- this.fetch()
356
- }
357
-
358
- async pageUpdated(changes: any, lifecycle: any) {
359
- if (this.active) {
360
- // do something here when this page just became as active
361
- }
362
- }
363
-
364
- async fetch() {
365
- const response = await client.query({
366
- query: gql`
367
- query {
368
- kpiTree {
369
- ...SubKpiFragment
370
- children {
371
- ...SubKpiFragment
372
- children {
373
- ...SubKpiFragment
374
- children {
375
- ...SubKpiFragment
376
- children {
377
- ...SubKpiFragment
378
- children {
379
- ...SubKpiFragment
380
- children {
381
- ...SubKpiFragment
382
- children {
383
- ...SubKpiFragment
384
- }
385
- }
386
- }
387
- }
388
- }
389
- }
390
- }
391
- }
392
- }
295
+ }
296
+ }
297
+
298
+ async pageInitialized(lifecycle: any) { this.fetch()
299
+ }
300
+
301
+ async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active
302
+ }
303
+ }
304
+
305
+ async fetch() { const response = await client.query({ query: gql`
306
+ query { kpiTree { ...SubKpiFragment
307
+ children { ...SubKpiFragment
308
+ children { ...SubKpiFragment
309
+ children { ...SubKpiFragment
310
+ children { ...SubKpiFragment
311
+ children { ...SubKpiFragment
312
+ children { ...SubKpiFragment
313
+ children { ...SubKpiFragment
314
+ }
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
393
323
  ${SubKpiFragment}
394
324
  `
395
- })
325
+ })
396
326
 
397
327
  const records = response.data.kpiTree || []
398
328
  /* 다중루트를 지원하기 위해서 this.root 에 모든 루트를 저장하라. */
399
329
  this.root = records
400
- }
330
+ }
401
331
 
402
- async exportHandler() {
403
- // Export functionality can be implemented here
404
- }
332
+ async exportHandler() { // Export functionality can be implemented here
333
+ }
405
334
 
406
- async importHandler(records: any[]) {
407
- // Import functionality can be implemented here
408
- }
335
+ async importHandler(records: any[]) { // Import functionality can be implemented here
336
+ }
409
337
  }