@things-factory/dataset 6.0.74 → 6.0.75
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/data-archive/data-archive-list-page.ts +0 -2
- package/client/pages/data-report/data-report-samples-page.ts +4 -2
- package/client/pages/data-sample/data-sample-list-page.ts +4 -2
- package/client/pages/data-sample/data-sample-search-page.ts +27 -22
- package/client/pages/data-sample/data-sample-view.ts +1 -0
- package/client/pages/data-set/data-item-list.ts +25 -0
- package/client/pages/data-set/data-set-list-page.ts +1 -0
- package/client/pages/data-summary/data-summary-list-page.ts +62 -6
- package/client/pages/data-summary/data-summary-search-page.ts +131 -62
- package/client/pages/data-summary/data-summary-view.ts +15 -2
- package/dist-client/pages/data-archive/data-archive-list-page.js +0 -1
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -1
- package/dist-client/pages/data-report/data-report-samples-page.js +4 -2
- package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -1
- package/dist-client/pages/data-sample/data-sample-list-page.js +4 -2
- package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -1
- package/dist-client/pages/data-sample/data-sample-search-page.d.ts +2 -1
- package/dist-client/pages/data-sample/data-sample-search-page.js +29 -22
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -1
- package/dist-client/pages/data-sample/data-sample-view.js +1 -0
- package/dist-client/pages/data-sample/data-sample-view.js.map +1 -1
- package/dist-client/pages/data-set/data-item-list.js +23 -0
- package/dist-client/pages/data-set/data-item-list.js.map +1 -1
- package/dist-client/pages/data-set/data-set-list-page.js +1 -0
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-list-page.js +62 -5
- package/dist-client/pages/data-summary/data-summary-list-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-search-page.d.ts +15 -2
- package/dist-client/pages/data-summary/data-summary-search-page.js +131 -62
- package/dist-client/pages/data-summary/data-summary-search-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-view.d.ts +1 -1
- package/dist-client/pages/data-summary/data-summary-view.js +15 -2
- package/dist-client/pages/data-summary/data-summary-view.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/generate-data-summary.js +52 -2
- package/dist-server/controllers/generate-data-summary.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-query.js +36 -2
- package/dist-server/service/data-sample/data-sample-query.js.map +1 -1
- package/dist-server/service/data-set/data-item-type.js +28 -20
- package/dist-server/service/data-set/data-item-type.js.map +1 -1
- package/dist-server/service/data-summary/data-summary-query.js +39 -7
- package/dist-server/service/data-summary/data-summary-query.js.map +1 -1
- package/dist-server/service/data-summary/data-summary.js +25 -0
- package/dist-server/service/data-summary/data-summary.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -11
- package/server/controllers/generate-data-summary.ts +68 -1
- package/server/service/data-sample/data-sample-query.ts +38 -2
- package/server/service/data-set/data-item-type.ts +16 -9
- package/server/service/data-summary/data-summary-query.ts +42 -6
- package/server/service/data-summary/data-summary.ts +20 -0
- package/translations/en.json +6 -0
- package/translations/ko.json +13 -7
- package/translations/ms.json +6 -0
- package/translations/zh.json +6 -0
@@ -125,8 +125,6 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
125
125
|
}
|
126
126
|
|
127
127
|
async pageInitialized(lifecycle) {
|
128
|
-
const today = new Date().toISOString().split('T')[0]
|
129
|
-
|
130
128
|
this.gristConfig = {
|
131
129
|
list: { fields: ['updater', 'updatedAt'] },
|
132
130
|
columns: [
|
@@ -8,6 +8,7 @@ import gql from 'graphql-tag'
|
|
8
8
|
import { css, html } from 'lit'
|
9
9
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
10
10
|
import { connect } from 'pwa-helpers/connect-mixin'
|
11
|
+
import moment from 'moment-timezone'
|
11
12
|
|
12
13
|
import { client } from '@operato/graphql'
|
13
14
|
import { i18next, localize } from '@operato/i18n'
|
@@ -41,7 +42,8 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
|
|
41
42
|
@query('iframe') container!: HTMLIFrameElement
|
42
43
|
|
43
44
|
get context() {
|
44
|
-
const
|
45
|
+
const yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
|
46
|
+
const today = moment().format('YYYY-MM-DD')
|
45
47
|
|
46
48
|
const filters = [
|
47
49
|
{
|
@@ -49,7 +51,7 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
|
|
49
51
|
type: 'date',
|
50
52
|
label: i18next.t('field.work-date'),
|
51
53
|
operator: 'between',
|
52
|
-
value: [
|
54
|
+
value: [yesterday, today]
|
53
55
|
},
|
54
56
|
...this.getDataKeyFilters()
|
55
57
|
]
|
@@ -5,6 +5,7 @@ import gql from 'graphql-tag'
|
|
5
5
|
import { css, html } from 'lit'
|
6
6
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
7
7
|
import { connect } from 'pwa-helpers/connect-mixin'
|
8
|
+
import moment from 'moment-timezone'
|
8
9
|
|
9
10
|
import {
|
10
11
|
getEditor,
|
@@ -115,7 +116,8 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
|
|
115
116
|
}
|
116
117
|
|
117
118
|
async pageInitialized(lifecycle) {
|
118
|
-
const
|
119
|
+
const yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
|
120
|
+
const today = moment().format('YYYY-MM-DD')
|
119
121
|
|
120
122
|
this.gristConfig = {
|
121
123
|
list: { fields: ['dataSet', 'data', 'updater', 'updatedAt'] },
|
@@ -268,7 +270,7 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
|
|
268
270
|
filter: {
|
269
271
|
type: 'date',
|
270
272
|
operator: 'between',
|
271
|
-
value: [
|
273
|
+
value: [yesterday, today]
|
272
274
|
},
|
273
275
|
width: 80,
|
274
276
|
imex: true
|
@@ -5,6 +5,7 @@ import gql from 'graphql-tag'
|
|
5
5
|
import { css, html } from 'lit'
|
6
6
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
7
7
|
import { connect } from 'pwa-helpers/connect-mixin'
|
8
|
+
import moment from 'moment-timezone'
|
8
9
|
|
9
10
|
import {
|
10
11
|
getEditor,
|
@@ -43,7 +44,8 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
43
44
|
`
|
44
45
|
]
|
45
46
|
|
46
|
-
@state()
|
47
|
+
@state() dataSetId?: string
|
48
|
+
@state() dataSet: any
|
47
49
|
@state() dataKeySet: any
|
48
50
|
|
49
51
|
@state() gristConfig: any
|
@@ -79,12 +81,7 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
79
81
|
const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
|
80
82
|
|
81
83
|
return html`
|
82
|
-
<ox-grist
|
83
|
-
.mode=${mode}
|
84
|
-
.config=${this.gristConfig}
|
85
|
-
.fetchHandler=${this.fetchHandler.bind(this)}
|
86
|
-
?url-params-sensitive=${this.active}
|
87
|
-
>
|
84
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
88
85
|
<div slot="headroom">
|
89
86
|
<div id="filters">
|
90
87
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -119,35 +116,42 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
119
116
|
|
120
117
|
pageUpdated(changes, lifecycle) {
|
121
118
|
if (this.active) {
|
122
|
-
this.
|
119
|
+
this.dataSetId = lifecycle.resourceId
|
123
120
|
return
|
124
121
|
}
|
125
122
|
}
|
126
123
|
|
127
124
|
async updated(changes) {
|
128
|
-
if (changes.has('
|
125
|
+
if (changes.has('dataSetId')) {
|
129
126
|
const response = await client.query({
|
130
127
|
query: gql`
|
131
128
|
query ($id: String!) {
|
132
|
-
|
129
|
+
dataSet(id: $id) {
|
133
130
|
id
|
134
131
|
name
|
135
132
|
description
|
136
|
-
|
133
|
+
dataKeySet {
|
134
|
+
id
|
137
135
|
name
|
138
136
|
description
|
139
|
-
|
140
|
-
|
137
|
+
dataKeyItems {
|
138
|
+
name
|
139
|
+
description
|
140
|
+
dataKey
|
141
|
+
tKey
|
142
|
+
}
|
141
143
|
}
|
142
144
|
}
|
143
145
|
}
|
144
146
|
`,
|
145
147
|
variables: {
|
146
|
-
id: this.
|
148
|
+
id: this.dataSetId
|
147
149
|
}
|
148
150
|
})
|
149
151
|
|
150
|
-
this.
|
152
|
+
this.dataSet = response.data.dataSet
|
153
|
+
this.dataKeySet = this.dataSet.dataKeySet
|
154
|
+
|
151
155
|
this.refreshGristConfig()
|
152
156
|
|
153
157
|
this.grist.fetch()
|
@@ -174,7 +178,8 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
174
178
|
}
|
175
179
|
|
176
180
|
refreshGristConfig() {
|
177
|
-
const
|
181
|
+
const yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
|
182
|
+
const today = moment().format('YYYY-MM-DD')
|
178
183
|
|
179
184
|
this.gristConfig = {
|
180
185
|
list: { fields: ['dataSet', 'data', 'updater', 'updatedAt'] },
|
@@ -263,7 +268,7 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
263
268
|
filter: {
|
264
269
|
type: 'date',
|
265
270
|
operator: 'between',
|
266
|
-
value: [
|
271
|
+
value: [yesterday, today]
|
267
272
|
},
|
268
273
|
width: 80,
|
269
274
|
imex: true
|
@@ -329,15 +334,15 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
329
334
|
}
|
330
335
|
|
331
336
|
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
332
|
-
if (!this.
|
337
|
+
if (!this.dataSetId) {
|
333
338
|
return { records: [], total: 0 }
|
334
339
|
}
|
335
340
|
|
336
341
|
const response = await client.query({
|
337
342
|
query: gql`
|
338
|
-
query ($
|
339
|
-
responses:
|
340
|
-
|
343
|
+
query ($dataSetId: String!, $filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
344
|
+
responses: dataSamplesByDataSet(
|
345
|
+
dataSetId: $dataSetId
|
341
346
|
filters: $filters
|
342
347
|
pagination: $pagination
|
343
348
|
sortings: $sortings
|
@@ -370,7 +375,7 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
|
|
370
375
|
}
|
371
376
|
`,
|
372
377
|
variables: {
|
373
|
-
|
378
|
+
dataSetId: this.dataSetId,
|
374
379
|
filters,
|
375
380
|
pagination: { page, limit },
|
376
381
|
sortings
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import gql from 'graphql-tag'
|
2
|
+
|
2
3
|
import { css, html, LitElement } from 'lit'
|
3
4
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
4
5
|
|
@@ -7,6 +8,20 @@ import { i18next, localize } from '@operato/i18n'
|
|
7
8
|
import { isMobileDevice } from '@operato/utils'
|
8
9
|
import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
|
9
10
|
|
11
|
+
enum DataItemStatType {
|
12
|
+
sum = 'sum',
|
13
|
+
mean = 'mean',
|
14
|
+
stddev = 'stddev',
|
15
|
+
variance = 'variance',
|
16
|
+
min = 'min',
|
17
|
+
max = 'max',
|
18
|
+
range = 'range',
|
19
|
+
median = 'median',
|
20
|
+
mode = 'mode'
|
21
|
+
}
|
22
|
+
|
23
|
+
const DataItemStats = ['sum', 'mean', 'stddev', 'variance', 'min', 'max', 'range', 'median', 'mode']
|
24
|
+
|
10
25
|
@customElement('data-item-list')
|
11
26
|
class DataItemList extends localize(i18next)(LitElement) {
|
12
27
|
@property({ type: Object }) dataSet: any
|
@@ -174,6 +189,16 @@ class DataItemList extends localize(i18next)(LitElement) {
|
|
174
189
|
},
|
175
190
|
width: 120
|
176
191
|
},
|
192
|
+
{
|
193
|
+
type: 'select',
|
194
|
+
name: 'stat',
|
195
|
+
header: i18next.t('field.stat-function'),
|
196
|
+
record: {
|
197
|
+
options: ['', ...DataItemStats],
|
198
|
+
editable: true
|
199
|
+
},
|
200
|
+
width: 120
|
201
|
+
},
|
177
202
|
{
|
178
203
|
type: 'string',
|
179
204
|
name: 'unit',
|
@@ -5,7 +5,7 @@ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato
|
|
5
5
|
import { PageView, store } from '@operato/shell'
|
6
6
|
import { css, html } from 'lit'
|
7
7
|
import { customElement, property, query } from 'lit/decorators.js'
|
8
|
-
import
|
8
|
+
import moment from 'moment-timezone'
|
9
9
|
import { ColumnConfig, DataGrist, GristRecord, FetchOption, SortersControl } from '@operato/data-grist'
|
10
10
|
import { client } from '@operato/graphql'
|
11
11
|
import { i18next, localize } from '@operato/i18n'
|
@@ -104,7 +104,8 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
104
104
|
}
|
105
105
|
|
106
106
|
async pageInitialized(lifecycle) {
|
107
|
-
const
|
107
|
+
const yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
|
108
|
+
const today = moment().format('YYYY-MM-DD')
|
108
109
|
|
109
110
|
this.gristConfig = {
|
110
111
|
list: { fields: ['dataSet', 'data', 'updater', 'updatedAt'] },
|
@@ -164,7 +165,7 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
164
165
|
filter: {
|
165
166
|
type: 'date',
|
166
167
|
operator: 'between',
|
167
|
-
value: [
|
168
|
+
value: [yesterday, today]
|
168
169
|
},
|
169
170
|
width: 80,
|
170
171
|
imex: true
|
@@ -233,7 +234,57 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
233
234
|
imex: true
|
234
235
|
},
|
235
236
|
{
|
236
|
-
type: '
|
237
|
+
type: 'number',
|
238
|
+
name: 'data01',
|
239
|
+
header: i18next.t('field.data-01'),
|
240
|
+
record: {
|
241
|
+
editable: false
|
242
|
+
},
|
243
|
+
width: 120,
|
244
|
+
imex: true
|
245
|
+
},
|
246
|
+
{
|
247
|
+
type: 'number',
|
248
|
+
name: 'data02',
|
249
|
+
header: i18next.t('field.data-02'),
|
250
|
+
record: {
|
251
|
+
editable: false
|
252
|
+
},
|
253
|
+
width: 120,
|
254
|
+
imex: true
|
255
|
+
},
|
256
|
+
{
|
257
|
+
type: 'number',
|
258
|
+
name: 'data03',
|
259
|
+
header: i18next.t('field.data-03'),
|
260
|
+
record: {
|
261
|
+
editable: false
|
262
|
+
},
|
263
|
+
width: 120,
|
264
|
+
imex: true
|
265
|
+
},
|
266
|
+
{
|
267
|
+
type: 'number',
|
268
|
+
name: 'data04',
|
269
|
+
header: i18next.t('field.data-04'),
|
270
|
+
record: {
|
271
|
+
editable: false
|
272
|
+
},
|
273
|
+
width: 120,
|
274
|
+
imex: true
|
275
|
+
},
|
276
|
+
{
|
277
|
+
type: 'number',
|
278
|
+
name: 'data05',
|
279
|
+
header: i18next.t('field.data-05'),
|
280
|
+
record: {
|
281
|
+
editable: false
|
282
|
+
},
|
283
|
+
width: 120,
|
284
|
+
imex: true
|
285
|
+
},
|
286
|
+
{
|
287
|
+
type: 'number',
|
237
288
|
name: 'count',
|
238
289
|
header: i18next.t('field.count'),
|
239
290
|
record: {
|
@@ -242,7 +293,7 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
242
293
|
width: 30
|
243
294
|
},
|
244
295
|
{
|
245
|
-
type: '
|
296
|
+
type: 'number',
|
246
297
|
name: 'countOoc',
|
247
298
|
header: i18next.t('field.count-ooc'),
|
248
299
|
record: {
|
@@ -251,7 +302,7 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
251
302
|
width: 30
|
252
303
|
},
|
253
304
|
{
|
254
|
-
type: '
|
305
|
+
type: 'number',
|
255
306
|
name: 'countOos',
|
256
307
|
header: i18next.t('field.count-oos'),
|
257
308
|
record: {
|
@@ -322,6 +373,11 @@ export class DataSummaryListPage extends connect(store)(localize(i18next)(PageVi
|
|
322
373
|
key03
|
323
374
|
key04
|
324
375
|
key05
|
376
|
+
data01
|
377
|
+
data02
|
378
|
+
data03
|
379
|
+
data04
|
380
|
+
data05
|
325
381
|
summary
|
326
382
|
count
|
327
383
|
countOoc
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import '@operato/data-grist'
|
2
2
|
import './data-summary-view.js'
|
3
|
+
import moment from 'moment-timezone'
|
3
4
|
|
4
5
|
import gql from 'graphql-tag'
|
5
6
|
import { css, html } from 'lit'
|
@@ -22,6 +23,7 @@ import { PageView, store } from '@operato/shell'
|
|
22
23
|
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
23
24
|
import { isMobileDevice } from '@operato/utils'
|
24
25
|
import { OxPopup } from '@operato/popup'
|
26
|
+
import { DataItem } from '@operato/dataset'
|
25
27
|
|
26
28
|
@customElement('data-summary-search-page')
|
27
29
|
export class DataSummarySearchPage extends connect(store)(localize(i18next)(PageView)) {
|
@@ -43,8 +45,11 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
43
45
|
`
|
44
46
|
]
|
45
47
|
|
46
|
-
@state()
|
48
|
+
@state() dataSetId?: string
|
49
|
+
|
50
|
+
@state() dataSet: any
|
47
51
|
@state() dataKeySet: any
|
52
|
+
@state() dataItems?: DataItem[]
|
48
53
|
|
49
54
|
@state() gristConfig: any
|
50
55
|
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
@@ -79,12 +84,7 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
79
84
|
const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
|
80
85
|
|
81
86
|
return html`
|
82
|
-
<ox-grist
|
83
|
-
.mode=${mode}
|
84
|
-
.config=${this.gristConfig}
|
85
|
-
.fetchHandler=${this.fetchHandler.bind(this)}
|
86
|
-
?url-params-sensitive=${this.active}
|
87
|
-
>
|
87
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
88
88
|
<div slot="headroom">
|
89
89
|
<div id="filters">
|
90
90
|
<ox-filters-form autofocus without-search></ox-filters-form>
|
@@ -119,42 +119,61 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
119
119
|
|
120
120
|
pageUpdated(changes, lifecycle) {
|
121
121
|
if (this.active) {
|
122
|
-
this.
|
122
|
+
this.dataSetId = lifecycle.resourceId
|
123
123
|
return
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
127
|
async updated(changes) {
|
128
|
-
if (changes.has('
|
128
|
+
if (changes.has('dataSetId')) {
|
129
129
|
const response = await client.query({
|
130
130
|
query: gql`
|
131
131
|
query ($id: String!) {
|
132
|
-
|
132
|
+
dataSet(id: $id) {
|
133
133
|
id
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
dataItems {
|
135
|
+
name
|
136
|
+
description
|
137
|
+
active
|
138
|
+
hidden
|
139
|
+
tag
|
140
|
+
type
|
141
|
+
unit
|
142
|
+
options
|
143
|
+
quota
|
144
|
+
spec
|
145
|
+
stat
|
146
|
+
}
|
147
|
+
dataKeySet {
|
148
|
+
id
|
137
149
|
name
|
138
150
|
description
|
139
|
-
|
140
|
-
|
151
|
+
dataKeyItems {
|
152
|
+
name
|
153
|
+
description
|
154
|
+
dataKey
|
155
|
+
tKey
|
156
|
+
}
|
141
157
|
}
|
142
158
|
}
|
143
159
|
}
|
144
160
|
`,
|
145
161
|
variables: {
|
146
|
-
id: this.
|
162
|
+
id: this.dataSetId
|
147
163
|
}
|
148
164
|
})
|
149
165
|
|
150
|
-
this.
|
166
|
+
this.dataSet = response.data.dataSet
|
167
|
+
this.dataKeySet = this.dataSet?.dataKeySet || {}
|
168
|
+
this.dataItems = this.dataSet?.dataItems || []
|
169
|
+
|
151
170
|
this.refreshGristConfig()
|
152
171
|
|
153
172
|
this.grist.fetch()
|
154
173
|
}
|
155
174
|
}
|
156
175
|
|
157
|
-
|
176
|
+
getKeyColumns() {
|
158
177
|
return (
|
159
178
|
this.dataKeySet?.dataKeyItems.map((item, index) => {
|
160
179
|
return {
|
@@ -173,8 +192,28 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
173
192
|
)
|
174
193
|
}
|
175
194
|
|
195
|
+
getDataColumns() {
|
196
|
+
return (
|
197
|
+
this.dataItems
|
198
|
+
?.filter(dataItem => dataItem.active && dataItem.stat)
|
199
|
+
.map((item, index) => {
|
200
|
+
return {
|
201
|
+
type: 'number',
|
202
|
+
name: `data0${index + 1}`,
|
203
|
+
header: i18next.t(item.name),
|
204
|
+
record: {
|
205
|
+
editable: false
|
206
|
+
},
|
207
|
+
width: 120,
|
208
|
+
imex: true
|
209
|
+
}
|
210
|
+
}) || []
|
211
|
+
)
|
212
|
+
}
|
213
|
+
|
176
214
|
refreshGristConfig() {
|
177
|
-
const
|
215
|
+
const yesterday = moment().subtract(1, 'day').format('YYYY-MM-DD')
|
216
|
+
const today = moment().format('YYYY-MM-DD')
|
178
217
|
|
179
218
|
this.gristConfig = {
|
180
219
|
list: { fields: ['dataSet', 'data', 'updater', 'updatedAt'] },
|
@@ -201,32 +240,54 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
201
240
|
}
|
202
241
|
}
|
203
242
|
},
|
243
|
+
// {
|
244
|
+
// type: 'string',
|
245
|
+
// name: 'name',
|
246
|
+
// label: true,
|
247
|
+
// header: i18next.t('field.name'),
|
248
|
+
// record: {
|
249
|
+
// editable: false
|
250
|
+
// },
|
251
|
+
// filter: 'search',
|
252
|
+
// sortable: true,
|
253
|
+
// width: 120,
|
254
|
+
// imex: true
|
255
|
+
// },
|
256
|
+
// {
|
257
|
+
// type: 'string',
|
258
|
+
// name: 'description',
|
259
|
+
// label: true,
|
260
|
+
// header: i18next.t('field.description'),
|
261
|
+
// record: {
|
262
|
+
// editable: false
|
263
|
+
// },
|
264
|
+
// filter: 'search',
|
265
|
+
// width: 150,
|
266
|
+
// imex: true
|
267
|
+
// },
|
204
268
|
{
|
205
269
|
type: 'string',
|
206
|
-
name: '
|
207
|
-
|
208
|
-
header: i18next.t('field.name'),
|
209
|
-
record: {
|
210
|
-
editable: false
|
211
|
-
},
|
212
|
-
filter: 'search',
|
270
|
+
name: 'workDate',
|
271
|
+
header: i18next.t('field.work-date'),
|
213
272
|
sortable: true,
|
214
|
-
|
273
|
+
filter: {
|
274
|
+
type: 'date',
|
275
|
+
operator: 'between',
|
276
|
+
value: [yesterday, today]
|
277
|
+
},
|
278
|
+
width: 80,
|
215
279
|
imex: true
|
216
280
|
},
|
217
281
|
{
|
218
282
|
type: 'string',
|
219
|
-
name: '
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
editable: false
|
224
|
-
},
|
225
|
-
filter: 'search',
|
226
|
-
width: 150,
|
283
|
+
name: 'workShift',
|
284
|
+
header: i18next.t('field.work-shift'),
|
285
|
+
sortable: true,
|
286
|
+
width: 60,
|
227
287
|
imex: true
|
228
288
|
},
|
229
|
-
...this.
|
289
|
+
...this.getKeyColumns(),
|
290
|
+
...this.getDataColumns(),
|
230
291
|
{
|
231
292
|
type: 'checkbox',
|
232
293
|
name: 'ooc',
|
@@ -256,25 +317,31 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
256
317
|
imex: true
|
257
318
|
},
|
258
319
|
{
|
259
|
-
type: '
|
260
|
-
name: '
|
261
|
-
header: i18next.t('field.
|
262
|
-
|
263
|
-
|
264
|
-
type: 'date',
|
265
|
-
operator: 'between',
|
266
|
-
value: [today, today]
|
320
|
+
type: 'number',
|
321
|
+
name: 'count',
|
322
|
+
header: i18next.t('field.count'),
|
323
|
+
record: {
|
324
|
+
editable: false
|
267
325
|
},
|
268
|
-
width:
|
269
|
-
imex: true
|
326
|
+
width: 30
|
270
327
|
},
|
271
328
|
{
|
272
|
-
type: '
|
273
|
-
name: '
|
274
|
-
header: i18next.t('field.
|
275
|
-
|
276
|
-
|
277
|
-
|
329
|
+
type: 'number',
|
330
|
+
name: 'countOoc',
|
331
|
+
header: i18next.t('field.count-ooc'),
|
332
|
+
record: {
|
333
|
+
editable: false
|
334
|
+
},
|
335
|
+
width: 30
|
336
|
+
},
|
337
|
+
{
|
338
|
+
type: 'number',
|
339
|
+
name: 'countOos',
|
340
|
+
header: i18next.t('field.count-oos'),
|
341
|
+
record: {
|
342
|
+
editable: false
|
343
|
+
},
|
344
|
+
width: 30
|
278
345
|
},
|
279
346
|
{
|
280
347
|
type: 'resource-object',
|
@@ -321,15 +388,15 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
321
388
|
}
|
322
389
|
|
323
390
|
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
324
|
-
if (!this.
|
391
|
+
if (!this.dataSetId) {
|
325
392
|
return { records: [], total: 0 }
|
326
393
|
}
|
327
394
|
|
328
395
|
const response = await client.query({
|
329
396
|
query: gql`
|
330
|
-
query ($
|
331
|
-
|
332
|
-
|
397
|
+
query ($dataSetId: String!, $filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
398
|
+
dataSummariesByDataSet(
|
399
|
+
dataSetId: $dataSetId
|
333
400
|
filters: $filters
|
334
401
|
pagination: $pagination
|
335
402
|
sortings: $sortings
|
@@ -338,9 +405,6 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
338
405
|
id
|
339
406
|
name
|
340
407
|
description
|
341
|
-
dataSet {
|
342
|
-
id
|
343
|
-
}
|
344
408
|
workDate
|
345
409
|
workShift
|
346
410
|
key01
|
@@ -348,6 +412,11 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
348
412
|
key03
|
349
413
|
key04
|
350
414
|
key05
|
415
|
+
data01
|
416
|
+
data02
|
417
|
+
data03
|
418
|
+
data04
|
419
|
+
data05
|
351
420
|
summary
|
352
421
|
count
|
353
422
|
countOoc
|
@@ -363,7 +432,7 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
363
432
|
}
|
364
433
|
`,
|
365
434
|
variables: {
|
366
|
-
|
435
|
+
dataSetId: this.dataSetId,
|
367
436
|
filters,
|
368
437
|
pagination: { page, limit },
|
369
438
|
sortings
|
@@ -371,8 +440,8 @@ export class DataSummarySearchPage extends connect(store)(localize(i18next)(Page
|
|
371
440
|
})
|
372
441
|
|
373
442
|
return {
|
374
|
-
total: response.data.
|
375
|
-
records: response.data.
|
443
|
+
total: response.data.dataSummariesByDataSet.total || 0,
|
444
|
+
records: response.data.dataSummariesByDataSet.items || []
|
376
445
|
}
|
377
446
|
}
|
378
447
|
|