@things-factory/dataset 6.0.25 → 6.0.28
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/data-collect.png +0 -0
- package/assets/images/ooc.png +0 -0
- package/assets/images/oos.png +0 -0
- package/client/{bootstrap.js → bootstrap.ts} +5 -1
- package/client/components/data-collect-activity-view.ts +100 -0
- package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
- package/client/components/ooc-resolve-activity-view.ts +174 -0
- package/client/components/ooc-review-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} +56 -36
- package/client/pages/data-ooc/data-ooc-view-page.ts +115 -0
- package/client/pages/data-ooc/data-ooc-view.ts +124 -0
- 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} +173 -40
- package/client/{route.js → route.ts} +5 -1
- package/client/tsconfig.json +11 -0
- package/config/config.development.js +30 -30
- package/config/config.production.js +31 -31
- package/dist-client/bootstrap.d.ts +5 -0
- package/dist-client/bootstrap.js +16 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/data-collect-activity-view.d.ts +19 -0
- package/dist-client/components/data-collect-activity-view.js +101 -0
- package/dist-client/components/data-collect-activity-view.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/components/ooc-resolve-activity-view.d.ts +1 -0
- package/dist-client/components/ooc-resolve-activity-view.js +175 -0
- package/dist-client/components/ooc-resolve-activity-view.js.map +1 -0
- package/dist-client/components/ooc-review-activity-view.d.ts +1 -0
- package/dist-client/components/ooc-review-activity-view.js +155 -0
- package/dist-client/components/ooc-review-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 +479 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view-page.d.ts +18 -0
- package/dist-client/pages/data-ooc/data-ooc-view-page.js +114 -0
- package/dist-client/pages/data-ooc/data-ooc-view-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.d.ts +15 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js +130 -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 +73 -0
- package/dist-client/pages/data-set/data-set-list-page.js +861 -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 +50 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/activity-template/activity-data-collect.js +82 -0
- package/dist-server/controllers/activity-template/activity-data-collect.js.map +1 -0
- package/dist-server/controllers/activity-template/activity-ooc-resolve.js +100 -0
- package/dist-server/controllers/activity-template/activity-ooc-resolve.js.map +1 -0
- package/dist-server/controllers/activity-template/activity-ooc-review.js +107 -0
- package/dist-server/controllers/activity-template/activity-ooc-review.js.map +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 +53 -14
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/data-use-case.js +1 -1
- package/dist-server/controllers/data-use-case.js.map +1 -1
- package/dist-server/controllers/index.js +7 -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 +47 -3
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc-query.js +22 -2
- package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc.js +26 -0
- package/dist-server/service/data-ooc/data-ooc.js.map +1 -1
- package/dist-server/service/data-set/data-set-mutation.js +88 -0
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +38 -4
- package/dist-server/service/data-set/data-set-query.js.map +1 -1
- package/dist-server/service/data-set/data-set-type.js +16 -0
- package/dist-server/service/data-set/data-set-type.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +55 -3
- 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/helps/dataset/data-ooc.md +5 -4
- package/package.json +17 -12
- package/server/controllers/activity-template/activity-data-collect.ts +84 -0
- package/server/controllers/activity-template/activity-ooc-resolve.ts +114 -0
- package/server/controllers/activity-template/activity-ooc-review.ts +118 -0
- package/server/controllers/create-data-sample.ts +61 -21
- package/server/controllers/data-use-case.ts +1 -1
- package/server/controllers/index.ts +11 -0
- package/server/index.ts +1 -2
- package/server/routes.ts +62 -5
- package/server/service/data-ooc/data-ooc-query.ts +12 -2
- package/server/service/data-ooc/data-ooc.ts +23 -0
- package/server/service/data-set/data-set-mutation.ts +99 -0
- package/server/service/data-set/data-set-query.ts +39 -5
- package/server/service/data-set/data-set-type.ts +14 -0
- package/server/service/data-set/data-set.ts +43 -2
- package/server/service/data-set-history/data-set-history-query.ts +4 -3
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +6 -2
- package/translations/en.json +3 -1
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/client/pages/data-key-set/data-key-set-importer.js +0 -105
- package/client/pages/data-ooc/data-ooc-view.js +0 -188
- package/client/pages/data-set/data-set-importer.js +0 -103
- 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,861 @@
|
|
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: record => (!record || !record.name ? '' : record.schedulerHandle ? 'pause' : 'play_arrow'),
|
203
|
+
handlers: {
|
204
|
+
click: (columns, data, column, record, rowIndex) => {
|
205
|
+
if (!record || !record.name) {
|
206
|
+
/* TODO record가 새로 추가된 것이면 리턴하도록 한다. */
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
if (record.schedulerHandle) {
|
210
|
+
this.stopDataCollectionSchedule(record);
|
211
|
+
}
|
212
|
+
else {
|
213
|
+
this.startDataCollectionSchedule(record);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
},
|
218
|
+
{
|
219
|
+
type: 'gutter',
|
220
|
+
gutterName: 'button',
|
221
|
+
icon: 'reorder',
|
222
|
+
handlers: {
|
223
|
+
click: (columns, data, column, record, rowIndex) => {
|
224
|
+
if (!record.id)
|
225
|
+
return;
|
226
|
+
const popup = openPopup(html ` <data-item-list .dataSet=${record}></data-item-list> `, {
|
227
|
+
backdrop: true,
|
228
|
+
help: 'dataset/ui/data-item-list',
|
229
|
+
size: 'large',
|
230
|
+
title: i18next.t('title.data-item list')
|
231
|
+
});
|
232
|
+
popup.onclosed = () => {
|
233
|
+
this.grist.fetch();
|
234
|
+
};
|
235
|
+
}
|
236
|
+
}
|
237
|
+
},
|
238
|
+
{
|
239
|
+
type: 'gutter',
|
240
|
+
gutterName: 'button',
|
241
|
+
icon: 'fact_check',
|
242
|
+
handlers: {
|
243
|
+
click: (columns, data, column, record, rowIndex) => {
|
244
|
+
openPopup(html ` <data-entry-form .dataSet=${record} style="background-color: white;"></data-entry-form> `, {
|
245
|
+
backdrop: true,
|
246
|
+
size: 'large',
|
247
|
+
title: i18next.t('title.data-entry-form')
|
248
|
+
});
|
249
|
+
}
|
250
|
+
}
|
251
|
+
},
|
252
|
+
{
|
253
|
+
type: 'string',
|
254
|
+
name: 'name',
|
255
|
+
header: i18next.t('field.name'),
|
256
|
+
record: {
|
257
|
+
editable: true
|
258
|
+
},
|
259
|
+
filter: 'search',
|
260
|
+
sortable: true,
|
261
|
+
width: 150,
|
262
|
+
imex: {
|
263
|
+
width: 25,
|
264
|
+
header: i18next.t('field.name'),
|
265
|
+
type: 'string',
|
266
|
+
key: 'name'
|
267
|
+
}
|
268
|
+
},
|
269
|
+
{
|
270
|
+
type: 'string',
|
271
|
+
name: 'description',
|
272
|
+
header: i18next.t('field.description'),
|
273
|
+
record: {
|
274
|
+
editable: true
|
275
|
+
},
|
276
|
+
filter: 'search',
|
277
|
+
width: 200,
|
278
|
+
imex: {
|
279
|
+
width: 33,
|
280
|
+
header: i18next.t('field.description'),
|
281
|
+
type: 'string',
|
282
|
+
key: 'description'
|
283
|
+
}
|
284
|
+
},
|
285
|
+
{
|
286
|
+
type: 'checkbox',
|
287
|
+
name: 'active',
|
288
|
+
label: true,
|
289
|
+
header: i18next.t('field.active'),
|
290
|
+
record: {
|
291
|
+
editable: true
|
292
|
+
},
|
293
|
+
filter: true,
|
294
|
+
sortable: true,
|
295
|
+
width: 60,
|
296
|
+
imex: {
|
297
|
+
width: 10,
|
298
|
+
header: i18next.t('field.active'),
|
299
|
+
type: 'checkbox',
|
300
|
+
key: 'active'
|
301
|
+
}
|
302
|
+
},
|
303
|
+
{
|
304
|
+
type: 'select',
|
305
|
+
name: 'type',
|
306
|
+
label: true,
|
307
|
+
header: i18next.t('field.type'),
|
308
|
+
record: {
|
309
|
+
editable: true,
|
310
|
+
options: [
|
311
|
+
{},
|
312
|
+
{
|
313
|
+
display: i18next.t('text.manually collected'),
|
314
|
+
value: 'manual'
|
315
|
+
},
|
316
|
+
{
|
317
|
+
display: i18next.t('text.automatically collected'),
|
318
|
+
value: 'automatic'
|
319
|
+
}
|
320
|
+
]
|
321
|
+
},
|
322
|
+
sortable: true,
|
323
|
+
filter: true,
|
324
|
+
width: 60,
|
325
|
+
imex: {
|
326
|
+
width: 10,
|
327
|
+
header: i18next.t('field.type'),
|
328
|
+
type: 'select',
|
329
|
+
key: 'type'
|
330
|
+
}
|
331
|
+
},
|
332
|
+
{
|
333
|
+
type: 'select',
|
334
|
+
name: 'useCase',
|
335
|
+
label: true,
|
336
|
+
header: i18next.t('field.use-case'),
|
337
|
+
record: {
|
338
|
+
editable: true,
|
339
|
+
options: USECASE_OPTIONS
|
340
|
+
},
|
341
|
+
sortable: true,
|
342
|
+
filter: true,
|
343
|
+
width: 80
|
344
|
+
},
|
345
|
+
{
|
346
|
+
type: 'resource-object',
|
347
|
+
name: 'dataKeySet',
|
348
|
+
header: i18next.t('field.data-key-set'),
|
349
|
+
record: {
|
350
|
+
editable: true,
|
351
|
+
options: {
|
352
|
+
queryName: 'dataKeySets'
|
353
|
+
}
|
354
|
+
},
|
355
|
+
filter: false,
|
356
|
+
width: 120
|
357
|
+
},
|
358
|
+
{
|
359
|
+
type: 'partition-keys',
|
360
|
+
name: 'partitionKeys',
|
361
|
+
header: i18next.t('field.partition-keys'),
|
362
|
+
record: {
|
363
|
+
editable: true,
|
364
|
+
options: {
|
365
|
+
objectified: true /* transfered as a object type */
|
366
|
+
}
|
367
|
+
},
|
368
|
+
width: 200
|
369
|
+
},
|
370
|
+
{
|
371
|
+
type: 'crontab',
|
372
|
+
name: 'schedule',
|
373
|
+
label: true,
|
374
|
+
header: i18next.t('field.schedule'),
|
375
|
+
record: {
|
376
|
+
editable: true,
|
377
|
+
options: {
|
378
|
+
objectified: true
|
379
|
+
}
|
380
|
+
},
|
381
|
+
width: 80,
|
382
|
+
imex: {
|
383
|
+
width: 13,
|
384
|
+
header: i18next.t('field.schedule'),
|
385
|
+
type: 'string',
|
386
|
+
key: 'schedule'
|
387
|
+
}
|
388
|
+
},
|
389
|
+
{
|
390
|
+
type: 'select',
|
391
|
+
name: 'timezone',
|
392
|
+
header: i18next.t('field.timezone'),
|
393
|
+
record: {
|
394
|
+
editable: true,
|
395
|
+
options: TIMEZONE_OPTIONS
|
396
|
+
},
|
397
|
+
width: 120,
|
398
|
+
imex: {
|
399
|
+
width: 13,
|
400
|
+
header: i18next.t('field.timezone'),
|
401
|
+
type: 'select',
|
402
|
+
key: 'timezone'
|
403
|
+
}
|
404
|
+
},
|
405
|
+
{
|
406
|
+
type: 'resource-object',
|
407
|
+
name: 'supervisoryRole',
|
408
|
+
header: i18next.t('field.supervisory-role'),
|
409
|
+
record: {
|
410
|
+
editable: true,
|
411
|
+
options: {
|
412
|
+
title: i18next.t('title.lookup role'),
|
413
|
+
queryName: 'roles'
|
414
|
+
}
|
415
|
+
},
|
416
|
+
filter: false,
|
417
|
+
width: 120
|
418
|
+
},
|
419
|
+
{
|
420
|
+
type: 'resource-object',
|
421
|
+
name: 'entryRole',
|
422
|
+
header: i18next.t('field.entry-role'),
|
423
|
+
record: {
|
424
|
+
editable: true,
|
425
|
+
options: {
|
426
|
+
title: i18next.t('title.lookup role'),
|
427
|
+
queryName: 'roles'
|
428
|
+
}
|
429
|
+
},
|
430
|
+
width: 120
|
431
|
+
},
|
432
|
+
{
|
433
|
+
type: 'assignees',
|
434
|
+
name: 'assignees',
|
435
|
+
header: i18next.t('field.assignees'),
|
436
|
+
record: {
|
437
|
+
editable: true
|
438
|
+
},
|
439
|
+
width: 120
|
440
|
+
},
|
441
|
+
{
|
442
|
+
type: 'approval-line',
|
443
|
+
name: 'approvalLine',
|
444
|
+
header: i18next.t('field.approval-line'),
|
445
|
+
record: {
|
446
|
+
editable: true
|
447
|
+
},
|
448
|
+
width: 120
|
449
|
+
},
|
450
|
+
{
|
451
|
+
type: 'select',
|
452
|
+
name: 'entryType',
|
453
|
+
label: true,
|
454
|
+
header: i18next.t('field.entry-type'),
|
455
|
+
record: {
|
456
|
+
editable: true,
|
457
|
+
options: ENTRY_TYPES
|
458
|
+
},
|
459
|
+
width: 80
|
460
|
+
},
|
461
|
+
{
|
462
|
+
type: 'string',
|
463
|
+
name: 'entryView',
|
464
|
+
header: i18next.t('field.entry-view'),
|
465
|
+
record: {
|
466
|
+
editable: true,
|
467
|
+
editor: function (value, column, record, rowIndex, field) {
|
468
|
+
var type = record.entryType !== 'board' ? 'string' : 'board';
|
469
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
470
|
+
},
|
471
|
+
renderer: function (value, column, record, rowIndex, field) {
|
472
|
+
var type = record.entryType !== 'board' ? 'string' : 'board';
|
473
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
474
|
+
}
|
475
|
+
},
|
476
|
+
width: 140
|
477
|
+
},
|
478
|
+
{
|
479
|
+
type: 'select',
|
480
|
+
name: 'monitorType',
|
481
|
+
label: true,
|
482
|
+
header: i18next.t('field.monitor-type'),
|
483
|
+
record: {
|
484
|
+
editable: true,
|
485
|
+
options: MONITOR_TYPES
|
486
|
+
},
|
487
|
+
width: 80
|
488
|
+
},
|
489
|
+
{
|
490
|
+
type: 'string',
|
491
|
+
name: 'monitorView',
|
492
|
+
header: i18next.t('field.monitor-view'),
|
493
|
+
record: {
|
494
|
+
editable: true,
|
495
|
+
editor: function (value, column, record, rowIndex, field) {
|
496
|
+
var type = record.monitorType !== 'board' ? 'string' : 'board';
|
497
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
498
|
+
},
|
499
|
+
renderer: function (value, column, record, rowIndex, field) {
|
500
|
+
var type = record.monitorType !== 'board' ? 'string' : 'board';
|
501
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
502
|
+
}
|
503
|
+
},
|
504
|
+
width: 140
|
505
|
+
},
|
506
|
+
{
|
507
|
+
type: 'select',
|
508
|
+
name: 'reportType',
|
509
|
+
label: true,
|
510
|
+
header: i18next.t('field.report-type'),
|
511
|
+
record: {
|
512
|
+
editable: true,
|
513
|
+
options: REPORT_TYPES
|
514
|
+
},
|
515
|
+
width: 80
|
516
|
+
},
|
517
|
+
{
|
518
|
+
type: 'string',
|
519
|
+
name: 'reportView',
|
520
|
+
header: i18next.t('field.report-view'),
|
521
|
+
record: {
|
522
|
+
editable: true,
|
523
|
+
editor: function (value, column, record, rowIndex, field) {
|
524
|
+
var type = record.reportType !== 'custom' ? 'string' : 'script';
|
525
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
526
|
+
},
|
527
|
+
renderer: function (value, column, record, rowIndex, field) {
|
528
|
+
var type = record.reportType !== 'custom' ? 'string' : 'string';
|
529
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
530
|
+
}
|
531
|
+
},
|
532
|
+
width: 140
|
533
|
+
},
|
534
|
+
{
|
535
|
+
type: 'file',
|
536
|
+
name: 'reportTemplate',
|
537
|
+
header: i18next.t('field.report-template'),
|
538
|
+
record: {
|
539
|
+
editable: true
|
540
|
+
},
|
541
|
+
width: 80
|
542
|
+
},
|
543
|
+
{
|
544
|
+
type: 'resource-object',
|
545
|
+
name: 'updater',
|
546
|
+
header: i18next.t('field.updater'),
|
547
|
+
record: {
|
548
|
+
editable: false
|
549
|
+
},
|
550
|
+
width: 120
|
551
|
+
},
|
552
|
+
{
|
553
|
+
type: 'datetime',
|
554
|
+
name: 'updatedAt',
|
555
|
+
header: i18next.t('field.updated_at'),
|
556
|
+
record: {
|
557
|
+
editable: false
|
558
|
+
},
|
559
|
+
sortable: true,
|
560
|
+
width: 180
|
561
|
+
}
|
562
|
+
],
|
563
|
+
rows: {
|
564
|
+
selectable: {
|
565
|
+
multiple: true
|
566
|
+
}
|
567
|
+
},
|
568
|
+
sorters: [
|
569
|
+
{
|
570
|
+
name: 'name'
|
571
|
+
}
|
572
|
+
]
|
573
|
+
};
|
574
|
+
}
|
575
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
576
|
+
const response = await client.query({
|
577
|
+
query: gql `
|
578
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
579
|
+
responses: dataSets(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
580
|
+
items {
|
581
|
+
id
|
582
|
+
name
|
583
|
+
description
|
584
|
+
partitionKeys
|
585
|
+
active
|
586
|
+
type
|
587
|
+
useCase
|
588
|
+
schedule
|
589
|
+
timezone
|
590
|
+
schedulerHandle
|
591
|
+
dataKeySet {
|
592
|
+
id
|
593
|
+
name
|
594
|
+
}
|
595
|
+
entryRole {
|
596
|
+
id
|
597
|
+
name
|
598
|
+
}
|
599
|
+
supervisoryRole {
|
600
|
+
id
|
601
|
+
name
|
602
|
+
}
|
603
|
+
assignees {
|
604
|
+
type
|
605
|
+
value
|
606
|
+
assignee {
|
607
|
+
id
|
608
|
+
name
|
609
|
+
description
|
610
|
+
controlNo
|
611
|
+
}
|
612
|
+
}
|
613
|
+
approvalLine {
|
614
|
+
type
|
615
|
+
value
|
616
|
+
approver {
|
617
|
+
id
|
618
|
+
name
|
619
|
+
description
|
620
|
+
controlNo
|
621
|
+
}
|
622
|
+
}
|
623
|
+
entryType
|
624
|
+
entryView
|
625
|
+
monitorType
|
626
|
+
monitorView
|
627
|
+
reportType
|
628
|
+
reportView
|
629
|
+
reportTemplate
|
630
|
+
updater {
|
631
|
+
id
|
632
|
+
name
|
633
|
+
}
|
634
|
+
updatedAt
|
635
|
+
dataItems {
|
636
|
+
name
|
637
|
+
description
|
638
|
+
active
|
639
|
+
hidden
|
640
|
+
tag
|
641
|
+
type
|
642
|
+
unit
|
643
|
+
options
|
644
|
+
quota
|
645
|
+
spec
|
646
|
+
}
|
647
|
+
}
|
648
|
+
total
|
649
|
+
}
|
650
|
+
}
|
651
|
+
`,
|
652
|
+
variables: {
|
653
|
+
filters,
|
654
|
+
pagination: { page, limit },
|
655
|
+
sortings
|
656
|
+
}
|
657
|
+
});
|
658
|
+
return {
|
659
|
+
total: response.data.responses.total || 0,
|
660
|
+
records: response.data.responses.items || []
|
661
|
+
};
|
662
|
+
}
|
663
|
+
async _deleteDataSet() {
|
664
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
665
|
+
const ids = this.grist.selected.map(record => record.id);
|
666
|
+
if (ids && ids.length > 0) {
|
667
|
+
const response = await client.mutate({
|
668
|
+
mutation: gql `
|
669
|
+
mutation ($ids: [String!]!) {
|
670
|
+
deleteDataSets(ids: $ids)
|
671
|
+
}
|
672
|
+
`,
|
673
|
+
variables: {
|
674
|
+
ids
|
675
|
+
}
|
676
|
+
});
|
677
|
+
if (!response.errors) {
|
678
|
+
this.grist.fetch();
|
679
|
+
notify({
|
680
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
681
|
+
});
|
682
|
+
}
|
683
|
+
}
|
684
|
+
}
|
685
|
+
}
|
686
|
+
async _copyDataSet() {
|
687
|
+
var selected = this.grist.selected;
|
688
|
+
if (selected.length == 0)
|
689
|
+
return;
|
690
|
+
if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') })))
|
691
|
+
return;
|
692
|
+
var response = await client.mutate({
|
693
|
+
mutation: gql `
|
694
|
+
mutation ($ids: [String!]!) {
|
695
|
+
copyDataSets(ids: $ids) {
|
696
|
+
id
|
697
|
+
}
|
698
|
+
}
|
699
|
+
`,
|
700
|
+
variables: {
|
701
|
+
ids: selected.map(r => r.id)
|
702
|
+
}
|
703
|
+
});
|
704
|
+
if (!response.errors) {
|
705
|
+
this.grist.fetch();
|
706
|
+
}
|
707
|
+
}
|
708
|
+
async _updateDataSet() {
|
709
|
+
let patches = this.grist.dirtyRecords;
|
710
|
+
if (patches && patches.length) {
|
711
|
+
patches = patches.map(patch => {
|
712
|
+
let patchField = patch.id ? { id: patch.id } : {};
|
713
|
+
const dirtyFields = patch.__dirtyfields__;
|
714
|
+
for (let key in dirtyFields) {
|
715
|
+
patchField[key] = dirtyFields[key].after;
|
716
|
+
}
|
717
|
+
if (patchField['reportTemplate'] instanceof FileList) {
|
718
|
+
patchField['reportTemplate'] = patchField['reportTemplate'][0];
|
719
|
+
}
|
720
|
+
patchField.cuFlag = patch.__dirty__;
|
721
|
+
return patchField;
|
722
|
+
});
|
723
|
+
const response = await client.mutate({
|
724
|
+
mutation: gql `
|
725
|
+
mutation ($patches: [DataSetPatch!]!) {
|
726
|
+
updateMultipleDataSet(patches: $patches) {
|
727
|
+
name
|
728
|
+
}
|
729
|
+
}
|
730
|
+
`,
|
731
|
+
variables: {
|
732
|
+
patches
|
733
|
+
},
|
734
|
+
context: {
|
735
|
+
hasUpload: true
|
736
|
+
}
|
737
|
+
});
|
738
|
+
if (!response.errors) {
|
739
|
+
this.grist.fetch();
|
740
|
+
}
|
741
|
+
}
|
742
|
+
}
|
743
|
+
async startDataCollectionSchedule(record) {
|
744
|
+
var response = await client.mutate({
|
745
|
+
mutation: gql `
|
746
|
+
mutation ($dataSetId: String!) {
|
747
|
+
startDataCollectionSchedule(dataSetId: $dataSetId) {
|
748
|
+
schedulerHandle
|
749
|
+
}
|
750
|
+
}
|
751
|
+
`,
|
752
|
+
variables: {
|
753
|
+
dataSetId: record.id
|
754
|
+
}
|
755
|
+
});
|
756
|
+
const schedulerHandle = response.data.startDataCollectionSchedule.schedulerHandle;
|
757
|
+
record.schedulerHandle = schedulerHandle;
|
758
|
+
notify({
|
759
|
+
level: 'info',
|
760
|
+
message: `${record.schedulerHandle ? 'success' : 'fail'} to start data collection schedule : ${record.name}`
|
761
|
+
});
|
762
|
+
this.grist.fetch();
|
763
|
+
}
|
764
|
+
async stopDataCollectionSchedule(record) {
|
765
|
+
var response = await client.mutate({
|
766
|
+
mutation: gql `
|
767
|
+
mutation ($dataSetId: String!) {
|
768
|
+
stopDataCollectionSchedule(dataSetId: $dataSetId) {
|
769
|
+
schedulerHandle
|
770
|
+
}
|
771
|
+
}
|
772
|
+
`,
|
773
|
+
variables: {
|
774
|
+
dataSetId: record.id
|
775
|
+
}
|
776
|
+
});
|
777
|
+
if (!response.errors) {
|
778
|
+
notify({
|
779
|
+
level: 'info',
|
780
|
+
message: `success to stop data collection schedule : ${record.name}`
|
781
|
+
});
|
782
|
+
}
|
783
|
+
else {
|
784
|
+
notify({
|
785
|
+
level: 'error',
|
786
|
+
message: `${response.errors.map(error => error.message).join('\n')}`
|
787
|
+
});
|
788
|
+
}
|
789
|
+
this.grist.fetch();
|
790
|
+
}
|
791
|
+
async exportHandler() {
|
792
|
+
var headerSetting = this.grist._config.columns
|
793
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
794
|
+
.map(column => {
|
795
|
+
return column.imex;
|
796
|
+
});
|
797
|
+
let records = this.grist.data.records;
|
798
|
+
var data = records.map(item => {
|
799
|
+
return Object.assign({ id: item.id }, this.grist._config.columns
|
800
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
801
|
+
.reduce((record, column) => {
|
802
|
+
var imexKey = column.imex.key;
|
803
|
+
record[imexKey] = imexKey
|
804
|
+
.split('.')
|
805
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item);
|
806
|
+
return record;
|
807
|
+
}, {}));
|
808
|
+
});
|
809
|
+
return { header: headerSetting, data: data };
|
810
|
+
}
|
811
|
+
async importHandler(records) {
|
812
|
+
openPopup(html `
|
813
|
+
<data-set-importer
|
814
|
+
.dataSets=${records}
|
815
|
+
@imported=${() => {
|
816
|
+
history.back();
|
817
|
+
this.grist.fetch();
|
818
|
+
}}
|
819
|
+
></data-set-importer>
|
820
|
+
`, {
|
821
|
+
backdrop: true,
|
822
|
+
size: 'large',
|
823
|
+
title: i18next.t('title.import data-set')
|
824
|
+
});
|
825
|
+
}
|
826
|
+
};
|
827
|
+
DataSetListPage.styles = [
|
828
|
+
ScrollbarStyles,
|
829
|
+
CommonGristStyles,
|
830
|
+
css `
|
831
|
+
:host {
|
832
|
+
display: flex;
|
833
|
+
|
834
|
+
width: 100%;
|
835
|
+
|
836
|
+
--grid-record-emphasized-background-color: red;
|
837
|
+
--grid-record-emphasized-color: yellow;
|
838
|
+
}
|
839
|
+
`
|
840
|
+
];
|
841
|
+
__decorate([
|
842
|
+
state(),
|
843
|
+
__metadata("design:type", Object)
|
844
|
+
], DataSetListPage.prototype, "gristConfig", void 0);
|
845
|
+
__decorate([
|
846
|
+
state(),
|
847
|
+
__metadata("design:type", String)
|
848
|
+
], DataSetListPage.prototype, "mode", void 0);
|
849
|
+
__decorate([
|
850
|
+
query('ox-grist'),
|
851
|
+
__metadata("design:type", DataGrist)
|
852
|
+
], DataSetListPage.prototype, "grist", void 0);
|
853
|
+
__decorate([
|
854
|
+
query('#sorter-control'),
|
855
|
+
__metadata("design:type", OxPopup)
|
856
|
+
], DataSetListPage.prototype, "sortersControl", void 0);
|
857
|
+
DataSetListPage = __decorate([
|
858
|
+
customElement('data-set-list-page')
|
859
|
+
], DataSetListPage);
|
860
|
+
export { DataSetListPage };
|
861
|
+
//# sourceMappingURL=data-set-list-page.js.map
|