@things-factory/dataset 6.0.25 → 6.0.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/README.md +26 -11
- package/assets/images/ooc.png +0 -0
- package/assets/images/oos.png +0 -0
- package/client/{bootstrap.js → bootstrap.ts} +2 -0
- package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
- package/client/components/data-ooc-activity-view.ts +153 -0
- package/client/pages/data-archive/{data-archive-list-page.js → data-archive-list-page.ts} +67 -53
- package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts} +41 -39
- package/client/pages/data-entry/{data-entry-list-page.js → data-entry-list-page.ts} +41 -38
- package/client/pages/data-key-set/{data-key-item-list.js → data-key-item-list.ts} +31 -39
- package/client/pages/data-key-set/data-key-set-importer.ts +95 -0
- package/client/pages/data-key-set/{data-key-set-list-page.js → data-key-set-list-page.ts} +54 -35
- package/client/pages/data-ooc/{data-ooc-list-page.js → data-ooc-list-page.ts} +50 -36
- package/client/pages/data-ooc/{data-ooc-view.js → data-ooc-view.ts} +66 -76
- package/client/pages/data-report/{data-report-embed-page.js → data-report-embed-page.ts} +25 -34
- package/client/pages/data-report/{data-report-list-page.js → data-report-list-page.ts} +49 -43
- package/client/pages/data-report/{data-report-samples-page.js → data-report-samples-page.ts} +29 -43
- package/client/pages/data-report/{jasper-report-oocs-page.js → jasper-report-oocs-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-crosstab-page.js → jasper-report-samples-crosstab-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-page.js → jasper-report-samples-page.ts} +22 -34
- package/client/pages/data-sample/{data-sample-list-page.js → data-sample-list-page.ts} +49 -36
- package/client/pages/data-sample/{data-sample-search-page.js → data-sample-search-page.ts} +53 -39
- package/client/pages/data-sample/{data-sample-view.js → data-sample-view.ts} +29 -33
- package/client/pages/data-sensor/{data-sensor-list-page.js → data-sensor-list-page.ts} +41 -35
- package/client/pages/data-set/{data-item-list.js → data-item-list.ts} +31 -37
- package/client/pages/data-set/data-set-importer.ts +96 -0
- package/client/pages/data-set/{data-set-list-page.js → data-set-list-page.ts} +62 -36
- package/client/{route.js → route.ts} +1 -1
- package/client/tsconfig.json +11 -0
- package/dist-client/bootstrap.d.ts +3 -0
- package/dist-client/bootstrap.js +14 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/data-entry-form.d.ts +15 -0
- package/dist-client/components/data-entry-form.js +83 -0
- package/dist-client/components/data-entry-form.js.map +1 -0
- package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
- package/dist-client/components/data-ooc-activity-view.js +154 -0
- package/dist-client/components/data-ooc-activity-view.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-list-page.d.ts +71 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js +287 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js +161 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -0
- package/dist-client/pages/data-entry/data-entry-list-page.d.ts +36 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js +383 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-item-list.d.ts +18 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js +188 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +9 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js +100 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +60 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js +450 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +58 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js +473 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.d.ts +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js +179 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -0
- package/dist-client/pages/data-report/data-report-embed-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-embed-page.js +101 -0
- package/dist-client/pages/data-report/data-report-embed-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-list-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-list-page.js +431 -0
- package/dist-client/pages/data-report/data-report-list-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-samples-page.d.ts +32 -0
- package/dist-client/pages/data-report/data-report-samples-page.js +164 -0
- package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-list-page.d.ts +58 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js +412 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-search-page.d.ts +63 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js +413 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -0
- package/dist-client/pages/data-sample/data-sample-view.js +109 -0
- package/dist-client/pages/data-sample/data-sample-view.js.map +1 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +49 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js +419 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -0
- package/dist-client/pages/data-set/data-item-list.d.ts +1 -0
- package/dist-client/pages/data-set/data-item-list.js +267 -0
- package/dist-client/pages/data-set/data-item-list.js.map +1 -0
- package/dist-client/pages/data-set/data-set-importer.d.ts +10 -0
- package/dist-client/pages/data-set/data-set-importer.js +103 -0
- package/dist-client/pages/data-set/data-set-importer.js.map +1 -0
- package/dist-client/pages/data-set/data-set-list-page.d.ts +71 -0
- package/dist-client/pages/data-set/data-set-list-page.js +759 -0
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +47 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
- package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
- package/dist-server/controllers/create-data-sample.js +38 -1
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/index.js +5 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +1 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +2 -2
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +5 -4
- package/dist-server/service/data-set/data-set-query.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +3 -0
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history-query.js +4 -3
- package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
- package/server/controllers/activity-template/activity-ooc.ts +55 -0
- package/server/controllers/create-data-sample.ts +48 -3
- package/server/controllers/index.ts +9 -0
- package/server/index.ts +1 -2
- package/server/routes.ts +2 -4
- package/server/service/data-set/data-set-query.ts +5 -4
- package/server/service/data-set/data-set.ts +3 -0
- package/server/service/data-set-history/data-set-history-query.ts +4 -3
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +2 -2
- package/translations/en.json +1 -1
- package/translations/ko.json +1 -1
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
- package/client/pages/data-key-set/data-key-set-importer.js +0 -105
- package/client/pages/data-set/data-set-importer.js +0 -103
- package/dist-server/middlewares/index.js +0 -8
- package/dist-server/middlewares/index.js.map +0 -1
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/tsconfig.json +0 -9
- /package/assets/{data-report.jpg → images/data-report.jpg} +0 -0
- /package/assets/{data-samples.jpg → images/data-samples.jpg} +0 -0
- /package/assets/{diagram.jpg → images/dataset-diagram.jpg} +0 -0
- /package/assets/{glue-table-indices.png → images/glue-table-indices-for-dataset.png} +0 -0
- /package/client/{index.js → index.ts} +0 -0
@@ -0,0 +1,759 @@
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
2
|
+
import '@operato/data-grist';
|
3
|
+
import './data-item-list.js';
|
4
|
+
import './data-set-importer.js';
|
5
|
+
import '../../components/data-entry-form.js';
|
6
|
+
import moment from 'moment-timezone';
|
7
|
+
import gql from 'graphql-tag';
|
8
|
+
import { css, html } from 'lit';
|
9
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
10
|
+
import { connect } from 'pwa-helpers/connect-mixin';
|
11
|
+
import { getEditor, getRenderer, DataGrist } from '@operato/data-grist';
|
12
|
+
import { OxDataUseCase } from '@operato/dataset';
|
13
|
+
import { client } from '@operato/graphql';
|
14
|
+
import { i18next, localize } from '@operato/i18n';
|
15
|
+
import { notify, openPopup } from '@operato/layout';
|
16
|
+
import { PageView, store } from '@operato/shell';
|
17
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
18
|
+
import { isMobileDevice } from '@operato/utils';
|
19
|
+
import { OxPopup } from '@operato/popup';
|
20
|
+
const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
21
|
+
const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)];
|
22
|
+
const ENTRY_TYPES = [
|
23
|
+
{
|
24
|
+
display: '',
|
25
|
+
value: ''
|
26
|
+
},
|
27
|
+
{
|
28
|
+
display: 'Generated',
|
29
|
+
value: 'generated'
|
30
|
+
},
|
31
|
+
{
|
32
|
+
display: 'Board',
|
33
|
+
value: 'board'
|
34
|
+
},
|
35
|
+
{
|
36
|
+
display: 'CustomElement',
|
37
|
+
value: 'custom-element'
|
38
|
+
},
|
39
|
+
{
|
40
|
+
display: 'Page',
|
41
|
+
value: 'page'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
display: 'External URL',
|
45
|
+
value: 'external'
|
46
|
+
}
|
47
|
+
];
|
48
|
+
const MONITOR_TYPES = [
|
49
|
+
{
|
50
|
+
display: '',
|
51
|
+
value: ''
|
52
|
+
},
|
53
|
+
{
|
54
|
+
display: 'Generated',
|
55
|
+
value: 'generated'
|
56
|
+
},
|
57
|
+
{
|
58
|
+
display: 'Board',
|
59
|
+
value: 'board'
|
60
|
+
},
|
61
|
+
{
|
62
|
+
display: 'CustomElement',
|
63
|
+
value: 'custom-element'
|
64
|
+
},
|
65
|
+
{
|
66
|
+
display: 'Page',
|
67
|
+
value: 'page'
|
68
|
+
},
|
69
|
+
{
|
70
|
+
display: 'External URL',
|
71
|
+
value: 'external'
|
72
|
+
}
|
73
|
+
];
|
74
|
+
const REPORT_TYPES = [
|
75
|
+
{
|
76
|
+
display: '',
|
77
|
+
value: ''
|
78
|
+
},
|
79
|
+
{
|
80
|
+
display: 'Generated',
|
81
|
+
value: 'generated'
|
82
|
+
},
|
83
|
+
{
|
84
|
+
display: 'Embed',
|
85
|
+
value: 'embed'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
display: 'CustomElement',
|
89
|
+
value: 'custom-element'
|
90
|
+
},
|
91
|
+
{
|
92
|
+
display: 'Page',
|
93
|
+
value: 'page'
|
94
|
+
},
|
95
|
+
{
|
96
|
+
display: 'External URL',
|
97
|
+
value: 'external'
|
98
|
+
},
|
99
|
+
{
|
100
|
+
display: 'Jasper',
|
101
|
+
value: 'jasper'
|
102
|
+
},
|
103
|
+
{
|
104
|
+
display: 'Shiny',
|
105
|
+
value: 'shiny'
|
106
|
+
}
|
107
|
+
];
|
108
|
+
const USECASE_OPTIONS = () => {
|
109
|
+
return ['', ...OxDataUseCase.getUseCaseNames()].map(name => {
|
110
|
+
return {
|
111
|
+
display: name,
|
112
|
+
value: name
|
113
|
+
};
|
114
|
+
});
|
115
|
+
};
|
116
|
+
let DataSetListPage = class DataSetListPage extends connect(store)(localize(i18next)(PageView)) {
|
117
|
+
constructor() {
|
118
|
+
super(...arguments);
|
119
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
120
|
+
}
|
121
|
+
get context() {
|
122
|
+
return {
|
123
|
+
search: {
|
124
|
+
handler: (search) => {
|
125
|
+
this.grist.searchText = search;
|
126
|
+
},
|
127
|
+
placeholder: i18next.t('title.data-set list'),
|
128
|
+
value: this.grist.searchText
|
129
|
+
},
|
130
|
+
filter: {
|
131
|
+
handler: () => {
|
132
|
+
this.grist.toggleHeadroom();
|
133
|
+
}
|
134
|
+
},
|
135
|
+
help: 'dataset/data-set',
|
136
|
+
actions: [
|
137
|
+
Object.assign({ title: i18next.t('button.copy'), action: this._copyDataSet.bind(this) }, CommonButtonStyles.copy),
|
138
|
+
Object.assign({ title: i18next.t('button.save'), action: this._updateDataSet.bind(this) }, CommonButtonStyles.save),
|
139
|
+
Object.assign({ title: i18next.t('button.delete'), action: this._deleteDataSet.bind(this) }, CommonButtonStyles.delete)
|
140
|
+
],
|
141
|
+
exportable: {
|
142
|
+
name: i18next.t('title.data-set list'),
|
143
|
+
data: this.exportHandler.bind(this)
|
144
|
+
},
|
145
|
+
importable: {
|
146
|
+
handler: this.importHandler.bind(this)
|
147
|
+
}
|
148
|
+
};
|
149
|
+
}
|
150
|
+
render() {
|
151
|
+
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
|
152
|
+
return html `
|
153
|
+
<ox-grist
|
154
|
+
.mode=${mode}
|
155
|
+
.config=${this.gristConfig}
|
156
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
157
|
+
?url-params-sensitive=${this.active}
|
158
|
+
>
|
159
|
+
<div slot="headroom">
|
160
|
+
<div id="filters">
|
161
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div id="sorters">
|
165
|
+
Sort
|
166
|
+
<mwc-icon
|
167
|
+
@click=${e => {
|
168
|
+
const target = e.currentTarget;
|
169
|
+
this.sortersControl.open({
|
170
|
+
right: 0,
|
171
|
+
top: target.offsetTop + target.offsetHeight
|
172
|
+
});
|
173
|
+
}}
|
174
|
+
>expand_more</mwc-icon
|
175
|
+
>
|
176
|
+
<ox-popup id="sorter-control">
|
177
|
+
<ox-sorters-control> </ox-sorters-control>
|
178
|
+
</ox-popup>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div id="modes">
|
182
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
183
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
184
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
</ox-grist>
|
188
|
+
`;
|
189
|
+
}
|
190
|
+
async pageInitialized(lifecycle) {
|
191
|
+
this.gristConfig = {
|
192
|
+
list: {
|
193
|
+
fields: ['name', 'description'],
|
194
|
+
details: ['schedule', 'active']
|
195
|
+
},
|
196
|
+
columns: [
|
197
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
198
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
199
|
+
{
|
200
|
+
type: 'gutter',
|
201
|
+
gutterName: 'button',
|
202
|
+
icon: 'reorder',
|
203
|
+
handlers: {
|
204
|
+
click: (columns, data, column, record, rowIndex) => {
|
205
|
+
if (!record.id)
|
206
|
+
return;
|
207
|
+
const popup = openPopup(html ` <data-item-list .dataSet=${record}></data-item-list> `, {
|
208
|
+
backdrop: true,
|
209
|
+
help: 'dataset/ui/data-item-list',
|
210
|
+
size: 'large',
|
211
|
+
title: i18next.t('title.data-item list')
|
212
|
+
});
|
213
|
+
popup.onclosed = () => {
|
214
|
+
this.grist.fetch();
|
215
|
+
};
|
216
|
+
}
|
217
|
+
}
|
218
|
+
},
|
219
|
+
{
|
220
|
+
type: 'gutter',
|
221
|
+
gutterName: 'button',
|
222
|
+
icon: 'fact_check',
|
223
|
+
handlers: {
|
224
|
+
click: (columns, data, column, record, rowIndex) => {
|
225
|
+
openPopup(html ` <data-entry-form .dataSet=${record} style="background-color: white;"></data-entry-form> `, {
|
226
|
+
backdrop: true,
|
227
|
+
size: 'large',
|
228
|
+
title: i18next.t('title.data-entry-form')
|
229
|
+
});
|
230
|
+
}
|
231
|
+
}
|
232
|
+
},
|
233
|
+
{
|
234
|
+
type: 'string',
|
235
|
+
name: 'name',
|
236
|
+
header: i18next.t('field.name'),
|
237
|
+
record: {
|
238
|
+
editable: true
|
239
|
+
},
|
240
|
+
filter: 'search',
|
241
|
+
sortable: true,
|
242
|
+
width: 150,
|
243
|
+
imex: {
|
244
|
+
width: 25,
|
245
|
+
header: i18next.t('field.name'),
|
246
|
+
type: 'string',
|
247
|
+
key: 'name'
|
248
|
+
}
|
249
|
+
},
|
250
|
+
{
|
251
|
+
type: 'string',
|
252
|
+
name: 'description',
|
253
|
+
header: i18next.t('field.description'),
|
254
|
+
record: {
|
255
|
+
editable: true
|
256
|
+
},
|
257
|
+
filter: 'search',
|
258
|
+
width: 200,
|
259
|
+
imex: {
|
260
|
+
width: 33,
|
261
|
+
header: i18next.t('field.description'),
|
262
|
+
type: 'string',
|
263
|
+
key: 'description'
|
264
|
+
}
|
265
|
+
},
|
266
|
+
{
|
267
|
+
type: 'checkbox',
|
268
|
+
name: 'active',
|
269
|
+
label: true,
|
270
|
+
header: i18next.t('field.active'),
|
271
|
+
record: {
|
272
|
+
editable: true
|
273
|
+
},
|
274
|
+
filter: true,
|
275
|
+
sortable: true,
|
276
|
+
width: 60,
|
277
|
+
imex: {
|
278
|
+
width: 10,
|
279
|
+
header: i18next.t('field.active'),
|
280
|
+
type: 'checkbox',
|
281
|
+
key: 'active'
|
282
|
+
}
|
283
|
+
},
|
284
|
+
{
|
285
|
+
type: 'select',
|
286
|
+
name: 'type',
|
287
|
+
label: true,
|
288
|
+
header: i18next.t('field.type'),
|
289
|
+
record: {
|
290
|
+
editable: true,
|
291
|
+
options: [
|
292
|
+
{},
|
293
|
+
{
|
294
|
+
display: i18next.t('text.manually collected'),
|
295
|
+
value: 'manual'
|
296
|
+
},
|
297
|
+
{
|
298
|
+
display: i18next.t('text.automatically collected'),
|
299
|
+
value: 'automatic'
|
300
|
+
}
|
301
|
+
]
|
302
|
+
},
|
303
|
+
sortable: true,
|
304
|
+
filter: true,
|
305
|
+
width: 60,
|
306
|
+
imex: {
|
307
|
+
width: 10,
|
308
|
+
header: i18next.t('field.type'),
|
309
|
+
type: 'select',
|
310
|
+
key: 'type'
|
311
|
+
}
|
312
|
+
},
|
313
|
+
{
|
314
|
+
type: 'select',
|
315
|
+
name: 'useCase',
|
316
|
+
label: true,
|
317
|
+
header: i18next.t('field.use-case'),
|
318
|
+
record: {
|
319
|
+
editable: true,
|
320
|
+
options: USECASE_OPTIONS
|
321
|
+
},
|
322
|
+
sortable: true,
|
323
|
+
filter: true,
|
324
|
+
width: 80
|
325
|
+
},
|
326
|
+
{
|
327
|
+
type: 'resource-object',
|
328
|
+
name: 'dataKeySet',
|
329
|
+
header: i18next.t('field.data-key-set'),
|
330
|
+
record: {
|
331
|
+
editable: true,
|
332
|
+
options: {
|
333
|
+
queryName: 'dataKeySets'
|
334
|
+
}
|
335
|
+
},
|
336
|
+
sortable: true,
|
337
|
+
filter: false,
|
338
|
+
width: 120
|
339
|
+
},
|
340
|
+
{
|
341
|
+
type: 'partition-keys',
|
342
|
+
name: 'partitionKeys',
|
343
|
+
header: i18next.t('field.partition-keys'),
|
344
|
+
record: {
|
345
|
+
editable: true,
|
346
|
+
options: {
|
347
|
+
objectified: true /* transfered as a object type */
|
348
|
+
}
|
349
|
+
},
|
350
|
+
width: 200
|
351
|
+
},
|
352
|
+
{
|
353
|
+
type: 'crontab',
|
354
|
+
name: 'schedule',
|
355
|
+
label: true,
|
356
|
+
header: i18next.t('field.schedule'),
|
357
|
+
record: {
|
358
|
+
editable: true,
|
359
|
+
options: {
|
360
|
+
objectified: true
|
361
|
+
}
|
362
|
+
},
|
363
|
+
width: 80,
|
364
|
+
imex: {
|
365
|
+
width: 13,
|
366
|
+
header: i18next.t('field.schedule'),
|
367
|
+
type: 'string',
|
368
|
+
key: 'schedule'
|
369
|
+
}
|
370
|
+
},
|
371
|
+
{
|
372
|
+
type: 'select',
|
373
|
+
name: 'timezone',
|
374
|
+
header: i18next.t('field.timezone'),
|
375
|
+
record: {
|
376
|
+
editable: true,
|
377
|
+
options: TIMEZONE_OPTIONS
|
378
|
+
},
|
379
|
+
width: 120,
|
380
|
+
imex: {
|
381
|
+
width: 13,
|
382
|
+
header: i18next.t('field.timezone'),
|
383
|
+
type: 'select',
|
384
|
+
key: 'timezone'
|
385
|
+
}
|
386
|
+
},
|
387
|
+
{
|
388
|
+
type: 'resource-object',
|
389
|
+
name: 'supervisoryRole',
|
390
|
+
header: i18next.t('field.supervisory-role'),
|
391
|
+
record: {
|
392
|
+
editable: true,
|
393
|
+
options: {
|
394
|
+
title: i18next.t('title.lookup role'),
|
395
|
+
queryName: 'roles'
|
396
|
+
}
|
397
|
+
},
|
398
|
+
sortable: true,
|
399
|
+
filter: false,
|
400
|
+
width: 120
|
401
|
+
},
|
402
|
+
{
|
403
|
+
type: 'resource-object',
|
404
|
+
name: 'entryRole',
|
405
|
+
header: i18next.t('field.entry-role'),
|
406
|
+
record: {
|
407
|
+
editable: true,
|
408
|
+
options: {
|
409
|
+
title: i18next.t('title.lookup role'),
|
410
|
+
queryName: 'roles'
|
411
|
+
}
|
412
|
+
},
|
413
|
+
sortable: true,
|
414
|
+
width: 120
|
415
|
+
},
|
416
|
+
{
|
417
|
+
type: 'select',
|
418
|
+
name: 'entryType',
|
419
|
+
label: true,
|
420
|
+
header: i18next.t('field.entry-type'),
|
421
|
+
record: {
|
422
|
+
editable: true,
|
423
|
+
options: ENTRY_TYPES
|
424
|
+
},
|
425
|
+
width: 80
|
426
|
+
},
|
427
|
+
{
|
428
|
+
type: 'string',
|
429
|
+
name: 'entryView',
|
430
|
+
header: i18next.t('field.entry-view'),
|
431
|
+
record: {
|
432
|
+
editable: true,
|
433
|
+
editor: function (value, column, record, rowIndex, field) {
|
434
|
+
var type = record.entryType !== 'board' ? 'string' : 'board';
|
435
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
436
|
+
},
|
437
|
+
renderer: function (value, column, record, rowIndex, field) {
|
438
|
+
var type = record.entryType !== 'board' ? 'string' : 'board';
|
439
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
440
|
+
}
|
441
|
+
},
|
442
|
+
width: 140
|
443
|
+
},
|
444
|
+
{
|
445
|
+
type: 'select',
|
446
|
+
name: 'monitorType',
|
447
|
+
label: true,
|
448
|
+
header: i18next.t('field.monitor-type'),
|
449
|
+
record: {
|
450
|
+
editable: true,
|
451
|
+
options: MONITOR_TYPES
|
452
|
+
},
|
453
|
+
width: 80
|
454
|
+
},
|
455
|
+
{
|
456
|
+
type: 'string',
|
457
|
+
name: 'monitorView',
|
458
|
+
header: i18next.t('field.monitor-view'),
|
459
|
+
record: {
|
460
|
+
editable: true,
|
461
|
+
editor: function (value, column, record, rowIndex, field) {
|
462
|
+
var type = record.monitorType !== 'board' ? 'string' : 'board';
|
463
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
464
|
+
},
|
465
|
+
renderer: function (value, column, record, rowIndex, field) {
|
466
|
+
var type = record.monitorType !== 'board' ? 'string' : 'board';
|
467
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
468
|
+
}
|
469
|
+
},
|
470
|
+
width: 140
|
471
|
+
},
|
472
|
+
{
|
473
|
+
type: 'select',
|
474
|
+
name: 'reportType',
|
475
|
+
label: true,
|
476
|
+
header: i18next.t('field.report-type'),
|
477
|
+
record: {
|
478
|
+
editable: true,
|
479
|
+
options: REPORT_TYPES
|
480
|
+
},
|
481
|
+
width: 80
|
482
|
+
},
|
483
|
+
{
|
484
|
+
type: 'string',
|
485
|
+
name: 'reportView',
|
486
|
+
header: i18next.t('field.report-view'),
|
487
|
+
record: {
|
488
|
+
editable: true,
|
489
|
+
editor: function (value, column, record, rowIndex, field) {
|
490
|
+
var type = record.reportType !== 'custom' ? 'string' : 'script';
|
491
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
492
|
+
},
|
493
|
+
renderer: function (value, column, record, rowIndex, field) {
|
494
|
+
var type = record.reportType !== 'custom' ? 'string' : 'string';
|
495
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
496
|
+
}
|
497
|
+
},
|
498
|
+
width: 140
|
499
|
+
},
|
500
|
+
{
|
501
|
+
type: 'file',
|
502
|
+
name: 'reportTemplate',
|
503
|
+
header: i18next.t('field.report-template'),
|
504
|
+
record: {
|
505
|
+
editable: true
|
506
|
+
},
|
507
|
+
width: 80
|
508
|
+
},
|
509
|
+
{
|
510
|
+
type: 'resource-object',
|
511
|
+
name: 'updater',
|
512
|
+
header: i18next.t('field.updater'),
|
513
|
+
record: {
|
514
|
+
editable: false
|
515
|
+
},
|
516
|
+
sortable: true,
|
517
|
+
width: 120
|
518
|
+
},
|
519
|
+
{
|
520
|
+
type: 'datetime',
|
521
|
+
name: 'updatedAt',
|
522
|
+
header: i18next.t('field.updated_at'),
|
523
|
+
record: {
|
524
|
+
editable: false
|
525
|
+
},
|
526
|
+
sortable: true,
|
527
|
+
width: 180
|
528
|
+
}
|
529
|
+
],
|
530
|
+
rows: {
|
531
|
+
selectable: {
|
532
|
+
multiple: true
|
533
|
+
}
|
534
|
+
},
|
535
|
+
sorters: [
|
536
|
+
{
|
537
|
+
name: 'name'
|
538
|
+
}
|
539
|
+
]
|
540
|
+
};
|
541
|
+
}
|
542
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
543
|
+
const response = await client.query({
|
544
|
+
query: gql `
|
545
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
546
|
+
responses: dataSets(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
547
|
+
items {
|
548
|
+
id
|
549
|
+
name
|
550
|
+
description
|
551
|
+
partitionKeys
|
552
|
+
active
|
553
|
+
type
|
554
|
+
useCase
|
555
|
+
schedule
|
556
|
+
timezone
|
557
|
+
dataKeySet {
|
558
|
+
id
|
559
|
+
name
|
560
|
+
}
|
561
|
+
entryRole {
|
562
|
+
id
|
563
|
+
name
|
564
|
+
}
|
565
|
+
supervisoryRole {
|
566
|
+
id
|
567
|
+
name
|
568
|
+
}
|
569
|
+
entryType
|
570
|
+
entryView
|
571
|
+
monitorType
|
572
|
+
monitorView
|
573
|
+
reportType
|
574
|
+
reportView
|
575
|
+
reportTemplate
|
576
|
+
updater {
|
577
|
+
id
|
578
|
+
name
|
579
|
+
}
|
580
|
+
updatedAt
|
581
|
+
dataItems {
|
582
|
+
name
|
583
|
+
description
|
584
|
+
active
|
585
|
+
hidden
|
586
|
+
tag
|
587
|
+
type
|
588
|
+
unit
|
589
|
+
options
|
590
|
+
quota
|
591
|
+
spec
|
592
|
+
}
|
593
|
+
}
|
594
|
+
total
|
595
|
+
}
|
596
|
+
}
|
597
|
+
`,
|
598
|
+
variables: {
|
599
|
+
filters,
|
600
|
+
pagination: { page, limit },
|
601
|
+
sortings
|
602
|
+
}
|
603
|
+
});
|
604
|
+
return {
|
605
|
+
total: response.data.responses.total || 0,
|
606
|
+
records: response.data.responses.items || []
|
607
|
+
};
|
608
|
+
}
|
609
|
+
async _deleteDataSet() {
|
610
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
611
|
+
const ids = this.grist.selected.map(record => record.id);
|
612
|
+
if (ids && ids.length > 0) {
|
613
|
+
const response = await client.mutate({
|
614
|
+
mutation: gql `
|
615
|
+
mutation ($ids: [String!]!) {
|
616
|
+
deleteDataSets(ids: $ids)
|
617
|
+
}
|
618
|
+
`,
|
619
|
+
variables: {
|
620
|
+
ids
|
621
|
+
}
|
622
|
+
});
|
623
|
+
if (!response.errors) {
|
624
|
+
this.grist.fetch();
|
625
|
+
notify({
|
626
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
627
|
+
});
|
628
|
+
}
|
629
|
+
}
|
630
|
+
}
|
631
|
+
}
|
632
|
+
async _copyDataSet() {
|
633
|
+
var selected = this.grist.selected;
|
634
|
+
if (selected.length == 0)
|
635
|
+
return;
|
636
|
+
if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') })))
|
637
|
+
return;
|
638
|
+
var response = await client.mutate({
|
639
|
+
mutation: gql `
|
640
|
+
mutation ($ids: [String!]!) {
|
641
|
+
copyDataSets(ids: $ids) {
|
642
|
+
id
|
643
|
+
}
|
644
|
+
}
|
645
|
+
`,
|
646
|
+
variables: {
|
647
|
+
ids: selected.map(r => r.id)
|
648
|
+
}
|
649
|
+
});
|
650
|
+
if (!response.errors) {
|
651
|
+
this.grist.fetch();
|
652
|
+
}
|
653
|
+
}
|
654
|
+
async _updateDataSet() {
|
655
|
+
let patches = this.grist.dirtyRecords;
|
656
|
+
if (patches && patches.length) {
|
657
|
+
patches = patches.map(patch => {
|
658
|
+
let patchField = patch.id ? { id: patch.id } : {};
|
659
|
+
const dirtyFields = patch.__dirtyfields__;
|
660
|
+
for (let key in dirtyFields) {
|
661
|
+
patchField[key] = dirtyFields[key].after;
|
662
|
+
}
|
663
|
+
if (patchField['reportTemplate'] instanceof FileList) {
|
664
|
+
patchField['reportTemplate'] = patchField['reportTemplate'][0];
|
665
|
+
}
|
666
|
+
patchField.cuFlag = patch.__dirty__;
|
667
|
+
return patchField;
|
668
|
+
});
|
669
|
+
const response = await client.mutate({
|
670
|
+
mutation: gql `
|
671
|
+
mutation ($patches: [DataSetPatch!]!) {
|
672
|
+
updateMultipleDataSet(patches: $patches) {
|
673
|
+
name
|
674
|
+
}
|
675
|
+
}
|
676
|
+
`,
|
677
|
+
variables: {
|
678
|
+
patches
|
679
|
+
},
|
680
|
+
context: {
|
681
|
+
hasUpload: true
|
682
|
+
}
|
683
|
+
});
|
684
|
+
if (!response.errors) {
|
685
|
+
this.grist.fetch();
|
686
|
+
}
|
687
|
+
}
|
688
|
+
}
|
689
|
+
async exportHandler() {
|
690
|
+
var headerSetting = this.grist._config.columns
|
691
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
692
|
+
.map(column => {
|
693
|
+
return column.imex;
|
694
|
+
});
|
695
|
+
let records = this.grist.data.records;
|
696
|
+
var data = records.map(item => {
|
697
|
+
return Object.assign({ id: item.id }, this.grist._config.columns
|
698
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
699
|
+
.reduce((record, column) => {
|
700
|
+
var imexKey = column.imex.key;
|
701
|
+
record[imexKey] = imexKey
|
702
|
+
.split('.')
|
703
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item);
|
704
|
+
return record;
|
705
|
+
}, {}));
|
706
|
+
});
|
707
|
+
return { header: headerSetting, data: data };
|
708
|
+
}
|
709
|
+
async importHandler(records) {
|
710
|
+
openPopup(html `
|
711
|
+
<data-set-importer
|
712
|
+
.dataSets=${records}
|
713
|
+
@imported=${() => {
|
714
|
+
history.back();
|
715
|
+
this.grist.fetch();
|
716
|
+
}}
|
717
|
+
></data-set-importer>
|
718
|
+
`, {
|
719
|
+
backdrop: true,
|
720
|
+
size: 'large',
|
721
|
+
title: i18next.t('title.import data-set')
|
722
|
+
});
|
723
|
+
}
|
724
|
+
};
|
725
|
+
DataSetListPage.styles = [
|
726
|
+
ScrollbarStyles,
|
727
|
+
CommonGristStyles,
|
728
|
+
css `
|
729
|
+
:host {
|
730
|
+
display: flex;
|
731
|
+
|
732
|
+
width: 100%;
|
733
|
+
|
734
|
+
--grid-record-emphasized-background-color: red;
|
735
|
+
--grid-record-emphasized-color: yellow;
|
736
|
+
}
|
737
|
+
`
|
738
|
+
];
|
739
|
+
__decorate([
|
740
|
+
state(),
|
741
|
+
__metadata("design:type", Object)
|
742
|
+
], DataSetListPage.prototype, "gristConfig", void 0);
|
743
|
+
__decorate([
|
744
|
+
state(),
|
745
|
+
__metadata("design:type", String)
|
746
|
+
], DataSetListPage.prototype, "mode", void 0);
|
747
|
+
__decorate([
|
748
|
+
query('ox-grist'),
|
749
|
+
__metadata("design:type", DataGrist)
|
750
|
+
], DataSetListPage.prototype, "grist", void 0);
|
751
|
+
__decorate([
|
752
|
+
query('#sorter-control'),
|
753
|
+
__metadata("design:type", OxPopup)
|
754
|
+
], DataSetListPage.prototype, "sortersControl", void 0);
|
755
|
+
DataSetListPage = __decorate([
|
756
|
+
customElement('data-set-list-page')
|
757
|
+
], DataSetListPage);
|
758
|
+
export { DataSetListPage };
|
759
|
+
//# sourceMappingURL=data-set-list-page.js.map
|