@things-factory/dataset 9.2.5 → 10.0.0-beta.10
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/dist-client/pages/data-archive/data-archive-list-page.d.ts +1 -7
- package/dist-client/pages/data-archive/data-archive-list-page.js +42 -77
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -1
- package/dist-client/pages/data-entry/data-entry-list-page.d.ts +1 -7
- package/dist-client/pages/data-entry/data-entry-list-page.js +77 -143
- package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -1
- package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +1 -7
- package/dist-client/pages/data-key-set/data-key-set-list-page.js +69 -131
- package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -1
- package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +0 -6
- package/dist-client/pages/data-ooc/data-ooc-list-page.js +87 -166
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -1
- package/dist-client/pages/data-report/data-report-list-page.d.ts +1 -7
- package/dist-client/pages/data-report/data-report-list-page.js +71 -132
- package/dist-client/pages/data-report/data-report-list-page.js.map +1 -1
- package/dist-client/pages/data-report/data-report-samples-page.d.ts +1 -7
- package/dist-client/pages/data-report/data-report-samples-page.js +17 -30
- package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -1
- package/dist-client/pages/data-sample/data-sample-list-page.d.ts +0 -6
- package/dist-client/pages/data-sample/data-sample-list-page.js +68 -130
- 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 +1 -7
- package/dist-client/pages/data-sample/data-sample-search-page.js +63 -116
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -1
- package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +0 -6
- package/dist-client/pages/data-sensor/data-sensor-list-page.js +89 -167
- package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -1
- package/dist-client/pages/data-set/data-set-list-page.d.ts +0 -6
- package/dist-client/pages/data-set/data-set-list-page.js +2 -3
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-list-page.d.ts +1 -7
- package/dist-client/pages/data-summary/data-summary-list-page.js +56 -105
- package/dist-client/pages/data-summary/data-summary-list-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-period-page.d.ts +1 -7
- package/dist-client/pages/data-summary/data-summary-period-page.js +50 -90
- package/dist-client/pages/data-summary/data-summary-period-page.js.map +1 -1
- package/dist-client/pages/data-summary/data-summary-search-page.d.ts +1 -7
- package/dist-client/pages/data-summary/data-summary-search-page.js +61 -111
- package/dist-client/pages/data-summary/data-summary-search-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -26
|
@@ -5,17 +5,16 @@ import '@operato/context/ox-context-page-toolbar.js';
|
|
|
5
5
|
import gql from 'graphql-tag';
|
|
6
6
|
import { css, html } from 'lit';
|
|
7
7
|
import { customElement, query, state } from 'lit/decorators.js';
|
|
8
|
-
import { connect } from 'pwa-helpers/connect-mixin';
|
|
9
8
|
import { client } from '@operato/graphql';
|
|
10
9
|
import { i18next, localize } from '@operato/i18n';
|
|
11
10
|
import { notify } from '@operato/layout';
|
|
12
|
-
import { PageView
|
|
11
|
+
import { PageView } from '@operato/shell';
|
|
13
12
|
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
14
13
|
import { isMobileDevice } from '@operato/utils';
|
|
15
14
|
import { DataGrist } from '@operato/data-grist';
|
|
16
15
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
17
16
|
import { p13n } from '@operato/p13n';
|
|
18
|
-
let DataSensorListPage = class DataSensorListPage extends
|
|
17
|
+
let DataSensorListPage = class DataSensorListPage extends p13n(localize(i18next)(PageView)) {
|
|
19
18
|
constructor() {
|
|
20
19
|
super(...arguments);
|
|
21
20
|
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
@@ -25,60 +24,48 @@ let DataSensorListPage = class DataSensorListPage extends connect(store)(p13n(lo
|
|
|
25
24
|
CommonGristStyles,
|
|
26
25
|
CommonHeaderStyles,
|
|
27
26
|
css `
|
|
28
|
-
:host {
|
|
29
|
-
display: flex;
|
|
27
|
+
:host { display: flex;
|
|
30
28
|
flex-direction: column;
|
|
31
29
|
|
|
32
30
|
overflow: hidden;
|
|
33
|
-
|
|
31
|
+
}
|
|
34
32
|
|
|
35
|
-
ox-grist {
|
|
36
|
-
overflow-y: auto;
|
|
33
|
+
ox-grist { overflow-y: auto;
|
|
37
34
|
flex: 1;
|
|
38
|
-
|
|
35
|
+
}
|
|
39
36
|
|
|
40
|
-
.header {
|
|
41
|
-
|
|
42
|
-
}
|
|
37
|
+
.header { grid-template-areas: 'filters actions';
|
|
38
|
+
}
|
|
43
39
|
`
|
|
44
40
|
]; }
|
|
45
41
|
get context() {
|
|
46
|
-
return {
|
|
47
|
-
|
|
48
|
-
search: {
|
|
49
|
-
handler: (search) => {
|
|
42
|
+
return { title: i18next.t('title.data-sensor list'),
|
|
43
|
+
search: { handler: (search) => {
|
|
50
44
|
this.grist.searchText = search;
|
|
51
45
|
},
|
|
52
|
-
value: this.grist?.searchText || ''
|
|
53
|
-
|
|
54
|
-
filter: {
|
|
55
|
-
handler: () => {
|
|
46
|
+
value: this.grist?.searchText || '' },
|
|
47
|
+
filter: { handler: () => {
|
|
56
48
|
this.grist.toggleHeadroom();
|
|
57
49
|
}
|
|
58
50
|
},
|
|
59
51
|
help: 'dataset/data-sensor',
|
|
60
52
|
actions: [
|
|
61
|
-
{
|
|
62
|
-
icon: 'content_copy',
|
|
53
|
+
{ icon: 'content_copy',
|
|
63
54
|
title: i18next.t('button.copy'),
|
|
64
55
|
action: this._copyDataSensor.bind(this)
|
|
65
56
|
},
|
|
66
|
-
{
|
|
67
|
-
icon: 'save',
|
|
57
|
+
{ icon: 'save',
|
|
68
58
|
title: i18next.t('button.save'),
|
|
69
59
|
action: this._updateDataSensor.bind(this)
|
|
70
60
|
},
|
|
71
|
-
{
|
|
72
|
-
icon: 'delete',
|
|
61
|
+
{ icon: 'delete',
|
|
73
62
|
title: i18next.t('button.delete'),
|
|
74
63
|
action: this._deleteDataSensor.bind(this),
|
|
75
|
-
emphasis: {
|
|
76
|
-
danger: true
|
|
64
|
+
emphasis: { danger: true
|
|
77
65
|
}
|
|
78
66
|
}
|
|
79
67
|
],
|
|
80
|
-
toolbar: false
|
|
81
|
-
};
|
|
68
|
+
toolbar: false };
|
|
82
69
|
}
|
|
83
70
|
render() {
|
|
84
71
|
const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID');
|
|
@@ -103,94 +90,76 @@ let DataSensorListPage = class DataSensorListPage extends connect(store)(p13n(lo
|
|
|
103
90
|
`;
|
|
104
91
|
}
|
|
105
92
|
async pageInitialized(lifecycle) {
|
|
106
|
-
this.gristConfig = {
|
|
107
|
-
list: { fields: ['name', 'description', 'active'] },
|
|
93
|
+
this.gristConfig = { list: { fields: ['name', 'description', 'active'] },
|
|
108
94
|
columns: [
|
|
109
95
|
{ type: 'gutter', gutterName: 'sequence', fixed: true },
|
|
110
96
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },
|
|
111
|
-
{
|
|
112
|
-
type: 'string',
|
|
97
|
+
{ type: 'string',
|
|
113
98
|
name: 'name',
|
|
114
99
|
label: true,
|
|
115
100
|
header: i18next.t('field.name'),
|
|
116
|
-
record: {
|
|
117
|
-
editable: true
|
|
101
|
+
record: { editable: true
|
|
118
102
|
},
|
|
119
103
|
filter: 'search',
|
|
120
104
|
sortable: true,
|
|
121
105
|
width: 150,
|
|
122
106
|
fixed: true
|
|
123
107
|
},
|
|
124
|
-
{
|
|
125
|
-
type: 'string',
|
|
108
|
+
{ type: 'string',
|
|
126
109
|
name: 'description',
|
|
127
110
|
label: true,
|
|
128
111
|
header: i18next.t('field.description'),
|
|
129
|
-
record: {
|
|
130
|
-
editable: true
|
|
112
|
+
record: { editable: true
|
|
131
113
|
},
|
|
132
114
|
filter: 'search',
|
|
133
115
|
width: 200
|
|
134
116
|
},
|
|
135
|
-
{
|
|
136
|
-
type: 'checkbox',
|
|
117
|
+
{ type: 'checkbox',
|
|
137
118
|
name: 'active',
|
|
138
119
|
label: true,
|
|
139
120
|
header: i18next.t('field.active'),
|
|
140
|
-
record: {
|
|
141
|
-
editable: true
|
|
121
|
+
record: { editable: true
|
|
142
122
|
},
|
|
143
123
|
sortable: true,
|
|
144
124
|
filter: true,
|
|
145
125
|
width: 60
|
|
146
126
|
},
|
|
147
|
-
{
|
|
148
|
-
type: 'string',
|
|
127
|
+
{ type: 'string',
|
|
149
128
|
name: 'deviceId',
|
|
150
129
|
label: true,
|
|
151
130
|
header: i18next.t('field.device-id'),
|
|
152
|
-
record: {
|
|
153
|
-
editable: true
|
|
131
|
+
record: { editable: true
|
|
154
132
|
},
|
|
155
133
|
filter: 'search',
|
|
156
134
|
sortable: true,
|
|
157
135
|
width: 150
|
|
158
136
|
},
|
|
159
|
-
{
|
|
160
|
-
type: 'varname',
|
|
137
|
+
{ type: 'varname',
|
|
161
138
|
name: 'tag',
|
|
162
139
|
label: true,
|
|
163
140
|
header: i18next.t('field.tag'),
|
|
164
|
-
record: {
|
|
165
|
-
editable: true
|
|
141
|
+
record: { editable: true
|
|
166
142
|
},
|
|
167
143
|
sortable: true,
|
|
168
144
|
filter: 'search',
|
|
169
145
|
width: 150
|
|
170
146
|
},
|
|
171
|
-
{
|
|
172
|
-
type: 'object',
|
|
147
|
+
{ type: 'object',
|
|
173
148
|
name: 'appliance',
|
|
174
149
|
header: i18next.t('field.appliance'),
|
|
175
|
-
record: {
|
|
176
|
-
|
|
177
|
-
options: {
|
|
178
|
-
queryName: 'appliances'
|
|
150
|
+
record: { editable: true,
|
|
151
|
+
options: { queryName: 'appliances'
|
|
179
152
|
}
|
|
180
153
|
},
|
|
181
154
|
sortable: true,
|
|
182
155
|
width: 120
|
|
183
156
|
},
|
|
184
|
-
{
|
|
185
|
-
type: 'resource-object',
|
|
157
|
+
{ type: 'resource-object',
|
|
186
158
|
name: 'decoder',
|
|
187
|
-
header: {
|
|
188
|
-
renderer: i18next.t('field.decoder-scenario')
|
|
159
|
+
header: { renderer: i18next.t('field.decoder-scenario')
|
|
189
160
|
},
|
|
190
|
-
record: {
|
|
191
|
-
|
|
192
|
-
options: {
|
|
193
|
-
title: i18next.t('title.lookup scenario'),
|
|
161
|
+
record: { editable: true,
|
|
162
|
+
options: { title: i18next.t('title.lookup scenario'),
|
|
194
163
|
queryName: 'scenarios',
|
|
195
164
|
columns: [
|
|
196
165
|
{ name: 'id', hidden: true },
|
|
@@ -203,156 +172,125 @@ let DataSensorListPage = class DataSensorListPage extends connect(store)(p13n(lo
|
|
|
203
172
|
filter: false,
|
|
204
173
|
width: 120
|
|
205
174
|
},
|
|
206
|
-
{
|
|
207
|
-
type: 'object',
|
|
175
|
+
{ type: 'object',
|
|
208
176
|
name: 'dataSet',
|
|
209
177
|
header: i18next.t('field.data-set'),
|
|
210
|
-
record: {
|
|
211
|
-
|
|
212
|
-
options: {
|
|
213
|
-
queryName: 'dataSets'
|
|
178
|
+
record: { editable: true,
|
|
179
|
+
options: { queryName: 'dataSets'
|
|
214
180
|
}
|
|
215
181
|
},
|
|
216
182
|
sortable: true,
|
|
217
183
|
width: 120
|
|
218
184
|
},
|
|
219
|
-
{
|
|
220
|
-
type: 'string',
|
|
185
|
+
{ type: 'string',
|
|
221
186
|
name: 'refBy',
|
|
222
187
|
label: true,
|
|
223
188
|
header: i18next.t('field.ref-by'),
|
|
224
|
-
record: {
|
|
225
|
-
editable: true
|
|
189
|
+
record: { editable: true
|
|
226
190
|
},
|
|
227
191
|
sortable: true,
|
|
228
192
|
width: 150
|
|
229
193
|
},
|
|
230
|
-
{
|
|
231
|
-
type: 'string',
|
|
194
|
+
{ type: 'string',
|
|
232
195
|
name: 'model',
|
|
233
196
|
label: true,
|
|
234
197
|
header: i18next.t('field.model'),
|
|
235
|
-
record: {
|
|
236
|
-
editable: true
|
|
198
|
+
record: { editable: true
|
|
237
199
|
},
|
|
238
200
|
sortable: true,
|
|
239
201
|
width: 150
|
|
240
202
|
},
|
|
241
|
-
{
|
|
242
|
-
type: 'string',
|
|
203
|
+
{ type: 'string',
|
|
243
204
|
name: 'brand',
|
|
244
205
|
label: true,
|
|
245
206
|
header: i18next.t('field.brand'),
|
|
246
|
-
record: {
|
|
247
|
-
editable: true
|
|
207
|
+
record: { editable: true
|
|
248
208
|
},
|
|
249
209
|
sortable: true,
|
|
250
210
|
width: 150
|
|
251
211
|
},
|
|
252
|
-
{
|
|
253
|
-
type: 'string',
|
|
212
|
+
{ type: 'string',
|
|
254
213
|
name: 'serialNo',
|
|
255
214
|
label: true,
|
|
256
215
|
header: i18next.t('field.serial-no'),
|
|
257
|
-
record: {
|
|
258
|
-
editable: true
|
|
216
|
+
record: { editable: true
|
|
259
217
|
},
|
|
260
218
|
sortable: true,
|
|
261
219
|
width: 150
|
|
262
220
|
},
|
|
263
|
-
{
|
|
264
|
-
type: 'string',
|
|
221
|
+
{ type: 'string',
|
|
265
222
|
name: 'netmask',
|
|
266
223
|
label: true,
|
|
267
224
|
header: i18next.t('field.netmask'),
|
|
268
|
-
record: {
|
|
269
|
-
editable: true
|
|
225
|
+
record: { editable: true
|
|
270
226
|
},
|
|
271
227
|
sortable: true,
|
|
272
228
|
width: 150
|
|
273
229
|
},
|
|
274
|
-
{
|
|
275
|
-
type: 'number',
|
|
230
|
+
{ type: 'number',
|
|
276
231
|
name: 'capacity',
|
|
277
232
|
label: true,
|
|
278
233
|
header: i18next.t('field.capacity'),
|
|
279
|
-
record: {
|
|
280
|
-
editable: true
|
|
234
|
+
record: { editable: true
|
|
281
235
|
},
|
|
282
236
|
sortable: true,
|
|
283
237
|
width: 100
|
|
284
238
|
},
|
|
285
|
-
{
|
|
286
|
-
type: 'string',
|
|
239
|
+
{ type: 'string',
|
|
287
240
|
name: 'unit',
|
|
288
241
|
label: true,
|
|
289
242
|
header: i18next.t('field.unit'),
|
|
290
|
-
record: {
|
|
291
|
-
editable: true
|
|
243
|
+
record: { editable: true
|
|
292
244
|
},
|
|
293
245
|
sortable: true,
|
|
294
246
|
width: 100
|
|
295
247
|
},
|
|
296
|
-
{
|
|
297
|
-
type: 'object',
|
|
248
|
+
{ type: 'object',
|
|
298
249
|
name: 'updater',
|
|
299
250
|
header: i18next.t('field.updater'),
|
|
300
|
-
record: {
|
|
301
|
-
editable: false
|
|
251
|
+
record: { editable: false
|
|
302
252
|
},
|
|
303
253
|
sortable: true,
|
|
304
254
|
width: 120
|
|
305
255
|
},
|
|
306
|
-
{
|
|
307
|
-
type: 'datetime',
|
|
256
|
+
{ type: 'datetime',
|
|
308
257
|
name: 'updatedAt',
|
|
309
258
|
header: i18next.t('field.updated_at'),
|
|
310
|
-
record: {
|
|
311
|
-
editable: false
|
|
259
|
+
record: { editable: false
|
|
312
260
|
},
|
|
313
261
|
sortable: true,
|
|
314
262
|
width: 180
|
|
315
263
|
}
|
|
316
264
|
],
|
|
317
|
-
rows: {
|
|
318
|
-
selectable: {
|
|
319
|
-
multiple: true
|
|
265
|
+
rows: { selectable: { multiple: true
|
|
320
266
|
}
|
|
321
267
|
},
|
|
322
268
|
sorters: [
|
|
323
|
-
{
|
|
324
|
-
name: 'name'
|
|
269
|
+
{ name: 'name'
|
|
325
270
|
}
|
|
326
271
|
]
|
|
327
272
|
};
|
|
328
273
|
}
|
|
329
274
|
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
330
|
-
const response = await client.query({
|
|
331
|
-
|
|
332
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
333
|
-
responses: dataSensors(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
334
|
-
items {
|
|
335
|
-
id
|
|
275
|
+
const response = await client.query({ query: gql `
|
|
276
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: dataSensors(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
336
277
|
name
|
|
337
278
|
description
|
|
338
279
|
active
|
|
339
280
|
deviceId
|
|
340
281
|
tag
|
|
341
|
-
appliance {
|
|
342
|
-
id
|
|
282
|
+
appliance { id
|
|
343
283
|
name
|
|
344
284
|
description
|
|
345
|
-
|
|
346
|
-
dataSet {
|
|
347
|
-
id
|
|
285
|
+
}
|
|
286
|
+
dataSet { id
|
|
348
287
|
name
|
|
349
288
|
description
|
|
350
|
-
|
|
351
|
-
decoder {
|
|
352
|
-
id
|
|
289
|
+
}
|
|
290
|
+
decoder { id
|
|
353
291
|
name
|
|
354
292
|
description
|
|
355
|
-
|
|
293
|
+
}
|
|
356
294
|
refBy
|
|
357
295
|
brand
|
|
358
296
|
model
|
|
@@ -360,50 +298,42 @@ let DataSensorListPage = class DataSensorListPage extends connect(store)(p13n(lo
|
|
|
360
298
|
netmask
|
|
361
299
|
capacity
|
|
362
300
|
unit
|
|
363
|
-
updater {
|
|
364
|
-
id
|
|
301
|
+
updater { id
|
|
365
302
|
name
|
|
366
|
-
|
|
303
|
+
}
|
|
367
304
|
updatedAt
|
|
368
|
-
|
|
305
|
+
}
|
|
369
306
|
total
|
|
370
|
-
|
|
371
|
-
|
|
307
|
+
}
|
|
308
|
+
}
|
|
372
309
|
`,
|
|
373
|
-
variables: {
|
|
374
|
-
filters,
|
|
310
|
+
variables: { filters,
|
|
375
311
|
pagination: { page, limit },
|
|
376
312
|
sortings
|
|
377
313
|
}
|
|
378
314
|
});
|
|
379
|
-
return {
|
|
380
|
-
total: response.data.responses.total || 0,
|
|
315
|
+
return { total: response.data.responses.total || 0,
|
|
381
316
|
records: response.data.responses.items || []
|
|
382
317
|
};
|
|
383
318
|
}
|
|
384
319
|
async _deleteDataSensor() {
|
|
385
|
-
if (await OxPrompt.open({
|
|
386
|
-
title: i18next.t('text.are_you_sure'),
|
|
320
|
+
if (await OxPrompt.open({ title: i18next.t('text.are_you_sure'),
|
|
387
321
|
text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
|
|
388
322
|
confirmButton: { text: i18next.t('button.confirm') },
|
|
389
323
|
cancelButton: { text: i18next.t('button.cancel') }
|
|
390
324
|
})) {
|
|
391
325
|
const ids = this.grist.selected.map(record => record.id);
|
|
392
326
|
if (ids && ids.length > 0) {
|
|
393
|
-
const response = await client.mutate({
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
deleteDataSensors(ids: $ids)
|
|
397
|
-
}
|
|
327
|
+
const response = await client.mutate({ mutation: gql `
|
|
328
|
+
mutation ($ids: [String!]!) { deleteDataSensors(ids: $ids)
|
|
329
|
+
}
|
|
398
330
|
`,
|
|
399
|
-
variables: {
|
|
400
|
-
ids
|
|
331
|
+
variables: { ids
|
|
401
332
|
}
|
|
402
333
|
});
|
|
403
334
|
if (!response.errors) {
|
|
404
335
|
this.grist.fetch();
|
|
405
|
-
notify({
|
|
406
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
336
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
407
337
|
});
|
|
408
338
|
}
|
|
409
339
|
}
|
|
@@ -415,16 +345,12 @@ let DataSensorListPage = class DataSensorListPage extends connect(store)(p13n(lo
|
|
|
415
345
|
return;
|
|
416
346
|
if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') })))
|
|
417
347
|
return;
|
|
418
|
-
var response = await client.mutate({
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
id
|
|
423
|
-
}
|
|
424
|
-
}
|
|
348
|
+
var response = await client.mutate({ mutation: gql `
|
|
349
|
+
mutation ($ids: [String!]!) { copyDataSensors(ids: $ids) { id
|
|
350
|
+
}
|
|
351
|
+
}
|
|
425
352
|
`,
|
|
426
|
-
variables: {
|
|
427
|
-
ids: selected.map(r => r.id)
|
|
353
|
+
variables: { ids: selected.map(r => r.id)
|
|
428
354
|
}
|
|
429
355
|
});
|
|
430
356
|
if (!response.errors)
|
|
@@ -442,16 +368,12 @@ let DataSensorListPage = class DataSensorListPage extends connect(store)(p13n(lo
|
|
|
442
368
|
patchField.cuFlag = patch.__dirty__;
|
|
443
369
|
return patchField;
|
|
444
370
|
});
|
|
445
|
-
const response = await client.mutate({
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
name
|
|
450
|
-
}
|
|
451
|
-
}
|
|
371
|
+
const response = await client.mutate({ mutation: gql `
|
|
372
|
+
mutation ($patches: [DataSensorPatch!]!) { updateMultipleDataSensor(patches: $patches) { name
|
|
373
|
+
}
|
|
374
|
+
}
|
|
452
375
|
`,
|
|
453
|
-
variables: {
|
|
454
|
-
patches
|
|
376
|
+
variables: { patches
|
|
455
377
|
}
|
|
456
378
|
});
|
|
457
379
|
if (!response.errors)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-sensor-list-page.js","sourceRoot":"","sources":["../../../client/pages/data-sensor/data-sensor-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AAEpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,kBA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,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;gBACtD,MAAM,WAAW,GAAG,KAAK,CAAC,eAAe,CAAA;gBACzC,KAAK,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;oBAC5B,UAAU,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAA;gBAC1C,CAAC;gBACD,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;gBAEnC,OAAO,UAAU,CAAA;YACnB,CAAC,CAAC,CAAA;YAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;gBACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;SAMZ;gBACD,SAAS,EAAE;oBACT,OAAO;iBACR;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,MAAM;gBAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAC1C,CAAC;IACH,CAAC;;AAhbgB;IAAhB,KAAK,EAAE;;uDAAyB;AAChB;IAAhB,KAAK,EAAE;;gDAA4E;AAEzD;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;iDAAA;AA3BjC,kBAAkB;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CAyc9B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport { p13n } from '@operato/p13n'\n\n@customElement('data-sensor-list-page')\nexport class DataSensorListPage extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n .header {\n grid-template-areas: 'filters actions';\n }\n `\n ]\n\n @state() private gristConfig: any\n @state() private mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.data-sensor list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'dataset/data-sensor',\n actions: [\n {\n icon: 'content_copy',\n title: i18next.t('button.copy'),\n action: this._copyDataSensor.bind(this)\n },\n {\n icon: 'save',\n title: i18next.t('button.save'),\n action: this._updateDataSensor.bind(this)\n },\n {\n icon: 'delete',\n title: i18next.t('button.delete'),\n action: this._deleteDataSensor.bind(this),\n emphasis: {\n danger: true\n }\n }\n ],\n toolbar: false\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) {\n this.gristConfig = {\n list: { fields: ['name', 'description', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence', fixed: true },\n { type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },\n {\n type: 'string',\n name: 'name',\n label: true,\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150,\n fixed: true\n },\n {\n type: 'string',\n name: 'description',\n label: true,\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n sortable: true,\n filter: true,\n width: 60\n },\n {\n type: 'string',\n name: 'deviceId',\n label: true,\n header: i18next.t('field.device-id'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'varname',\n name: 'tag',\n label: true,\n header: i18next.t('field.tag'),\n record: {\n editable: true\n },\n sortable: true,\n filter: 'search',\n width: 150\n },\n {\n type: 'object',\n name: 'appliance',\n header: i18next.t('field.appliance'),\n record: {\n editable: true,\n options: {\n queryName: 'appliances'\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'resource-object',\n name: 'decoder',\n header: {\n renderer: i18next.t('field.decoder-scenario')\n },\n record: {\n editable: true,\n options: {\n title: i18next.t('title.lookup scenario'),\n queryName: 'scenarios',\n columns: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'description', header: i18next.t('field.description'), filter: 'search' }\n ],\n list: { fields: ['name', 'description'] }\n }\n },\n filter: false,\n width: 120\n },\n {\n type: 'object',\n name: 'dataSet',\n header: i18next.t('field.data-set'),\n record: {\n editable: true,\n options: {\n queryName: 'dataSets'\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'refBy',\n label: true,\n header: i18next.t('field.ref-by'),\n record: {\n editable: true\n },\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'model',\n label: true,\n header: i18next.t('field.model'),\n record: {\n editable: true\n },\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'brand',\n label: true,\n header: i18next.t('field.brand'),\n record: {\n editable: true\n },\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'serialNo',\n label: true,\n header: i18next.t('field.serial-no'),\n record: {\n editable: true\n },\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'netmask',\n label: true,\n header: i18next.t('field.netmask'),\n record: {\n editable: true\n },\n sortable: true,\n width: 150\n },\n {\n type: 'number',\n name: 'capacity',\n label: true,\n header: i18next.t('field.capacity'),\n record: {\n editable: true\n },\n sortable: true,\n width: 100\n },\n {\n type: 'string',\n name: 'unit',\n label: true,\n header: i18next.t('field.unit'),\n record: {\n editable: true\n },\n sortable: true,\n width: 100\n },\n {\n type: 'object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: dataSensors(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n deviceId\n tag\n appliance {\n id\n name\n description\n }\n dataSet {\n id\n name\n description\n }\n decoder {\n id\n name\n description\n }\n refBy\n brand\n model\n serialNo\n netmask\n capacity\n unit\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteDataSensor() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteDataSensors(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _copyDataSensor() {\n var selected = this.grist.selected\n if (selected.length == 0) return\n\n if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') }))) return\n var response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n copyDataSensors(ids: $ids) {\n id\n }\n }\n `,\n variables: {\n ids: selected.map(r => r.id)\n }\n })\n\n if (!response.errors) this.grist.fetch()\n }\n\n async _updateDataSensor() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [DataSensorPatch!]!) {\n updateMultipleDataSensor(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) this.grist.fetch()\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"data-sensor-list-page.js","sourceRoot":"","sources":["../../../client/pages/data-sensor/data-sensor-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AAEpD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM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A8W9B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport { p13n } from '@operato/p13n'\n\n@customElement('data-sensor-list-page')\nexport class DataSensorListPage extends p13n(localize(i18next)(PageView)) { static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n flex-direction: column;\n\n overflow: hidden;\n }\n\n ox-grist { overflow-y: auto;\n flex: 1;\n }\n\n .header { grid-template-areas: 'filters actions';\n }\n `\n ]\n\n @state() private gristConfig: any\n @state() private mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.data-sensor list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'dataset/data-sensor',\n actions: [\n { icon: 'content_copy',\n title: i18next.t('button.copy'),\n action: this._copyDataSensor.bind(this)\n },\n { icon: 'save',\n title: i18next.t('button.save'),\n action: this._updateDataSensor.bind(this)\n },\n { icon: 'delete',\n title: i18next.t('button.delete'),\n action: this._deleteDataSensor.bind(this),\n emphasis: { danger: true\n }\n }\n ],\n toolbar: false\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) { this.gristConfig = { list: { fields: ['name', 'description', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence', fixed: true },\n { type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },\n { type: 'string',\n name: 'name',\n label: true,\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150,\n fixed: true\n },\n { type: 'string',\n name: 'description',\n label: true,\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n sortable: true,\n filter: true,\n width: 60\n },\n { type: 'string',\n name: 'deviceId',\n label: true,\n header: i18next.t('field.device-id'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'varname',\n name: 'tag',\n label: true,\n header: i18next.t('field.tag'),\n record: { editable: true\n },\n sortable: true,\n filter: 'search',\n width: 150\n },\n { type: 'object',\n name: 'appliance',\n header: i18next.t('field.appliance'),\n record: { editable: true,\n options: { queryName: 'appliances'\n }\n },\n sortable: true,\n width: 120\n },\n { type: 'resource-object',\n name: 'decoder',\n header: { renderer: i18next.t('field.decoder-scenario')\n },\n record: { editable: true,\n options: { title: i18next.t('title.lookup scenario'),\n queryName: 'scenarios',\n columns: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'description', header: i18next.t('field.description'), filter: 'search' }\n ],\n list: { fields: ['name', 'description'] }\n }\n },\n filter: false,\n width: 120\n },\n { type: 'object',\n name: 'dataSet',\n header: i18next.t('field.data-set'),\n record: { editable: true,\n options: { queryName: 'dataSets'\n }\n },\n sortable: true,\n width: 120\n },\n { type: 'string',\n name: 'refBy',\n label: true,\n header: i18next.t('field.ref-by'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'model',\n label: true,\n header: i18next.t('field.model'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'brand',\n label: true,\n header: i18next.t('field.brand'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'serialNo',\n label: true,\n header: i18next.t('field.serial-no'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'netmask',\n label: true,\n header: i18next.t('field.netmask'),\n record: { editable: true\n },\n sortable: true,\n width: 150\n },\n { type: 'number',\n name: 'capacity',\n label: true,\n header: i18next.t('field.capacity'),\n record: { editable: true\n },\n sortable: true,\n width: 100\n },\n { type: 'string',\n name: 'unit',\n label: true,\n header: i18next.t('field.unit'),\n record: { editable: true\n },\n sortable: true,\n width: 100\n },\n { type: 'object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: dataSensors(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n deviceId\n tag\n appliance { id\n name\n description\n }\n dataSet { id\n name\n description\n }\n decoder { id\n name\n description\n }\n refBy\n brand\n model\n serialNo\n netmask\n capacity\n unit\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteDataSensor() { if (\n await OxPrompt.open({ title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteDataSensors(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _copyDataSensor() { var selected = this.grist.selected\n if (selected.length == 0) return\n\n if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') }))) return\n var response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { copyDataSensors(ids: $ids) { id\n }\n }\n `,\n variables: { ids: selected.map(r => r.id)\n }\n })\n\n if (!response.errors) this.grist.fetch()\n }\n\n async _updateDataSensor() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [DataSensorPatch!]!) { updateMultipleDataSensor(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) this.grist.fetch()\n }\n }\n}\n"]}
|
|
@@ -9,12 +9,6 @@ import { FetchOption, ImexConfig } from '@operato/data-grist';
|
|
|
9
9
|
import { PageView } from '@operato/shell';
|
|
10
10
|
export declare const showEntryView: (columns: any, data: any, column: any, record: any, rowIndex: any) => Promise<void>;
|
|
11
11
|
declare const DataSetListPage_base: (new (...args: any[]) => {
|
|
12
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
13
|
-
connectedCallback(): void;
|
|
14
|
-
disconnectedCallback(): void;
|
|
15
|
-
stateChanged(_state: unknown): void;
|
|
16
|
-
readonly isConnected: boolean;
|
|
17
|
-
}) & (new (...args: any[]) => {
|
|
18
12
|
__preferenceProviders: {
|
|
19
13
|
[element: string]: import("@operato/p13n").PagePreferenceProvider;
|
|
20
14
|
};
|
|
@@ -10,13 +10,12 @@ import gql from 'graphql-tag';
|
|
|
10
10
|
import { css, html } from 'lit';
|
|
11
11
|
import { customElement, query, state } from 'lit/decorators.js';
|
|
12
12
|
import { asyncReplace } from 'lit/directives/async-replace.js';
|
|
13
|
-
import { connect } from 'pwa-helpers/connect-mixin';
|
|
14
13
|
import { DataGrist, getEditor, getRenderer } from '@operato/data-grist';
|
|
15
14
|
import { OxDataUseCase } from '@operato/dataset';
|
|
16
15
|
import { client } from '@operato/graphql';
|
|
17
16
|
import { i18next, localize } from '@operato/i18n';
|
|
18
17
|
import { notify, openPopup } from '@operato/layout';
|
|
19
|
-
import { PageView,
|
|
18
|
+
import { PageView, navigate } from '@operato/shell';
|
|
20
19
|
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
21
20
|
import { isMobileDevice, sleep } from '@operato/utils';
|
|
22
21
|
import { p13n } from '@operato/p13n';
|
|
@@ -115,7 +114,7 @@ export const showEntryView = async (columns, data, column, record, rowIndex) =>
|
|
|
115
114
|
break;
|
|
116
115
|
}
|
|
117
116
|
};
|
|
118
|
-
let DataSetListPage = class DataSetListPage extends
|
|
117
|
+
let DataSetListPage = class DataSetListPage extends p13n(localize(i18next)(PageView)) {
|
|
119
118
|
constructor() {
|
|
120
119
|
super(...arguments);
|
|
121
120
|
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|