@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.
- 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/service/index.d.ts +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
|
@@ -6,7 +6,7 @@ import '@operato/data-grist/ox-record-creator.js'
|
|
|
6
6
|
import './kpi-metric-value-manual-entry-form.js'
|
|
7
7
|
|
|
8
8
|
import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
9
|
-
import { PageView
|
|
9
|
+
import { PageView } from '@operato/shell'
|
|
10
10
|
import { css, html } from 'lit'
|
|
11
11
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
12
12
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
@@ -18,27 +18,22 @@ import { OxPopup, OxPrompt } from '@operato/popup'
|
|
|
18
18
|
import { isMobileDevice } from '@operato/utils'
|
|
19
19
|
import { p13n } from '@operato/p13n'
|
|
20
20
|
|
|
21
|
-
import { connect } from 'pwa-helpers/connect-mixin'
|
|
22
21
|
import gql from 'graphql-tag'
|
|
23
22
|
|
|
24
23
|
@customElement('kpi-metric-value-list-page')
|
|
25
|
-
export class KpiMetricValueListPage extends
|
|
26
|
-
static styles = [
|
|
24
|
+
export class KpiMetricValueListPage extends p13n(localize(i18next)(ScopedElementsMixin(PageView))) { static styles = [
|
|
27
25
|
ScrollbarStyles,
|
|
28
26
|
CommonGristStyles,
|
|
29
27
|
CommonHeaderStyles,
|
|
30
28
|
css`
|
|
31
|
-
:host {
|
|
32
|
-
display: flex;
|
|
29
|
+
:host { display: flex;
|
|
33
30
|
width: 100%;
|
|
34
|
-
|
|
35
|
-
ox-grist {
|
|
36
|
-
overflow-y: auto;
|
|
31
|
+
}
|
|
32
|
+
ox-grist { overflow-y: auto;
|
|
37
33
|
flex: 1;
|
|
38
|
-
|
|
39
|
-
ox-filters-form {
|
|
40
|
-
|
|
41
|
-
}
|
|
34
|
+
}
|
|
35
|
+
ox-filters-form { flex: 1;
|
|
36
|
+
}
|
|
42
37
|
`
|
|
43
38
|
]
|
|
44
39
|
|
|
@@ -46,50 +41,38 @@ export class KpiMetricValueListPage extends connect(store)(p13n(localize(i18next
|
|
|
46
41
|
@property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
47
42
|
@query('ox-grist') private grist!: DataGrist
|
|
48
43
|
|
|
49
|
-
get context() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
search: {
|
|
53
|
-
handler: (search: string) => {
|
|
54
|
-
this.grist.searchText = search
|
|
55
|
-
},
|
|
44
|
+
get context() { return { title: i18next.t('title.kpi metric value list'),
|
|
45
|
+
search: { handler: (search: string) => { this.grist.searchText = search
|
|
46
|
+
},
|
|
56
47
|
value: this.grist.searchText
|
|
57
|
-
|
|
58
|
-
filter: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
},
|
|
48
|
+
},
|
|
49
|
+
filter: { handler: () => { this.grist.toggleHeadroom()
|
|
50
|
+
}
|
|
51
|
+
},
|
|
63
52
|
help: 'kpi/kpi-metric-value',
|
|
64
53
|
actions: [
|
|
65
|
-
{
|
|
66
|
-
title: i18next.t('button.bulk edit'),
|
|
54
|
+
{ title: i18next.t('button.bulk edit'),
|
|
67
55
|
action: this._openEditor.bind(this),
|
|
68
56
|
...CommonButtonStyles.edit
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
title: i18next.t('button.save'),
|
|
57
|
+
},
|
|
58
|
+
{ title: i18next.t('button.save'),
|
|
72
59
|
action: this._updateKpiMetricValue.bind(this),
|
|
73
60
|
...CommonButtonStyles.save
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
title: i18next.t('button.delete'),
|
|
61
|
+
},
|
|
62
|
+
{ title: i18next.t('button.delete'),
|
|
77
63
|
action: this._deleteKpiMetricValue.bind(this),
|
|
78
64
|
...CommonButtonStyles.delete
|
|
79
|
-
|
|
65
|
+
}
|
|
80
66
|
],
|
|
81
|
-
exportable: {
|
|
82
|
-
name: i18next.t('title.kpi metric value list'),
|
|
67
|
+
exportable: { name: i18next.t('title.kpi metric value list'),
|
|
83
68
|
data: this.exportHandler.bind(this)
|
|
84
|
-
|
|
85
|
-
importable: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
69
|
+
},
|
|
70
|
+
importable: { handler: this.importHandler.bind(this)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
90
74
|
|
|
91
|
-
render() {
|
|
92
|
-
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
75
|
+
render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
|
|
93
76
|
return html`
|
|
94
77
|
<ox-grist
|
|
95
78
|
.mode=${mode}
|
|
@@ -116,221 +99,170 @@ export class KpiMetricValueListPage extends connect(store)(p13n(localize(i18next
|
|
|
116
99
|
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
117
100
|
</ox-grist>
|
|
118
101
|
`
|
|
119
|
-
|
|
102
|
+
}
|
|
120
103
|
|
|
121
|
-
async pageInitialized() {
|
|
122
|
-
this.gristConfig = {
|
|
123
|
-
list: {
|
|
124
|
-
fields: ['metric', 'valueDate', 'value', 'org', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater'],
|
|
104
|
+
async pageInitialized() { this.gristConfig = { list: { fields: ['metric', 'valueDate', 'value', 'org', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater'],
|
|
125
105
|
details: ['metric', 'valueDate', 'value', 'org', 'meta', 'createdAt', 'updatedAt', 'creator', 'updater']
|
|
126
|
-
|
|
106
|
+
},
|
|
127
107
|
columns: [
|
|
128
108
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
129
109
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
130
110
|
// KPI Metric Value 수정 버튼 추가
|
|
131
|
-
{
|
|
132
|
-
type: 'gutter',
|
|
111
|
+
{ type: 'gutter',
|
|
133
112
|
gutterName: 'button',
|
|
134
113
|
icon: 'edit',
|
|
135
114
|
title: '수정',
|
|
136
|
-
handlers: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
type: 'string',
|
|
115
|
+
handlers: { click: (columns, data, column, record, rowIndex) => { this._editKpiMetricValue(record)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{ type: 'string',
|
|
144
120
|
name: 'metric',
|
|
145
121
|
header: 'Metric',
|
|
146
122
|
record: { editable: false, renderer: (v, c, r) => r.metric?.name },
|
|
147
123
|
width: 150
|
|
148
|
-
|
|
124
|
+
},
|
|
149
125
|
{ type: 'string', name: 'valueDate', header: '날짜', record: { editable: true }, width: 120 },
|
|
150
126
|
{ type: 'number', name: 'value', header: '값', record: { editable: true }, width: 120 },
|
|
151
127
|
{ type: 'string', name: 'org', header: '조직', record: { editable: false }, width: 120 },
|
|
152
128
|
{ type: 'object', name: 'meta', header: '메타', record: { editable: false }, width: 120 },
|
|
153
129
|
{ type: 'datetime', name: 'createdAt', header: '생성일', record: { editable: false }, width: 180 },
|
|
154
130
|
{ type: 'datetime', name: 'updatedAt', header: '수정일', record: { editable: false }, width: 180 },
|
|
155
|
-
{
|
|
156
|
-
type: 'resource-object',
|
|
131
|
+
{ type: 'resource-object',
|
|
157
132
|
name: 'creator',
|
|
158
133
|
header: '생성자',
|
|
159
134
|
record: { editable: false, renderer: (v, c, r) => r.creator?.name },
|
|
160
135
|
width: 120
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
type: 'resource-object',
|
|
136
|
+
},
|
|
137
|
+
{ type: 'resource-object',
|
|
164
138
|
name: 'updater',
|
|
165
139
|
header: '수정자',
|
|
166
140
|
record: { editable: false, renderer: (v, c, r) => r.updater?.name },
|
|
167
141
|
width: 120
|
|
168
|
-
|
|
142
|
+
}
|
|
169
143
|
],
|
|
170
|
-
rows: {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
},
|
|
144
|
+
rows: { appendable: false,
|
|
145
|
+
selectable: { multiple: true
|
|
146
|
+
}
|
|
147
|
+
},
|
|
176
148
|
sorters: [{ name: 'valueDate' }]
|
|
177
|
-
|
|
178
|
-
|
|
149
|
+
}
|
|
150
|
+
}
|
|
179
151
|
|
|
180
|
-
pageUpdated(changes: any, lifecycle: any) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
}
|
|
152
|
+
pageUpdated(changes: any, lifecycle: any) { if (this.active) { this.grist.fetch()
|
|
153
|
+
}
|
|
154
|
+
}
|
|
185
155
|
|
|
186
|
-
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
190
|
-
responses: kpiMetricValues(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
191
|
-
items {
|
|
192
|
-
id
|
|
193
|
-
metric {
|
|
194
|
-
id
|
|
156
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`
|
|
157
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: kpiMetricValues(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
158
|
+
metric { id
|
|
195
159
|
name
|
|
196
|
-
|
|
160
|
+
}
|
|
197
161
|
valueDate
|
|
198
162
|
value
|
|
199
163
|
meta
|
|
200
164
|
org
|
|
201
|
-
updater {
|
|
202
|
-
id
|
|
165
|
+
updater { id
|
|
203
166
|
name
|
|
204
|
-
|
|
167
|
+
}
|
|
205
168
|
updatedAt
|
|
206
|
-
creator {
|
|
207
|
-
id
|
|
169
|
+
creator { id
|
|
208
170
|
name
|
|
209
|
-
|
|
171
|
+
}
|
|
210
172
|
createdAt
|
|
211
|
-
|
|
173
|
+
}
|
|
212
174
|
total
|
|
213
|
-
|
|
214
|
-
|
|
175
|
+
}
|
|
176
|
+
}
|
|
215
177
|
`,
|
|
216
|
-
variables: {
|
|
217
|
-
filters,
|
|
178
|
+
variables: { filters,
|
|
218
179
|
pagination: { page, limit },
|
|
219
180
|
sortings
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return {
|
|
223
|
-
total: response.data.responses.total || 0,
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
return { total: response.data.responses.total || 0,
|
|
224
184
|
records: response.data.responses.items || []
|
|
225
|
-
|
|
226
|
-
|
|
185
|
+
}
|
|
186
|
+
}
|
|
227
187
|
|
|
228
|
-
async _deleteKpiMetricValue() {
|
|
229
|
-
|
|
230
|
-
await OxPrompt.open({
|
|
231
|
-
title: i18next.t('text.are_you_sure'),
|
|
188
|
+
async _deleteKpiMetricValue() { if (
|
|
189
|
+
await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
|
|
232
190
|
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
233
191
|
confirmButton: { text: i18next.t('button.confirm') },
|
|
234
192
|
cancelButton: { text: i18next.t('button.cancel') }
|
|
235
|
-
|
|
236
|
-
) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
mutation: gql`
|
|
241
|
-
mutation ($ids: [String!]!) {
|
|
242
|
-
deleteKpiMetricValues(ids: $ids)
|
|
243
|
-
}
|
|
193
|
+
})
|
|
194
|
+
) { const ids = this.grist.selected.map(record => record.id)
|
|
195
|
+
if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`
|
|
196
|
+
mutation ($ids: [String!]!) { deleteKpiMetricValues(ids: $ids)
|
|
197
|
+
}
|
|
244
198
|
`,
|
|
245
199
|
variables: { ids }
|
|
246
|
-
|
|
247
|
-
if (!response.errors) {
|
|
248
|
-
this.grist.fetch()
|
|
200
|
+
})
|
|
201
|
+
if (!response.errors) { this.grist.fetch()
|
|
249
202
|
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') }) })
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
254
207
|
|
|
255
|
-
async _updateKpiMetricValue() {
|
|
256
|
-
|
|
257
|
-
if (patches && patches.length) {
|
|
258
|
-
patches = patches.map(patch => {
|
|
259
|
-
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
208
|
+
async _updateKpiMetricValue() { let patches = this.grist.dirtyRecords
|
|
209
|
+
if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}
|
|
260
210
|
const dirtyFields = patch.__dirtyfields__
|
|
261
|
-
for (let key in dirtyFields) {
|
|
262
|
-
|
|
263
|
-
}
|
|
211
|
+
for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after
|
|
212
|
+
}
|
|
264
213
|
patchField.cuFlag = patch.__dirty__
|
|
265
214
|
return patchField
|
|
266
|
-
|
|
267
|
-
const response = await client.mutate({
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
updateMultipleKpiMetricValue(patches: $patches) {
|
|
271
|
-
id
|
|
272
|
-
metric {
|
|
273
|
-
id
|
|
215
|
+
})
|
|
216
|
+
const response = await client.mutate({ mutation: gql`
|
|
217
|
+
mutation ($patches: [KpiMetricValuePatch!]!) { updateMultipleKpiMetricValue(patches: $patches) { id
|
|
218
|
+
metric { id
|
|
274
219
|
name
|
|
275
|
-
|
|
220
|
+
}
|
|
276
221
|
valueDate
|
|
277
222
|
value
|
|
278
|
-
|
|
279
|
-
|
|
223
|
+
}
|
|
224
|
+
}
|
|
280
225
|
`,
|
|
281
226
|
variables: { patches }
|
|
282
|
-
|
|
283
|
-
if (!response.errors) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
227
|
+
})
|
|
228
|
+
if (!response.errors) { this.grist.fetch()
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
288
232
|
|
|
289
|
-
async creationCallback(metricValue) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
mutation ($metricValue: NewKpiMetricValue!) {
|
|
294
|
-
createKpiMetricValue(metricValue: $metricValue) {
|
|
295
|
-
id
|
|
296
|
-
}
|
|
297
|
-
}
|
|
233
|
+
async creationCallback(metricValue) { try { const response = await client.mutate({ mutation: gql`
|
|
234
|
+
mutation ($metricValue: NewKpiMetricValue!) { createKpiMetricValue(metricValue: $metricValue) { id
|
|
235
|
+
}
|
|
236
|
+
}
|
|
298
237
|
`,
|
|
299
238
|
variables: { metricValue },
|
|
300
239
|
context: { hasUpload: true }
|
|
301
|
-
|
|
302
|
-
if (!response.errors) {
|
|
303
|
-
this.grist.fetch()
|
|
240
|
+
})
|
|
241
|
+
if (!response.errors) { this.grist.fetch()
|
|
304
242
|
document.dispatchEvent(
|
|
305
243
|
new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully') } })
|
|
306
244
|
)
|
|
307
|
-
|
|
245
|
+
}
|
|
308
246
|
return true
|
|
309
|
-
|
|
310
|
-
console.error(ex)
|
|
247
|
+
} catch (ex) { console.error(ex)
|
|
311
248
|
document.dispatchEvent(new CustomEvent('notify', { detail: { type: 'error', message: i18next.t('text.error') } }))
|
|
312
249
|
return false
|
|
313
|
-
|
|
314
|
-
|
|
250
|
+
}
|
|
251
|
+
}
|
|
315
252
|
|
|
316
|
-
async exportHandler() {
|
|
317
|
-
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
253
|
+
async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
318
254
|
const targetFieldSet = new Set(['id', 'metric', 'valueDate', 'value', 'org', 'meta'])
|
|
319
|
-
return exportTargets.map(metricValue => {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
tempObj[field] = metricValue[field]
|
|
323
|
-
}
|
|
255
|
+
return exportTargets.map(metricValue => { let tempObj = {}
|
|
256
|
+
for (const field of targetFieldSet) { tempObj[field] = metricValue[field]
|
|
257
|
+
}
|
|
324
258
|
return tempObj
|
|
325
|
-
|
|
326
|
-
|
|
259
|
+
})
|
|
260
|
+
}
|
|
327
261
|
|
|
328
|
-
async importHandler(records) {
|
|
329
|
-
|
|
330
|
-
}
|
|
262
|
+
async importHandler(records) { // 임포트 팝업 등은 추후 구현
|
|
263
|
+
}
|
|
331
264
|
|
|
332
|
-
async _editKpiMetricValue(metricValue) {
|
|
333
|
-
const popup = await openPopup(
|
|
265
|
+
async _editKpiMetricValue(metricValue) { const popup = await openPopup(
|
|
334
266
|
html`
|
|
335
267
|
<kpi-metric-value-manual-entry-form
|
|
336
268
|
.metric=${metricValue.metric}
|
|
@@ -338,24 +270,21 @@ export class KpiMetricValueListPage extends connect(store)(p13n(localize(i18next
|
|
|
338
270
|
.value=${metricValue.value}
|
|
339
271
|
.org=${metricValue.org}
|
|
340
272
|
.meta=${metricValue.meta ? JSON.stringify(metricValue.meta) : ''}
|
|
341
|
-
@saved=${() => {
|
|
342
|
-
this.grist.fetch()
|
|
273
|
+
@saved=${() => { this.grist.fetch()
|
|
343
274
|
popup.close()
|
|
344
|
-
|
|
275
|
+
}}
|
|
345
276
|
></kpi-metric-value-manual-entry-form>
|
|
346
277
|
`,
|
|
347
|
-
{
|
|
348
|
-
title: `${metricValue.metric?.name || ''} 값 수정`,
|
|
278
|
+
{ title: `${metricValue.metric?.name || ''} 값 수정`,
|
|
349
279
|
size: 'medium',
|
|
350
280
|
backdrop: true
|
|
351
|
-
|
|
281
|
+
}
|
|
352
282
|
)
|
|
353
|
-
|
|
283
|
+
}
|
|
354
284
|
|
|
355
|
-
async _openEditor() {
|
|
356
|
-
const { KpiMetricValueEditorPage } = await import('./kpi-metric-value-editor-page.js')
|
|
285
|
+
async _openEditor() { const { KpiMetricValueEditorPage } = await import('./kpi-metric-value-editor-page.js')
|
|
357
286
|
await openPopup(html`
|
|
358
287
|
<${KpiMetricValueEditorPage}></${KpiMetricValueEditorPage}>
|
|
359
288
|
`)
|
|
360
|
-
|
|
289
|
+
}
|
|
361
290
|
}
|