@things-factory/dataset 8.0.0 → 9.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. package/dist-client/activities/activity-data-review-edit.d.ts +5 -1
  2. package/dist-client/activities/activity-data-review-edit.js +143 -5
  3. package/dist-client/activities/activity-data-review-edit.js.map +1 -1
  4. package/dist-client/pages/data-entry/data-entry-list-page.js +2 -2
  5. package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -1
  6. package/dist-client/tsconfig.tsbuildinfo +1 -1
  7. package/dist-server/activities/activity-data-review.js +18 -5
  8. package/dist-server/activities/activity-data-review.js.map +1 -1
  9. package/dist-server/activities/activity-ooc-review.js +13 -52
  10. package/dist-server/activities/activity-ooc-review.js.map +1 -1
  11. package/dist-server/controllers/create-data-ooc.d.ts +4 -0
  12. package/dist-server/controllers/create-data-ooc.js +65 -0
  13. package/dist-server/controllers/create-data-ooc.js.map +1 -0
  14. package/dist-server/controllers/create-data-sample.js +4 -94
  15. package/dist-server/controllers/create-data-sample.js.map +1 -1
  16. package/dist-server/controllers/index.d.ts +3 -0
  17. package/dist-server/controllers/index.js +3 -0
  18. package/dist-server/controllers/index.js.map +1 -1
  19. package/dist-server/controllers/issue-ooc-resolve.d.ts +3 -0
  20. package/dist-server/controllers/issue-ooc-resolve.js +49 -0
  21. package/dist-server/controllers/issue-ooc-resolve.js.map +1 -0
  22. package/dist-server/controllers/issue-ooc-review.d.ts +3 -0
  23. package/dist-server/controllers/issue-ooc-review.js +47 -0
  24. package/dist-server/controllers/issue-ooc-review.js.map +1 -0
  25. package/dist-server/service/data-sample/data-sample-query.d.ts +1 -1
  26. package/dist-server/service/data-sample/data-sample-query.js +3 -3
  27. package/dist-server/service/data-sample/data-sample-query.js.map +1 -1
  28. package/dist-server/service/index.d.ts +1 -1
  29. package/dist-server/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +26 -26
  31. package/translations/en.json +3 -0
  32. package/translations/ja.json +3 -0
  33. package/translations/ko.json +3 -0
  34. package/translations/ms.json +3 -0
  35. package/translations/zh.json +3 -0
  36. package/client/activities/activity-data-collect-edit.ts +0 -105
  37. package/client/activities/activity-data-collect-view.ts +0 -91
  38. package/client/activities/activity-data-review-edit.ts +0 -133
  39. package/client/activities/activity-data-review-view.ts +0 -145
  40. package/client/activities/activity-ooc-resolve-edit.ts +0 -195
  41. package/client/activities/activity-ooc-resolve-view.ts +0 -143
  42. package/client/activities/activity-ooc-review-edit.ts +0 -173
  43. package/client/activities/activity-ooc-review-view.ts +0 -129
  44. package/client/bootstrap.ts +0 -35
  45. package/client/components/data-entry-form.ts +0 -109
  46. package/client/index.ts +0 -1
  47. package/client/pages/data-archive/data-archive-list-page.ts +0 -277
  48. package/client/pages/data-archive/data-archive-request-popup.ts +0 -177
  49. package/client/pages/data-entry/data-entry-list-page.ts +0 -464
  50. package/client/pages/data-key-set/data-key-item-list.ts +0 -183
  51. package/client/pages/data-key-set/data-key-set-importer.ts +0 -89
  52. package/client/pages/data-key-set/data-key-set-list-page.ts +0 -413
  53. package/client/pages/data-ooc/data-ooc-list-page.ts +0 -549
  54. package/client/pages/data-ooc/data-ooc-page.ts +0 -164
  55. package/client/pages/data-ooc/data-ooc-view.ts +0 -236
  56. package/client/pages/data-ooc/data-oocs-page.ts +0 -200
  57. package/client/pages/data-report/data-report-embed-page.ts +0 -108
  58. package/client/pages/data-report/data-report-list-page.ts +0 -454
  59. package/client/pages/data-report/data-report-samples-page.ts +0 -174
  60. package/client/pages/data-report/jasper-report-oocs-page.ts +0 -110
  61. package/client/pages/data-report/jasper-report-samples-crosstab-page.ts +0 -110
  62. package/client/pages/data-report/jasper-report-samples-page.ts +0 -110
  63. package/client/pages/data-sample/data-sample-list-page.ts +0 -442
  64. package/client/pages/data-sample/data-sample-page.ts +0 -55
  65. package/client/pages/data-sample/data-sample-search-page.ts +0 -424
  66. package/client/pages/data-sample/data-sample-view.ts +0 -292
  67. package/client/pages/data-sample/data-samples-page.ts +0 -249
  68. package/client/pages/data-sensor/data-sensor-list-page.ts +0 -456
  69. package/client/pages/data-set/data-item-list.ts +0 -304
  70. package/client/pages/data-set/data-set-importer.ts +0 -89
  71. package/client/pages/data-set/data-set-list-page.ts +0 -1078
  72. package/client/pages/data-summary/data-summary-list-page.ts +0 -363
  73. package/client/pages/data-summary/data-summary-period-page.ts +0 -439
  74. package/client/pages/data-summary/data-summary-search-page.ts +0 -426
  75. package/client/pages/data-summary/data-summary-view.ts +0 -133
  76. package/client/route.ts +0 -91
  77. package/client/tsconfig.json +0 -13
  78. package/server/activities/activity-data-collect.ts +0 -100
  79. package/server/activities/activity-data-review.ts +0 -82
  80. package/server/activities/activity-ooc-resolve.ts +0 -123
  81. package/server/activities/activity-ooc-review.ts +0 -144
  82. package/server/activities/index.ts +0 -11
  83. package/server/controllers/create-data-sample.ts +0 -426
  84. package/server/controllers/data-use-case.ts +0 -98
  85. package/server/controllers/finalize-data-collection.ts +0 -388
  86. package/server/controllers/index.ts +0 -3
  87. package/server/controllers/issue-data-collection-task.ts +0 -70
  88. package/server/controllers/jasper-report.ts +0 -186
  89. package/server/controllers/query-data-summary-by-period.ts +0 -178
  90. package/server/controllers/shiny-report.ts +0 -54
  91. package/server/engine/index.ts +0 -1
  92. package/server/engine/task/create-data-sample.ts +0 -100
  93. package/server/engine/task/index.ts +0 -2
  94. package/server/engine/task/issue-collect-data.ts +0 -45
  95. package/server/index.ts +0 -8
  96. package/server/routes.ts +0 -188
  97. package/server/service/data-archive/data-archive-mutation.ts +0 -273
  98. package/server/service/data-archive/data-archive-query.ts +0 -58
  99. package/server/service/data-archive/data-archive-type.ts +0 -48
  100. package/server/service/data-archive/data-archive.ts +0 -69
  101. package/server/service/data-archive/index.ts +0 -6
  102. package/server/service/data-key-set/data-key-item-type.ts +0 -31
  103. package/server/service/data-key-set/data-key-set-mutation.ts +0 -201
  104. package/server/service/data-key-set/data-key-set-query.ts +0 -68
  105. package/server/service/data-key-set/data-key-set-type.ts +0 -70
  106. package/server/service/data-key-set/data-key-set.ts +0 -86
  107. package/server/service/data-key-set/index.ts +0 -6
  108. package/server/service/data-ooc/data-ooc-mutation.ts +0 -154
  109. package/server/service/data-ooc/data-ooc-query.ts +0 -106
  110. package/server/service/data-ooc/data-ooc-subscription.ts +0 -48
  111. package/server/service/data-ooc/data-ooc-type.ts +0 -71
  112. package/server/service/data-ooc/data-ooc.ts +0 -259
  113. package/server/service/data-ooc/index.ts +0 -7
  114. package/server/service/data-sample/data-sample-mutation.ts +0 -18
  115. package/server/service/data-sample/data-sample-query.ts +0 -215
  116. package/server/service/data-sample/data-sample-type.ts +0 -47
  117. package/server/service/data-sample/data-sample.ts +0 -193
  118. package/server/service/data-sample/index.ts +0 -6
  119. package/server/service/data-sensor/data-sensor-mutation.ts +0 -116
  120. package/server/service/data-sensor/data-sensor-query.ts +0 -76
  121. package/server/service/data-sensor/data-sensor-type.ts +0 -104
  122. package/server/service/data-sensor/data-sensor.ts +0 -126
  123. package/server/service/data-sensor/index.ts +0 -6
  124. package/server/service/data-set/data-item-type.ts +0 -155
  125. package/server/service/data-set/data-set-mutation.ts +0 -552
  126. package/server/service/data-set/data-set-query.ts +0 -461
  127. package/server/service/data-set/data-set-type.ts +0 -204
  128. package/server/service/data-set/data-set.ts +0 -326
  129. package/server/service/data-set/index.ts +0 -6
  130. package/server/service/data-set-history/data-set-history-query.ts +0 -126
  131. package/server/service/data-set-history/data-set-history-type.ts +0 -12
  132. package/server/service/data-set-history/data-set-history.ts +0 -217
  133. package/server/service/data-set-history/event-subscriber.ts +0 -17
  134. package/server/service/data-set-history/index.ts +0 -7
  135. package/server/service/data-spec/data-spec-manager.ts +0 -21
  136. package/server/service/data-spec/data-spec-query.ts +0 -21
  137. package/server/service/data-spec/data-spec.ts +0 -45
  138. package/server/service/data-spec/index.ts +0 -5
  139. package/server/service/data-summary/data-summary-mutation.ts +0 -45
  140. package/server/service/data-summary/data-summary-query.ts +0 -179
  141. package/server/service/data-summary/data-summary-type.ts +0 -86
  142. package/server/service/data-summary/data-summary.ts +0 -170
  143. package/server/service/data-summary/index.ts +0 -7
  144. package/server/service/index.ts +0 -57
  145. package/server/tsconfig.json +0 -10
  146. package/server/utils/config-resolver.ts +0 -29
  147. package/server/utils/index.ts +0 -1
