@things-factory/dataset 8.0.0-beta.1 → 8.0.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/package.json +13 -13
  2. package/client/activities/activity-data-collect-edit.ts +0 -105
  3. package/client/activities/activity-data-collect-view.ts +0 -91
  4. package/client/activities/activity-data-review-edit.ts +0 -133
  5. package/client/activities/activity-data-review-view.ts +0 -145
  6. package/client/activities/activity-ooc-resolve-edit.ts +0 -195
  7. package/client/activities/activity-ooc-resolve-view.ts +0 -143
  8. package/client/activities/activity-ooc-review-edit.ts +0 -173
  9. package/client/activities/activity-ooc-review-view.ts +0 -129
  10. package/client/bootstrap.ts +0 -35
  11. package/client/components/data-entry-form.ts +0 -109
  12. package/client/index.ts +0 -1
  13. package/client/pages/data-archive/data-archive-list-page.ts +0 -277
  14. package/client/pages/data-archive/data-archive-request-popup.ts +0 -177
  15. package/client/pages/data-entry/data-entry-list-page.ts +0 -464
  16. package/client/pages/data-key-set/data-key-item-list.ts +0 -183
  17. package/client/pages/data-key-set/data-key-set-importer.ts +0 -89
  18. package/client/pages/data-key-set/data-key-set-list-page.ts +0 -413
  19. package/client/pages/data-ooc/data-ooc-list-page.ts +0 -549
  20. package/client/pages/data-ooc/data-ooc-page.ts +0 -164
  21. package/client/pages/data-ooc/data-ooc-view.ts +0 -236
  22. package/client/pages/data-ooc/data-oocs-page.ts +0 -200
  23. package/client/pages/data-report/data-report-embed-page.ts +0 -108
  24. package/client/pages/data-report/data-report-list-page.ts +0 -454
  25. package/client/pages/data-report/data-report-samples-page.ts +0 -174
  26. package/client/pages/data-report/jasper-report-oocs-page.ts +0 -110
  27. package/client/pages/data-report/jasper-report-samples-crosstab-page.ts +0 -110
  28. package/client/pages/data-report/jasper-report-samples-page.ts +0 -110
  29. package/client/pages/data-sample/data-sample-list-page.ts +0 -442
  30. package/client/pages/data-sample/data-sample-page.ts +0 -55
  31. package/client/pages/data-sample/data-sample-search-page.ts +0 -424
  32. package/client/pages/data-sample/data-sample-view.ts +0 -292
  33. package/client/pages/data-sample/data-samples-page.ts +0 -249
  34. package/client/pages/data-sensor/data-sensor-list-page.ts +0 -456
  35. package/client/pages/data-set/data-item-list.ts +0 -304
  36. package/client/pages/data-set/data-set-importer.ts +0 -89
  37. package/client/pages/data-set/data-set-list-page.ts +0 -1078
  38. package/client/pages/data-summary/data-summary-list-page.ts +0 -363
  39. package/client/pages/data-summary/data-summary-period-page.ts +0 -439
  40. package/client/pages/data-summary/data-summary-search-page.ts +0 -426
  41. package/client/pages/data-summary/data-summary-view.ts +0 -133
  42. package/client/route.ts +0 -91
  43. package/client/tsconfig.json +0 -13
  44. package/server/activities/activity-data-collect.ts +0 -100
  45. package/server/activities/activity-data-review.ts +0 -82
  46. package/server/activities/activity-ooc-resolve.ts +0 -123
  47. package/server/activities/activity-ooc-review.ts +0 -144
  48. package/server/activities/index.ts +0 -11
  49. package/server/controllers/create-data-sample.ts +0 -426
  50. package/server/controllers/data-use-case.ts +0 -98
  51. package/server/controllers/finalize-data-collection.ts +0 -388
  52. package/server/controllers/index.ts +0 -3
  53. package/server/controllers/issue-data-collection-task.ts +0 -70
  54. package/server/controllers/jasper-report.ts +0 -186
  55. package/server/controllers/query-data-summary-by-period.ts +0 -178
  56. package/server/controllers/shiny-report.ts +0 -54
  57. package/server/engine/index.ts +0 -1
  58. package/server/engine/task/create-data-sample.ts +0 -100
  59. package/server/engine/task/index.ts +0 -2
  60. package/server/engine/task/issue-collect-data.ts +0 -45
  61. package/server/index.ts +0 -8
  62. package/server/routes.ts +0 -188
  63. package/server/service/data-archive/data-archive-mutation.ts +0 -273
  64. package/server/service/data-archive/data-archive-query.ts +0 -58
  65. package/server/service/data-archive/data-archive-type.ts +0 -48
  66. package/server/service/data-archive/data-archive.ts +0 -69
  67. package/server/service/data-archive/index.ts +0 -6
  68. package/server/service/data-key-set/data-key-item-type.ts +0 -31
  69. package/server/service/data-key-set/data-key-set-mutation.ts +0 -201
  70. package/server/service/data-key-set/data-key-set-query.ts +0 -68
  71. package/server/service/data-key-set/data-key-set-type.ts +0 -70
  72. package/server/service/data-key-set/data-key-set.ts +0 -86
  73. package/server/service/data-key-set/index.ts +0 -6
  74. package/server/service/data-ooc/data-ooc-mutation.ts +0 -154
  75. package/server/service/data-ooc/data-ooc-query.ts +0 -106
  76. package/server/service/data-ooc/data-ooc-subscription.ts +0 -48
  77. package/server/service/data-ooc/data-ooc-type.ts +0 -71
  78. package/server/service/data-ooc/data-ooc.ts +0 -259
  79. package/server/service/data-ooc/index.ts +0 -7
  80. package/server/service/data-sample/data-sample-mutation.ts +0 -18
  81. package/server/service/data-sample/data-sample-query.ts +0 -215
  82. package/server/service/data-sample/data-sample-type.ts +0 -47
  83. package/server/service/data-sample/data-sample.ts +0 -193
  84. package/server/service/data-sample/index.ts +0 -6
  85. package/server/service/data-sensor/data-sensor-mutation.ts +0 -116
  86. package/server/service/data-sensor/data-sensor-query.ts +0 -76
  87. package/server/service/data-sensor/data-sensor-type.ts +0 -104
  88. package/server/service/data-sensor/data-sensor.ts +0 -126
  89. package/server/service/data-sensor/index.ts +0 -6
  90. package/server/service/data-set/data-item-type.ts +0 -155
  91. package/server/service/data-set/data-set-mutation.ts +0 -552
  92. package/server/service/data-set/data-set-query.ts +0 -461
  93. package/server/service/data-set/data-set-type.ts +0 -204
  94. package/server/service/data-set/data-set.ts +0 -326
  95. package/server/service/data-set/index.ts +0 -6
  96. package/server/service/data-set-history/data-set-history-query.ts +0 -126
  97. package/server/service/data-set-history/data-set-history-type.ts +0 -12
  98. package/server/service/data-set-history/data-set-history.ts +0 -217
  99. package/server/service/data-set-history/event-subscriber.ts +0 -17
  100. package/server/service/data-set-history/index.ts +0 -7
  101. package/server/service/data-spec/data-spec-manager.ts +0 -21
  102. package/server/service/data-spec/data-spec-query.ts +0 -21
  103. package/server/service/data-spec/data-spec.ts +0 -45
  104. package/server/service/data-spec/index.ts +0 -5
  105. package/server/service/data-summary/data-summary-mutation.ts +0 -45
  106. package/server/service/data-summary/data-summary-query.ts +0 -179
  107. package/server/service/data-summary/data-summary-type.ts +0 -86
  108. package/server/service/data-summary/data-summary.ts +0 -170
  109. package/server/service/data-summary/index.ts +0 -7
  110. package/server/service/index.ts +0 -57
  111. package/server/tsconfig.json +0 -10
  112. package/server/utils/config-resolver.ts +0 -29
  113. package/server/utils/index.ts +0 -1
