@things-factory/kpi 9.1.19 → 10.0.0-beta.2

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 (140) 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/service/index.d.ts +1 -1
  43. package/dist-server/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +18 -18
  45. package/client/tsconfig.json +0 -11
  46. package/dist-server/tsconfig.json +0 -10
  47. package/server/@types/index.d.ts +0 -11
  48. package/server/calculator/evaluator.ts +0 -45
  49. package/server/calculator/functions.ts +0 -67
  50. package/server/calculator/index.ts +0 -4
  51. package/server/calculator/parser.ts +0 -137
  52. package/server/calculator/provider.ts +0 -10
  53. package/server/controllers/index.ts +0 -2
  54. package/server/controllers/kpi-metric-value-provider.ts +0 -79
  55. package/server/controllers/kpi-value-provider.ts +0 -51
  56. package/server/index.ts +0 -6
  57. package/server/migrations/1752190849680-seed-kpi-metrics.ts +0 -124
  58. package/server/migrations/1752190849681-seed-kpi.ts +0 -356
  59. package/server/migrations/1752192090123-add-grades-to-kpi.ts +0 -67
  60. package/server/migrations/1752192090124-add-kpi-statistics.ts +0 -719
  61. package/server/migrations/1752192090128-seed-kpi-org-scope.ts +0 -132
  62. package/server/migrations/1752192090129-seed-kpi-values.ts +0 -207
  63. package/server/migrations/grade-data/x11-performance-table.json +0 -962
  64. package/server/migrations/grade-data/x12-performance-table.json +0 -611
  65. package/server/migrations/grade-data/x14-performance-table.json +0 -42
  66. package/server/migrations/grade-data/x21-performance-table.json +0 -889
  67. package/server/migrations/grade-data/x22-performance-table.json +0 -1064
  68. package/server/migrations/grade-data/x23-performance-table.json +0 -42
  69. package/server/migrations/grade-data/x31-performance-table.json +0 -644
  70. package/server/migrations/grade-data/x32-performance-table.json +0 -993
  71. package/server/migrations/grade-data/x33-performance-table.json +0 -195
  72. package/server/migrations/grade-data/x34-performance-table.json +0 -12
  73. package/server/migrations/grade-data/x35-performance-table.json +0 -42
  74. package/server/migrations/grade-data/x41-performance-table.json +0 -825
  75. package/server/migrations/grade-data/x42-performance-table.json +0 -786
  76. package/server/migrations/grade-data/x43-performance-table.json +0 -12
  77. package/server/migrations/grade-data/x44-performance-table.json +0 -42
  78. package/server/migrations/grade-data/x51-performance-table.json +0 -924
  79. package/server/migrations/grade-data/x52-performance-table.json +0 -42
  80. package/server/migrations/grade-data/x61-performance-table.json +0 -261
  81. package/server/migrations/grade-data/x62-performance-table.json +0 -42
  82. package/server/migrations/index.ts +0 -9
  83. package/server/migrations/seed-data/kpi-metrics-seed.json +0 -454
  84. package/server/migrations/seed-data/kpi-org-scope-seed.json +0 -1676
  85. package/server/migrations/seed-data/kpi-scopes-seed.json +0 -121
  86. package/server/migrations/seed-data/kpi-values-seed.json +0 -402
  87. package/server/migrations/seed-data/kpis-seed.json +0 -488
  88. package/server/migrations/seed-data/scope-definitions-seed.json +0 -90
  89. package/server/routes.ts +0 -81
  90. package/server/service/index.ts +0 -51
  91. package/server/service/kpi/aggregate-kpi.ts +0 -103
  92. package/server/service/kpi/event-subscriber.ts +0 -29
  93. package/server/service/kpi/index.ts +0 -9
  94. package/server/service/kpi/kpi-formula.service.ts +0 -164
  95. package/server/service/kpi/kpi-grade.types.ts +0 -28
  96. package/server/service/kpi/kpi-history.ts +0 -126
  97. package/server/service/kpi/kpi-mutation.ts +0 -553
  98. package/server/service/kpi/kpi-query.ts +0 -224
  99. package/server/service/kpi/kpi-type.ts +0 -151
  100. package/server/service/kpi/kpi.ts +0 -254
  101. package/server/service/kpi-alert/index.ts +0 -3
  102. package/server/service/kpi-alert/kpi-alert-query.ts +0 -59
  103. package/server/service/kpi-alert/kpi-alert-type.ts +0 -20
  104. package/server/service/kpi-metric/aggregate-kpi-metric.ts +0 -132
  105. package/server/service/kpi-metric/index.ts +0 -7
  106. package/server/service/kpi-metric/kpi-metric-mutation.ts +0 -309
  107. package/server/service/kpi-metric/kpi-metric-query.ts +0 -70
  108. package/server/service/kpi-metric/kpi-metric-type.ts +0 -111
  109. package/server/service/kpi-metric/kpi-metric.ts +0 -134
  110. package/server/service/kpi-metric-value/index.ts +0 -7
  111. package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +0 -270
  112. package/server/service/kpi-metric-value/kpi-metric-value-query.ts +0 -62
  113. package/server/service/kpi-metric-value/kpi-metric-value-type.ts +0 -82
  114. package/server/service/kpi-metric-value/kpi-metric-value.ts +0 -93
  115. package/server/service/kpi-org-scope/index.ts +0 -6
  116. package/server/service/kpi-org-scope/kpi-org-scope-mutation.ts +0 -173
  117. package/server/service/kpi-org-scope/kpi-org-scope-query.ts +0 -127
  118. package/server/service/kpi-org-scope/kpi-org-scope-type.ts +0 -68
  119. package/server/service/kpi-org-scope/kpi-org-scope.ts +0 -123
  120. package/server/service/kpi-scope/index.ts +0 -11
  121. package/server/service/kpi-scope/kpi-scope-mutation.ts +0 -129
  122. package/server/service/kpi-scope/kpi-scope-query.ts +0 -63
  123. package/server/service/kpi-scope/kpi-scope-type.ts +0 -96
  124. package/server/service/kpi-scope/kpi-scope.ts +0 -143
  125. package/server/service/kpi-statistic/index.ts +0 -7
  126. package/server/service/kpi-statistic/kpi-statistic-batch.service.ts +0 -231
  127. package/server/service/kpi-statistic/kpi-statistic-calculation.service.ts +0 -410
  128. package/server/service/kpi-statistic/kpi-statistic-mutation.ts +0 -291
  129. package/server/service/kpi-statistic/kpi-statistic-query.ts +0 -146
  130. package/server/service/kpi-statistic/kpi-statistic-type.ts +0 -152
  131. package/server/service/kpi-statistic/kpi-statistic.ts +0 -199
  132. package/server/service/kpi-value/index.ts +0 -7
  133. package/server/service/kpi-value/kpi-value-mutation.ts +0 -432
  134. package/server/service/kpi-value/kpi-value-query.ts +0 -61
  135. package/server/service/kpi-value/kpi-value-score.service.ts +0 -106
  136. package/server/service/kpi-value/kpi-value-type.ts +0 -122
  137. package/server/service/kpi-value/kpi-value.ts +0 -160
  138. package/server/service/utils/value-date-util.ts +0 -119
  139. package/server/tsconfig.json +0 -10
  140. package/server/types/global.d.ts +0 -8
