@things-factory/reference-app 5.0.0-zeta.7 → 5.0.0
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/attachments/1aa35791-259f-42f3-9bab-faf4dc81c54a.png +0 -0
- package/attachments/39e79f93-f50c-4d0d-9016-12ef6fc72d04.pptx +0 -0
- package/attachments/5705d276-f428-44d6-a0b8-9667671fc011.png +0 -0
- package/attachments/5f63a469-132c-4ddd-a7a8-37d01f693c9d.png +0 -0
- package/attachments/69808491-8e6b-45e2-9bf8-dccea1c5b52e.png +0 -0
- package/attachments/6c3b55e5-8a42-4afa-a456-9f540972a4b5.png +0 -0
- package/attachments/7927fe8e-2246-453d-9869-7072b983437c.png +0 -0
- package/attachments/7d150574-01b8-4439-96a0-d57299f3ffcf.png +0 -0
- package/attachments/8bacec9a-bd5d-4dbf-bbcb-9f08dd7b60d5.png +0 -0
- package/attachments/a1cf142c-f3c2-442c-b8d5-a7f9cc6a59b3.png +0 -0
- package/attachments/aedcc3d7-a4ab-4ada-98bd-0db6fa5061ba.png +0 -0
- package/attachments/c1cd9051-bcf4-4711-89a2-63dfefbd969a.png +0 -0
- package/attachments/cb3ac834-ece0-4802-bef0-dfdc0fcd93bd.png +0 -0
- package/attachments/fb06c90b-df44-4ac7-b71c-056278439290.png +0 -0
- package/client/bootstrap.js +21 -11
- package/client/components/ocr-viewpart.js +1 -1
- package/client/editors/id-editor.js +1 -1
- package/client/editors/id-selector.js +1 -1
- package/client/menu.js +10 -5
- package/client/pages/data-entry/data-entry-form.js +117 -0
- package/client/pages/data-entry/data-entry-generator-popup.js +110 -0
- package/client/pages/data-set/data-item-list.js +277 -0
- package/client/pages/data-set/data-set-importer.js +103 -0
- package/client/pages/data-set/data-set-list-page.js +738 -0
- package/client/pages/ocr-page.js +1 -1
- package/client/pages/operation/operation-api.js +85 -0
- package/client/pages/operation/operation-master.js +432 -0
- package/client/pages/pending-job-page.js +1 -1
- package/client/pages/product/product-api.js +150 -0
- package/client/pages/product/product-master.js +888 -0
- package/client/pages/product-combination-settings-popup.js +395 -0
- package/client/pages/product-combinations-popup.js +372 -0
- package/client/pages/product-details-popup.js +744 -0
- package/client/pages/upload-page.js +1 -1
- package/client/route.js +12 -0
- package/config/config.development.js +1 -1
- package/config.development.js +16 -2
- package/db.sqlite +0 -0
- package/dist-server/constants/index.js +18 -0
- package/dist-server/constants/index.js.map +1 -0
- package/dist-server/constants/type-constants.js +26 -0
- package/dist-server/constants/type-constants.js.map +1 -0
- package/dist-server/controllers/create-data-sample-mockup.js +236 -0
- package/dist-server/controllers/create-data-sample-mockup.js.map +1 -0
- package/dist-server/controllers/index.js +17 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/service/data-sample-mockup/data-sample-mockup-mutation.js +40 -0
- package/dist-server/service/data-sample-mockup/data-sample-mockup-mutation.js.map +1 -0
- package/dist-server/service/data-sample-mockup/data-sample-mockup-type.js +28 -0
- package/dist-server/service/data-sample-mockup/data-sample-mockup-type.js.map +1 -0
- package/dist-server/service/data-sample-mockup/index.js +7 -0
- package/dist-server/service/data-sample-mockup/index.js.map +1 -0
- package/dist-server/service/index.js +5 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/reference/reference-mutation.js +6 -3
- package/dist-server/service/reference/reference-mutation.js.map +1 -1
- package/dist-server/service/reference/reference-query.js +7 -4
- package/dist-server/service/reference/reference-query.js.map +1 -1
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +4 -4
- package/logs/.33a2b6820ab05dbb0f8bea4849090e12685d0b36-audit.json +3 -8
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +29 -4
- package/logs/application-2022-06-16-13.log +4 -0
- package/logs/application-2022-06-16-20.log +4 -0
- package/logs/application-2022-06-16-21.log +7 -0
- package/logs/application-2022-07-22-10.log +26 -0
- package/logs/{connections-2022-01-17-14.log → connections-2022-01-01-00.log} +0 -0
- package/logs/{connections-2022-01-17-15.log → connections-2022-06-05-11.log} +0 -0
- package/logs/{connections-2022-06-20-13.log → connections-2022-06-08-11.log} +0 -0
- package/logs/connections-2022-06-08-12.log +0 -0
- package/logs/connections-2022-06-08-13.log +0 -0
- package/logs/connections-2022-06-08-15.log +0 -0
- package/logs/connections-2022-06-08-16.log +0 -0
- package/logs/connections-2022-06-08-17.log +0 -0
- package/logs/connections-2022-06-08-18.log +0 -0
- package/logs/connections-2022-06-09-00.log +0 -0
- package/logs/connections-2022-06-10-10.log +0 -0
- package/logs/connections-2022-06-10-15.log +0 -0
- package/logs/connections-2022-06-12-17.log +0 -0
- package/logs/connections-2022-06-12-19.log +0 -0
- package/logs/connections-2022-06-16-13.log +0 -0
- package/logs/connections-2022-06-16-20.log +0 -0
- package/logs/connections-2022-06-16-21.log +0 -0
- package/logs/connections-2022-07-12-00.log +0 -0
- package/logs/connections-2022-07-14-14.log +0 -0
- package/logs/connections-2022-07-14-15.log +0 -0
- package/logs/connections-2022-07-14-16.log +0 -0
- package/logs/connections-2022-07-14-17.log +0 -0
- package/logs/connections-2022-07-22-10.log +0 -0
- package/logs/system/.de213bae5e079f641b78bdb917979b79dcc8e501-audit.json +15 -0
- package/logs/system/scenario-1-2022-04-15-16.log +176 -0
- package/package.json +58 -56
- package/server/constants/index.ts +1 -0
- package/server/constants/type-constants.ts +24 -0
- package/server/controllers/create-data-sample-mockup.ts +268 -0
- package/server/controllers/index.ts +1 -0
- package/server/service/data-sample-mockup/data-sample-mockup-mutation.ts +18 -0
- package/server/service/data-sample-mockup/data-sample-mockup-type.ts +10 -0
- package/server/service/data-sample-mockup/index.ts +4 -0
- package/server/service/index.ts +5 -2
- package/server/service/reference/reference-mutation.ts +5 -3
- package/server/service/reference/reference-query.ts +8 -7
- package/things-factory.config.js +8 -0
- package/translations/en.json +6 -1
- package/translations/ko.json +7 -1
- package/attachments/02d2c4ea-147a-411e-a34e-5dbd96eea3f8.jpeg +0 -0
- package/attachments/05284c84-1330-4b54-a698-bcd3020d9d90.png +0 -0
- package/attachments/0554c8c2-aefe-4ce5-b030-94c643976577.jpeg +0 -0
- package/attachments/0598f578-ddd9-4b8c-8726-74ea5fe13778.jpeg +0 -0
- package/attachments/09fd9f4d-1909-4fbb-b5bd-b3604dd44d83.pdf +0 -0
- package/attachments/0c759fb7-b15a-4eba-b55f-1c97c9320e12.jpeg +0 -0
- package/attachments/0ca13d71-3df4-4932-b834-0057a6454776.jpeg +0 -0
- package/attachments/0fe94be8-c2bf-44ea-b8bd-3b2e5d65cb07.png +0 -0
- package/attachments/105aff20-62d2-41ae-a9ab-8ea1eb03a064.jpeg +0 -0
- package/attachments/124d6ef2-6ab9-4963-8b0b-5f8607b79a5b.png +0 -0
- package/attachments/1a4edbc9-b06c-4e1b-8b7a-4af7a8a08720.jpeg +0 -0
- package/attachments/1aaa7721-7a6c-47fa-a375-b186b82dd3b1.jpeg +0 -0
- package/attachments/1e647161-13ff-4540-9115-0fe383860516.jpeg +0 -0
- package/attachments/1e7fec94-e08f-468e-af89-e108904e4401.png +0 -0
- package/attachments/1ee44a5b-b946-4609-bf09-bc4f741325f1.png +0 -0
- package/attachments/244fbab5-0821-4e57-8c7e-745feaac12b3.jpeg +0 -0
- package/attachments/2b1cfec6-4d1c-4130-8ac5-5dffa64ac4d5.png +0 -0
- package/attachments/3a328a7f-b7fd-4ea1-9c4c-005e24e1e897.png +0 -0
- package/attachments/3c562896-8cc8-489b-8760-5109602b631a.jpeg +0 -0
- package/attachments/426bd3d4-aaec-496c-8d20-a84692d574dc.jpeg +0 -0
- package/attachments/4412432a-b79b-49b8-81b2-af6b927703b4.png +0 -0
- package/attachments/5427ece0-13b3-48a8-ac14-b25dcfae3cd9.jpeg +0 -0
- package/attachments/56aad6a3-e99d-4186-985b-d8d3ccd4ab68.jpeg +0 -0
- package/attachments/5a4d23c9-6fa0-43ce-87d1-27fbb252438d.jpeg +0 -0
- package/attachments/5a564ed4-1858-4656-8d88-b6a490bc0309.jpeg +0 -0
- package/attachments/5ba01610-dc05-483e-8988-da9d34c141df.jpeg +0 -0
- package/attachments/5d34b97a-61b9-472f-a88f-636b85c1e45c.jpeg +0 -0
- package/attachments/5dc41b95-4970-4221-accb-86afa94b4f3b.png +0 -0
- package/attachments/60ca3d2a-cfa4-4f14-b952-a96be9f64f96.png +0 -0
- package/attachments/62232866-32ef-43fe-b84b-993d074c173d.png +0 -0
- package/attachments/6309383a-7c72-4a2c-8fb9-b14fe4f1905a.jpeg +0 -0
- package/attachments/63142721-6030-4889-b52d-d21e8ddd52cd.jpeg +0 -0
- package/attachments/6a284a40-de4a-4e79-adbb-fe2ac6f123d4.png +0 -0
- package/attachments/6b1839fa-098b-4881-9d26-f950282f0ee7.pdf +0 -0
- package/attachments/6cb59217-600f-47a1-91fc-299c27e5e248.png +0 -0
- package/attachments/6da5c66a-08a0-409b-8f35-1a953cf44c3f.jpeg +0 -0
- package/attachments/709a2c9d-c919-42ca-8001-6b1688daf978.jpeg +0 -0
- package/attachments/70bd97b9-0cfe-4c43-9cba-3c0dbedfff70.jpeg +0 -0
- package/attachments/71a71839-5521-456b-8eee-134b5f0a6c1c.jpeg +0 -0
- package/attachments/79d67c49-a3a0-4cd9-a78c-a012732d9d8b.jpeg +0 -0
- package/attachments/7f4f78ba-bfe5-466c-88b4-b31824263b84.png +0 -0
- package/attachments/82214212-6296-4c73-812f-18a509368247.jpeg +0 -0
- package/attachments/8488bba6-353a-4f77-84be-1526c92f7b7f.png +0 -0
- package/attachments/891d2e46-a01d-408d-b715-4513fcb52240.jpeg +0 -0
- package/attachments/8a240663-dffe-4c20-a6a0-51e4561c2037.png +0 -0
- package/attachments/8b82bd3d-10ed-4c9e-94d5-7f01400b1fe1.jpeg +0 -0
- package/attachments/8cee2fe7-1bb9-48b1-b759-1efd0164b8c9.jpeg +0 -0
- package/attachments/90ea058c-ed47-4802-a694-bce0e86c217f.png +0 -0
- package/attachments/92be3157-e6b1-4104-b86c-4e510895a71e.jpeg +0 -0
- package/attachments/93a9638b-34b6-4625-9a23-dc088d5ed615.jpeg +0 -0
- package/attachments/9c92e78d-afcb-4d62-b51e-f73f15211314.png +0 -0
- package/attachments/9edcd63b-39e9-4e0c-b3e4-b255ffadc037.jpeg +0 -0
- package/attachments/a64d028e-7e33-4455-a1c4-f294250b5650.png +0 -0
- package/attachments/b1008da4-9e8a-4360-9600-2aeca8e4503a.pdf +0 -0
- package/attachments/b174f420-3f33-463a-8efd-6abad2f709fe.jpeg +0 -0
- package/attachments/b27517ec-f2ac-4735-9d8a-353af2fa5f67.png +0 -0
- package/attachments/b3b99d3b-6e95-4ac8-a349-b4bcf5d78dcd.png +0 -0
- package/attachments/b6c2d24d-8f18-4925-bc2d-4d3bffad4a02.png +0 -0
- package/attachments/b8a5d357-e196-4c32-8059-6d9b94470672.jpeg +0 -0
- package/attachments/b93a5d06-7395-4409-8680-64e8fa9542bb.jpeg +0 -0
- package/attachments/bacf8fe2-a3ef-433b-a00d-f154378db75a.png +0 -0
- package/attachments/bcb6e85d-9dae-4271-9ff6-47a235c41488.jpeg +0 -0
- package/attachments/c3fdecd2-b06e-461e-b2c7-23c69a30e744.jpeg +0 -0
- package/attachments/c47bf238-810c-489b-bc2e-c942033b2ac3.png +0 -0
- package/attachments/c5953130-2bc7-4f73-ab00-835e10658027.png +0 -0
- package/attachments/c66e06b2-32d5-416e-bc8a-c057cf938491.png +0 -0
- package/attachments/c7e77261-cfa2-48e8-8135-383cb0487901.jpeg +0 -0
- package/attachments/cc7892b9-fca6-49f9-a10b-3febeef83fd2.png +0 -0
- package/attachments/d179dc14-baf5-4549-b79e-580ce6b9b897.jpeg +0 -0
- package/attachments/d5ac154b-8c03-4456-9296-e9ce0b24c9ac.png +0 -0
- package/attachments/dbf0459a-4f1a-44c6-a4fc-d73adc3e4cfa.png +0 -0
- package/attachments/de443f64-d2b8-4b10-9b8c-e55b9ab30944.png +0 -0
- package/attachments/de9e417e-9636-41c7-8e27-49ff2c759ddb.jpeg +0 -0
- package/attachments/e5bfd176-32ac-48c0-ad7c-d65478950e28.jpeg +0 -0
- package/attachments/e6fcee2a-cdda-4131-8f9c-90b1fa06a4f4.png +0 -0
- package/attachments/f8a9e56b-6205-4dc8-991e-eec568403810.jpeg +0 -0
- package/logs/application-2022-06-20-13.log +0 -4
|
@@ -0,0 +1,738 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
import './data-item-list.js'
|
|
3
|
+
import './data-set-importer.js'
|
|
4
|
+
import '../data-entry/data-entry-form.js'
|
|
5
|
+
|
|
6
|
+
import gql from 'graphql-tag'
|
|
7
|
+
import { css, html } from 'lit'
|
|
8
|
+
import moment from 'moment-timezone'
|
|
9
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
10
|
+
|
|
11
|
+
import { getEditor, getRenderer } 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
|
+
|
|
20
|
+
const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
21
|
+
const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
|
|
22
|
+
|
|
23
|
+
const ENTRY_TYPES = [
|
|
24
|
+
{
|
|
25
|
+
display: '',
|
|
26
|
+
value: ''
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
display: 'Generated',
|
|
30
|
+
value: 'generated'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
display: 'Board',
|
|
34
|
+
value: 'board'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
display: 'Page',
|
|
38
|
+
value: 'page'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
display: 'External URL',
|
|
42
|
+
value: 'external'
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
const MONITOR_TYPES = [
|
|
47
|
+
{
|
|
48
|
+
display: '',
|
|
49
|
+
value: ''
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
display: 'Generated',
|
|
53
|
+
value: 'generated'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
display: 'Board',
|
|
57
|
+
value: 'board'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
display: 'Page',
|
|
61
|
+
value: 'page'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
display: 'External URL',
|
|
65
|
+
value: 'external'
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
const REPORT_TYPES = [
|
|
70
|
+
{
|
|
71
|
+
display: '',
|
|
72
|
+
value: ''
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
display: 'Generated',
|
|
76
|
+
value: 'generated'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
display: 'Embed',
|
|
80
|
+
value: 'embed'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
display: 'Page',
|
|
84
|
+
value: 'page'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
display: 'External URL',
|
|
88
|
+
value: 'external'
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
const USECASE_OPTIONS = () => {
|
|
93
|
+
return ['', ...OxDataUseCase.getUseCaseNames()].map(name => {
|
|
94
|
+
return {
|
|
95
|
+
display: name,
|
|
96
|
+
value: name
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
export class DataSetListPage extends connect(store)(localize(i18next)(PageView)) {
|
|
101
|
+
static get properties() {
|
|
102
|
+
return {
|
|
103
|
+
gristConfig: Object,
|
|
104
|
+
mode: String
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static get styles() {
|
|
109
|
+
return [
|
|
110
|
+
ScrollbarStyles,
|
|
111
|
+
CommonGristStyles,
|
|
112
|
+
css`
|
|
113
|
+
:host {
|
|
114
|
+
display: flex;
|
|
115
|
+
|
|
116
|
+
width: 100%;
|
|
117
|
+
|
|
118
|
+
--grid-record-emphasized-background-color: red;
|
|
119
|
+
--grid-record-emphasized-color: yellow;
|
|
120
|
+
}
|
|
121
|
+
`
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
get context() {
|
|
126
|
+
return {
|
|
127
|
+
title: i18next.t('title.data-set list'),
|
|
128
|
+
help: 'dataset/data-set',
|
|
129
|
+
actions: [
|
|
130
|
+
{
|
|
131
|
+
title: i18next.t('button.copy'),
|
|
132
|
+
action: this._copyDataSet.bind(this),
|
|
133
|
+
...CommonButtonStyles.copy
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
title: i18next.t('button.save'),
|
|
137
|
+
action: this._updateDataSet.bind(this),
|
|
138
|
+
...CommonButtonStyles.save
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: i18next.t('button.delete'),
|
|
142
|
+
action: this._deleteDataSet.bind(this),
|
|
143
|
+
...CommonButtonStyles.delete
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
exportable: {
|
|
147
|
+
name: i18next.t('title.data-set list'),
|
|
148
|
+
data: this.exportHandler.bind(this)
|
|
149
|
+
},
|
|
150
|
+
importable: {
|
|
151
|
+
handler: this.importHandler.bind(this)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
render() {
|
|
157
|
+
const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
|
|
158
|
+
|
|
159
|
+
return html`
|
|
160
|
+
<ox-grist
|
|
161
|
+
.mode=${mode}
|
|
162
|
+
.config=${this.gristConfig}
|
|
163
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
164
|
+
?url-params-sensitive=${this.active}
|
|
165
|
+
>
|
|
166
|
+
<div slot="headroom">
|
|
167
|
+
<div id="filters">
|
|
168
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div id="sorters">
|
|
172
|
+
Sort
|
|
173
|
+
<mwc-icon
|
|
174
|
+
@click=${e => {
|
|
175
|
+
const target = e.currentTarget
|
|
176
|
+
this.renderRoot.querySelector('#sorter-control').open({
|
|
177
|
+
right: 0,
|
|
178
|
+
top: target.offsetTop + target.offsetHeight
|
|
179
|
+
})
|
|
180
|
+
}}
|
|
181
|
+
>expand_more</mwc-icon
|
|
182
|
+
>
|
|
183
|
+
<ox-popup id="sorter-control">
|
|
184
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
185
|
+
</ox-popup>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div id="modes">
|
|
189
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
190
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
191
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</ox-grist>
|
|
195
|
+
`
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
get grist() {
|
|
199
|
+
return this.renderRoot.querySelector('ox-grist')
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async pageInitialized(lifecycle) {
|
|
203
|
+
this.gristConfig = {
|
|
204
|
+
list: {
|
|
205
|
+
fields: ['name', 'description'],
|
|
206
|
+
details: ['schedule', 'active']
|
|
207
|
+
},
|
|
208
|
+
columns: [
|
|
209
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
210
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
211
|
+
{
|
|
212
|
+
type: 'gutter',
|
|
213
|
+
gutterName: 'button',
|
|
214
|
+
icon: 'reorder',
|
|
215
|
+
handlers: {
|
|
216
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
217
|
+
if (!record.id) return
|
|
218
|
+
const popup = openPopup(html` <data-item-list .dataSet=${record}></data-item-list> `, {
|
|
219
|
+
backdrop: true,
|
|
220
|
+
help: 'data-set/ui/data-item-list',
|
|
221
|
+
size: 'large',
|
|
222
|
+
title: i18next.t('title.data-item list')
|
|
223
|
+
})
|
|
224
|
+
popup.onclosed = () => {
|
|
225
|
+
this.grist.fetch()
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: 'gutter',
|
|
232
|
+
gutterName: 'button',
|
|
233
|
+
icon: 'fact_check',
|
|
234
|
+
handlers: {
|
|
235
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
236
|
+
openPopup(
|
|
237
|
+
html` <data-entry-form .dataSet=${record} style="background-color: white;"></data-entry-form> `,
|
|
238
|
+
{
|
|
239
|
+
backdrop: true,
|
|
240
|
+
size: 'large',
|
|
241
|
+
title: i18next.t('title.data-entry-form')
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: 'string',
|
|
249
|
+
name: 'name',
|
|
250
|
+
header: i18next.t('field.name'),
|
|
251
|
+
record: {
|
|
252
|
+
editable: true
|
|
253
|
+
},
|
|
254
|
+
filter: 'search',
|
|
255
|
+
sortable: true,
|
|
256
|
+
width: 150,
|
|
257
|
+
imex: {
|
|
258
|
+
width: 25,
|
|
259
|
+
header: i18next.t('field.name'),
|
|
260
|
+
type: 'string',
|
|
261
|
+
key: 'name'
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
type: 'string',
|
|
266
|
+
name: 'description',
|
|
267
|
+
header: i18next.t('field.description'),
|
|
268
|
+
record: {
|
|
269
|
+
editable: true
|
|
270
|
+
},
|
|
271
|
+
filter: 'search',
|
|
272
|
+
width: 200,
|
|
273
|
+
imex: {
|
|
274
|
+
width: 33,
|
|
275
|
+
header: i18next.t('field.description'),
|
|
276
|
+
type: 'string',
|
|
277
|
+
key: 'description'
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
type: 'checkbox',
|
|
282
|
+
name: 'active',
|
|
283
|
+
label: true,
|
|
284
|
+
header: i18next.t('field.active'),
|
|
285
|
+
record: {
|
|
286
|
+
editable: true
|
|
287
|
+
},
|
|
288
|
+
filter: true,
|
|
289
|
+
sortable: true,
|
|
290
|
+
width: 60,
|
|
291
|
+
imex: {
|
|
292
|
+
width: 10,
|
|
293
|
+
header: i18next.t('field.active'),
|
|
294
|
+
type: 'checkbox',
|
|
295
|
+
key: 'active'
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
type: 'select',
|
|
300
|
+
name: 'type',
|
|
301
|
+
label: true,
|
|
302
|
+
header: i18next.t('field.type'),
|
|
303
|
+
record: {
|
|
304
|
+
editable: true,
|
|
305
|
+
options: [
|
|
306
|
+
{},
|
|
307
|
+
{
|
|
308
|
+
display: i18next.t('text.manually collected'),
|
|
309
|
+
value: 'manual'
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
display: i18next.t('text.automatically collected'),
|
|
313
|
+
value: 'automatic'
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
sortable: true,
|
|
318
|
+
filter: true,
|
|
319
|
+
width: 60,
|
|
320
|
+
imex: {
|
|
321
|
+
width: 10,
|
|
322
|
+
header: i18next.t('field.type'),
|
|
323
|
+
type: 'select',
|
|
324
|
+
key: 'type'
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
type: 'select',
|
|
329
|
+
name: 'useCase',
|
|
330
|
+
label: true,
|
|
331
|
+
header: i18next.t('field.use-case'),
|
|
332
|
+
record: {
|
|
333
|
+
editable: true,
|
|
334
|
+
options: USECASE_OPTIONS
|
|
335
|
+
},
|
|
336
|
+
sortable: true,
|
|
337
|
+
filter: true,
|
|
338
|
+
width: 80
|
|
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
|
+
label: true,
|
|
365
|
+
imex: {
|
|
366
|
+
width: 13,
|
|
367
|
+
header: i18next.t('field.schedule'),
|
|
368
|
+
type: 'string',
|
|
369
|
+
key: 'schedule'
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
type: 'select',
|
|
374
|
+
name: 'timezone',
|
|
375
|
+
header: i18next.t('field.timezone'),
|
|
376
|
+
record: {
|
|
377
|
+
editable: true,
|
|
378
|
+
options: TIMEZONE_OPTIONS
|
|
379
|
+
},
|
|
380
|
+
width: 120,
|
|
381
|
+
imex: {
|
|
382
|
+
width: 13,
|
|
383
|
+
header: i18next.t('field.timezone'),
|
|
384
|
+
type: 'select',
|
|
385
|
+
key: 'timezone'
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
type: 'resource-object',
|
|
390
|
+
name: 'supervisoryRole',
|
|
391
|
+
header: i18next.t('field.supervisory-role'),
|
|
392
|
+
record: {
|
|
393
|
+
editable: true,
|
|
394
|
+
options: {
|
|
395
|
+
queryName: 'roles'
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
sortable: true,
|
|
399
|
+
filter: 'like',
|
|
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
|
+
queryName: 'roles'
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
sortable: true,
|
|
413
|
+
width: 120
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
type: 'select',
|
|
417
|
+
name: 'entryType',
|
|
418
|
+
label: true,
|
|
419
|
+
header: i18next.t('field.entry-type'),
|
|
420
|
+
record: {
|
|
421
|
+
editable: true,
|
|
422
|
+
options: ENTRY_TYPES
|
|
423
|
+
},
|
|
424
|
+
width: 80
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
type: 'string',
|
|
428
|
+
name: 'entryView',
|
|
429
|
+
header: i18next.t('field.entry-view'),
|
|
430
|
+
record: {
|
|
431
|
+
editable: true,
|
|
432
|
+
editor: function (value, column, record, rowIndex, field) {
|
|
433
|
+
var type = record.entryType !== 'board' ? 'string' : 'board'
|
|
434
|
+
return getEditor(type)(value, column, record, rowIndex, field)
|
|
435
|
+
},
|
|
436
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
437
|
+
var type = record.entryType !== 'board' ? 'string' : 'board'
|
|
438
|
+
return getRenderer(type)(value, column, record, rowIndex, field)
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
width: 140
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
type: 'select',
|
|
445
|
+
name: 'monitorType',
|
|
446
|
+
label: true,
|
|
447
|
+
header: i18next.t('field.monitor-type'),
|
|
448
|
+
record: {
|
|
449
|
+
editable: true,
|
|
450
|
+
options: MONITOR_TYPES
|
|
451
|
+
},
|
|
452
|
+
width: 80
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
type: 'string',
|
|
456
|
+
name: 'monitorView',
|
|
457
|
+
header: i18next.t('field.monitor-view'),
|
|
458
|
+
record: {
|
|
459
|
+
editable: true,
|
|
460
|
+
editor: function (value, column, record, rowIndex, field) {
|
|
461
|
+
var type = record.monitorType !== 'board' ? 'string' : 'board'
|
|
462
|
+
return getEditor(type)(value, column, record, rowIndex, field)
|
|
463
|
+
},
|
|
464
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
465
|
+
var type = record.monitorType !== 'board' ? 'string' : 'board'
|
|
466
|
+
return getRenderer(type)(value, column, record, rowIndex, field)
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
width: 140
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
type: 'select',
|
|
473
|
+
name: 'reportType',
|
|
474
|
+
label: true,
|
|
475
|
+
header: i18next.t('field.report-type'),
|
|
476
|
+
record: {
|
|
477
|
+
editable: true,
|
|
478
|
+
options: REPORT_TYPES
|
|
479
|
+
},
|
|
480
|
+
width: 80
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
type: 'string',
|
|
484
|
+
name: 'reportView',
|
|
485
|
+
header: i18next.t('field.report-view'),
|
|
486
|
+
record: {
|
|
487
|
+
editable: true,
|
|
488
|
+
editor: function (value, column, record, rowIndex, field) {
|
|
489
|
+
var type = record.reportType !== 'custom' ? 'string' : 'script'
|
|
490
|
+
return getEditor(type)(value, column, record, rowIndex, field)
|
|
491
|
+
},
|
|
492
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
493
|
+
var type = record.reportType !== 'custom' ? 'string' : 'string'
|
|
494
|
+
return getRenderer(type)(value, column, record, rowIndex, field)
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
width: 140
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
type: 'file',
|
|
501
|
+
name: 'reportTemplate',
|
|
502
|
+
header: i18next.t('field.report-template'),
|
|
503
|
+
record: {
|
|
504
|
+
editable: true
|
|
505
|
+
},
|
|
506
|
+
width: 80
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
type: 'resource-object',
|
|
510
|
+
name: 'updater',
|
|
511
|
+
header: i18next.t('field.updater'),
|
|
512
|
+
record: {
|
|
513
|
+
editable: false
|
|
514
|
+
},
|
|
515
|
+
sortable: true,
|
|
516
|
+
width: 120
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
type: 'datetime',
|
|
520
|
+
name: 'updatedAt',
|
|
521
|
+
header: i18next.t('field.updated_at'),
|
|
522
|
+
record: {
|
|
523
|
+
editable: false
|
|
524
|
+
},
|
|
525
|
+
sortable: true,
|
|
526
|
+
width: 180
|
|
527
|
+
}
|
|
528
|
+
],
|
|
529
|
+
rows: {
|
|
530
|
+
selectable: {
|
|
531
|
+
multiple: true
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
sorters: [
|
|
535
|
+
{
|
|
536
|
+
name: 'name'
|
|
537
|
+
}
|
|
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
|
+
entryRole {
|
|
558
|
+
id
|
|
559
|
+
name
|
|
560
|
+
}
|
|
561
|
+
supervisoryRole {
|
|
562
|
+
id
|
|
563
|
+
name
|
|
564
|
+
}
|
|
565
|
+
entryType
|
|
566
|
+
entryView
|
|
567
|
+
monitorType
|
|
568
|
+
monitorView
|
|
569
|
+
reportType
|
|
570
|
+
reportView
|
|
571
|
+
reportTemplate
|
|
572
|
+
updater {
|
|
573
|
+
id
|
|
574
|
+
name
|
|
575
|
+
}
|
|
576
|
+
updatedAt
|
|
577
|
+
dataItems {
|
|
578
|
+
name
|
|
579
|
+
description
|
|
580
|
+
active
|
|
581
|
+
tag
|
|
582
|
+
type
|
|
583
|
+
unit
|
|
584
|
+
options
|
|
585
|
+
quota
|
|
586
|
+
spec
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
total
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
`,
|
|
593
|
+
variables: {
|
|
594
|
+
filters,
|
|
595
|
+
pagination: { page, limit },
|
|
596
|
+
sortings
|
|
597
|
+
}
|
|
598
|
+
})
|
|
599
|
+
|
|
600
|
+
return {
|
|
601
|
+
total: response.data.responses.total || 0,
|
|
602
|
+
records: response.data.responses.items || []
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
async _deleteDataSet() {
|
|
607
|
+
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
608
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
609
|
+
if (ids && ids.length > 0) {
|
|
610
|
+
const response = await client.mutate({
|
|
611
|
+
mutation: gql`
|
|
612
|
+
mutation ($ids: [String!]!) {
|
|
613
|
+
deleteDataSets(ids: $ids)
|
|
614
|
+
}
|
|
615
|
+
`,
|
|
616
|
+
variables: {
|
|
617
|
+
ids
|
|
618
|
+
}
|
|
619
|
+
})
|
|
620
|
+
|
|
621
|
+
if (!response.errors) {
|
|
622
|
+
this.grist.fetch()
|
|
623
|
+
notify({
|
|
624
|
+
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
625
|
+
})
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
async _copyDataSet() {
|
|
632
|
+
var selected = this.grist.selected
|
|
633
|
+
if (selected.length == 0) return
|
|
634
|
+
|
|
635
|
+
if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') }))) return
|
|
636
|
+
var response = await client.mutate({
|
|
637
|
+
mutation: gql`
|
|
638
|
+
mutation ($ids: [String!]!) {
|
|
639
|
+
copyDataSets(ids: $ids) {
|
|
640
|
+
id
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
`,
|
|
644
|
+
variables: {
|
|
645
|
+
ids: selected.map(r => r.id)
|
|
646
|
+
}
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
if (!response.errors) {
|
|
650
|
+
this.grist.fetch()
|
|
651
|
+
}
|
|
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
|
+
|
|
668
|
+
return patchField
|
|
669
|
+
})
|
|
670
|
+
|
|
671
|
+
const response = await client.mutate({
|
|
672
|
+
mutation: gql`
|
|
673
|
+
mutation ($patches: [DataSetPatch!]!) {
|
|
674
|
+
updateMultipleDataSet(patches: $patches) {
|
|
675
|
+
name
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
`,
|
|
679
|
+
variables: {
|
|
680
|
+
patches
|
|
681
|
+
},
|
|
682
|
+
context: {
|
|
683
|
+
hasUpload: true
|
|
684
|
+
}
|
|
685
|
+
})
|
|
686
|
+
|
|
687
|
+
if (!response.errors) {
|
|
688
|
+
this.grist.fetch()
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
async exportHandler() {
|
|
694
|
+
var headerSetting = this.grist._config.columns
|
|
695
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
696
|
+
.map(column => {
|
|
697
|
+
return column.imex
|
|
698
|
+
})
|
|
699
|
+
|
|
700
|
+
let records = this.grist.data.records
|
|
701
|
+
|
|
702
|
+
var data = records.map(item => {
|
|
703
|
+
return {
|
|
704
|
+
id: item.id,
|
|
705
|
+
...this.grist._config.columns
|
|
706
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
707
|
+
.reduce((record, column) => {
|
|
708
|
+
record[column.imex.key] = column.imex.key
|
|
709
|
+
.split('.')
|
|
710
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)
|
|
711
|
+
return record
|
|
712
|
+
}, {})
|
|
713
|
+
}
|
|
714
|
+
})
|
|
715
|
+
return { header: headerSetting, data: data }
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
async importHandler(records) {
|
|
719
|
+
openPopup(
|
|
720
|
+
html`
|
|
721
|
+
<data-set-importer
|
|
722
|
+
.dataSets=${records}
|
|
723
|
+
@imported=${() => {
|
|
724
|
+
history.back()
|
|
725
|
+
this.grist.fetch()
|
|
726
|
+
}}
|
|
727
|
+
></data-set-importer>
|
|
728
|
+
`,
|
|
729
|
+
{
|
|
730
|
+
backdrop: true,
|
|
731
|
+
size: 'large',
|
|
732
|
+
title: i18next.t('title.import data-set')
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
window.customElements.define('data-set-list-page', DataSetListPage)
|