@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.
- package/client/pages/kpi/kpi-list-page.ts +339 -525
- package/client/pages/kpi/kpi-tree-page.ts +135 -207
- package/client/pages/kpi-metric/kpi-metric-list-page.ts +146 -226
- package/client/pages/kpi-metric-value/kpi-metric-value-editor-page.ts +187 -295
- package/client/pages/kpi-metric-value/kpi-metric-value-list-page.ts +123 -194
- package/client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.ts +57 -91
- package/client/pages/kpi-statistic/kpi-statistic-editor-page.ts +180 -278
- package/client/pages/kpi-statistic/kpi-statistic-list-page.ts +186 -286
- package/client/pages/kpi-value/kpi-value-editor-page.ts +189 -292
- package/client/pages/kpi-value/kpi-value-list-page.ts +170 -264
- package/dist-client/pages/kpi/kpi-list-page.d.ts +0 -6
- package/dist-client/pages/kpi/kpi-list-page.js +150 -282
- package/dist-client/pages/kpi/kpi-list-page.js.map +1 -1
- package/dist-client/pages/kpi/kpi-tree-page.d.ts +1 -7
- package/dist-client/pages/kpi/kpi-tree-page.js +76 -127
- package/dist-client/pages/kpi/kpi-tree-page.js.map +1 -1
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.d.ts +0 -6
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js +62 -116
- package/dist-client/pages/kpi-metric/kpi-metric-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.d.ts +1 -7
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js +82 -140
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.d.ts +0 -6
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js +54 -98
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-list-page.js.map +1 -1
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.d.ts +1 -7
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js +30 -57
- package/dist-client/pages/kpi-metric-value/kpi-metric-value-manual-entry-page.js.map +1 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.d.ts +1 -7
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js +91 -153
- package/dist-client/pages/kpi-statistic/kpi-statistic-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.d.ts +0 -6
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js +81 -155
- package/dist-client/pages/kpi-statistic/kpi-statistic-list-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-editor-page.d.ts +1 -7
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js +80 -136
- package/dist-client/pages/kpi-value/kpi-value-editor-page.js.map +1 -1
- package/dist-client/pages/kpi-value/kpi-value-list-page.d.ts +0 -6
- package/dist-client/pages/kpi-value/kpi-value-list-page.js +73 -134
- package/dist-client/pages/kpi-value/kpi-value-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/client/tsconfig.json +0 -11
- package/dist-server/tsconfig.json +0 -10
- package/server/@types/index.d.ts +0 -11
- package/server/calculator/evaluator.ts +0 -45
- package/server/calculator/functions.ts +0 -67
- package/server/calculator/index.ts +0 -4
- package/server/calculator/parser.ts +0 -137
- package/server/calculator/provider.ts +0 -10
- package/server/controllers/index.ts +0 -2
- package/server/controllers/kpi-metric-value-provider.ts +0 -79
- package/server/controllers/kpi-value-provider.ts +0 -51
- package/server/index.ts +0 -6
- package/server/migrations/1752190849680-seed-kpi-metrics.ts +0 -124
- package/server/migrations/1752190849681-seed-kpi.ts +0 -356
- package/server/migrations/1752192090123-add-grades-to-kpi.ts +0 -67
- package/server/migrations/1752192090124-add-kpi-statistics.ts +0 -719
- package/server/migrations/1752192090128-seed-kpi-org-scope.ts +0 -132
- package/server/migrations/1752192090129-seed-kpi-values.ts +0 -207
- package/server/migrations/grade-data/x11-performance-table.json +0 -962
- package/server/migrations/grade-data/x12-performance-table.json +0 -611
- package/server/migrations/grade-data/x14-performance-table.json +0 -42
- package/server/migrations/grade-data/x21-performance-table.json +0 -889
- package/server/migrations/grade-data/x22-performance-table.json +0 -1064
- package/server/migrations/grade-data/x23-performance-table.json +0 -42
- package/server/migrations/grade-data/x31-performance-table.json +0 -644
- package/server/migrations/grade-data/x32-performance-table.json +0 -993
- package/server/migrations/grade-data/x33-performance-table.json +0 -195
- package/server/migrations/grade-data/x34-performance-table.json +0 -12
- package/server/migrations/grade-data/x35-performance-table.json +0 -42
- package/server/migrations/grade-data/x41-performance-table.json +0 -825
- package/server/migrations/grade-data/x42-performance-table.json +0 -786
- package/server/migrations/grade-data/x43-performance-table.json +0 -12
- package/server/migrations/grade-data/x44-performance-table.json +0 -42
- package/server/migrations/grade-data/x51-performance-table.json +0 -924
- package/server/migrations/grade-data/x52-performance-table.json +0 -42
- package/server/migrations/grade-data/x61-performance-table.json +0 -261
- package/server/migrations/grade-data/x62-performance-table.json +0 -42
- package/server/migrations/index.ts +0 -9
- package/server/migrations/seed-data/kpi-metrics-seed.json +0 -454
- package/server/migrations/seed-data/kpi-org-scope-seed.json +0 -1676
- package/server/migrations/seed-data/kpi-scopes-seed.json +0 -121
- package/server/migrations/seed-data/kpi-values-seed.json +0 -402
- package/server/migrations/seed-data/kpis-seed.json +0 -488
- package/server/migrations/seed-data/scope-definitions-seed.json +0 -90
- package/server/routes.ts +0 -81
- package/server/service/index.ts +0 -51
- package/server/service/kpi/aggregate-kpi.ts +0 -103
- package/server/service/kpi/event-subscriber.ts +0 -29
- package/server/service/kpi/index.ts +0 -9
- package/server/service/kpi/kpi-formula.service.ts +0 -164
- package/server/service/kpi/kpi-grade.types.ts +0 -28
- package/server/service/kpi/kpi-history.ts +0 -126
- package/server/service/kpi/kpi-mutation.ts +0 -553
- package/server/service/kpi/kpi-query.ts +0 -224
- package/server/service/kpi/kpi-type.ts +0 -151
- package/server/service/kpi/kpi.ts +0 -254
- package/server/service/kpi-alert/index.ts +0 -3
- package/server/service/kpi-alert/kpi-alert-query.ts +0 -59
- package/server/service/kpi-alert/kpi-alert-type.ts +0 -20
- package/server/service/kpi-metric/aggregate-kpi-metric.ts +0 -132
- package/server/service/kpi-metric/index.ts +0 -7
- package/server/service/kpi-metric/kpi-metric-mutation.ts +0 -309
- package/server/service/kpi-metric/kpi-metric-query.ts +0 -70
- package/server/service/kpi-metric/kpi-metric-type.ts +0 -111
- package/server/service/kpi-metric/kpi-metric.ts +0 -134
- package/server/service/kpi-metric-value/index.ts +0 -7
- package/server/service/kpi-metric-value/kpi-metric-value-mutation.ts +0 -270
- package/server/service/kpi-metric-value/kpi-metric-value-query.ts +0 -62
- package/server/service/kpi-metric-value/kpi-metric-value-type.ts +0 -82
- package/server/service/kpi-metric-value/kpi-metric-value.ts +0 -93
- package/server/service/kpi-org-scope/index.ts +0 -6
- package/server/service/kpi-org-scope/kpi-org-scope-mutation.ts +0 -173
- package/server/service/kpi-org-scope/kpi-org-scope-query.ts +0 -127
- package/server/service/kpi-org-scope/kpi-org-scope-type.ts +0 -68
- package/server/service/kpi-org-scope/kpi-org-scope.ts +0 -123
- package/server/service/kpi-scope/index.ts +0 -11
- package/server/service/kpi-scope/kpi-scope-mutation.ts +0 -129
- package/server/service/kpi-scope/kpi-scope-query.ts +0 -63
- package/server/service/kpi-scope/kpi-scope-type.ts +0 -96
- package/server/service/kpi-scope/kpi-scope.ts +0 -143
- package/server/service/kpi-statistic/index.ts +0 -7
- package/server/service/kpi-statistic/kpi-statistic-batch.service.ts +0 -231
- package/server/service/kpi-statistic/kpi-statistic-calculation.service.ts +0 -410
- package/server/service/kpi-statistic/kpi-statistic-mutation.ts +0 -291
- package/server/service/kpi-statistic/kpi-statistic-query.ts +0 -146
- package/server/service/kpi-statistic/kpi-statistic-type.ts +0 -152
- package/server/service/kpi-statistic/kpi-statistic.ts +0 -199
- package/server/service/kpi-value/index.ts +0 -7
- package/server/service/kpi-value/kpi-value-mutation.ts +0 -432
- package/server/service/kpi-value/kpi-value-query.ts +0 -61
- package/server/service/kpi-value/kpi-value-score.service.ts +0 -106
- package/server/service/kpi-value/kpi-value-type.ts +0 -122
- package/server/service/kpi-value/kpi-value.ts +0 -160
- package/server/service/utils/value-date-util.ts +0 -119
- package/server/tsconfig.json +0 -10
- 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
|
|
8
|
+
import { PageView } from '@operato/shell'
|
|
9
9
|
import { css, html, PropertyValues } from 'lit'
|
|
10
10
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
11
11
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
@@ -17,88 +17,70 @@ 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 { KpiMetricImporter } from './kpi-metric-importer'
|
|
24
23
|
|
|
25
24
|
@customElement('kpi-metric-list-page')
|
|
26
|
-
export class KpiMetricListPage extends
|
|
27
|
-
static styles = [
|
|
25
|
+
export class KpiMetricListPage 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
|
-
|
|
48
|
-
}
|
|
42
|
+
ox-filters-form { flex: 1;
|
|
43
|
+
}
|
|
49
44
|
`
|
|
50
45
|
]
|
|
51
46
|
|
|
52
|
-
static get scopedElements() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
}
|
|
47
|
+
static get scopedElements() { return { 'kpi-metric-importer': KpiMetricImporter
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
search: {
|
|
67
|
-
handler: (search: string) => {
|
|
68
|
-
this.grist.searchText = search
|
|
69
|
-
},
|
|
56
|
+
get context() { return { title: i18next.t('title.kpi metric list'),
|
|
57
|
+
search: { handler: (search: string) => { this.grist.searchText = search
|
|
58
|
+
},
|
|
70
59
|
value: this.grist.searchText
|
|
71
|
-
|
|
72
|
-
filter: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
},
|
|
60
|
+
},
|
|
61
|
+
filter: { handler: () => { this.grist.toggleHeadroom()
|
|
62
|
+
}
|
|
63
|
+
},
|
|
77
64
|
help: 'kpi/kpi-metric',
|
|
78
65
|
actions: [
|
|
79
|
-
{
|
|
80
|
-
title: i18next.t('button.save'),
|
|
66
|
+
{ title: i18next.t('button.save'),
|
|
81
67
|
action: this._updateKpiMetric.bind(this),
|
|
82
68
|
...CommonButtonStyles.save
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
title: i18next.t('button.delete'),
|
|
69
|
+
},
|
|
70
|
+
{ title: i18next.t('button.delete'),
|
|
86
71
|
action: this._deleteKpiMetric.bind(this),
|
|
87
72
|
...CommonButtonStyles.delete
|
|
88
|
-
|
|
73
|
+
}
|
|
89
74
|
],
|
|
90
|
-
exportable: {
|
|
91
|
-
name: i18next.t('title.kpi metric list'),
|
|
75
|
+
exportable: { name: i18next.t('title.kpi metric list'),
|
|
92
76
|
data: this.exportHandler.bind(this)
|
|
93
|
-
|
|
94
|
-
importable: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
77
|
+
},
|
|
78
|
+
importable: { handler: this.importHandler.bind(this)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
99
82
|
|
|
100
|
-
render() {
|
|
101
|
-
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
83
|
+
render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
102
84
|
|
|
103
85
|
return html`
|
|
104
86
|
<ox-grist
|
|
@@ -128,12 +110,9 @@ export class KpiMetricListPage extends connect(store)(p13n(localize(i18next)(Sco
|
|
|
128
110
|
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
129
111
|
</ox-grist>
|
|
130
112
|
`
|
|
131
|
-
|
|
113
|
+
}
|
|
132
114
|
|
|
133
|
-
async pageInitialized(lifecycle: any) {
|
|
134
|
-
this.gristConfig = {
|
|
135
|
-
list: {
|
|
136
|
-
fields: [
|
|
115
|
+
async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: [
|
|
137
116
|
'name',
|
|
138
117
|
'description',
|
|
139
118
|
'unit',
|
|
@@ -167,43 +146,38 @@ export class KpiMetricListPage extends connect(store)(p13n(localize(i18next)(Sco
|
|
|
167
146
|
'creator',
|
|
168
147
|
'updater'
|
|
169
148
|
]
|
|
170
|
-
|
|
149
|
+
},
|
|
171
150
|
columns: [
|
|
172
151
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
173
152
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
174
|
-
{
|
|
175
|
-
type: 'string',
|
|
153
|
+
{ type: 'string',
|
|
176
154
|
name: 'name',
|
|
177
155
|
header: '코드',
|
|
178
156
|
record: { editable: true },
|
|
179
157
|
filter: 'search',
|
|
180
158
|
sortable: true,
|
|
181
159
|
width: 120
|
|
182
|
-
|
|
160
|
+
},
|
|
183
161
|
{ type: 'string', name: 'description', header: '설명', record: { editable: true }, width: 200 },
|
|
184
162
|
{ type: 'string', name: 'unit', header: '단위', record: { editable: true }, width: 80 },
|
|
185
163
|
{ type: 'string', name: 'source', header: '데이터출처', record: { editable: true }, width: 120 },
|
|
186
|
-
{
|
|
187
|
-
type: 'string',
|
|
164
|
+
{ type: 'string',
|
|
188
165
|
name: 'dataSet',
|
|
189
166
|
header: '데이터셋',
|
|
190
167
|
record: { editable: false, renderer: (v, c, r) => r.dataSet?.name },
|
|
191
168
|
width: 120
|
|
192
|
-
|
|
169
|
+
},
|
|
193
170
|
{ type: 'string', name: 'fieldName', header: '필드명', record: { editable: true }, width: 120 },
|
|
194
|
-
{
|
|
195
|
-
type: 'select',
|
|
171
|
+
{ type: 'select',
|
|
196
172
|
name: 'collectType',
|
|
197
173
|
header: '수집방법',
|
|
198
174
|
record: { editable: true, options: ['', 'AUTO', 'MANUAL', 'IMPORT', 'EXTERNAL'] },
|
|
199
175
|
width: 120
|
|
200
|
-
|
|
201
|
-
{
|
|
202
|
-
type: 'select',
|
|
176
|
+
},
|
|
177
|
+
{ type: 'select',
|
|
203
178
|
name: 'periodType',
|
|
204
179
|
header: '주기',
|
|
205
|
-
record: {
|
|
206
|
-
editable: true,
|
|
180
|
+
record: { editable: true,
|
|
207
181
|
options: [
|
|
208
182
|
{ value: '', display: '' },
|
|
209
183
|
{ value: 'DAY', display: '일' },
|
|
@@ -214,53 +188,42 @@ export class KpiMetricListPage extends connect(store)(p13n(localize(i18next)(Sco
|
|
|
214
188
|
{ value: 'RANGE', display: '범위' },
|
|
215
189
|
{ value: 'ALLTIME', display: '전체' }
|
|
216
190
|
]
|
|
217
|
-
|
|
191
|
+
},
|
|
218
192
|
width: 80
|
|
219
|
-
|
|
193
|
+
},
|
|
220
194
|
{ type: 'checkbox', name: 'active', label: true, header: '활성', record: { editable: true }, width: 60 },
|
|
221
195
|
{ type: 'crontab', name: 'schedule', header: '스케줄', record: { editable: true }, width: 120 },
|
|
222
196
|
{ type: 'string', name: 'scheduleId', header: '스케줄ID', record: { editable: false }, width: 120 },
|
|
223
197
|
{ type: 'timezone', name: 'timezone', header: '타임존', record: { editable: true }, width: 120 },
|
|
224
198
|
{ type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },
|
|
225
199
|
{ type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },
|
|
226
|
-
{
|
|
227
|
-
type: 'resource-object',
|
|
200
|
+
{ type: 'resource-object',
|
|
228
201
|
name: 'creator',
|
|
229
202
|
header: '생성자',
|
|
230
203
|
record: { editable: false, renderer: (v, c, r) => r.creator?.name },
|
|
231
204
|
width: 120
|
|
232
|
-
|
|
233
|
-
{
|
|
234
|
-
type: 'resource-object',
|
|
205
|
+
},
|
|
206
|
+
{ type: 'resource-object',
|
|
235
207
|
name: 'updater',
|
|
236
208
|
header: '수정자',
|
|
237
209
|
record: { editable: false, renderer: (v, c, r) => r.updater?.name },
|
|
238
210
|
width: 120
|
|
239
|
-
|
|
211
|
+
}
|
|
240
212
|
],
|
|
241
|
-
rows: {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
},
|
|
213
|
+
rows: { appendable: false,
|
|
214
|
+
selectable: { multiple: true
|
|
215
|
+
}
|
|
216
|
+
},
|
|
247
217
|
sorters: [{ name: 'name' }]
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
async pageUpdated(changes: any, lifecycle: any) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
258
|
-
const response = await client.query({
|
|
259
|
-
query: gql`
|
|
260
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
261
|
-
responses: kpiMetrics(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
262
|
-
items {
|
|
263
|
-
id
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`
|
|
226
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: kpiMetrics(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
264
227
|
name
|
|
265
228
|
description
|
|
266
229
|
periodType
|
|
@@ -268,184 +231,141 @@ export class KpiMetricListPage extends connect(store)(p13n(localize(i18next)(Sco
|
|
|
268
231
|
unit
|
|
269
232
|
source
|
|
270
233
|
collectType
|
|
271
|
-
dataSet {
|
|
272
|
-
id
|
|
234
|
+
dataSet { id
|
|
273
235
|
name
|
|
274
|
-
|
|
236
|
+
}
|
|
275
237
|
fieldName
|
|
276
238
|
schedule
|
|
277
239
|
timezone
|
|
278
|
-
updater {
|
|
279
|
-
id
|
|
240
|
+
updater { id
|
|
280
241
|
name
|
|
281
|
-
|
|
242
|
+
}
|
|
282
243
|
updatedAt
|
|
283
|
-
creator {
|
|
284
|
-
id
|
|
244
|
+
creator { id
|
|
285
245
|
name
|
|
286
|
-
|
|
246
|
+
}
|
|
287
247
|
createdAt
|
|
288
|
-
|
|
248
|
+
}
|
|
289
249
|
total
|
|
290
|
-
|
|
291
|
-
|
|
250
|
+
}
|
|
251
|
+
}
|
|
292
252
|
`,
|
|
293
|
-
variables: {
|
|
294
|
-
filters,
|
|
253
|
+
variables: { filters,
|
|
295
254
|
pagination: { page, limit },
|
|
296
255
|
sortings
|
|
297
|
-
|
|
298
|
-
|
|
256
|
+
}
|
|
257
|
+
})
|
|
299
258
|
|
|
300
|
-
return {
|
|
301
|
-
total: response.data.responses.total || 0,
|
|
259
|
+
return { total: response.data.responses.total || 0,
|
|
302
260
|
records: response.data.responses.items || []
|
|
303
|
-
|
|
304
|
-
|
|
261
|
+
}
|
|
262
|
+
}
|
|
305
263
|
|
|
306
|
-
async _deleteKpiMetric() {
|
|
307
|
-
|
|
308
|
-
await OxPrompt.open({
|
|
309
|
-
title: i18next.t('text.are_you_sure'),
|
|
264
|
+
async _deleteKpiMetric() { if (
|
|
265
|
+
await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
|
|
310
266
|
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
311
267
|
confirmButton: { text: i18next.t('button.confirm') },
|
|
312
268
|
cancelButton: { text: i18next.t('button.cancel') }
|
|
313
|
-
|
|
314
|
-
) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
mutation: gql`
|
|
319
|
-
mutation ($ids: [String!]!) {
|
|
320
|
-
deleteKpiMetrics(ids: $ids)
|
|
321
|
-
}
|
|
269
|
+
})
|
|
270
|
+
) { const ids = this.grist.selected.map(record => record.id)
|
|
271
|
+
if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`
|
|
272
|
+
mutation ($ids: [String!]!) { deleteKpiMetrics(ids: $ids)
|
|
273
|
+
}
|
|
322
274
|
`,
|
|
323
|
-
variables: {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
async _updateKpiMetric() {
|
|
339
|
-
let patches = this.grist.dirtyRecords
|
|
340
|
-
if (patches && patches.length) {
|
|
341
|
-
patches = patches.map(patch => {
|
|
342
|
-
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
275
|
+
variables: { ids
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
if (!response.errors) { this.grist.fetch()
|
|
280
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
281
|
+
})
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async _updateKpiMetric() { let patches = this.grist.dirtyRecords
|
|
288
|
+
if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}
|
|
343
289
|
const dirtyFields = patch.__dirtyfields__
|
|
344
|
-
for (let key in dirtyFields) {
|
|
345
|
-
|
|
346
|
-
}
|
|
290
|
+
for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after
|
|
291
|
+
}
|
|
347
292
|
patchField.cuFlag = patch.__dirty__
|
|
348
293
|
|
|
349
294
|
return patchField
|
|
350
|
-
|
|
295
|
+
})
|
|
351
296
|
|
|
352
|
-
const response = await client.mutate({
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
name
|
|
357
|
-
}
|
|
358
|
-
}
|
|
297
|
+
const response = await client.mutate({ mutation: gql`
|
|
298
|
+
mutation ($patches: [KpiMetricPatch!]!) { updateMultipleKpiMetric(patches: $patches) { name
|
|
299
|
+
}
|
|
300
|
+
}
|
|
359
301
|
`,
|
|
360
|
-
variables: {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const response = await client.query({
|
|
374
|
-
query: gql`
|
|
375
|
-
mutation ($kpiMetric: NewKpiMetric!) {
|
|
376
|
-
createKpiMetric(kpiMetric: $kpiMetric) {
|
|
377
|
-
id
|
|
378
|
-
}
|
|
379
|
-
}
|
|
302
|
+
variables: { patches
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
if (!response.errors) { this.grist.fetch()
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async creationCallback(kpiMetric) { try { const response = await client.query({ query: gql`
|
|
312
|
+
mutation ($kpiMetric: NewKpiMetric!) { createKpiMetric(kpiMetric: $kpiMetric) { id
|
|
313
|
+
}
|
|
314
|
+
}
|
|
380
315
|
`,
|
|
381
|
-
variables: {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (!response.errors) {
|
|
390
|
-
this.grist.fetch()
|
|
316
|
+
variables: { kpiMetric
|
|
317
|
+
},
|
|
318
|
+
context: { hasUpload: true
|
|
319
|
+
}
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
if (!response.errors) { this.grist.fetch()
|
|
391
323
|
document.dispatchEvent(
|
|
392
|
-
new CustomEvent('notify', {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
})
|
|
324
|
+
new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully')
|
|
325
|
+
}
|
|
326
|
+
})
|
|
397
327
|
)
|
|
398
|
-
|
|
328
|
+
}
|
|
399
329
|
|
|
400
330
|
return true
|
|
401
|
-
|
|
402
|
-
console.error(ex)
|
|
331
|
+
} catch (ex) { console.error(ex)
|
|
403
332
|
document.dispatchEvent(
|
|
404
|
-
new CustomEvent('notify', {
|
|
405
|
-
detail: {
|
|
406
|
-
type: 'error',
|
|
333
|
+
new CustomEvent('notify', { detail: { type: 'error',
|
|
407
334
|
message: i18next.t('text.error')
|
|
408
|
-
|
|
409
|
-
|
|
335
|
+
}
|
|
336
|
+
})
|
|
410
337
|
)
|
|
411
338
|
return false
|
|
412
|
-
|
|
413
|
-
|
|
339
|
+
}
|
|
340
|
+
}
|
|
414
341
|
|
|
415
|
-
async exportHandler() {
|
|
416
|
-
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
342
|
+
async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
417
343
|
const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
|
|
418
344
|
|
|
419
|
-
return exportTargets.map(kpiMetric => {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
tempObj[field] = kpiMetric[field]
|
|
423
|
-
}
|
|
345
|
+
return exportTargets.map(kpiMetric => { let tempObj = {}
|
|
346
|
+
for (const field of targetFieldSet) { tempObj[field] = kpiMetric[field]
|
|
347
|
+
}
|
|
424
348
|
|
|
425
349
|
return tempObj
|
|
426
|
-
|
|
427
|
-
|
|
350
|
+
})
|
|
351
|
+
}
|
|
428
352
|
|
|
429
|
-
async importHandler(records) {
|
|
430
|
-
const popup = openPopup(
|
|
353
|
+
async importHandler(records) { const popup = openPopup(
|
|
431
354
|
html`
|
|
432
355
|
<kpi-metric-importer
|
|
433
356
|
.kpiMetrics=${records}
|
|
434
|
-
@imported=${() => {
|
|
435
|
-
history.back()
|
|
357
|
+
@imported=${() => { history.back()
|
|
436
358
|
this.grist.fetch()
|
|
437
|
-
|
|
359
|
+
}}
|
|
438
360
|
></kpi-metric-importer>
|
|
439
361
|
`,
|
|
440
|
-
{
|
|
441
|
-
backdrop: true,
|
|
362
|
+
{ backdrop: true,
|
|
442
363
|
size: 'large',
|
|
443
364
|
title: i18next.t('title.import kpi-metric')
|
|
444
|
-
|
|
365
|
+
}
|
|
445
366
|
)
|
|
446
367
|
|
|
447
|
-
popup.onclosed = () => {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
368
|
+
popup.onclosed = () => { this.grist.fetch()
|
|
369
|
+
}
|
|
370
|
+
}
|
|
451
371
|
}
|