@@ -5,7 +5,7 @@ import '@operato/data-grist/ox-filters-form.js'
5
5
  import '@operato/data-grist/ox-record-creator.js'
6
6
 
7
7
  import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
8
- import { PageView, store } from '@operato/shell'
8
+ import { PageView } from '@operato/shell'
9
9
  import { css, html } from 'lit'
10
10
  import { customElement, property, query } from 'lit/decorators.js'
11
11
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
@@ -17,94 +17,75 @@ import { OxPopup, OxPrompt } from '@operato/popup'
17
17
  import { isMobileDevice } from '@operato/utils'
18
18
  import { p13n } from '@operato/p13n'
19
19
 
20
- import { connect } from 'pwa-helpers/connect-mixin'
21
20
  import gql from 'graphql-tag'
22
21
 
23
22
  import { KpiValueImporter } from './kpi-value-importer'
24
23
 
25
24
  @customElement('kpi-value-list-page')
26
- export class KpiValueListPage extends connect(store)(p13n(localize(i18next)(ScopedElementsMixin(PageView)))) {
27
- static styles = [
25
+ export class KpiValueListPage extends p13n(localize(i18next)(ScopedElementsMixin(PageView))) { static styles = [
28
26
  ScrollbarStyles,
29
27
  CommonGristStyles,
30
28
  CommonHeaderStyles,
31
29
  css`
32
- :host {
33
- display: flex;
30
+ :host { display: flex;
34
31
 
35
32
  width: 100%;
36
33
 
37
34
  --grid-record-emphasized-background-color: #8b0000;
38
35
  --grid-record-emphasized-color: #ff6b6b;
39
- }
36
+ }
40
37
 
41
- ox-grist {
42
- overflow-y: auto;
38
+ ox-grist { overflow-y: auto;
43
39
  flex: 1;
44
- }
40
+ }
45
41
 
46
- ox-filters-form {
47
- flex: 1;
48
- }
42
+ ox-filters-form { flex: 1;
43
+ }
49
44
  `
50
45
  ]
51
46
 
52
- static get scopedElements() {
53
- return {
54
- 'kpi-value-importer': KpiValueImporter
55
- }
56
- }
47
+ static get scopedElements() { return { 'kpi-value-importer': KpiValueImporter
48
+ }
49
+ }
57
50
 
58
51
  @property({ type: Object }) gristConfig: any
59
52
  @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
60
53
 
61
54
  @query('ox-grist') private grist!: DataGrist
62
55
 
63
- get context() {
64
- return {
65
- title: i18next.t('title.kpi value list'),
66
- search: {
67
- handler: (search: string) => {
68
- this.grist.searchText = search
69
- },
56
+ get context() { return { title: i18next.t('title.kpi value list'),
57
+ search: { handler: (search: string) => { this.grist.searchText = search
58
+ },
70
59
  value: this.grist.searchText
71
- },
72
- filter: {
73
- handler: () => {
74
- this.grist.toggleHeadroom()
75
- }
76
- },
60
+ },
61
+ filter: { handler: () => { this.grist.toggleHeadroom()
62
+ }
63
+ },
77
64
  help: 'kpi/kpi-value',
78
65
  actions: [
79
- {
80
- title: '일괄 편집',
66
+ { title: '일괄 편집',
81
67
  action: this._openEditor.bind(this),
82
68
  icon: 'edit',
83
69
  style: 'background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container);'
84
- },
85
- {
86
- title: i18next.t('button.save'),
70
+ },
71
+ { title: i18next.t('button.save'),
87
72
  action: this._updateKpiValue.bind(this),
88
73
  ...CommonButtonStyles.save
89
- },
90
- {
91
- title: i18next.t('button.delete'),
74
+ },
75
+ { title: i18next.t('button.delete'),
92
76
  action: this._deleteKpiValue.bind(this),
93
77
  ...CommonButtonStyles.delete
94
- }
78
+ }
95
79
  ],
96
- exportable: {
97
- name: i18next.t('title.kpi value list'),
80
+ exportable: { name: i18next.t('title.kpi value list'),
98
81
  data: this.exportHandler.bind(this)
99
- },
100
- importable: {
101
- handler: this.importHandler.bind(this)
102
- }
103
- }
104
- }
82
+ },
83
+ importable: { handler: this.importHandler.bind(this)
84
+ }
85
+ }
86
+ }
105
87
 
106
- render() {
107
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
88
+ render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
108
89
 
109
90
  return html`
110
91
  <ox-grist
@@ -134,12 +115,9 @@ export class KpiValueListPage extends connect(store)(p13n(localize(i18next)(Scop
134
115
  <ox-grist-personalizer slot="setting"></ox-grist-personalizer>
135
116
  </ox-grist>
136
117
  `
137
- }
118
+ }
138
119
 
139
- async pageInitialized(lifecycle: any) {
140
- this.gristConfig = {
141
- list: {
142
- fields: [
120
+ async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: [
143
121
  'kpi',
144
122
  'version',
145
123
  'valueDate',
@@ -169,39 +147,33 @@ export class KpiValueListPage extends connect(store)(p13n(localize(i18next)(Scop
169
147
  'creator',
170
148
  'updater'
171
149
  ]
172
- },
150
+ },
173
151
  columns: [
174
152
  { type: 'gutter', gutterName: 'sequence' },
175
153
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
176
154
  // KPI Value 재계산 버튼 추가
177
- {
178
- type: 'gutter',
155
+ { type: 'gutter',
179
156
  gutterName: 'button',
180
157
  icon: 'refresh',
181
158
  title: '재계산',
182
- handlers: {
183
- click: (columns, data, column, record, rowIndex) => {
184
- this._recalculateKpiValue(record)
185
- }
186
- }
187
- },
188
- {
189
- type: 'string',
159
+ handlers: { click: (columns, data, column, record, rowIndex) => { this._recalculateKpiValue(record)
160
+ }
161
+ }
162
+ },
163
+ { type: 'string',
190
164
  name: 'kpiOrgScope',
191
165
  header: '조직',
192
166
  record: { editable: false },
193
167
  width: 120,
194
- renderer: (value, column, record, rowIndex, field) => {
195
- return value?.entityName || value?.org || ''
196
- }
197
- },
198
- {
199
- type: 'string',
168
+ renderer: (value, column, record, rowIndex, field) => { return value?.entityName || value?.org || ''
169
+ }
170
+ },
171
+ { type: 'string',
200
172
  name: 'kpi',
201
173
  header: 'KPI',
202
174
  record: { editable: false, renderer: (v, c, r) => r.kpi?.name },
203
175
  width: 150
204
- },
176
+ },
205
177
  { type: 'number', name: 'version', header: '버전', record: { editable: false }, width: 80 },
206
178
  { type: 'string', name: 'valueDate', header: '실적일', record: { editable: true }, width: 120 },
207
179
  { type: 'number', name: 'value', header: '실적값', record: { editable: true }, width: 120 },
@@ -211,48 +183,36 @@ export class KpiValueListPage extends connect(store)(p13n(localize(i18next)(Scop
211
183
  { type: 'object', name: 'meta', header: '메타', record: { editable: false }, width: 120 },
212
184
  { type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },
213
185
  { type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },
214
- {
215
- type: 'resource-object',
186
+ { type: 'resource-object',
216
187
  name: 'creator',
217
188
  header: '생성자',
218
189
  record: { editable: false, renderer: (v, c, r) => r.creator?.name },
219
190
  width: 120
220
- },
221
- {
222
- type: 'resource-object',
191
+ },
192
+ { type: 'resource-object',
223
193
  name: 'updater',
224
194
  header: '수정자',
225
195
  record: { editable: false, renderer: (v, c, r) => r.updater?.name },
226
196
  width: 120
227
- }
197
+ }
228
198
  ],
229
- rows: {
230
- appendable: false,
231
- selectable: {
232
- multiple: true
233
- }
234
- },
199
+ rows: { appendable: false,
200
+ selectable: { multiple: true
201
+ }
202
+ },
235
203
  sorters: [{ name: 'valueDate' }]
236
- }
237
- }
238
-
239
- async pageUpdated(changes: any, lifecycle: any) {
240
- if (this.active) {
241
- // do something here when this page just became as active
242
- }
243
- }
244
-
245
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
246
- const response = await client.query({
247
- query: gql`
248
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
249
- responses: kpiValues(filters: $filters, pagination: $pagination, sortings: $sortings) {
250
- items {
251
- id
252
- kpi {
253
- id
204
+ }
205
+ }
206
+
207
+ async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active
208
+ }
209
+ }
210
+
211
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`
212
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: kpiValues(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
213
+ kpi { id
254
214
  name
255
- }
215
+ }
256
216
  version
257
217
  valueDate
258
218
  value
@@ -260,227 +220,173 @@ export class KpiValueListPage extends connect(store)(p13n(localize(i18next)(Scop
260
220
  inputType
261
221
  source
262
222
  meta
263
- kpiOrgScope {
264
- id
223
+ kpiOrgScope { id
265
224
  org
266
- }
267
- updater {
268
- id
225
+ }
226
+ updater { id
269
227
  name
270
- }
228
+ }
271
229
  updatedAt
272
- creator {
273
- id
230
+ creator { id
274
231
  name
275
- }
232
+ }
276
233
  createdAt
277
- }
234
+ }
278
235
  total
279
- }
280
- }
236
+ }
237
+ }
281
238
  `,
282
- variables: {
283
- filters,
239
+ variables: { filters,
284
240
  pagination: { page, limit },
285
241
  sortings
286
- }
287
- })
242
+ }
243
+ })
288
244
 
289
- return {
290
- total: response.data.responses.total || 0,
245
+ return { total: response.data.responses.total || 0,
291
246
  records: response.data.responses.items || []
292
- }
293
- }
247
+ }
248
+ }
294
249
 
295
- async _openEditor() {
296
- const { KpiValueEditorPage } = await import('./kpi-value-editor-page.js')
250
+ async _openEditor() { const { KpiValueEditorPage } = await import('./kpi-value-editor-page.js')
297
251
  await openPopup(html`
298
252
  <${KpiValueEditorPage}></${KpiValueEditorPage}>
299
253
  `)
300
- }
254
+ }
301
255
 
302
- async _deleteKpiValue() {
303
- if (
304
- await OxPrompt.open({
305
- title: i18next.t('text.are_you_sure'),
256
+ async _deleteKpiValue() { if (
257
+ await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
306
258
  text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
307
259
  confirmButton: { text: i18next.t('button.confirm') },
308
260
  cancelButton: { text: i18next.t('button.cancel') }
309
- })
310
- ) {
311
- const ids = this.grist.selected.map(record => record.id)
312
- if (ids && ids.length > 0) {
313
- const response = await client.mutate({
314
- mutation: gql`
315
- mutation ($ids: [String!]!) {
316
- deleteKpiValues(ids: $ids)
317
- }
261
+ })
262
+ ) { const ids = this.grist.selected.map(record => record.id)
263
+ if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`
264
+ mutation ($ids: [String!]!) { deleteKpiValues(ids: $ids)
265
+ }
318
266
  `,
319
- variables: {
320
- ids
321
- }
322
- })
323
-
324
- if (!response.errors) {
325
- this.grist.fetch()
326
- notify({
327
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
328
- })
329
- }
330
- }
331
- }
332
- }
333
-
334
- async _updateKpiValue() {
335
- let patches = this.grist.dirtyRecords
336
- if (patches && patches.length) {
337
- patches = patches.map(patch => {
338
- let patchField: any = patch.id ? { id: patch.id } : {}
267
+ variables: { ids
268
+ }
269
+ })
270
+
271
+ if (!response.errors) { this.grist.fetch()
272
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
273
+ })
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ async _updateKpiValue() { let patches = this.grist.dirtyRecords
280
+ if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}
339
281
  const dirtyFields = patch.__dirtyfields__
340
- for (let key in dirtyFields) {
341
- patchField[key] = dirtyFields[key].after
342
- }
282
+ for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after
283
+ }
343
284
  patchField.cuFlag = patch.__dirty__
