@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
|
@@ -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 } from 'lit'
|
|
10
10
|
import { customElement, property, query } 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 { KpiStatisticImporter } from './kpi-statistic-importer.js'
|
|
24
23
|
|
|
25
24
|
@customElement('kpi-statistic-list-page')
|
|
26
|
-
export class KpiStatisticListPage extends
|
|
27
|
-
static styles = [
|
|
25
|
+
export class KpiStatisticListPage 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-statistic-importer': KpiStatisticImporter
|
|
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-statistic 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-statistic',
|
|
78
65
|
actions: [
|
|
79
|
-
{
|
|
80
|
-
title: i18next.t('button.save'),
|
|
66
|
+
{ title: i18next.t('button.save'),
|
|
81
67
|
action: this._updateKpiStatistic.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._deleteKpiStatistic.bind(this),
|
|
87
72
|
...CommonButtonStyles.delete
|
|
88
|
-
|
|
73
|
+
}
|
|
89
74
|
],
|
|
90
|
-
exportable: {
|
|
91
|
-
name: i18next.t('title.kpi-statistic list'),
|
|
75
|
+
exportable: { name: i18next.t('title.kpi-statistic 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,182 +110,142 @@ export class KpiStatisticListPage extends connect(store)(p13n(localize(i18next)(
|
|
|
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: ['kpi', 'valueDate', 'periodType'],
|
|
115
|
+
async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['kpi', 'valueDate', 'periodType'],
|
|
137
116
|
details: ['mean', 'median', 'count', 'updatedAt']
|
|
138
|
-
|
|
117
|
+
},
|
|
139
118
|
columns: [
|
|
140
119
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
141
120
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
142
|
-
{
|
|
143
|
-
type: 'resource-object',
|
|
121
|
+
{ type: 'resource-object',
|
|
144
122
|
name: 'kpi',
|
|
145
123
|
header: i18next.t('field.kpi'),
|
|
146
|
-
record: {
|
|
147
|
-
|
|
148
|
-
},
|
|
124
|
+
record: { editable: false
|
|
125
|
+
},
|
|
149
126
|
filter: 'search',
|
|
150
127
|
sortable: true,
|
|
151
128
|
width: 150
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
type: 'string',
|
|
129
|
+
},
|
|
130
|
+
{ type: 'string',
|
|
155
131
|
name: 'valueDate',
|
|
156
132
|
header: i18next.t('field.value_date'),
|
|
157
|
-
record: {
|
|
158
|
-
|
|
159
|
-
},
|
|
133
|
+
record: { editable: true
|
|
134
|
+
},
|
|
160
135
|
filter: true,
|
|
161
136
|
sortable: true,
|
|
162
137
|
width: 120
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
type: 'string',
|
|
138
|
+
},
|
|
139
|
+
{ type: 'string',
|
|
166
140
|
name: 'periodType',
|
|
167
141
|
header: i18next.t('field.period_type'),
|
|
168
|
-
record: {
|
|
169
|
-
|
|
170
|
-
},
|
|
142
|
+
record: { editable: true
|
|
143
|
+
},
|
|
171
144
|
filter: true,
|
|
172
145
|
sortable: true,
|
|
173
146
|
width: 100
|
|
174
|
-
|
|
175
|
-
{
|
|
176
|
-
type: 'number',
|
|
147
|
+
},
|
|
148
|
+
{ type: 'number',
|
|
177
149
|
name: 'count',
|
|
178
150
|
header: i18next.t('field.count'),
|
|
179
|
-
record: {
|
|
180
|
-
|
|
181
|
-
},
|
|
151
|
+
record: { editable: false
|
|
152
|
+
},
|
|
182
153
|
sortable: true,
|
|
183
154
|
width: 80
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
type: 'number',
|
|
155
|
+
},
|
|
156
|
+
{ type: 'number',
|
|
187
157
|
name: 'mean',
|
|
188
158
|
header: i18next.t('field.mean'),
|
|
189
|
-
record: {
|
|
190
|
-
|
|
191
|
-
},
|
|
159
|
+
record: { editable: false
|
|
160
|
+
},
|
|
192
161
|
sortable: true,
|
|
193
162
|
width: 100
|
|
194
|
-
|
|
195
|
-
{
|
|
196
|
-
type: 'number',
|
|
163
|
+
},
|
|
164
|
+
{ type: 'number',
|
|
197
165
|
name: 'median',
|
|
198
166
|
header: i18next.t('field.median'),
|
|
199
|
-
record: {
|
|
200
|
-
|
|
201
|
-
},
|
|
167
|
+
record: { editable: false
|
|
168
|
+
},
|
|
202
169
|
sortable: true,
|
|
203
170
|
width: 100
|
|
204
|
-
|
|
205
|
-
{
|
|
206
|
-
type: 'number',
|
|
171
|
+
},
|
|
172
|
+
{ type: 'number',
|
|
207
173
|
name: 'minimum',
|
|
208
174
|
header: i18next.t('field.minimum'),
|
|
209
|
-
record: {
|
|
210
|
-
|
|
211
|
-
},
|
|
175
|
+
record: { editable: false
|
|
176
|
+
},
|
|
212
177
|
sortable: true,
|
|
213
178
|
width: 100
|
|
214
|
-
|
|
215
|
-
{
|
|
216
|
-
type: 'number',
|
|
179
|
+
},
|
|
180
|
+
{ type: 'number',
|
|
217
181
|
name: 'maximum',
|
|
218
182
|
header: i18next.t('field.maximum'),
|
|
219
|
-
record: {
|
|
220
|
-
|
|
221
|
-
},
|
|
183
|
+
record: { editable: false
|
|
184
|
+
},
|
|
222
185
|
sortable: true,
|
|
223
186
|
width: 100
|
|
224
|
-
|
|
225
|
-
{
|
|
226
|
-
type: 'number',
|
|
187
|
+
},
|
|
188
|
+
{ type: 'number',
|
|
227
189
|
name: 'standardDeviation',
|
|
228
190
|
header: i18next.t('field.standard_deviation'),
|
|
229
|
-
record: {
|
|
230
|
-
|
|
231
|
-
},
|
|
191
|
+
record: { editable: false
|
|
192
|
+
},
|
|
232
193
|
sortable: true,
|
|
233
194
|
width: 120
|
|
234
|
-
|
|
235
|
-
{
|
|
236
|
-
type: 'number',
|
|
195
|
+
},
|
|
196
|
+
{ type: 'number',
|
|
237
197
|
name: 'lowerFence',
|
|
238
198
|
header: i18next.t('field.lower_fence'),
|
|
239
|
-
record: {
|
|
240
|
-
|
|
241
|
-
},
|
|
199
|
+
record: { editable: false
|
|
200
|
+
},
|
|
242
201
|
sortable: true,
|
|
243
202
|
width: 100
|
|
244
|
-
|
|
245
|
-
{
|
|
246
|
-
type: 'number',
|
|
203
|
+
},
|
|
204
|
+
{ type: 'number',
|
|
247
205
|
name: 'upperFence',
|
|
248
206
|
header: i18next.t('field.upper_fence'),
|
|
249
|
-
record: {
|
|
250
|
-
|
|
251
|
-
},
|
|
207
|
+
record: { editable: false
|
|
208
|
+
},
|
|
252
209
|
sortable: true,
|
|
253
210
|
width: 100
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
type: 'resource-object',
|
|
211
|
+
},
|
|
212
|
+
{ type: 'resource-object',
|
|
257
213
|
name: 'updater',
|
|
258
214
|
header: i18next.t('field.updater'),
|
|
259
|
-
record: {
|
|
260
|
-
|
|
261
|
-
},
|
|
215
|
+
record: { editable: false
|
|
216
|
+
},
|
|
262
217
|
sortable: true,
|
|
263
218
|
width: 120
|
|
264
|
-
|
|
265
|
-
{
|
|
266
|
-
type: 'datetime',
|
|
219
|
+
},
|
|
220
|
+
{ type: 'datetime',
|
|
267
221
|
name: 'updatedAt',
|
|
268
222
|
header: i18next.t('field.updated_at'),
|
|
269
|
-
record: {
|
|
270
|
-
|
|
271
|
-
},
|
|
223
|
+
record: { editable: false
|
|
224
|
+
},
|
|
272
225
|
sortable: true,
|
|
273
226
|
width: 180
|
|
274
|
-
|
|
227
|
+
}
|
|
275
228
|
],
|
|
276
|
-
rows: {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
},
|
|
229
|
+
rows: { appendable: false,
|
|
230
|
+
selectable: { multiple: true
|
|
231
|
+
}
|
|
232
|
+
},
|
|
282
233
|
sorters: [
|
|
283
|
-
{
|
|
284
|
-
|
|
285
|
-
}
|
|
234
|
+
{ name: 'kpi'
|
|
235
|
+
}
|
|
286
236
|
]
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
async pageUpdated(changes: any, lifecycle: any) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const response = await client.query({
|
|
298
|
-
query: gql`
|
|
299
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
300
|
-
responses: kpiStatistics(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
301
|
-
items {
|
|
302
|
-
id
|
|
303
|
-
kpi {
|
|
304
|
-
id
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`
|
|
245
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: kpiStatistics(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
246
|
+
kpi { id
|
|
305
247
|
name
|
|
306
|
-
|
|
248
|
+
}
|
|
307
249
|
valueDate
|
|
308
250
|
periodType
|
|
309
251
|
count
|
|
@@ -322,145 +264,109 @@ export class KpiStatisticListPage extends connect(store)(p13n(localize(i18next)(
|
|
|
322
264
|
upperFence
|
|
323
265
|
additionalStatistics
|
|
324
266
|
metadata
|
|
325
|
-
updater {
|
|
326
|
-
id
|
|
267
|
+
updater { id
|
|
327
268
|
name
|
|
328
|
-
|
|
269
|
+
}
|
|
329
270
|
updatedAt
|
|
330
|
-
|
|
271
|
+
}
|
|
331
272
|
total
|
|
332
|
-
|
|
333
|
-
|
|
273
|
+
}
|
|
274
|
+
}
|
|
334
275
|
`,
|
|
335
|
-
variables: {
|
|
336
|
-
filters,
|
|
276
|
+
variables: { filters,
|
|
337
277
|
pagination: { page, limit },
|
|
338
278
|
sortings
|
|
339
|
-
|
|
340
|
-
|
|
279
|
+
}
|
|
280
|
+
})
|
|
341
281
|
|
|
342
|
-
return {
|
|
343
|
-
total: response.data.responses.total || 0,
|
|
282
|
+
return { total: response.data.responses.total || 0,
|
|
344
283
|
records: response.data.responses.items || []
|
|
345
|
-
|
|
346
|
-
|
|
284
|
+
}
|
|
285
|
+
}
|
|
347
286
|
|
|
348
|
-
async _deleteKpiStatistic() {
|
|
349
|
-
|
|
350
|
-
await OxPrompt.open({
|
|
351
|
-
title: i18next.t('text.are_you_sure'),
|
|
287
|
+
async _deleteKpiStatistic() { if (
|
|
288
|
+
await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
|
|
352
289
|
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
353
290
|
confirmButton: { text: i18next.t('button.confirm') },
|
|
354
291
|
cancelButton: { text: i18next.t('button.cancel') }
|
|
355
|
-
|
|
356
|
-
) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
mutation: gql`
|
|
361
|
-
mutation ($ids: [String!]!) {
|
|
362
|
-
deleteKpiStatistics(ids: $ids)
|
|
363
|
-
}
|
|
292
|
+
})
|
|
293
|
+
) { const ids = this.grist.selected.map(record => record.id)
|
|
294
|
+
if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`
|
|
295
|
+
mutation ($ids: [String!]!) { deleteKpiStatistics(ids: $ids)
|
|
296
|
+
}
|
|
364
297
|
`,
|
|
365
|
-
variables: {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
async _updateKpiStatistic() {
|
|
381
|
-
let patches = this.grist.dirtyRecords
|
|
382
|
-
if (patches && patches.length) {
|
|
383
|
-
patches = patches.map(patch => {
|
|
384
|
-
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
298
|
+
variables: { ids
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
if (!response.errors) { this.grist.fetch()
|
|
303
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
304
|
+
})
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
async _updateKpiStatistic() { let patches = this.grist.dirtyRecords
|
|
311
|
+
if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}
|
|
385
312
|
const dirtyFields = patch.__dirtyfields__
|
|
386
|
-
for (let key in dirtyFields) {
|
|
387
|
-
|
|
388
|
-
}
|
|
313
|
+
for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after
|
|
314
|
+
}
|
|
389
315
|
patchField.cuFlag = patch.__dirty__
|
|
390
316
|
|
|
391
317
|
return patchField
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const response = await client.mutate({
|
|
395
|
-
|
|
396
|
-
mutation ($patches: [KpiStatisticPatch!]!) {
|
|
397
|
-
updateMultipleKpiStatistic(patches: $patches) {
|
|
398
|
-
kpi {
|
|
399
|
-
id
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
const response = await client.mutate({ mutation: gql`
|
|
321
|
+
mutation ($patches: [KpiStatisticPatch!]!) { updateMultipleKpiStatistic(patches: $patches) { kpi { id
|
|
400
322
|
name
|
|
401
|
-
|
|
323
|
+
}
|
|
402
324
|
valueDate
|
|
403
325
|
periodType
|
|
404
|
-
|
|
405
|
-
|
|
326
|
+
}
|
|
327
|
+
}
|
|
406
328
|
`,
|
|
407
|
-
variables: {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const response = await client.query({
|
|
421
|
-
query: gql`
|
|
422
|
-
mutation ($kpiStatistic: NewKpiStatistic!) {
|
|
423
|
-
createKpiStatistic(kpiStatistic: $kpiStatistic) {
|
|
424
|
-
id
|
|
425
|
-
}
|
|
426
|
-
}
|
|
329
|
+
variables: { patches
|
|
330
|
+
}
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
if (!response.errors) { this.grist.fetch()
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async creationCallback(kpiStatistic) { try { const response = await client.query({ query: gql`
|
|
339
|
+
mutation ($kpiStatistic: NewKpiStatistic!) { createKpiStatistic(kpiStatistic: $kpiStatistic) { id
|
|
340
|
+
}
|
|
341
|
+
}
|
|
427
342
|
`,
|
|
428
|
-
variables: {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (!response.errors) {
|
|
437
|
-
this.grist.fetch()
|
|
343
|
+
variables: { kpiStatistic
|
|
344
|
+
},
|
|
345
|
+
context: { hasUpload: true
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
|
|
349
|
+
if (!response.errors) { this.grist.fetch()
|
|
438
350
|
document.dispatchEvent(
|
|
439
|
-
new CustomEvent('notify', {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
})
|
|
351
|
+
new CustomEvent('notify', { detail: { message: i18next.t('text.data_created_successfully')
|
|
352
|
+
}
|
|
353
|
+
})
|
|
444
354
|
)
|
|
445
|
-
|
|
355
|
+
}
|
|
446
356
|
|
|
447
357
|
return true
|
|
448
|
-
|
|
449
|
-
console.error(ex)
|
|
358
|
+
} catch (ex) { console.error(ex)
|
|
450
359
|
document.dispatchEvent(
|
|
451
|
-
new CustomEvent('notify', {
|
|
452
|
-
detail: {
|
|
453
|
-
type: 'error',
|
|
360
|
+
new CustomEvent('notify', { detail: { type: 'error',
|
|
454
361
|
message: i18next.t('text.error')
|
|
455
|
-
|
|
456
|
-
|
|
362
|
+
}
|
|
363
|
+
})
|
|
457
364
|
)
|
|
458
365
|
return false
|
|
459
|
-
|
|
460
|
-
|
|
366
|
+
}
|
|
367
|
+
}
|
|
461
368
|
|
|
462
|
-
async exportHandler() {
|
|
463
|
-
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
369
|
+
async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
464
370
|
const targetFieldSet = new Set([
|
|
465
371
|
'id',
|
|
466
372
|
'kpi',
|
|
@@ -478,36 +384,30 @@ export class KpiStatisticListPage extends connect(store)(p13n(localize(i18next)(
|
|
|
478
384
|
'upperFence'
|
|
479
385
|
])
|
|
480
386
|
|
|
481
|
-
return exportTargets.map(kpiStatistic => {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
tempObj[field] = kpiStatistic[field]
|
|
485
|
-
}
|
|
387
|
+
return exportTargets.map(kpiStatistic => { let tempObj = {}
|
|
388
|
+
for (const field of targetFieldSet) { tempObj[field] = kpiStatistic[field]
|
|
389
|
+
}
|
|
486
390
|
|
|
487
391
|
return tempObj
|
|
488
|
-
|
|
489
|
-
|
|
392
|
+
})
|
|
393
|
+
}
|
|
490
394
|
|
|
491
|
-
async importHandler(records) {
|
|
492
|
-
const popup = openPopup(
|
|
395
|
+
async importHandler(records) { const popup = openPopup(
|
|
493
396
|
html`
|
|
494
397
|
<kpi-statistic-importer
|
|
495
398
|
.kpiStatistics=${records}
|
|
496
|
-
@imported=${() => {
|
|
497
|
-
history.back()
|
|
399
|
+
@imported=${() => { history.back()
|
|
498
400
|
this.grist.fetch()
|
|
499
|
-
|
|
401
|
+
}}
|
|
500
402
|
></kpi-statistic-importer>
|
|
501
403
|
`,
|
|
502
|
-
{
|
|
503
|
-
backdrop: true,
|
|
404
|
+
{ backdrop: true,
|
|
504
405
|
size: 'large',
|
|
505
406
|
title: i18next.t('title.import kpi-statistic')
|
|
506
|
-
|
|
407
|
+
}
|
|
507
408
|
)
|
|
508
409
|
|
|
509
|
-
popup.onclosed = () => {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
410
|
+
popup.onclosed = () => { this.grist.fetch()
|
|
411
|
+
}
|
|
412
|
+
}
|
|
513
413
|
}
|