@@ -1,89 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/data-grist'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
7
-
8
- import { client } from '@operato/graphql'
9
- import { i18next } from '@operato/i18n'
10
- import { isMobileDevice } from '@operato/utils'
11
- import { CommonHeaderStyles } from '@operato/styles'
12
-
13
- @customElement('data-key-set-importer')
14
- export class DataKeySetImporter extends LitElement {
15
- static styles = [
16
- CommonHeaderStyles,
17
- css`
18
- :host {
19
- display: flex;
20
- flex-direction: column;
21
-
22
- background-color: var(--md-sys-color-surface);
23
- }
24
-
25
- ox-grist {
26
- flex: 1;
27
- }
28
- `
29
- ]
30
-
31
- @property({ type: Array }) dataKeySets: any[] = []
32
-
33
- private columns = {
34
- list: { fields: ['name', 'description'] },
35
- pagination: { infinite: true },
36
- columns: [
37
- {
38
- type: 'string',
39
- name: 'name',
40
- header: i18next.t('field.name'),
41
- width: 150
42
- },
43
- {
44
- type: 'string',
45
- name: 'description',
46
- header: i18next.t('field.description'),
47
- width: 200
48
- },
49
- {
50
- type: 'checkbox',
51
- name: 'active',
52
- header: i18next.t('field.active'),
53
- width: 60
54
- }
55
- ]
56
- }
57
-
58
- render() {
59
- return html`
60
- <ox-grist
61
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
62
- .config=${this.columns}
63
- .data=${{
64
- records: this.dataKeySets
65
- }}
66
- ></ox-grist>
67
-
68
- <div class="footer">
69
- <div filler></div>
70
- <button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</button>
71
- </div>
72
- `
73
- }
74
-
75
- async save() {
76
- const response = await client.mutate({
77
- mutation: gql`
78
- mutation importDataKeySets($dataKeySets: [DataKeySetPatch!]!) {
79
- importDataKeySets(dataKeySets: $dataKeySets)
80
- }
81
- `,
82
- variables: { dataKeySets: this.dataKeySets }
83
- })
84
-
85
- if (response.errors?.length) return
86
-
87
- this.dispatchEvent(new CustomEvent('imported'))
88
- }
89
- }
@@ -1,413 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/data-grist'
3
- import '@operato/context/ox-context-page-toolbar.js'
4
- import './data-key-set-importer.js'
5
- import './data-key-item-list'
6
-
7
- import gql from 'graphql-tag'
8
- import { css, html } from 'lit'
9
- import { customElement, property, query, state } from 'lit/decorators.js'
10
- import { connect } from 'pwa-helpers/connect-mixin'
11
-
12
- import { getEditor, getRenderer, DataGrist, FetchOption } from '@operato/data-grist'
13
- import { client } from '@operato/graphql'
14
- import { i18next, localize } from '@operato/i18n'
15
- import { notify, openPopup } from '@operato/layout'
16
- import { navigate, PageView, store } from '@operato/shell'
17
- import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
18
- import { isMobileDevice, encodeUrlParams } from '@operato/utils'
19
-
20
- const REPORT_TYPES = [
21
- {
22
- display: '',
23
- value: ''
24
- },
25
- {
26
- display: 'Generated',
27
- value: 'generated'
28
- },
29
- {
30
- display: 'Embed',
31
- value: 'embed'
32
- },
33
- {
34
- display: 'CustomElement',
35
- value: 'custom-element'
36
- },
37
- {
38
- display: 'Page',
39
- value: 'page'
40
- },
41
- {
42
- display: 'External URL',
43
- value: 'external'
44
- },
45
- {
46
- display: 'Jasper',
47
- value: 'jasper'
48
- },
49
- {
50
- display: 'Shiny',
51
- value: 'shiny'
52
- }
53
- ]
54
-
55
- @customElement('data-key-set-list-page')
56
- export class DataKeySetListPage extends connect(store)(localize(i18next)(PageView)) {
57
- static styles = [
58
- ScrollbarStyles,
59
- CommonHeaderStyles,
60
- css`
61
- :host {
62
- display: flex;
63
-
64
- width: 100%;
65
-
66
- --grid-record-emphasized-background-color: #8b0000;
67
- --grid-record-emphasized-color: #ff6b6b;
68
- }
69
-
70
- ox-grist {
71
- overflow-y: auto;
72
- flex: 1;
73
- }
74
-
75
- .header {
76
- grid-template-areas: 'filters actions';
77
- }
78
- `
79
- ]
80
-
81
- @state() gristConfig: any
82
- @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
83
-
84
- @query('ox-grist') private grist!: DataGrist
85
-
86
- get context() {
87
- return {
88
- title: i18next.t('title.data-key-set list'),
89
- search: {
90
- handler: (search: string) => {
91
- this.grist.searchText = search
92
- },
93
- value: this.grist?.searchText || ''
94
- },
95
- filter: {
96
- handler: () => {
97
- this.grist.toggleHeadroom()
98
- }
99
- },
100
- help: 'dataset/data-key-set',
101
- actions: [
102
- {
103
- title: i18next.t('button.save'),
104
- action: this._updateDataKeySet.bind(this),
105
- icon: 'save'
106
- },
107
- {
108
- title: i18next.t('button.delete'),
109
- action: this._deleteDataKeySet.bind(this),
110
- icon: 'delete',
111
- emphasis: {
112
- danger: true
113
- }
114
- }
115
- ],
116
- exportable: {
117
- name: i18next.t('title.data-key-set list'),
118
- data: this.exportHandler.bind(this)
119
- },
120
- importable: {
121
- handler: this.importHandler.bind(this)
122
- },
123
- toolbar: false
124
- }
125
- }
126
-
127
- render() {
128
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
129
-
130
- return html`
131
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
132
- <div slot="headroom" class="header">
133
- <div class="filters">
134
- <ox-filters-form autofocus without-search></ox-filters-form>
135
- </div>
136
-
137
- <ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
138
- </div>
139
- </ox-grist>
140
- `
141
- }
142
-
143
- async pageInitialized(lifecycle) {
144
- this.gristConfig = {
145
- list: {
146
- fields: ['name', 'description'],
147
- details: ['active', 'updatedAt']
148
- },
149
- columns: [
150
- { type: 'gutter', gutterName: 'sequence', fixed: true },
151
- { type: 'gutter', gutterName: 'row-selector', fixed: true, multiple: true },
152
- {
153
- type: 'gutter',
154
- gutterName: 'button',
155
- fixed: true,
156
- title: record =>
157
- !record ? i18next.t('button.edit-model') : !record.id ? '' : i18next.t('button.edit-model'),
158
- icon: record => (!record ? 'reorder' : !record.id ? '' : 'reorder'),
159
- iconOnly: false,
160
- width: 96,
161
- handlers: {
162
- click: (columns, data, column, record, rowIndex) => {
163
- if (!record.id) return
164
- const popup = openPopup(html` <data-key-item-list .dataKeySet=${record}></data-key-item-list> `, {
165
- backdrop: true,
166
- help: 'dataset/ui/data-key-item-list',
167
- size: 'large',
168
- title: i18next.t('title.data-key-item list')
169
- })
170
- popup.onclosed = () => {
171
- this.grist.fetch()
172
- }
173
- }
174
- }
175
- },
176
- {
177
- type: 'string',
178
- name: 'name',
179
- fixed: true,
180
- header: i18next.t('field.name'),
181
- record: {
182
- editable: true
183
- },
184
- filter: 'search',
185
- sortable: true,
186
- width: 150
187
- },
188
- {
189
- type: 'string',
190
- name: 'description',
191
- header: i18next.t('field.description'),
192
- record: {
193
- editable: true
194
- },
195
- filter: 'search',
196
- width: 200
197
- },
198
- {
199
- type: 'checkbox',
200
- name: 'active',
201
- label: true,
202
- header: i18next.t('field.active'),
203
- record: {
204
- editable: true
205
- },
206
- filter: true,
207
- sortable: true,
208
- width: 60
209
- },
210
- {
211
- type: 'select',
212
- name: 'reportType',
213
- label: true,
214
- header: i18next.t('field.report-type'),
215
- record: {
216
- editable: true,
217
- options: REPORT_TYPES
218
- },
219
- width: 80
220
- },
221
- {
222
- type: 'string',
223
- name: 'reportView',
224
- header: i18next.t('field.report-view'),
225
- record: {
226
- editable: true,
227
- editor: function (value, column, record, rowIndex, field) {
228
- var type = record.reportType !== 'custom' ? 'string' : 'script'
229
- return getEditor(type)(value, column, record, rowIndex, field)
230
- },
231
- renderer: function (value, column, record, rowIndex, field) {
232
- var type = record.reportType !== 'custom' ? 'string' : 'string'
233
- return getRenderer(type)(value, column, record, rowIndex, field)
234
- }
235
- },
236
- width: 140
237
- },
238
- {
239
- type: 'resource-object',
240
- name: 'updater',
241
- header: i18next.t('field.updater'),
242
- record: {
243
- editable: false
244
- },
245
- sortable: true,
246
- width: 120
247
- },
248
- {
249
- type: 'datetime',
250
- name: 'updatedAt',
251
- header: i18next.t('field.updated_at'),
252
- record: {
253
- editable: false
254
- },
255
- sortable: true,
256
- width: 180
257
- }
258
- ],
259
- rows: {
260
- selectable: {
261
- multiple: true
262
- }
263
- },
264
- sorters: [
265
- {
266
- name: 'name'
267
- }
268
- ]
269
- }
270
- }
271
-
272
- async pageUpdated(changes, lifecycle) {
273
- if (this.active) {
274
- // do something here when this page just became as active
275
- }
276
- }
277
-
278
- async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
279
- const response = await client.query({
280
- query: gql`
281
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
282
- responses: dataKeySets(filters: $filters, pagination: $pagination, sortings: $sortings) {
283
- items {
284
- id
285
- name
286
- description
287
- active
288
- reportType
289
- reportView
290
- dataKeyItems {
291
- name
292
- description
293
- dataKey
294
- tKey
295
- }
296
- updater {
297
- id
298
- name
299
- }
300
- updatedAt
301
- }
302
- total
303
- }
304
- }
305
- `,
306
- variables: {
307
- filters,
308
- pagination: { page, limit },
309
- sortings
310
- }
311
- })
312
-
313
- return {
314
- total: response.data.responses.total || 0,
315
- records: response.data.responses.items || []
316
- }
317
- }
318
-
319
- async _deleteDataKeySet() {
320
- if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
321
- const ids = this.grist.selected.map(record => record.id)
322
- if (ids && ids.length > 0) {
323
- const response = await client.mutate({
324
- mutation: gql`
325
- mutation ($ids: [String!]!) {
326
- deleteDataKeySets(ids: $ids)
327
- }
328
- `,
329
- variables: {
330
- ids
331
- }
332
- })
333
-
334
- if (!response.errors) {
335
- this.grist.fetch()
336
- notify({
337
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
338
- })
339
- }
340
- }
341
- }
342
- }
343
-
344
- async _updateDataKeySet() {
345
- let patches = this.grist.dirtyRecords
346
- if (patches && patches.length) {
347
- patches = patches.map(patch => {
348
- let patchField: any = patch.id ? { id: patch.id } : {}
349
- const dirtyFields = patch.__dirtyfields__
350
- for (let key in dirtyFields) {
351
- patchField[key] = dirtyFields[key].after
352
- }
353
- patchField.cuFlag = patch.__dirty__
354
-
355
- return patchField
356
- })
357
-
358
- const response = await client.mutate({
359
- mutation: gql`
360
- mutation ($patches: [DataKeySetPatch!]!) {
361
- updateMultipleDataKeySet(patches: $patches) {
362
- name
363
- }
364
- }
365
- `,
366
- variables: {
367
- patches
368
- }
369
- })
370
-
371
- if (!response.errors) {
372
- this.grist.fetch()
373
- }
374
- }
375
- }
376
-
377
- async exportHandler() {
378
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
379
- const targetFieldSet = new Set(['id', 'name', 'description', 'active', 'reportType', 'reportView'])
380
-
381
- return exportTargets.map(dataKeySet => {
382
- let tempObj = {}
383
- for (const field of targetFieldSet) {
384
- tempObj[field] = dataKeySet[field]
385
- }
386
-
387
- return tempObj
388
- })
389
- }
390
-
391
- async importHandler(records) {
392
- const popup = openPopup(
393
- html`
394
- <data-key-set-importer
395
- .dataKeySets=${records}
396
- @imported=${() => {
397
- history.back()
398
- this.grist.fetch()
399
- }}
400
- ></data-key-set-importer>
401
- `,
402
- {
403
- backdrop: true,
404
- size: 'large',
405
- title: i18next.t('title.import data-key-set')
406
- }
407
- )
408
-
409
- popup.onclosed = () => {
410
- this.grist.fetch()
411
- }
412
- }
413
- }