@things-factory/dataset 5.0.0-alpha.26 → 5.0.0-alpha.27
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-entry-form.js → data-entry/data-entry-form.js} +1 -0
- package/client/pages/data-entry/data-entry-list-page.js +324 -0
- package/client/pages/{data-ooc.js → data-ooc/data-ooc-list-page.js} +3 -3
- package/client/pages/{data-ooc-view.js → data-ooc/data-ooc-view.js} +0 -0
- package/client/pages/{data-sample.js → data-sample/data-sample-list-page.js} +3 -3
- package/client/pages/{data-sample-view.js → data-sample/data-sample-view.js} +0 -0
- package/client/pages/{data-sensor.js → data-sensor/data-sensor-list-page.js} +3 -3
- package/client/pages/{data-item-list.js → data-set/data-item-list.js} +0 -0
- package/client/pages/{data-set-importer.js → data-set/data-set-importer.js} +0 -0
- package/client/pages/{data-set.js → data-set/data-set-list-page.js} +6 -6
- package/client/route.js +12 -8
- package/package.json +6 -6
- package/things-factory.config.js +12 -8
- package/translations/en.json +2 -1
- package/yarn-error.log +23244 -0
@@ -0,0 +1,324 @@
|
|
1
|
+
import '@operato/data-grist'
|
2
|
+
import './data-entry-form'
|
3
|
+
|
4
|
+
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
5
|
+
import { PageView, store } from '@operato/shell'
|
6
|
+
import { css, html } from 'lit'
|
7
|
+
import { i18next, localize } from '@operato/i18n'
|
8
|
+
import { notify, openPopup } from '@operato/layout'
|
9
|
+
|
10
|
+
import JSON5 from 'json5'
|
11
|
+
import { OxDataUseCase } from '@operato/dataset'
|
12
|
+
import { client } from '@operato/graphql'
|
13
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
14
|
+
import gql from 'graphql-tag'
|
15
|
+
|
16
|
+
export class DataEntryListPage extends connect(store)(localize(i18next)(PageView)) {
|
17
|
+
static get properties() {
|
18
|
+
return {
|
19
|
+
active: String,
|
20
|
+
gristConfig: Object,
|
21
|
+
filters: Object,
|
22
|
+
sorters: Object,
|
23
|
+
mode: String
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
static get styles() {
|
28
|
+
return [
|
29
|
+
ScrollbarStyles,
|
30
|
+
CommonGristStyles,
|
31
|
+
css`
|
32
|
+
:host {
|
33
|
+
display: flex;
|
34
|
+
|
35
|
+
width: 100%;
|
36
|
+
|
37
|
+
--grid-record-emphasized-background-color: red;
|
38
|
+
--grid-record-emphasized-color: yellow;
|
39
|
+
}
|
40
|
+
`
|
41
|
+
]
|
42
|
+
}
|
43
|
+
|
44
|
+
get context() {
|
45
|
+
return {
|
46
|
+
title: i18next.t('title.data-entry list'),
|
47
|
+
help: 'dataset/data-entry-list'
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
render() {
|
52
|
+
const mode = 'CARD'
|
53
|
+
|
54
|
+
return html`
|
55
|
+
<ox-grist
|
56
|
+
.mode=${mode}
|
57
|
+
.config=${this.gristConfig}
|
58
|
+
.filters=${this.filters}
|
59
|
+
.orders=${this.orders}
|
60
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
61
|
+
>
|
62
|
+
<div slot="headroom" id="filters">
|
63
|
+
<div id="filters">
|
64
|
+
<ox-filters-form></ox-filters-form>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<div id="sorters">
|
68
|
+
Sort
|
69
|
+
<mwc-icon
|
70
|
+
@click=${e => {
|
71
|
+
const target = e.currentTarget
|
72
|
+
this.renderRoot.querySelector('#sorter-control').open({
|
73
|
+
right: 0,
|
74
|
+
top: target.offsetTop + target.offsetHeight
|
75
|
+
})
|
76
|
+
}}
|
77
|
+
>expand_more</mwc-icon
|
78
|
+
>
|
79
|
+
<ox-popup id="sorter-control">
|
80
|
+
<ox-sorters-control> </ox-sorters-control>
|
81
|
+
</ox-popup>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</ox-grist>
|
85
|
+
`
|
86
|
+
}
|
87
|
+
|
88
|
+
get grist() {
|
89
|
+
return this.renderRoot.querySelector('ox-grist')
|
90
|
+
}
|
91
|
+
|
92
|
+
async pageInitialized(lifecycle) {
|
93
|
+
this.gristConfig = {
|
94
|
+
list: {
|
95
|
+
fields: ['name', 'description'],
|
96
|
+
details: ['schedule', 'active']
|
97
|
+
},
|
98
|
+
columns: [
|
99
|
+
{
|
100
|
+
type: 'string',
|
101
|
+
name: 'name',
|
102
|
+
header: i18next.t('field.name'),
|
103
|
+
record: {
|
104
|
+
editable: true
|
105
|
+
},
|
106
|
+
filter: 'search',
|
107
|
+
sortable: true,
|
108
|
+
width: 150
|
109
|
+
},
|
110
|
+
{
|
111
|
+
type: 'string',
|
112
|
+
name: 'description',
|
113
|
+
header: i18next.t('field.description'),
|
114
|
+
record: {
|
115
|
+
editable: true
|
116
|
+
},
|
117
|
+
filter: 'search',
|
118
|
+
width: 200
|
119
|
+
},
|
120
|
+
{
|
121
|
+
type: 'checkbox',
|
122
|
+
name: 'active',
|
123
|
+
label: true,
|
124
|
+
header: i18next.t('field.active'),
|
125
|
+
record: {
|
126
|
+
editable: false
|
127
|
+
},
|
128
|
+
filter: true,
|
129
|
+
sortable: true,
|
130
|
+
width: 60
|
131
|
+
},
|
132
|
+
{
|
133
|
+
type: 'select',
|
134
|
+
name: 'type',
|
135
|
+
label: true,
|
136
|
+
header: i18next.t('field.type'),
|
137
|
+
record: {
|
138
|
+
editable: false,
|
139
|
+
options: [
|
140
|
+
{},
|
141
|
+
{
|
142
|
+
display: 'Manually Collected',
|
143
|
+
value: 'manual'
|
144
|
+
},
|
145
|
+
{
|
146
|
+
display: 'Automatically Collected',
|
147
|
+
value: 'automatic'
|
148
|
+
}
|
149
|
+
]
|
150
|
+
},
|
151
|
+
sortable: true,
|
152
|
+
filter: true,
|
153
|
+
width: 60
|
154
|
+
},
|
155
|
+
{
|
156
|
+
type: 'select',
|
157
|
+
name: 'useCase',
|
158
|
+
label: true,
|
159
|
+
header: i18next.t('field.use-case'),
|
160
|
+
record: {
|
161
|
+
editable: false,
|
162
|
+
options: () => {
|
163
|
+
return ['', ...OxDataUseCase.getUseCaseNames()].map(name => {
|
164
|
+
return {
|
165
|
+
display: name,
|
166
|
+
value: name
|
167
|
+
}
|
168
|
+
})
|
169
|
+
}
|
170
|
+
},
|
171
|
+
sortable: true,
|
172
|
+
filter: {
|
173
|
+
operator: 'eq',
|
174
|
+
options: () => {
|
175
|
+
return ['', ...OxDataUseCase.getUseCaseNames()].map(name => {
|
176
|
+
return {
|
177
|
+
display: name,
|
178
|
+
value: name
|
179
|
+
}
|
180
|
+
})
|
181
|
+
}
|
182
|
+
},
|
183
|
+
width: 80
|
184
|
+
},
|
185
|
+
{
|
186
|
+
type: 'crontab',
|
187
|
+
name: 'schedule',
|
188
|
+
label: true,
|
189
|
+
header: i18next.t('field.schedule'),
|
190
|
+
record: {
|
191
|
+
editable: true,
|
192
|
+
options: {
|
193
|
+
objectified: true
|
194
|
+
}
|
195
|
+
},
|
196
|
+
width: 80,
|
197
|
+
label: true
|
198
|
+
},
|
199
|
+
{
|
200
|
+
type: 'resource-object',
|
201
|
+
name: 'supervisoryRole',
|
202
|
+
header: i18next.t('field.supervisory-role'),
|
203
|
+
record: {
|
204
|
+
editable: true,
|
205
|
+
options: {
|
206
|
+
queryName: 'roles'
|
207
|
+
}
|
208
|
+
},
|
209
|
+
sortable: true,
|
210
|
+
width: 120
|
211
|
+
}
|
212
|
+
],
|
213
|
+
rows: {
|
214
|
+
selectable: {
|
215
|
+
multiple: false
|
216
|
+
},
|
217
|
+
handlers: {
|
218
|
+
click: (columns, data, column, record, rowIndex) => {
|
219
|
+
openPopup(html` <data-entry-form .dataSet=${record} style="background-color: white;"></data-entry-form> `, {
|
220
|
+
backdrop: true,
|
221
|
+
size: 'large',
|
222
|
+
title: i18next.t('title.data-entry-form')
|
223
|
+
})
|
224
|
+
}
|
225
|
+
},
|
226
|
+
classifier: function (record, rowIndex) {}
|
227
|
+
},
|
228
|
+
sorters: [
|
229
|
+
{
|
230
|
+
name: 'name'
|
231
|
+
}
|
232
|
+
]
|
233
|
+
}
|
234
|
+
|
235
|
+
await this.updateComplete
|
236
|
+
|
237
|
+
this.grist.fetch()
|
238
|
+
}
|
239
|
+
|
240
|
+
async pageUpdated(changes, lifecycle) {
|
241
|
+
if (this.active) {
|
242
|
+
await this.updateComplete
|
243
|
+
|
244
|
+
var filters = lifecycle.params?.['filters']
|
245
|
+
if (filters) {
|
246
|
+
try {
|
247
|
+
filters = JSON5.parse(filters)
|
248
|
+
this.filters = filters
|
249
|
+
} catch (e) {
|
250
|
+
console.error(`filters parameter parsing error: ${e}`)
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
var sorters = lifecycle.params?.['sorters']
|
255
|
+
if (sorters) {
|
256
|
+
try {
|
257
|
+
sorters = JSON5.parse(sorters)
|
258
|
+
this.sorters = sorters
|
259
|
+
} catch (e) {
|
260
|
+
console.error(`sorters parameter parsing error: ${e}`)
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
this.grist.fetch()
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
269
|
+
const response = await client.query({
|
270
|
+
query: gql`
|
271
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
272
|
+
responses: dataSets(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
273
|
+
items {
|
274
|
+
id
|
275
|
+
name
|
276
|
+
description
|
277
|
+
partitionKeys
|
278
|
+
slugger
|
279
|
+
active
|
280
|
+
type
|
281
|
+
useCase
|
282
|
+
schedule
|
283
|
+
timezone
|
284
|
+
supervisoryRole {
|
285
|
+
id
|
286
|
+
name
|
287
|
+
}
|
288
|
+
updater {
|
289
|
+
id
|
290
|
+
name
|
291
|
+
}
|
292
|
+
updatedAt
|
293
|
+
dataItems {
|
294
|
+
name
|
295
|
+
description
|
296
|
+
sequence
|
297
|
+
active
|
298
|
+
tag
|
299
|
+
type
|
300
|
+
unit
|
301
|
+
options
|
302
|
+
quota
|
303
|
+
spec
|
304
|
+
}
|
305
|
+
}
|
306
|
+
total
|
307
|
+
}
|
308
|
+
}
|
309
|
+
`,
|
310
|
+
variables: {
|
311
|
+
filters,
|
312
|
+
pagination: { page, limit },
|
313
|
+
sortings
|
314
|
+
}
|
315
|
+
})
|
316
|
+
|
317
|
+
return {
|
318
|
+
total: response.data.responses.total || 0,
|
319
|
+
records: response.data.responses.items || []
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
324
|
+
window.customElements.define('data-entry-list-page', DataEntryListPage)
|
@@ -12,7 +12,7 @@ import { PageView, store } from '@operato/shell'
|
|
12
12
|
import { ScrollbarStyles } from '@operato/styles'
|
13
13
|
import { isMobileDevice } from '@operato/utils'
|
14
14
|
|
15
|
-
export class
|
15
|
+
export class DataOocListPage extends connect(store)(localize(i18next)(PageView)) {
|
16
16
|
static get properties() {
|
17
17
|
return {
|
18
18
|
active: String,
|
@@ -54,7 +54,7 @@ export class DataOoc extends connect(store)(localize(i18next)(PageView)) {
|
|
54
54
|
get context() {
|
55
55
|
return {
|
56
56
|
title: i18next.t('title.data-ooc list'),
|
57
|
-
help: '
|
57
|
+
help: 'dataset/data-ooc',
|
58
58
|
actions: [
|
59
59
|
// {
|
60
60
|
// title: i18next.t('button.save'),
|
@@ -485,4 +485,4 @@ export class DataOoc extends connect(store)(localize(i18next)(PageView)) {
|
|
485
485
|
}
|
486
486
|
}
|
487
487
|
|
488
|
-
window.customElements.define('data-ooc-page',
|
488
|
+
window.customElements.define('data-ooc-list-page', DataOocListPage)
|
File without changes
|
@@ -12,7 +12,7 @@ import { PageView, store } from '@operato/shell'
|
|
12
12
|
import { ScrollbarStyles } from '@operato/styles'
|
13
13
|
import { isMobileDevice } from '@operato/utils'
|
14
14
|
|
15
|
-
export class
|
15
|
+
export class DataSampleListPage extends connect(store)(localize(i18next)(PageView)) {
|
16
16
|
static get properties() {
|
17
17
|
return {
|
18
18
|
active: String,
|
@@ -54,7 +54,7 @@ export class DataSample extends connect(store)(localize(i18next)(PageView)) {
|
|
54
54
|
get context() {
|
55
55
|
return {
|
56
56
|
title: i18next.t('title.data-sample list'),
|
57
|
-
help: '
|
57
|
+
help: 'dataset/data-sample',
|
58
58
|
actions: [],
|
59
59
|
exportable: {
|
60
60
|
name: i18next.t('title.data-sample list'),
|
@@ -388,4 +388,4 @@ export class DataSample extends connect(store)(localize(i18next)(PageView)) {
|
|
388
388
|
}
|
389
389
|
}
|
390
390
|
|
391
|
-
window.customElements.define('data-sample-page',
|
391
|
+
window.customElements.define('data-sample-list-page', DataSampleListPage)
|
File without changes
|
@@ -11,7 +11,7 @@ import gql from 'graphql-tag'
|
|
11
11
|
import { isMobileDevice } from '@operato/utils'
|
12
12
|
import { notify } from '@operato/layout'
|
13
13
|
|
14
|
-
export class
|
14
|
+
export class DataSensorListPage extends connect(store)(localize(i18next)(PageView)) {
|
15
15
|
static get properties() {
|
16
16
|
return {
|
17
17
|
active: String,
|
@@ -53,7 +53,7 @@ export class DataSensor extends connect(store)(localize(i18next)(PageView)) {
|
|
53
53
|
get context() {
|
54
54
|
return {
|
55
55
|
title: i18next.t('title.data-sensor list'),
|
56
|
-
help: '
|
56
|
+
help: 'dataset/data-sensor',
|
57
57
|
actions: [
|
58
58
|
{
|
59
59
|
title: i18next.t('button.copy'),
|
@@ -438,4 +438,4 @@ export class DataSensor extends connect(store)(localize(i18next)(PageView)) {
|
|
438
438
|
}
|
439
439
|
}
|
440
440
|
|
441
|
-
window.customElements.define('data-sensor-page',
|
441
|
+
window.customElements.define('data-sensor-list-page', DataSensorListPage)
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import '@operato/data-grist'
|
2
|
-
import './data-item-list'
|
3
|
-
import './data-set-importer'
|
4
|
-
import '
|
2
|
+
import './data-item-list.js'
|
3
|
+
import './data-set-importer.js'
|
4
|
+
import '../data-entry/data-entry-form.js'
|
5
5
|
|
6
6
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
7
7
|
import { PageView, store } from '@operato/shell'
|
@@ -17,7 +17,7 @@ import gql from 'graphql-tag'
|
|
17
17
|
import { isMobileDevice } from '@operato/utils'
|
18
18
|
import moment from 'moment-timezone'
|
19
19
|
|
20
|
-
export class
|
20
|
+
export class DataSetListPage extends connect(store)(localize(i18next)(PageView)) {
|
21
21
|
static get properties() {
|
22
22
|
return {
|
23
23
|
active: String,
|
@@ -48,7 +48,7 @@ export class DataSet extends connect(store)(localize(i18next)(PageView)) {
|
|
48
48
|
get context() {
|
49
49
|
return {
|
50
50
|
title: i18next.t('title.data-set list'),
|
51
|
-
help: '
|
51
|
+
help: 'dataset/data-set',
|
52
52
|
actions: [
|
53
53
|
{
|
54
54
|
title: i18next.t('button.copy'),
|
@@ -549,4 +549,4 @@ export class DataSet extends connect(store)(localize(i18next)(PageView)) {
|
|
549
549
|
}
|
550
550
|
}
|
551
551
|
|
552
|
-
window.customElements.define('data-set-page',
|
552
|
+
window.customElements.define('data-set-list-page', DataSetListPage)
|
package/client/route.js
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
export default function route(page) {
|
2
2
|
switch (page) {
|
3
|
-
case 'data-set':
|
4
|
-
import('./pages/data-set')
|
3
|
+
case 'data-set-list':
|
4
|
+
import('./pages/data-set/data-set-list-page.js')
|
5
5
|
return page
|
6
6
|
|
7
|
-
case 'data-sensor':
|
8
|
-
import('./pages/data-sensor')
|
7
|
+
case 'data-sensor-list':
|
8
|
+
import('./pages/data-sensor/data-sensor-list-page.js')
|
9
9
|
return page
|
10
10
|
|
11
|
-
case 'data-sample':
|
12
|
-
import('./pages/data-sample')
|
11
|
+
case 'data-sample-list':
|
12
|
+
import('./pages/data-sample/data-sample-list-page.js')
|
13
13
|
return page
|
14
14
|
|
15
|
-
case 'data-ooc':
|
16
|
-
import('./pages/data-ooc')
|
15
|
+
case 'data-ooc-list':
|
16
|
+
import('./pages/data-ooc/data-ooc-list-page.js')
|
17
|
+
return page
|
18
|
+
|
19
|
+
case 'data-entry-list':
|
20
|
+
import('./pages/data-entry/data-entry-list-page.js')
|
17
21
|
return page
|
18
22
|
}
|
19
23
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/dataset",
|
3
|
-
"version": "5.0.0-alpha.
|
3
|
+
"version": "5.0.0-alpha.27",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -33,11 +33,11 @@
|
|
33
33
|
"@operato/shell": "1.0.0-alpha.48",
|
34
34
|
"@operato/styles": "1.0.0-alpha.48",
|
35
35
|
"@operato/utils": "1.0.0-alpha.48",
|
36
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
37
|
-
"@things-factory/env": "^5.0.0-alpha.
|
38
|
-
"@things-factory/shell": "^5.0.0-alpha.
|
39
|
-
"@things-factory/work-shift": "^5.0.0-alpha.
|
36
|
+
"@things-factory/auth-base": "^5.0.0-alpha.27",
|
37
|
+
"@things-factory/env": "^5.0.0-alpha.27",
|
38
|
+
"@things-factory/shell": "^5.0.0-alpha.27",
|
39
|
+
"@things-factory/work-shift": "^5.0.0-alpha.27",
|
40
40
|
"moment": "^2.29.1"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "57962482d2b5a5aaba07d7477f3f35938d6e66b8"
|
43
43
|
}
|
package/things-factory.config.js
CHANGED
@@ -5,20 +5,24 @@ export default {
|
|
5
5
|
route,
|
6
6
|
routes: [
|
7
7
|
{
|
8
|
-
tagname: 'data-set-page',
|
9
|
-
page: 'data-set'
|
8
|
+
tagname: 'data-set-list-page',
|
9
|
+
page: 'data-set-list'
|
10
10
|
},
|
11
11
|
{
|
12
|
-
tagname: 'data-sensor-page',
|
13
|
-
page: 'data-sensor'
|
12
|
+
tagname: 'data-sensor-list-page',
|
13
|
+
page: 'data-sensor-list'
|
14
14
|
},
|
15
15
|
{
|
16
|
-
tagname: 'data-sample-page',
|
17
|
-
page: 'data-sample'
|
16
|
+
tagname: 'data-sample-list-page',
|
17
|
+
page: 'data-sample-list'
|
18
18
|
},
|
19
19
|
{
|
20
|
-
tagname: 'data-ooc-page',
|
21
|
-
page: 'data-ooc'
|
20
|
+
tagname: 'data-ooc-list-page',
|
21
|
+
page: 'data-ooc-list'
|
22
|
+
},
|
23
|
+
{
|
24
|
+
tagname: 'data-entry-list-page',
|
25
|
+
page: 'data-entry-list'
|
22
26
|
}
|
23
27
|
],
|
24
28
|
bootstrap
|
package/translations/en.json
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
"text.data sample created successfully": "a data sample created successfully",
|
31
31
|
"text.data ooc updated successfully": "a data ooc updated successfully",
|
32
32
|
"title.data-entry-form": "data entry form",
|
33
|
+
"title.data-entry list": "data entry list",
|
33
34
|
"title.data-item list": "data item list",
|
34
35
|
"title.data-ooc list": "data OOC list",
|
35
36
|
"title.data-ooc view": "data OOC view",
|
@@ -37,4 +38,4 @@
|
|
37
38
|
"title.data-sample view": "data sample view",
|
38
39
|
"title.data-sensor list": "data sensor list",
|
39
40
|
"title.data-set list": "data set list"
|
40
|
-
}
|
41
|
+
}
|