@@ -1,249 +0,0 @@
1
- import '@operato/dataset/ox-data-sample-view.js'
2
- import '@operato/dataset/ox-data-ooc-brief-view.js'
3
- import '@things-factory/worklist/dist-client/components/activity-thread-timeline.js'
4
-
5
- import gql from 'graphql-tag'
6
- import { PropertyValues, html, css, nothing } from 'lit'
7
- import { customElement, state } from 'lit/decorators.js'
8
- import { PageView } from '@operato/shell'
9
- import { i18next, localize } from '@operato/i18n'
10
- import { client } from '@operato/graphql'
11
-
12
- /**
13
- * 이 페이지는 여러개의 Data Sample을 한번에 프린트하기 위한 용도로 사용되는 페이지이다.
14
- */
15
- @customElement('data-samples-page')
16
- export class DataSamplesPage extends localize(i18next)(PageView) {
17
- static styles = [
18
- css`
19
- :host {
20
- display: block;
21
- overflow: auto;
22
- }
23
-
24
- .end {
25
- page-break-after: always;
26
- break-after: always;
27
- }
28
- `
29
- ]
30
-
31
- @state() dataSamples?: any[]
32
-
33
- get context() {
34
- return {
35
- title: i18next.t('title.data-sample view')
36
- }
37
- }
38
-
39
- render() {
40
- return this.dataSamples?.map(dataSample => {
41
- if (dataSample?.dataOoc) {
42
- var reviewActivityThread = dataSample.dataOoc.reviewActivityInstance?.activityThreads?.[0]
43
- var resolveActivityThread = dataSample.dataOoc.resolveActivityInstance?.activityThreads?.[0]
44
- } else {
45
- var reviewActivityThread = dataSample?.reviewActivityInstance?.activityThreads?.[0]
46
- }
47
-
48
- return html`
49
- ${!dataSample.dataOoc
50
- ? html` <ox-data-sample-view .dataSample=${dataSample}></ox-data-sample-view> `
51
- : html` <ox-data-ooc-brief-view .dataOoc=${dataSample.dataOoc}></ox-data-ooc-brief-view>`}
52
- ${reviewActivityThread
53
- ? html`
54
- <activity-thread-timeline
55
- subtitle=${String(i18next.t(dataSample?.dataOoc ? 'label.ooc review timeline' : 'label.datasample review timeline'))}
56
- .activityThread=${reviewActivityThread}
57
- short-form
58
- ></activity-thread-timeline>
59
- `
60
- : nothing}
61
- ${resolveActivityThread
62
- ? html`
63
- <activity-thread-timeline
64
- subtitle=${String(i18next.t('label.ooc resolve timeline'))}
65
- .activityThread=${resolveActivityThread}
66
- short-form
67
- ></activity-thread-timeline>
68
- `
69
- : nothing}
70
- <div class="end"></div>
71
- `
72
- })
73
- }
74
-
75
- updated(changes: PropertyValues<this>) {}
76
-
77
- pageUpdated(changes: any, lifecycle: any, before: any) {
78
- if (this.active) {
79
- /*
80
- * this page is activated
81
- */
82
- const { ids = '' } = lifecycle.params
83
-
84
- this.fetchSamples(ids.split('|').map(id => id.trim()))
85
- } else {
86
- /* this page is deactivated */
87
- }
88
- }
89
-
90
- async fetchSamples(ids: string[]) {
91
- const filters = [
92
- {
93
- name: 'id',
94
- operator: 'in',
95
- value: ids
96
- }
97
- ]
98
-
99
- const response = await client.query({
100
- query: gql`
101
- query ($filters: [Filter!]) {
102
- dataSamples(filters: $filters) {
103
- items {
104
- id
105
- name
106
- description
107
- useCase
108
- key01
109
- key02
110
- key03
111
- key04
112
- key05
113
- data
114
- ooc
115
- oos
116
- updatedAt
117
- collectedAt
118
- updater {
119
- id
120
- name
121
- }
122
- dataSet {
123
- id
124
- name
125
- description
126
- }
127
- dataItems {
128
- name
129
- description
130
- active
131
- hidden
132
- tag
133
- group
134
- type
135
- unit
136
- options
137
- quota
138
- spec
139
- stat
140
- }
141
- judgment
142
- workDate
143
- workShift
144
- reviewActivityInstance {
145
- ...ActivityInstanceFragment
146
- }
147
- dataOoc {
148
- name
149
- description
150
- useCase
151
- dataSet {
152
- id
153
- name
154
- }
155
- key01
156
- key02
157
- key03
158
- key04
159
- key05
160
- partitionKeys
161
- dataItems {
162
- name
163
- description
164
- active
165
- hidden
166
- tag
167
- group
168
- type
169
- unit
170
- options
171
- quota
172
- spec
173
- stat
174
- }
175
- data
176
- rawData
177
- judgment
178
- ooc
179
- oos
180
- state
181
- history
182
- workDate
183
- workShift
184
- correctiveInstruction
185
- correctiveAction
186
- reviewedAt
187
- reviewer {
188
- id
189
- name
190
- }
191
- correctedAt
192
- corrector {
193
- id
194
- name
195
- }
196
- updater {
197
- id
198
- name
199
- }
200
- updatedAt
201
- collectedAt
202
- reviewActivityInstance {
203
- ...ActivityInstanceFragment
204
- }
205
- resolveActivityInstance {
206
- ...ActivityInstanceFragment
207
- }
208
- }
209
- }
210
- }
211
- }
212
-
213
- fragment ActivityInstanceFragment on ActivityInstance {
214
- activityThreads {
215
- assignee {
216
- name
217
- }
218
- output
219
- activityApprovals {
220
- judgment
221
- approver {
222
- name
223
- }
224
- comment
225
- createdAt
226
- updatedAt
227
- terminatedAt
228
- }
229
- activityThreadHistories {
230
- transaction
231
- reason
232
- updater {
233
- name
234
- }
235
- updatedAt
236
- state
237
- output
238
- }
239
- }
240
- }
241
- `,
242
- variables: {
243
- filters
244
- }
245
- })
246
-
247
- this.dataSamples = response.data.dataSamples.items
248
- }
249
- }
@@ -1,456 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/data-grist'
3
- import '@operato/context/ox-context-page-toolbar.js'
4
-
5
- import gql from 'graphql-tag'
6
- import { css, html } from 'lit'
7
- import { customElement, property, query, state } from 'lit/decorators.js'
8
-
9
- import { connect } from 'pwa-helpers/connect-mixin'
10
-
11
- import { client } from '@operato/graphql'
12
- import { i18next, localize } from '@operato/i18n'
13
- import { notify } from '@operato/layout'
14
- import { PageView, store } from '@operato/shell'
15
- import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
16
- import { isMobileDevice } from '@operato/utils'
17
- import { DataGrist, FetchOption } from '@operato/data-grist'
18
- import { OxPrompt } from '@operato/popup/ox-prompt.js'
19
-
20
- import { p13n } from '@operato/p13n'
21
-
22
- @customElement('data-sensor-list-page')
23
- export class DataSensorListPage extends connect(store)(p13n(localize(i18next)(PageView))) {
24
- static styles = [
25
- ScrollbarStyles,
26
- CommonGristStyles,
27
- CommonHeaderStyles,
28
- css`
29
- :host {
30
- display: flex;
31
- flex-direction: column;
32
-
33
- overflow: hidden;
34
- }
35
-
36
- ox-grist {
37
- overflow-y: auto;
38
- flex: 1;
39
- }
40
-
41
- .header {
42
- grid-template-areas: 'filters actions';
43
- }
44
- `
45
- ]
46
-
47
- @state() private gristConfig: any
48
- @state() private mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
49
-
50
- @query('ox-grist') private grist!: DataGrist
51
-
52
- get context() {
53
- return {
54
- title: i18next.t('title.data-sensor list'),
55
- search: {
56
- handler: (search: string) => {
57
- this.grist.searchText = search
58
- },
59
- value: this.grist?.searchText || ''
60
- },
61
- filter: {
62
- handler: () => {
63
- this.grist.toggleHeadroom()
64
- }
65
- },
66
- help: 'dataset/data-sensor',
67
- actions: [
68
- {
69
- icon: 'content_copy',
70
- title: i18next.t('button.copy'),
71
- action: this._copyDataSensor.bind(this)
72
- },
73
- {
74
- icon: 'save',
75
- title: i18next.t('button.save'),
76
- action: this._updateDataSensor.bind(this)
77
- },
78
- {
79
- icon: 'delete',
80
- title: i18next.t('button.delete'),
81
- action: this._deleteDataSensor.bind(this),
82
- emphasis: {
83
- danger: true
84
- }
85
- }
86
- ],
87
- toolbar: false
88
- }
89
- }
90
-
91
- render() {
92
- const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
93
-
94
- return html`
95
- <ox-grist
96
- .mode=${mode}
97
- .config=${this.gristConfig}
98
- .fetchHandler=${this.fetchHandler.bind(this)}
99
- .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
100
- ?url-params-sensitive=${this.active}
101
- >
102
- <div slot="headroom" class="header">
103
- <div class="filters">
104
- <ox-filters-form class="filter" autofocus without-search></ox-filters-form>
105
- </div>
106
-
107
- <ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
108
- </div>
109
-
110
- <ox-grist-personalizer slot="setting"></ox-grist-personalizer>
111
- </ox-grist>
112
- `
113
- }
114
-
115
- async pageInitialized(lifecycle) {
116
- this.gristConfig = {
117
- list: { fields: ['name', 'description', 'active'] },
118
- columns: [
119
- { type: 'gutter', gutterName: 'sequence', fixed: true },
120
- { type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },
121
- {
122
- type: 'string',
123
- name: 'name',
124
- label: true,
125
- header: i18next.t('field.name'),
126
- record: {
127
- editable: true
128
- },
129
- filter: 'search',
130
- sortable: true,
131
- width: 150,
132
- fixed: true
133
- },
134
- {
135
- type: 'string',
136
- name: 'description',
137
- label: true,
138
- header: i18next.t('field.description'),
139
- record: {
140
- editable: true
141
- },
142
- filter: 'search',
143
- width: 200
144
- },
145
- {
146
- type: 'checkbox',
147
- name: 'active',
148
- label: true,
149
- header: i18next.t('field.active'),
150
- record: {
151
- editable: true
152
- },
153
- sortable: true,
154
- filter: true,
155
- width: 60
156
- },
157
- {
158
- type: 'string',
159
- name: 'deviceId',
160
- label: true,
161
- header: i18next.t('field.device-id'),
162
- record: {
163
- editable: true
164
- },
165
- filter: 'search',
166
- sortable: true,
167
- width: 150
168
- },
169
- {
170
- type: 'varname',
171
- name: 'tag',
172
- label: true,
173
- header: i18next.t('field.tag'),
174
- record: {
175
- editable: true
176
- },
177
- sortable: true,
178
- filter: 'search',
179
- width: 150
180
- },
181
- {
182
- type: 'object',
183
- name: 'appliance',
184
- header: i18next.t('field.appliance'),
185
- record: {
186
- editable: true,
187
- options: {
188
- queryName: 'appliances'
189
- }
190
- },
191
- sortable: true,
192
- width: 120
193
- },
194
- {
195
- type: 'resource-object',
196
- name: 'decoder',
197
- header: {
198
- renderer: i18next.t('field.decoder-scenario')
199
- },
200
- record: {
201
- editable: true,
202
- options: {
203
- title: i18next.t('title.lookup scenario'),
204
- queryName: 'scenarios',
205
- columns: [
206
- { name: 'id', hidden: true },
207
- { name: 'name', header: i18next.t('field.name'), filter: 'search' },
208
- { name: 'description', header: i18next.t('field.description'), filter: 'search' }
209
- ],
210
- list: { fields: ['name', 'description'] }
211
- }
212
- },
213
- filter: false,
214
- width: 120
215
- },
216
- {
217
- type: 'object',
218
- name: 'dataSet',
219
- header: i18next.t('field.data-set'),
220
- record: {
221
- editable: true,
222
- options: {
223
- queryName: 'dataSets'
224
- }
225
- },
226
- sortable: true,
227
- width: 120
228
- },
229
- {
230
- type: 'string',
231
- name: 'refBy',
232
- label: true,
233
- header: i18next.t('field.ref-by'),
234
- record: {
235
- editable: true
236
- },
237
- sortable: true,
238
- width: 150
239
- },
240
- {
241
- type: 'string',
242
- name: 'model',
243
- label: true,
244
- header: i18next.t('field.model'),
245
- record: {
246
- editable: true
247
- },
248
- sortable: true,
249
- width: 150
250
- },
251
- {
252
- type: 'string',
253
- name: 'brand',
254
- label: true,
255
- header: i18next.t('field.brand'),
256
- record: {
257
- editable: true
258
- },
259
- sortable: true,
260
- width: 150
261
- },
262
- {
263
- type: 'string',
264
- name: 'serialNo',
265
- label: true,
266
- header: i18next.t('field.serial-no'),
267
- record: {
268
- editable: true
269
- },
270
- sortable: true,
271
- width: 150
272
- },
273
- {
274
- type: 'string',
275
- name: 'netmask',
276
- label: true,
277
- header: i18next.t('field.netmask'),
278
- record: {
279
- editable: true
280
- },
281
- sortable: true,
282
- width: 150
283
- },
284
- {
285
- type: 'object',
286
- name: 'updater',
287
- header: i18next.t('field.updater'),
288
- record: {
289
- editable: false
290
- },
291
- sortable: true,
292
- width: 120
293
- },
294
- {
295
- type: 'datetime',
296
- name: 'updatedAt',
297
- header: i18next.t('field.updated_at'),
298
- record: {
299
- editable: false
300
- },
301
- sortable: true,
302
- width: 180
303
- }
304
- ],
305
- rows: {
306
- selectable: {
307
- multiple: true
308
- }
309
- },
310
- sorters: [
311
- {
312
- name: 'name'
313
- }
314
- ]
315
- }
316
- }
317
-
318
- async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
319
- const response = await client.query({
320
- query: gql`
321
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
322
- responses: dataSensors(filters: $filters, pagination: $pagination, sortings: $sortings) {
323
- items {
324
- id
325
- name
326
- description
327
- active
328
- deviceId
329
- tag
330
- appliance {
331
- id
332
- name
333
- description
334
- }
335
- dataSet {
336
- id
337
- name
338
- description
339
- }
340
- decoder {
341
- id
342
- name
343
- description
344
- }
345
- refBy
346
- brand
347
- model
348
- serialNo
349
- netmask
350
- updater {
351
- id
352
- name
353
- }
354
- updatedAt
355
- }
356
- total
357
- }
358
- }
359
- `,
360
- variables: {
361
- filters,
362
- pagination: { page, limit },
363
- sortings
364
- }
365
- })
366
-
367
- return {
368
- total: response.data.responses.total || 0,
369
- records: response.data.responses.items || []
370
- }
371
- }
372
-
373
- async _deleteDataSensor() {
374
- if (
375
- await OxPrompt.open({
376
- title: i18next.t('text.are_you_sure'),
377
- text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
378
- confirmButton: { text: i18next.t('button.confirm') },
379
- cancelButton: { text: i18next.t('button.cancel') }
380
- })
381
- ) {
382
- const ids = this.grist.selected.map(record => record.id)
383
- if (ids && ids.length > 0) {
384
- const response = await client.mutate({
385
- mutation: gql`
386
- mutation ($ids: [String!]!) {
387
- deleteDataSensors(ids: $ids)
388
- }
389
- `,
390
- variables: {
391
- ids
392
- }
393
- })
394
-
395
- if (!response.errors) {
396
- this.grist.fetch()
397
- notify({
398
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
399
- })
400
- }
401
- }
402
- }
403
- }
404
-
405
- async _copyDataSensor() {
406
- var selected = this.grist.selected
407
- if (selected.length == 0) return
408
-
409
- if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') }))) return
410
- var response = await client.mutate({
411
- mutation: gql`
412
- mutation ($ids: [String!]!) {
413
- copyDataSensors(ids: $ids) {
414
- id
415
- }
416
- }
417
- `,
418
- variables: {
419
- ids: selected.map(r => r.id)
420
- }
421
- })
422
-
423
- if (!response.errors) this.grist.fetch()
424
- }
425
-
426
- async _updateDataSensor() {
427
- let patches = this.grist.dirtyRecords
428
- if (patches && patches.length) {
429
- patches = patches.map(patch => {
430
- let patchField: any = patch.id ? { id: patch.id } : {}
431
- const dirtyFields = patch.__dirtyfields__
432
- for (let key in dirtyFields) {
433
- patchField[key] = dirtyFields[key].after
434
- }
435
- patchField.cuFlag = patch.__dirty__
436
-
437
- return patchField
438
- })
439
-
440
- const response = await client.mutate({
441
- mutation: gql`
442
- mutation ($patches: [DataSensorPatch!]!) {
443
- updateMultipleDataSensor(patches: $patches) {
444
- name
445
- }
446
- }
447
- `,
448
- variables: {
449
- patches
450
- }
451
- })
452
-
453
- if (!response.errors) this.grist.fetch()
454
- }
455
- }
456
- }