@things-factory/dataset 5.0.0-alpha.45 → 5.0.0-alpha.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/pages/data-ooc/data-ooc-list-page.js +1 -1
- package/client/pages/data-ooc/data-ooc-view.js +5 -4
- package/client/pages/data-report/data-report-embed-page.js +9 -9
- package/client/pages/data-report/jasper-report-oocs-page.js +15 -13
- package/client/pages/data-report/jasper-report-samples-crosstab-page.js +15 -13
- package/client/pages/data-report/jasper-report-samples-page.js +15 -13
- package/client/pages/data-sample/data-sample-list-page.js +1 -1
- package/client/pages/data-sample/data-sample-view.js +5 -4
- package/client/pages/data-sensor/data-sensor-list-page.js +1 -1
- package/client/pages/data-set/data-set-list-page.js +63 -29
- package/dist-server/service/data-set/data-set-mutation.js +3 -6
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/package.json +17 -17
- package/server/service/data-set/data-set-mutation.ts +6 -7
@@ -67,7 +67,7 @@ export class DataOocListPage extends connect(store)(localize(i18next)(PageView))
|
|
67
67
|
.mode=${mode}
|
68
68
|
.config=${this.gristConfig}
|
69
69
|
.fetchHandler=${this.fetchHandler.bind(this)}
|
70
|
-
url-params-sensitive
|
70
|
+
?url-params-sensitive=${this.active}
|
71
71
|
>
|
72
72
|
<div slot="headroom">
|
73
73
|
<div id="filters">
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import '@operato/dataset/ox-data-ooc-view.js'
|
2
2
|
|
3
|
-
import
|
4
|
-
import {
|
3
|
+
import gql from 'graphql-tag'
|
4
|
+
import { css, html, LitElement } from 'lit'
|
5
5
|
|
6
|
-
import { ScrollbarStyles } from '@operato/styles'
|
7
6
|
import { client } from '@operato/graphql'
|
8
|
-
import
|
7
|
+
import { i18next, localize } from '@operato/i18n'
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
9
9
|
|
10
10
|
class DataOocView extends localize(i18next)(LitElement) {
|
11
11
|
static get styles() {
|
@@ -29,6 +29,7 @@ class DataOocView extends localize(i18next)(LitElement) {
|
|
29
29
|
ox-data-ooc-view {
|
30
30
|
flex: 1;
|
31
31
|
padding: var(--padding-wide);
|
32
|
+
overflow: auto;
|
32
33
|
}
|
33
34
|
|
34
35
|
label[comment] {
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
1
|
import '@operato/data-grist'
|
3
2
|
import '@things-factory/form-ui'
|
4
3
|
|
4
|
+
import { css, html } from 'lit'
|
5
|
+
|
5
6
|
import { i18next, localize } from '@operato/i18n'
|
6
7
|
import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
|
7
8
|
import { PageView } from '@things-factory/shell'
|
8
|
-
import {
|
9
|
+
import { encodeFormParams, getCookie } from '@things-factory/utils'
|
9
10
|
|
10
11
|
class DataReportEmbedPage extends localize(i18next)(PageView) {
|
11
12
|
static get properties() {
|
@@ -69,7 +70,7 @@ class DataReportEmbedPage extends localize(i18next)(PageView) {
|
|
69
70
|
console.log('filters changed', e.detail)
|
70
71
|
this._reportTemplate(e.detail.filters)
|
71
72
|
}}
|
72
|
-
url-params-sensitive
|
73
|
+
?url-params-sensitive=${this.active}
|
73
74
|
></ox-filters-form-base>
|
74
75
|
<iframe id="container" frameborder="0" style="border:0"></iframe>
|
75
76
|
`
|
@@ -82,18 +83,17 @@ class DataReportEmbedPage extends localize(i18next)(PageView) {
|
|
82
83
|
}
|
83
84
|
|
84
85
|
async _reportTemplate(filters) {
|
85
|
-
|
86
86
|
// convert filters array to object
|
87
|
-
const params = filters.reduce((acc,curr) => (acc[curr.name] = curr.value, acc), {})
|
87
|
+
const params = filters.reduce((acc, curr) => ((acc[curr.name] = curr.value), acc), {})
|
88
88
|
Object.assign(params, this.lifecycle.params)
|
89
89
|
|
90
90
|
const { workDateRange, workShift, reportView } = params
|
91
91
|
|
92
92
|
/** ignoring date conditions */
|
93
|
-
if (!workDateRange[0] || !workDateRange[1] ||
|
93
|
+
if (!workDateRange[0] || !workDateRange[1] || workDateRange[0] > workDateRange[1]) {
|
94
94
|
return
|
95
95
|
}
|
96
|
-
|
96
|
+
|
97
97
|
/** urlencoded params including test values */
|
98
98
|
const urlParams = {
|
99
99
|
table: 'samples',
|
@@ -103,11 +103,11 @@ class DataReportEmbedPage extends localize(i18next)(PageView) {
|
|
103
103
|
token: getCookie('access_token'),
|
104
104
|
workShift
|
105
105
|
}
|
106
|
-
|
106
|
+
|
107
107
|
const encodedUrlParams = encodeFormParams(urlParams)
|
108
108
|
|
109
109
|
this.shadowRoot.querySelector('#container').src = `${reportView}?params=${encodedUrlParams}`
|
110
110
|
}
|
111
111
|
}
|
112
112
|
|
113
|
-
window.customElements.define('data-report-embed-page', DataReportEmbedPage)
|
113
|
+
window.customElements.define('data-report-embed-page', DataReportEmbedPage)
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
1
|
import '@operato/data-grist'
|
3
2
|
import '@operato/form'
|
4
3
|
|
4
|
+
import { css, html } from 'lit'
|
5
|
+
|
5
6
|
import { i18next, localize } from '@operato/i18n'
|
6
7
|
import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
|
7
8
|
import { PageView } from '@things-factory/shell'
|
@@ -69,7 +70,7 @@ class JasperReportOocsPage extends localize(i18next)(PageView) {
|
|
69
70
|
console.log('filters changed', e.detail)
|
70
71
|
this._reportTemplate(e.detail.filters)
|
71
72
|
}}
|
72
|
-
url-params-sensitive
|
73
|
+
?url-params-sensitive=${this.active}
|
73
74
|
></ox-filters-form-base>
|
74
75
|
<iframe id="container"></iframe>
|
75
76
|
`
|
@@ -85,16 +86,16 @@ class JasperReportOocsPage extends localize(i18next)(PageView) {
|
|
85
86
|
}
|
86
87
|
|
87
88
|
async _reportTemplate(filters) {
|
88
|
-
const params = filters.reduce((acc,curr) => (acc[curr.name] = curr.value, acc), {})
|
89
|
+
const params = filters.reduce((acc, curr) => ((acc[curr.name] = curr.value), acc), {})
|
89
90
|
Object.assign(params, this.lifecycle.params)
|
90
91
|
|
91
92
|
const { workDateRange, workShift, template } = params
|
92
93
|
|
93
94
|
/** ignoring date conditions */
|
94
|
-
if (!workDateRange[0] || !workDateRange[1] ||
|
95
|
+
if (!workDateRange[0] || !workDateRange[1] || workDateRange[0] > workDateRange[1]) {
|
95
96
|
return
|
96
97
|
}
|
97
|
-
|
98
|
+
|
98
99
|
/** urlencoded params including test values */
|
99
100
|
const urlParams = {
|
100
101
|
table: 'ooc',
|
@@ -105,16 +106,17 @@ class JasperReportOocsPage extends localize(i18next)(PageView) {
|
|
105
106
|
template,
|
106
107
|
templateType: 'normal'
|
107
108
|
}
|
108
|
-
|
109
|
-
const encodedUrlParams = Object.keys(urlParams)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
109
|
+
|
110
|
+
const encodedUrlParams = Object.keys(urlParams)
|
111
|
+
.filter(key => {
|
112
|
+
// ignore empty
|
113
|
+
return !!urlParams[key]
|
114
|
+
})
|
115
|
+
.map(key => `${key}=${encodeURIComponent(urlParams[key])}`)
|
116
|
+
.join('&')
|
115
117
|
|
116
118
|
this.shadowRoot.querySelector('#container').src = `/data-report/jasper?${encodedUrlParams}`
|
117
119
|
}
|
118
120
|
}
|
119
121
|
|
120
|
-
window.customElements.define('jasper-report-oocs-page', JasperReportOocsPage)
|
122
|
+
window.customElements.define('jasper-report-oocs-page', JasperReportOocsPage)
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
1
|
import '@operato/data-grist'
|
3
2
|
import '@operato/form'
|
4
3
|
|
4
|
+
import { css, html } from 'lit'
|
5
|
+
|
5
6
|
import { i18next, localize } from '@operato/i18n'
|
6
7
|
import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
|
7
8
|
import { PageView } from '@things-factory/shell'
|
@@ -69,7 +70,7 @@ class JasperReportSamplesCrosstabPage extends localize(i18next)(PageView) {
|
|
69
70
|
console.log('filters changed', e.detail)
|
70
71
|
this._reportTemplate(e.detail.filters)
|
71
72
|
}}
|
72
|
-
url-params-sensitive
|
73
|
+
?url-params-sensitive=${this.active}
|
73
74
|
></ox-filters-form-base>
|
74
75
|
<iframe id="container"></iframe>
|
75
76
|
`
|
@@ -85,16 +86,16 @@ class JasperReportSamplesCrosstabPage extends localize(i18next)(PageView) {
|
|
85
86
|
}
|
86
87
|
|
87
88
|
async _reportTemplate(filters) {
|
88
|
-
const params = filters.reduce((acc,curr) => (acc[curr.name] = curr.value, acc), {})
|
89
|
+
const params = filters.reduce((acc, curr) => ((acc[curr.name] = curr.value), acc), {})
|
89
90
|
Object.assign(params, this.lifecycle.params)
|
90
91
|
|
91
92
|
const { workDateRange, workShift, template } = params
|
92
93
|
|
93
94
|
/** ignoring date conditions */
|
94
|
-
if (!workDateRange[0] || !workDateRange[1] ||
|
95
|
+
if (!workDateRange[0] || !workDateRange[1] || workDateRange[0] > workDateRange[1]) {
|
95
96
|
return
|
96
97
|
}
|
97
|
-
|
98
|
+
|
98
99
|
/** urlencoded params including test values */
|
99
100
|
const urlParams = {
|
100
101
|
table: 'samples',
|
@@ -105,16 +106,17 @@ class JasperReportSamplesCrosstabPage extends localize(i18next)(PageView) {
|
|
105
106
|
template,
|
106
107
|
templateType: 'crosstab'
|
107
108
|
}
|
108
|
-
|
109
|
-
const encodedUrlParams = Object.keys(urlParams)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
109
|
+
|
110
|
+
const encodedUrlParams = Object.keys(urlParams)
|
111
|
+
.filter(key => {
|
112
|
+
// ignore empty
|
113
|
+
return !!urlParams[key]
|
114
|
+
})
|
115
|
+
.map(key => `${key}=${encodeURIComponent(urlParams[key])}`)
|
116
|
+
.join('&')
|
115
117
|
|
116
118
|
this.shadowRoot.querySelector('#container').src = `/data-report/jasper?${encodedUrlParams}`
|
117
119
|
}
|
118
120
|
}
|
119
121
|
|
120
|
-
window.customElements.define('jasper-report-samples-crosstab-page', JasperReportSamplesCrosstabPage)
|
122
|
+
window.customElements.define('jasper-report-samples-crosstab-page', JasperReportSamplesCrosstabPage)
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
1
|
import '@operato/data-grist'
|
3
2
|
import '@operato/form'
|
4
3
|
|
4
|
+
import { css, html } from 'lit'
|
5
|
+
|
5
6
|
import { i18next, localize } from '@operato/i18n'
|
6
7
|
import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
|
7
8
|
import { PageView } from '@things-factory/shell'
|
@@ -69,7 +70,7 @@ class JasperReportSamplesPage extends localize(i18next)(PageView) {
|
|
69
70
|
console.log('filters changed', e.detail)
|
70
71
|
this._reportTemplate(e.detail.filters)
|
71
72
|
}}
|
72
|
-
url-params-sensitive
|
73
|
+
?url-params-sensitive=${this.active}
|
73
74
|
></ox-filters-form-base>
|
74
75
|
<iframe id="container"></iframe>
|
75
76
|
`
|
@@ -85,16 +86,16 @@ class JasperReportSamplesPage extends localize(i18next)(PageView) {
|
|
85
86
|
}
|
86
87
|
|
87
88
|
async _reportTemplate(filters) {
|
88
|
-
const params = filters.reduce((acc,curr) => (acc[curr.name] = curr.value, acc), {})
|
89
|
+
const params = filters.reduce((acc, curr) => ((acc[curr.name] = curr.value), acc), {})
|
89
90
|
Object.assign(params, this.lifecycle.params)
|
90
91
|
|
91
92
|
const { workDateRange, workShift, template } = params
|
92
93
|
|
93
94
|
/** ignoring date conditions */
|
94
|
-
if (!workDateRange[0] || !workDateRange[1] ||
|
95
|
+
if (!workDateRange[0] || !workDateRange[1] || workDateRange[0] > workDateRange[1]) {
|
95
96
|
return
|
96
97
|
}
|
97
|
-
|
98
|
+
|
98
99
|
/** urlencoded params including test values */
|
99
100
|
const urlParams = {
|
100
101
|
table: 'samples',
|
@@ -105,16 +106,17 @@ class JasperReportSamplesPage extends localize(i18next)(PageView) {
|
|
105
106
|
template,
|
106
107
|
templateType: 'normal'
|
107
108
|
}
|
108
|
-
|
109
|
-
const encodedUrlParams = Object.keys(urlParams)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
109
|
+
|
110
|
+
const encodedUrlParams = Object.keys(urlParams)
|
111
|
+
.filter(key => {
|
112
|
+
// ignore empty
|
113
|
+
return !!urlParams[key]
|
114
|
+
})
|
115
|
+
.map(key => `${key}=${encodeURIComponent(urlParams[key])}`)
|
116
|
+
.join('&')
|
115
117
|
|
116
118
|
this.shadowRoot.querySelector('#container').src = `/data-report/jasper?${encodedUrlParams}`
|
117
119
|
}
|
118
120
|
}
|
119
121
|
|
120
|
-
window.customElements.define('jasper-report-samples-page', JasperReportSamplesPage)
|
122
|
+
window.customElements.define('jasper-report-samples-page', JasperReportSamplesPage)
|
@@ -61,7 +61,7 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
|
|
61
61
|
.mode=${mode}
|
62
62
|
.config=${this.gristConfig}
|
63
63
|
.fetchHandler=${this.fetchHandler.bind(this)}
|
64
|
-
url-params-sensitive
|
64
|
+
?url-params-sensitive=${this.active}
|
65
65
|
>
|
66
66
|
<div slot="headroom">
|
67
67
|
<div id="filters">
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import '@operato/dataset/ox-data-sample-view.js'
|
2
2
|
|
3
|
-
import
|
4
|
-
import {
|
3
|
+
import gql from 'graphql-tag'
|
4
|
+
import { css, html, LitElement } from 'lit'
|
5
5
|
|
6
|
-
import { ScrollbarStyles } from '@operato/styles'
|
7
6
|
import { client } from '@operato/graphql'
|
8
|
-
import
|
7
|
+
import { i18next, localize } from '@operato/i18n'
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
9
9
|
|
10
10
|
class DataSampleView extends localize(i18next)(LitElement) {
|
11
11
|
static get properties() {
|
@@ -36,6 +36,7 @@ class DataSampleView extends localize(i18next)(LitElement) {
|
|
36
36
|
ox-data-sample-view {
|
37
37
|
flex: 1;
|
38
38
|
padding: var(--padding-wide);
|
39
|
+
overflow: auto;
|
39
40
|
}
|
40
41
|
`
|
41
42
|
]
|
@@ -72,7 +72,7 @@ export class DataSensorListPage extends connect(store)(localize(i18next)(PageVie
|
|
72
72
|
.mode=${mode}
|
73
73
|
.config=${this.gristConfig}
|
74
74
|
.fetchHandler=${this.fetchHandler.bind(this)}
|
75
|
-
url-params-sensitive
|
75
|
+
?url-params-sensitive=${this.active}
|
76
76
|
>
|
77
77
|
<div slot="headroom">
|
78
78
|
<div id="filters">
|
@@ -16,7 +16,6 @@ import { notify, openPopup } from '@operato/layout'
|
|
16
16
|
import { PageView, store } from '@operato/shell'
|
17
17
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
18
18
|
import { isMobileDevice } from '@operato/utils'
|
19
|
-
import { FileSelector } from '@things-factory/attachment-ui'
|
20
19
|
|
21
20
|
const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
|
22
21
|
const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
|
@@ -101,7 +100,6 @@ const USECASE_OPTIONS = () => {
|
|
101
100
|
export class DataSetListPage extends connect(store)(localize(i18next)(PageView)) {
|
102
101
|
static get properties() {
|
103
102
|
return {
|
104
|
-
active: String,
|
105
103
|
gristConfig: Object,
|
106
104
|
mode: String
|
107
105
|
}
|
@@ -163,7 +161,7 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
163
161
|
.mode=${mode}
|
164
162
|
.config=${this.gristConfig}
|
165
163
|
.fetchHandler=${this.fetchHandler.bind(this)}
|
166
|
-
url-params-sensitive
|
164
|
+
?url-params-sensitive=${this.active}
|
167
165
|
>
|
168
166
|
<div slot="headroom">
|
169
167
|
<div id="filters">
|
@@ -202,7 +200,6 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
202
200
|
}
|
203
201
|
|
204
202
|
async pageInitialized(lifecycle) {
|
205
|
-
const fileSelector = new FileSelector()
|
206
203
|
this.gristConfig = {
|
207
204
|
list: {
|
208
205
|
fields: ['name', 'description'],
|
@@ -256,7 +253,13 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
256
253
|
},
|
257
254
|
filter: 'search',
|
258
255
|
sortable: true,
|
259
|
-
width: 150
|
256
|
+
width: 150,
|
257
|
+
imex: {
|
258
|
+
width: 25,
|
259
|
+
header: i18next.t('field.name'),
|
260
|
+
type: 'string',
|
261
|
+
key: 'name'
|
262
|
+
}
|
260
263
|
},
|
261
264
|
{
|
262
265
|
type: 'string',
|
@@ -266,7 +269,13 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
266
269
|
editable: true
|
267
270
|
},
|
268
271
|
filter: 'search',
|
269
|
-
width: 200
|
272
|
+
width: 200,
|
273
|
+
imex: {
|
274
|
+
width: 33,
|
275
|
+
header: i18next.t('field.description'),
|
276
|
+
type: 'string',
|
277
|
+
key: 'description'
|
278
|
+
}
|
270
279
|
},
|
271
280
|
{
|
272
281
|
type: 'checkbox',
|
@@ -278,7 +287,13 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
278
287
|
},
|
279
288
|
filter: true,
|
280
289
|
sortable: true,
|
281
|
-
width: 60
|
290
|
+
width: 60,
|
291
|
+
imex: {
|
292
|
+
width: 10,
|
293
|
+
header: i18next.t('field.active'),
|
294
|
+
type: 'checkbox',
|
295
|
+
key: 'active'
|
296
|
+
}
|
282
297
|
},
|
283
298
|
{
|
284
299
|
type: 'select',
|
@@ -301,7 +316,13 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
301
316
|
},
|
302
317
|
sortable: true,
|
303
318
|
filter: true,
|
304
|
-
width: 60
|
319
|
+
width: 60,
|
320
|
+
imex: {
|
321
|
+
width: 10,
|
322
|
+
header: i18next.t('field.type'),
|
323
|
+
type: 'select',
|
324
|
+
key: 'type'
|
325
|
+
}
|
305
326
|
},
|
306
327
|
{
|
307
328
|
type: 'select',
|
@@ -343,7 +364,13 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
343
364
|
}
|
344
365
|
},
|
345
366
|
width: 80,
|
346
|
-
label: true
|
367
|
+
label: true,
|
368
|
+
imex: {
|
369
|
+
width: 13,
|
370
|
+
header: i18next.t('field.schedule'),
|
371
|
+
type: 'string',
|
372
|
+
key: 'schedule'
|
373
|
+
}
|
347
374
|
},
|
348
375
|
{
|
349
376
|
type: 'select',
|
@@ -353,7 +380,13 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
353
380
|
editable: true,
|
354
381
|
options: TIMEZONE_OPTIONS
|
355
382
|
},
|
356
|
-
width: 120
|
383
|
+
width: 120,
|
384
|
+
imex: {
|
385
|
+
width: 13,
|
386
|
+
header: i18next.t('field.timezone'),
|
387
|
+
type: 'select',
|
388
|
+
key: 'timezone'
|
389
|
+
}
|
357
390
|
},
|
358
391
|
{
|
359
392
|
type: 'resource-object',
|
@@ -666,27 +699,28 @@ export class DataSetListPage extends connect(store)(localize(i18next)(PageView))
|
|
666
699
|
}
|
667
700
|
|
668
701
|
async exportHandler() {
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
'description',
|
675
|
-
'tag',
|
676
|
-
'schedule',
|
677
|
-
'timezone',
|
678
|
-
'active',
|
679
|
-
'dataItems'
|
680
|
-
])
|
681
|
-
|
682
|
-
return exportTargets.map(dataSet => {
|
683
|
-
let tempObj = {}
|
684
|
-
for (const field of targetFieldSet) {
|
685
|
-
tempObj[field] = dataSet[field]
|
686
|
-
}
|
702
|
+
var headerSetting = this.grist._config.columns
|
703
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
704
|
+
.map(column => {
|
705
|
+
return column.imex
|
706
|
+
})
|
687
707
|
|
688
|
-
|
708
|
+
let records = this.grist.data.records
|
709
|
+
|
710
|
+
var data = records.map(item => {
|
711
|
+
return {
|
712
|
+
id: item.id,
|
713
|
+
...this.grist._config.columns
|
714
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
715
|
+
.reduce((record, column) => {
|
716
|
+
record[column.imex.key] = column.imex.key
|
717
|
+
.split('.')
|
718
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
|
719
|
+
return record
|
720
|
+
}, {})
|
721
|
+
}
|
689
722
|
})
|
723
|
+
return { header: headerSetting, data: data }
|
690
724
|
}
|
691
725
|
|
692
726
|
async importHandler(records) {
|
@@ -11,18 +11,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
13
13
|
};
|
14
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
15
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
16
|
-
};
|
17
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
15
|
exports.DataSetMutation = void 0;
|
19
16
|
const type_graphql_1 = require("type-graphql");
|
20
17
|
const typeorm_1 = require("typeorm");
|
21
|
-
const v4_1 = __importDefault(require("uuid/v4"));
|
22
18
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
23
19
|
const data_item_1 = require("../data-item/data-item");
|
24
20
|
const data_set_1 = require("./data-set");
|
25
21
|
const data_set_type_1 = require("./data-set-type");
|
22
|
+
const crypto = require('crypto');
|
26
23
|
let DataSetMutation = class DataSetMutation {
|
27
24
|
async createDataSet(dataSet, context) {
|
28
25
|
const { domain, user, tx } = context.state;
|
@@ -112,7 +109,7 @@ let DataSetMutation = class DataSetMutation {
|
|
112
109
|
}
|
113
110
|
var newDataItems = [];
|
114
111
|
var newCopys = originals.map(dataSet => {
|
115
|
-
let dataSetId =
|
112
|
+
let dataSetId = crypto.randomUUID();
|
116
113
|
newDataItems.push(...dataSet.dataItems.map(dataItem => {
|
117
114
|
return {
|
118
115
|
dataSet: dataSetId,
|
@@ -157,7 +154,7 @@ let DataSetMutation = class DataSetMutation {
|
|
157
154
|
async _createAttachment(context, attachment, { refId, cuFlag }) {
|
158
155
|
if (attachment) {
|
159
156
|
const attachmentRef = 'report-' + refId;
|
160
|
-
cuFlag == 'M' && await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [attachmentRef] }, context);
|
157
|
+
cuFlag == 'M' && (await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [attachmentRef] }, context));
|
161
158
|
await (0, attachment_base_1.createAttachment)(null, {
|
162
159
|
attachment: {
|
163
160
|
file: attachment,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-set-mutation.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-mutation.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"data-set-mutation.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAA2C;AAE3C,qEAA0F;AAG1F,sDAAiD;AACjD,yCAAoC;AACpC,mDAA0D;AAE1D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAGhC,IAAa,eAAe,GAA5B,MAAa,eAAe;IAI1B,KAAK,CAAC,aAAa,CAAiB,OAAmB,EAAS,OAAY;QAC1E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAC,IAAI,iCAC9C,OAAO,KACV,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;QAEhG,OAAO,MAAM,CAAA;IACf,CAAC;IAKD,KAAK,CAAC,aAAa,CAAY,EAAU,EAAgB,KAAmB,EA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IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,kBAAO,CAAC,EAAE,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;IAC1D,WAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;mDAiErE;AAxNU,eAAe;IAD3B,IAAA,uBAAQ,EAAC,kBAAO,CAAC;GACL,eAAe,CA0O3B;AA1OY,0CAAe"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/dataset",
|
3
|
-
"version": "5.0.0-alpha.
|
3
|
+
"version": "5.0.0-alpha.48",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -24,23 +24,23 @@
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@operato/app": "1.0.0-beta.
|
28
|
-
"@operato/data-grist": "1.0.0-beta.
|
29
|
-
"@operato/dataset": "1.0.0-beta.
|
30
|
-
"@operato/graphql": "1.0.0-beta.
|
31
|
-
"@operato/i18n": "1.0.0-beta.
|
32
|
-
"@operato/layout": "1.0.0-beta.
|
33
|
-
"@operato/shell": "1.0.0-beta.
|
34
|
-
"@operato/styles": "1.0.0-beta.
|
35
|
-
"@operato/utils": "1.0.0-beta.
|
36
|
-
"@things-factory/auth-base": "^5.0.0-alpha.
|
37
|
-
"@things-factory/aws-base": "^5.0.0-alpha.
|
38
|
-
"@things-factory/board-service": "^5.0.0-alpha.
|
39
|
-
"@things-factory/env": "^5.0.0-alpha.
|
40
|
-
"@things-factory/shell": "^5.0.0-alpha.
|
41
|
-
"@things-factory/work-shift": "^5.0.0-alpha.
|
27
|
+
"@operato/app": "1.0.0-beta.18",
|
28
|
+
"@operato/data-grist": "1.0.0-beta.18",
|
29
|
+
"@operato/dataset": "1.0.0-beta.18",
|
30
|
+
"@operato/graphql": "1.0.0-beta.18",
|
31
|
+
"@operato/i18n": "1.0.0-beta.18",
|
32
|
+
"@operato/layout": "1.0.0-beta.18",
|
33
|
+
"@operato/shell": "1.0.0-beta.18",
|
34
|
+
"@operato/styles": "1.0.0-beta.18",
|
35
|
+
"@operato/utils": "1.0.0-beta.18",
|
36
|
+
"@things-factory/auth-base": "^5.0.0-alpha.48",
|
37
|
+
"@things-factory/aws-base": "^5.0.0-alpha.48",
|
38
|
+
"@things-factory/board-service": "^5.0.0-alpha.48",
|
39
|
+
"@things-factory/env": "^5.0.0-alpha.48",
|
40
|
+
"@things-factory/shell": "^5.0.0-alpha.48",
|
41
|
+
"@things-factory/work-shift": "^5.0.0-alpha.48",
|
42
42
|
"cron-parser": "^4.3.0",
|
43
43
|
"moment-timezone": "^0.5.34"
|
44
44
|
},
|
45
|
-
"gitHead": "
|
45
|
+
"gitHead": "0fa9b26abce176fa96d820fb50cc5565760d50c9"
|
46
46
|
}
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
2
2
|
import { EntityManager, In } from 'typeorm'
|
3
|
-
import uuid from 'uuid/v4'
|
4
3
|
|
5
|
-
import { Domain } from '@things-factory/shell'
|
6
4
|
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
5
|
+
import { Domain } from '@things-factory/shell'
|
7
6
|
|
8
7
|
import { DataItem } from '../data-item/data-item'
|
9
8
|
import { DataSet } from './data-set'
|
10
9
|
import { DataSetPatch, NewDataSet } from './data-set-type'
|
11
10
|
|
11
|
+
const crypto = require('crypto')
|
12
|
+
|
12
13
|
@Resolver(DataSet)
|
13
14
|
export class DataSetMutation {
|
14
15
|
@Directive('@privilege(category: "data-set", privilege: "mutation", domainOwnerGranted: true)')
|
@@ -126,7 +127,7 @@ export class DataSetMutation {
|
|
126
127
|
id: In(ids)
|
127
128
|
})
|
128
129
|
|
129
|
-
await deleteAttachmentsByRef(null, { refBys: ids.map(id => `report-${id}`) }
|
130
|
+
await deleteAttachmentsByRef(null, { refBys: ids.map(id => `report-${id}`) }, context)
|
130
131
|
|
131
132
|
return true
|
132
133
|
}
|
@@ -179,7 +180,7 @@ export class DataSetMutation {
|
|
179
180
|
var newDataItems = []
|
180
181
|
|
181
182
|
var newCopys = originals.map(dataSet => {
|
182
|
-
let dataSetId =
|
183
|
+
let dataSetId = crypto.randomUUID()
|
183
184
|
newDataItems.push(
|
184
185
|
...dataSet.dataItems.map(dataItem => {
|
185
186
|
return {
|
@@ -228,11 +229,10 @@ export class DataSetMutation {
|
|
228
229
|
})
|
229
230
|
}
|
230
231
|
|
231
|
-
|
232
232
|
async _createAttachment(context, attachment, { refId, cuFlag }) {
|
233
233
|
if (attachment) {
|
234
234
|
const attachmentRef = 'report-' + refId
|
235
|
-
cuFlag == 'M' && await deleteAttachmentsByRef(null, { refBys: [attachmentRef] }, context)
|
235
|
+
cuFlag == 'M' && (await deleteAttachmentsByRef(null, { refBys: [attachmentRef] }, context))
|
236
236
|
await createAttachment(
|
237
237
|
null,
|
238
238
|
{
|
@@ -246,4 +246,3 @@ export class DataSetMutation {
|
|
246
246
|
}
|
247
247
|
}
|
248
248
|
}
|
249
|
-
|