344
285
 
345
286
  return patchField
346
- })
347
-
348
- const response = await client.mutate({
349
- mutation: gql`
350
- mutation ($patches: [KpiValuePatch!]!) {
351
- updateMultipleKpiValue(patches: $patches) {
352
- id
353
- kpi {
354
- id
287
+ })
288
+
289
+ const response = await client.mutate({ mutation: gql`
290
+ mutation ($patches: [KpiValuePatch!]!) { updateMultipleKpiValue(patches: $patches) { id
291
+ kpi { id
355
292
  name
356
- }
293
+ }
357
294
  version
358
295
  valueDate
359
296
  value
360
297
  score
361
- }
362
- }
298
+ }
299
+ }
363
300
  `,
364
- variables: {
365
- patches
366
- }
367
- })
301
+ variables: { patches
302
+ }
303
+ })
368
304
 
369
- if (!response.errors) {
370
- this.grist.fetch()
371
- }
372
- }
373
- }
374
-
375
- async _recalculateKpiValue(kpiValue) {
376
- try {
377
- const response = await client.mutate({
378
- mutation: gql`
379
- mutation ($id: String!) {
380
- recalculateKpiValue(id: $id) {
381
- id
305
+ if (!response.errors) { this.grist.fetch()
306
+ }
307
+ }
308
+ }
309
+
310
+ async _recalculateKpiValue(kpiValue) { try { const response = await client.mutate({ mutation: gql`
311
+ mutation ($id: String!) { recalculateKpiValue(id: $id) { id
382
312
  value
383
313
  score
384
314
  valueDate
385
- kpiOrgScope {
386
- id
315
+ kpiOrgScope { id
387
316
  entityName
388
317
  org
389
- }
390
- }
391
- }
318
+ }
319
+ }
320
+ }
392
321
  `,
393
- variables: {
394
- id: kpiValue.id
395
- }
396
- })
397
- if (!response.errors) {
398
- notify({ message: 'KPI Value가 성공적으로 재계산되었습니다.' })
322
+ variables: { id: kpiValue.id
323
+ }
324
+ })
325
+ if (!response.errors) { notify({ message: 'KPI Value가 성공적으로 재계산되었습니다.' })
399
326
  this.grist.fetch()
400
- }
401
- } catch (error) {
402
- notify({ message: 'KPI Value 재계산 중 오류가 발생했습니다.' })
403
- }
404
- }
405
-
406
- async creationCallback(kpiValue) {
407
- try {
408
- const response = await client.query({
409
- query: gql`
410
- mutation ($kpiValue: NewKpiValue!) {
411
- createKpiValue(kpiValue: $kpiValue) {
412
- id
413
- }
414
- }
327
+ }
328
+ } catch (error) { notify({ message: 'KPI Value 재계산 중 오류가 발생했습니다.' })
329
+ }
330
+ }
331
+
332
+ async creationCallback(kpiValue) { try { const response = await client.query({ query: gql`
333
+ mutation ($kpiValue: NewKpiValue!) { createKpiValue(kpiValue: $kpiValue) { id
334
+ }
335
+ }
415
336
  `,
416
- variables: {
417
- kpiValue
418
- },
419
- context: {
420
- hasUpload: true
421
- }
422
- })
423
-
424
- if (!response.errors) {
425
- this.grist.fetch()
337
+ variables: { kpiValue
338
+ },
339
+ context: { hasUpload: true
340
+ }
341
+ })
342
+
343
+ if (!response.errors) { this.grist.fetch()
426
344
  document.dispatchEvent(
427
- new CustomEvent('notify', {
428
- detail: {
429
- message: i18next.t('text.data_created_successfully')
430
- }
431
- })
345
+ new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully')
346
+ }
347
+ })
432
348
  )
433
- }
349
+ }
434
350
 
435
351
  return true
436
- } catch (ex) {
437
- console.error(ex)
352
+ } catch (ex) { console.error(ex)
438
353
  document.dispatchEvent(
439
- new CustomEvent('notify', {
440
- detail: {
441
- type: 'error',
354
+ new CustomEvent('notify', { detail: { type: 'error',
442
355
  message: i18next.t('text.error')
443
- }
444
- })
356
+ }
357
+ })
445
358
  )
446
359
  return false
447
- }
448
- }
360
+ }
361
+ }
449
362
 
450
- async exportHandler() {
451
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
363
+ async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
452
364
  const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
453
365
 
454
- return exportTargets.map(kpiValue => {
455
- let tempObj = {}
456
- for (const field of targetFieldSet) {
457
- tempObj[field] = kpiValue[field]
458
- }
366
+ return exportTargets.map(kpiValue => { let tempObj = {}
367
+ for (const field of targetFieldSet) { tempObj[field] = kpiValue[field]
368
+ }
459
369
 
460
370
  return tempObj
461
- })
462
- }
371
+ })
372
+ }
463
373
 
464
- async importHandler(records) {
465
- const popup = openPopup(
374
+ async importHandler(records) { const popup = openPopup(
466
375
  html`
467
376
  <kpi-value-importer
468
377
  .kpiValues=${records}
469
- @imported=${() => {
470
- history.back()
378
+ @imported=${() => { history.back()
471
379
  this.grist.fetch()
472
- }}
380
+ }}
473
381
  ></kpi-value-importer>
474
382
  `,
475
- {
476
- backdrop: true,
383
+ { backdrop: true,
477
384
  size: 'large',
478
385
  title: i18next.t('title.import kpi-value')
479
- }
386
+ }
480
387
  )
481
388
 
482
- popup.onclosed = () => {
483
- this.grist.fetch()
484
- }
485
- }
389
+ popup.onclosed = () => { this.grist.fetch()
390
+ }
391
+ }
486
392
  }
@@ -11,12 +11,6 @@ import { KpiImporter } from './kpi-importer';
11
11
  import { KpiGradeEditor } from './kpi-grade-editor';
12
12
  import { KpiVizEditor } from './kpi-viz-editor';
13
13
  declare const KpiListPage_base: (new (...args: any[]) => {
14
- _storeUnsubscribe: import("redux").Unsubscribe;
15
- connectedCallback(): void;
16
- disconnectedCallback(): void;
17
- stateChanged(_state: unknown): void;
18
- readonly isConnected: boolean;
19
- }) & (new (...args: any[]) => {
20
14
  __preferenceProviders: {
21
15
  [element: string]: import("@operato/p13n").PagePreferenceProvider;
22
16
  };