@things-factory/dataset 6.0.25 → 6.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -11
- package/assets/images/ooc.png +0 -0
- package/assets/images/oos.png +0 -0
- package/client/{bootstrap.js → bootstrap.ts} +2 -0
- package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
- package/client/components/data-ooc-activity-view.ts +153 -0
- package/client/pages/data-archive/{data-archive-list-page.js → data-archive-list-page.ts} +67 -53
- package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts} +41 -39
- package/client/pages/data-entry/{data-entry-list-page.js → data-entry-list-page.ts} +41 -38
- package/client/pages/data-key-set/{data-key-item-list.js → data-key-item-list.ts} +31 -39
- package/client/pages/data-key-set/data-key-set-importer.ts +95 -0
- package/client/pages/data-key-set/{data-key-set-list-page.js → data-key-set-list-page.ts} +54 -35
- package/client/pages/data-ooc/{data-ooc-list-page.js → data-ooc-list-page.ts} +50 -36
- package/client/pages/data-ooc/{data-ooc-view.js → data-ooc-view.ts} +66 -76
- package/client/pages/data-report/{data-report-embed-page.js → data-report-embed-page.ts} +25 -34
- package/client/pages/data-report/{data-report-list-page.js → data-report-list-page.ts} +49 -43
- package/client/pages/data-report/{data-report-samples-page.js → data-report-samples-page.ts} +29 -43
- package/client/pages/data-report/{jasper-report-oocs-page.js → jasper-report-oocs-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-crosstab-page.js → jasper-report-samples-crosstab-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-page.js → jasper-report-samples-page.ts} +22 -34
- package/client/pages/data-sample/{data-sample-list-page.js → data-sample-list-page.ts} +49 -36
- package/client/pages/data-sample/{data-sample-search-page.js → data-sample-search-page.ts} +53 -39
- package/client/pages/data-sample/{data-sample-view.js → data-sample-view.ts} +29 -33
- package/client/pages/data-sensor/{data-sensor-list-page.js → data-sensor-list-page.ts} +41 -35
- package/client/pages/data-set/{data-item-list.js → data-item-list.ts} +31 -37
- package/client/pages/data-set/data-set-importer.ts +96 -0
- package/client/pages/data-set/{data-set-list-page.js → data-set-list-page.ts} +62 -36
- package/client/{route.js → route.ts} +1 -1
- package/client/tsconfig.json +11 -0
- package/dist-client/bootstrap.d.ts +3 -0
- package/dist-client/bootstrap.js +14 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/data-entry-form.d.ts +15 -0
- package/dist-client/components/data-entry-form.js +83 -0
- package/dist-client/components/data-entry-form.js.map +1 -0
- package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
- package/dist-client/components/data-ooc-activity-view.js +154 -0
- package/dist-client/components/data-ooc-activity-view.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-list-page.d.ts +71 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js +287 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js +161 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -0
- package/dist-client/pages/data-entry/data-entry-list-page.d.ts +36 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js +383 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-item-list.d.ts +18 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js +188 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +9 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js +100 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +60 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js +450 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +58 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js +473 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.d.ts +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js +179 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -0
- package/dist-client/pages/data-report/data-report-embed-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-embed-page.js +101 -0
- package/dist-client/pages/data-report/data-report-embed-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-list-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-list-page.js +431 -0
- package/dist-client/pages/data-report/data-report-list-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-samples-page.d.ts +32 -0
- package/dist-client/pages/data-report/data-report-samples-page.js +164 -0
- package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-list-page.d.ts +58 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js +412 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-search-page.d.ts +63 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js +413 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -0
- package/dist-client/pages/data-sample/data-sample-view.js +109 -0
- package/dist-client/pages/data-sample/data-sample-view.js.map +1 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +49 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js +419 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -0
- package/dist-client/pages/data-set/data-item-list.d.ts +1 -0
- package/dist-client/pages/data-set/data-item-list.js +267 -0
- package/dist-client/pages/data-set/data-item-list.js.map +1 -0
- package/dist-client/pages/data-set/data-set-importer.d.ts +10 -0
- package/dist-client/pages/data-set/data-set-importer.js +103 -0
- package/dist-client/pages/data-set/data-set-importer.js.map +1 -0
- package/dist-client/pages/data-set/data-set-list-page.d.ts +71 -0
- package/dist-client/pages/data-set/data-set-list-page.js +759 -0
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +47 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
- package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
- package/dist-server/controllers/create-data-sample.js +38 -1
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/index.js +5 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +1 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +2 -2
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +5 -4
- package/dist-server/service/data-set/data-set-query.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +3 -0
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history-query.js +4 -3
- package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
- package/server/controllers/activity-template/activity-ooc.ts +55 -0
- package/server/controllers/create-data-sample.ts +48 -3
- package/server/controllers/index.ts +9 -0
- package/server/index.ts +1 -2
- package/server/routes.ts +2 -4
- package/server/service/data-set/data-set-query.ts +5 -4
- package/server/service/data-set/data-set.ts +3 -0
- package/server/service/data-set-history/data-set-history-query.ts +4 -3
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +2 -2
- package/translations/en.json +1 -1
- package/translations/ko.json +1 -1
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
- package/client/pages/data-key-set/data-key-set-importer.js +0 -105
- package/client/pages/data-set/data-set-importer.js +0 -103
- package/dist-server/middlewares/index.js +0 -8
- package/dist-server/middlewares/index.js.map +0 -1
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/tsconfig.json +0 -9
- /package/assets/{data-report.jpg → images/data-report.jpg} +0 -0
- /package/assets/{data-samples.jpg → images/data-samples.jpg} +0 -0
- /package/assets/{diagram.jpg → images/dataset-diagram.jpg} +0 -0
- /package/assets/{glue-table-indices.png → images/glue-table-indices-for-dataset.png} +0 -0
- /package/client/{index.js → index.ts} +0 -0
package/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# dataset
|
2
|
+
|
2
3
|
## dataset relation diagram
|
3
|
-
|
4
|
+
|
5
|
+

|
6
|
+
|
4
7
|
- data_sets 하나가 여러 data_items 를 갖습니다. data_sets와 data_items 조합으로 CCP 항목들을 정의합니다.
|
5
|
-
-
|
8
|
+
- data*sets는 또한 data_key_sets를 참고할 수 있습니다. data_key_sets에서는 data_samples, data_oocs의 조회 인덱스를 위한 key(key_01~key_05)를 정의합니다. data_samples, data_oocs 데이타 생성 시점에, data 컬럼 값으로 부터 별도 컬럼(key*##)에 해당 값을 저장합니다.
|
6
9
|
- data_set_histories에는 data_sets의 변경 내역이 추가됩니다. data_sets의 id는 data_set_histories에 original_id로 추가됩니다. data_set_histories를 사용하려면 original_id 와 version이 필요합니다.
|
7
10
|
- data_sensors에는 자동 수집되는 디바이스 정보를 정의합니다. data_sets를 참고하여 CCP를 관리하도록 합니다.
|
8
11
|
- data_samples에는 입력받은 실제 데이터가 저장됩니다.
|
@@ -10,29 +13,38 @@
|
|
10
13
|
- data_archives에는 다운로드 받기 위한 요청 정보 및 상태가 저장됩니다.
|
11
14
|
|
12
15
|
## Architecture for collecting data samples
|
13
|
-
|
16
|
+
|
17
|
+

|
14
18
|
data_samples, data_oocs, data_set_histories의 테이블 변경 사항은 Database CDC로 Kafka에 전송 및 저장되고 토픽별로 다음의 lambda 들이 트리거되어 S3로 저장합니다. 이 S3 데이터는 Glue Crawler, Glue Data Catalog를 거쳐 Athena에서 조회할 수 있습니다. hive 스타일의 S3 파티션 정보들을 업데이트 하는 작업이 스케줄링되어 작동하고, 파티션 정보가 업데이트 된 S3파일들이 Athena에서 조회되므로 실시간으로 데이터가 반영되지는 않습니다.
|
19
|
+
|
15
20
|
- [func-data-samples-to-s3](https://github.com/operatochef/serverless/tree/main/func-data-samples-to-s3)
|
16
21
|
- [func-data-oocs-to-s3](https://github.com/operatochef/serverless/tree/main/func-data-oocs-to-s3)
|
17
22
|
- [func-data-set-histories-to-s3](https://github.com/operatochef/serverless/tree/main/func-data-set-histories-to-s3)
|
18
23
|
|
19
|
-
개발용으로는 reference-app을 사용하고 있으며, 여기서는 func-dev
|
24
|
+
개발용으로는 reference-app을 사용하고 있으며, 여기서는 func-dev-\* 로 시작하는 lambda들을 사용합니다.
|
25
|
+
|
20
26
|
## data-report process
|
21
|
-
|
27
|
+
|
28
|
+

|
22
29
|
|
23
30
|
'shiny' uses the next lambda. But 'jasper' is not using this lambda now. Consider using the same data service.
|
31
|
+
|
24
32
|
- [func-transform-data-samples](https://github.com/operatochef/serverless/tree/main/func-transform-data-samples)
|
25
33
|
|
26
34
|
## Partition Keys
|
35
|
+
|
27
36
|
At the early stage, partition keys are desinged for dynamic partitioning for Athena. But It will be required so many AWS Glue crawlers also by each 'data-sets'.
|
28
37
|
|
29
|
-
Partition keys are related for S3 request limitations.
|
30
|
-
|
38
|
+
Partition keys are related for S3 request limitations.
|
39
|
+
|
40
|
+
> **3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests per second per prefix in a bucket**
|
41
|
+
|
31
42
|
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/optimizing-performance.html
|
32
43
|
|
33
44
|
### :warning: This concept will be deprecated.
|
34
45
|
|
35
|
-
Now partition keys are fixed
|
46
|
+
Now partition keys are fixed
|
47
|
+
|
36
48
|
- domain
|
37
49
|
- datasetid
|
38
50
|
- date: local time date
|
@@ -40,19 +52,22 @@ Now partition keys are fixed
|
|
40
52
|
- workshift
|
41
53
|
|
42
54
|
### Glue Catalog Table Indices
|
55
|
+
|
43
56
|
Partitions can be indices. You can create new indices with combination of partitions.
|
44
57
|
It affects query performance and finding partitions.
|
45
|
-

|
58
|
+

|
46
59
|
|
47
60
|
## Timestamp of Data Samples
|
61
|
+
|
48
62
|
sample data could have an own timestamp if it is from a sensor data.
|
49
63
|
'collected_at' uses this timestamp.
|
50
64
|
Manual type of data is used 'Date.now() and new Date()'
|
51
65
|
Graphql might affect timezone of server os for Date type field.
|
52
66
|
'TZ=UTC node' can help to solve this when server starts.
|
53
|
-
Or use
|
67
|
+
Or use `process.env.TZ = 'UTC'`.
|
54
68
|
Now applied in 'create-data-samples.ts'
|
55
69
|
|
56
70
|
## Data Archive
|
71
|
+
|
57
72
|
제출용 데이터를 위해 data_samples를 다운로드 하는 기능입니다. csv.gz 형태로 다운로드 가능한 임시 url을 제공합니다. 해당 기능을 위해 [func-data-set-download](https://github.com/operatochef/serverless/tree/main/func-data-set-download) lambda를 사용합니다. 이는 수동 수집용 데이터에 적합합니다. 자동 수집 데이터는 lambda로 처리하기에는 많은 메모리가 필요할 수 있습니다. 따라서, 데이타셋 유형별 처리가 필요할 것 같습니다.
|
58
|
-
Glue Job을 이용한 처리를 진행해보았으나, 시간이 너무 오래걸리는 문제가 있었습니다. 해당 내용은 AWS ibex계정의 Glue Jobs - 'reference_app_samples_archive' 리소스를 참고바랍니다.
|
73
|
+
Glue Job을 이용한 처리를 진행해보았으나, 시간이 너무 오래걸리는 문제가 있었습니다. 해당 내용은 AWS ibex계정의 Glue Jobs - 'reference_app_samples_archive' 리소스를 참고바랍니다.
|
Binary file
|
Binary file
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import './components/data-ooc-activity-view' /* refered by the activity template (activity-ooc) on server */
|
2
|
+
|
1
3
|
import '@operato/app/filter-renderer.js' /* register resource-object filter renderer */
|
2
4
|
|
3
5
|
import { OxGristEditorCode } from '@operato/app/grist-editor/ox-grist-editor-code.js'
|
@@ -2,47 +2,43 @@ import '@operato/dataset/ox-data-entry-form.js'
|
|
2
2
|
|
3
3
|
import gql from 'graphql-tag'
|
4
4
|
import { css, html, LitElement } from 'lit'
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
5
6
|
|
6
7
|
import { client } from '@operato/graphql'
|
7
8
|
import { i18next, localize } from '@operato/i18n'
|
8
9
|
import { ScrollbarStyles } from '@operato/styles'
|
10
|
+
import { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js'
|
11
|
+
import { DataSet } from '@operato/dataset'
|
9
12
|
|
13
|
+
@customElement('data-entry-form')
|
10
14
|
export class DataEntryForm extends localize(i18next)(LitElement) {
|
11
|
-
static
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
static styles = [
|
16
|
+
ScrollbarStyles,
|
17
|
+
css`
|
18
|
+
:host {
|
19
|
+
display: flex;
|
20
|
+
flex-direction: column;
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
ScrollbarStyles,
|
20
|
-
css`
|
21
|
-
:host {
|
22
|
-
display: flex;
|
23
|
-
flex-direction: column;
|
22
|
+
background-color: #fff;
|
23
|
+
}
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
ox-data-entry-form {
|
26
|
+
flex: 1;
|
27
|
+
padding: 10px;
|
28
|
+
overflow: auto;
|
29
|
+
}
|
27
30
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
.button-container {
|
32
|
+
display: flex;
|
33
|
+
margin-left: auto;
|
34
|
+
padding: var(--padding-default);
|
35
|
+
}
|
36
|
+
`
|
37
|
+
]
|
33
38
|
|
34
|
-
|
35
|
-
display: flex;
|
36
|
-
margin-left: auto;
|
37
|
-
padding: var(--padding-default);
|
38
|
-
}
|
39
|
-
`
|
40
|
-
]
|
41
|
-
}
|
39
|
+
@property({ type: Object }) dataSet?: DataSet & { id: string }
|
42
40
|
|
43
|
-
|
44
|
-
return this.renderRoot.querySelector('ox-data-entry-form')
|
45
|
-
}
|
41
|
+
@query('ox-data-entry-form') entryForm!: OxDataEntryForm
|
46
42
|
|
47
43
|
render() {
|
48
44
|
return html`
|
@@ -54,10 +50,13 @@ export class DataEntryForm extends localize(i18next)(LitElement) {
|
|
54
50
|
}
|
55
51
|
|
56
52
|
async _updateDataItems() {
|
53
|
+
//@ts-ignore TODO replace with following line and confirm
|
57
54
|
const data = this.entryForm.buildValue()
|
55
|
+
// const data = this.entryForm.value
|
56
|
+
|
58
57
|
const dataSample = {
|
59
58
|
dataSet: {
|
60
|
-
id: this.dataSet
|
59
|
+
id: this.dataSet?.id
|
61
60
|
},
|
62
61
|
data
|
63
62
|
}
|
@@ -83,5 +82,3 @@ export class DataEntryForm extends localize(i18next)(LitElement) {
|
|
83
82
|
}
|
84
83
|
}
|
85
84
|
}
|
86
|
-
|
87
|
-
window.customElements.define('data-entry-form', DataEntryForm)
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import '@operato/dataset/ox-data-sample-view.js'
|
2
|
+
|
3
|
+
import gql from 'graphql-tag'
|
4
|
+
import { css, html, LitElement } from 'lit'
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
6
|
+
|
7
|
+
import { client } from '@operato/graphql'
|
8
|
+
import { i18next, localize } from '@operato/i18n'
|
9
|
+
import { ScrollbarStyles } from '@operato/styles'
|
10
|
+
|
11
|
+
@customElement('data-ooc-activity-view')
|
12
|
+
class DataOocActivityView extends localize(i18next)(LitElement) {
|
13
|
+
static styles = [
|
14
|
+
ScrollbarStyles,
|
15
|
+
css`
|
16
|
+
:host {
|
17
|
+
display: flex;
|
18
|
+
flex-direction: column;
|
19
|
+
|
20
|
+
background-color: #fff;
|
21
|
+
}
|
22
|
+
|
23
|
+
div[content] {
|
24
|
+
flex: 1;
|
25
|
+
flex-direction: column;
|
26
|
+
|
27
|
+
display: flex;
|
28
|
+
overflow: auto;
|
29
|
+
}
|
30
|
+
|
31
|
+
ox-data-ooc-view {
|
32
|
+
flex: 1;
|
33
|
+
padding: var(--padding-wide);
|
34
|
+
overflow: auto;
|
35
|
+
}
|
36
|
+
|
37
|
+
label[comment] {
|
38
|
+
display: flex;
|
39
|
+
flex-direction: column;
|
40
|
+
|
41
|
+
padding: var(--padding-wide);
|
42
|
+
}
|
43
|
+
|
44
|
+
label[comment] div {
|
45
|
+
display: flex;
|
46
|
+
}
|
47
|
+
|
48
|
+
mwc-icon {
|
49
|
+
color: var(--status-danger-color);
|
50
|
+
}
|
51
|
+
|
52
|
+
textarea {
|
53
|
+
border: var(--input-field-border);
|
54
|
+
border-radius: var(--input-border-radius);
|
55
|
+
padding: var(--input-field-padding);
|
56
|
+
font: var(--input-field-font);
|
57
|
+
}
|
58
|
+
|
59
|
+
.button-container {
|
60
|
+
display: flex;
|
61
|
+
margin-left: auto;
|
62
|
+
padding: var(--padding-default);
|
63
|
+
}
|
64
|
+
`
|
65
|
+
]
|
66
|
+
|
67
|
+
@property({ type: Object }) input?: any
|
68
|
+
@property({ type: Object }) output?: any
|
69
|
+
|
70
|
+
@state() dataOoc?: any
|
71
|
+
|
72
|
+
@query('textarea') commentTextArea!: HTMLTextAreaElement
|
73
|
+
|
74
|
+
render() {
|
75
|
+
const comment = this.output?.comment
|
76
|
+
|
77
|
+
return html`
|
78
|
+
<div content>
|
79
|
+
<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<label comment>
|
83
|
+
<div><mwc-icon>build_circle</mwc-icon> <span>correction activity</span></div>
|
84
|
+
<textarea
|
85
|
+
placeholder="조치 내용을 입력해주세요."
|
86
|
+
.value=${comment || ''}
|
87
|
+
@change=${this.onChangeComment}
|
88
|
+
></textarea>
|
89
|
+
</label>
|
90
|
+
`
|
91
|
+
}
|
92
|
+
|
93
|
+
onChangeComment(e: Event) {
|
94
|
+
this.output = this.output || {}
|
95
|
+
this.output.comment = (e.target as HTMLTextAreaElement).value
|
96
|
+
|
97
|
+
this.dispatchEvent(
|
98
|
+
new CustomEvent('change', {
|
99
|
+
detail: this.output
|
100
|
+
})
|
101
|
+
)
|
102
|
+
}
|
103
|
+
|
104
|
+
updated(changes) {
|
105
|
+
if (changes.has('input')) {
|
106
|
+
this.fetchDataOoc()
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
async fetchDataOoc() {
|
111
|
+
const id = this.input.dataOocId
|
112
|
+
|
113
|
+
if (id) {
|
114
|
+
const response = await client.query({
|
115
|
+
query: gql`
|
116
|
+
query ($id: String!) {
|
117
|
+
dataOoc(id: $id) {
|
118
|
+
id
|
119
|
+
name
|
120
|
+
description
|
121
|
+
ooc
|
122
|
+
oos
|
123
|
+
state
|
124
|
+
type
|
125
|
+
useCase
|
126
|
+
data
|
127
|
+
judgment
|
128
|
+
dataItems {
|
129
|
+
name
|
130
|
+
description
|
131
|
+
active
|
132
|
+
tag
|
133
|
+
type
|
134
|
+
unit
|
135
|
+
options
|
136
|
+
quota
|
137
|
+
spec
|
138
|
+
}
|
139
|
+
workDate
|
140
|
+
workShift
|
141
|
+
collectedAt
|
142
|
+
}
|
143
|
+
}
|
144
|
+
`,
|
145
|
+
variables: {
|
146
|
+
id
|
147
|
+
}
|
148
|
+
})
|
149
|
+
|
150
|
+
this.dataOoc = response.data.dataOoc
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
@@ -2,51 +2,79 @@ import '@operato/data-grist'
|
|
2
2
|
|
3
3
|
import gql from 'graphql-tag'
|
4
4
|
import { css, html } from 'lit'
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
5
6
|
import { connect } from 'pwa-helpers/connect-mixin'
|
6
7
|
|
8
|
+
import {
|
9
|
+
getEditor,
|
10
|
+
getRenderer,
|
11
|
+
ColumnConfig,
|
12
|
+
DataGrist,
|
13
|
+
FetchOption,
|
14
|
+
SortersControl,
|
15
|
+
GristRecord
|
16
|
+
} from '@operato/data-grist'
|
7
17
|
import { client } from '@operato/graphql'
|
8
18
|
import { i18next, localize } from '@operato/i18n'
|
9
19
|
import { openPopup } from '@operato/layout'
|
10
20
|
import { PageView, store } from '@operato/shell'
|
11
|
-
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
21
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
12
22
|
import { isMobileDevice } from '@operato/utils'
|
23
|
+
import { OxPopup, PopupHandle } from '@operato/popup'
|
13
24
|
|
14
25
|
import './data-archive-request-popup'
|
15
26
|
|
27
|
+
@customElement('data-archive-list-page')
|
16
28
|
export class DataArchiveListPage extends connect(store)(localize(i18next)(PageView)) {
|
17
|
-
static
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
29
|
+
static styles = [
|
30
|
+
ScrollbarStyles,
|
31
|
+
CommonGristStyles,
|
32
|
+
css`
|
33
|
+
:host {
|
34
|
+
display: flex;
|
35
|
+
flex-direction: column;
|
24
36
|
|
25
|
-
|
26
|
-
|
27
|
-
ScrollbarStyles,
|
28
|
-
CommonGristStyles,
|
29
|
-
css`
|
30
|
-
:host {
|
31
|
-
display: flex;
|
32
|
-
flex-direction: column;
|
37
|
+
overflow: hidden;
|
38
|
+
}
|
33
39
|
|
34
|
-
|
35
|
-
|
40
|
+
ox-grist {
|
41
|
+
overflow-y: auto;
|
42
|
+
flex: 1;
|
43
|
+
}
|
44
|
+
`
|
45
|
+
]
|
36
46
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
@state() gristConfig: any
|
48
|
+
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
49
|
+
|
50
|
+
@query('ox-grist') private grist!: DataGrist
|
51
|
+
@query('#sorter-control') private sortersControl!: OxPopup
|
52
|
+
|
53
|
+
private popup?: PopupHandle
|
44
54
|
|
45
55
|
get context() {
|
46
56
|
return {
|
47
|
-
|
57
|
+
search: {
|
58
|
+
handler: (search: string) => {
|
59
|
+
this.grist.searchText = search
|
60
|
+
},
|
61
|
+
placeholder: i18next.t('title.data-archive list'),
|
62
|
+
value: this.grist.searchText
|
63
|
+
},
|
64
|
+
filter: {
|
65
|
+
handler: () => {
|
66
|
+
this.grist.toggleHeadroom()
|
67
|
+
}
|
68
|
+
},
|
48
69
|
help: 'dataset/data-archive',
|
49
|
-
actions: [
|
70
|
+
actions: [
|
71
|
+
{
|
72
|
+
...CommonButtonStyles.save,
|
73
|
+
title: i18next.t('button.request-archive'),
|
74
|
+
action: this.openArchivePopup.bind(this),
|
75
|
+
icon: 'archive'
|
76
|
+
}
|
77
|
+
],
|
50
78
|
exportable: {
|
51
79
|
name: i18next.t('title.data-archive list'),
|
52
80
|
data: this._exportableData.bind(this)
|
@@ -66,7 +94,7 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
66
94
|
>
|
67
95
|
<div slot="headroom">
|
68
96
|
<div id="filters">
|
69
|
-
<ox-filters-form autofocus></ox-filters-form>
|
97
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
70
98
|
</div>
|
71
99
|
|
72
100
|
<div id="sorters">
|
@@ -74,7 +102,7 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
74
102
|
<mwc-icon
|
75
103
|
@click=${e => {
|
76
104
|
const target = e.currentTarget
|
77
|
-
this.
|
105
|
+
this.sortersControl.open({
|
78
106
|
right: 0,
|
79
107
|
top: target.offsetTop + target.offsetHeight
|
80
108
|
})
|
@@ -91,23 +119,11 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
91
119
|
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
92
120
|
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
93
121
|
</div>
|
94
|
-
|
95
|
-
<mwc-button
|
96
|
-
dense
|
97
|
-
raised
|
98
|
-
label=${i18next.t('button.request')}
|
99
|
-
@click=${this.openArchivePopup.bind(this)}
|
100
|
-
icon="archive"
|
101
|
-
></mwc-button>
|
102
122
|
</div>
|
103
123
|
</ox-grist>
|
104
124
|
`
|
105
125
|
}
|
106
126
|
|
107
|
-
get grist() {
|
108
|
-
return this.renderRoot.querySelector('ox-grist')
|
109
|
-
}
|
110
|
-
|
111
127
|
async pageInitialized(lifecycle) {
|
112
128
|
const today = new Date().toISOString().split('T')[0]
|
113
129
|
|
@@ -190,25 +206,25 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
190
206
|
}
|
191
207
|
|
192
208
|
closePopupAndRefesh() {
|
193
|
-
this.popup
|
209
|
+
this.popup?.close()
|
194
210
|
this.grist.fetch()
|
195
211
|
}
|
196
212
|
|
197
213
|
async openArchivePopup() {
|
198
214
|
this.popup = openPopup(
|
199
|
-
html`
|
200
|
-
|
201
|
-
@
|
202
|
-
|
203
|
-
></data-archive-request-popup>`,
|
215
|
+
html` <data-archive-request-popup
|
216
|
+
@requested=${this.closePopupAndRefesh.bind(this)}
|
217
|
+
@created=${this.closePopupAndRefesh.bind(this)}
|
218
|
+
></data-archive-request-popup>`,
|
204
219
|
{
|
205
220
|
backdrop: true,
|
206
221
|
size: 'small',
|
207
222
|
title: i18next.t('title.data-archive request popup')
|
208
|
-
}
|
223
|
+
}
|
224
|
+
)
|
209
225
|
}
|
210
226
|
|
211
|
-
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
227
|
+
async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
|
212
228
|
const response = await client.query({
|
213
229
|
query: gql`
|
214
230
|
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
@@ -248,7 +264,7 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
248
264
|
}
|
249
265
|
|
250
266
|
_exportableData() {
|
251
|
-
let records = []
|
267
|
+
let records = [] as GristRecord[]
|
252
268
|
if (this.grist.selected && this.grist.selected.length > 0) {
|
253
269
|
records = this.grist.selected
|
254
270
|
} else {
|
@@ -260,7 +276,7 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
260
276
|
.map(column => {
|
261
277
|
return column.imex === true
|
262
278
|
? {
|
263
|
-
header: column.header.renderer(),
|
279
|
+
header: column.header.renderer(column),
|
264
280
|
key: column.name,
|
265
281
|
width: column.width,
|
266
282
|
type: column.type
|
@@ -286,5 +302,3 @@ export class DataArchiveListPage extends connect(store)(localize(i18next)(PageVi
|
|
286
302
|
return { header: headerSetting, data: data }
|
287
303
|
}
|
288
304
|
}
|
289
|
-
|
290
|
-
window.customElements.define('data-archive-list-page', DataArchiveListPage)
|
package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts}
RENAMED
@@ -1,38 +1,41 @@
|
|
1
|
-
import { SingleColumnFormStyles } from '@things-factory/form-ui'
|
2
|
-
import { i18next, localize } from '@things-factory/i18n-base'
|
3
|
-
import { client, CustomAlert } from '@things-factory/shell'
|
4
1
|
import gql from 'graphql-tag'
|
5
|
-
import { css, html, LitElement } from 'lit
|
2
|
+
import { css, html, LitElement } from 'lit'
|
3
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
4
|
+
|
5
|
+
import { i18next, localize } from '@operato/i18n'
|
6
|
+
import { client } from '@operato/graphql'
|
7
|
+
import { SingleColumnFormStyles } from '@things-factory/form-ui'
|
8
|
+
|
6
9
|
import moment from 'moment-timezone'
|
10
|
+
import Swal from 'sweetalert2'
|
7
11
|
|
12
|
+
@customElement('data-archive-request-popup')
|
8
13
|
class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
9
|
-
static
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
static styles = [
|
15
|
+
SingleColumnFormStyles,
|
16
|
+
css`
|
17
|
+
:host {
|
18
|
+
padding: 10px;
|
19
|
+
display: flex;
|
20
|
+
flex-direction: column;
|
21
|
+
overflow-x: overlay;
|
22
|
+
background-color: var(--main-section-background-color);
|
23
|
+
}
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
text-align: var(--button-container-align);
|
30
|
-
background-color: var(--button-container-background);
|
31
|
-
height: var(--button-container-height);
|
32
|
-
}
|
33
|
-
`
|
34
|
-
]
|
35
|
-
}
|
25
|
+
form {
|
26
|
+
overflow: auto;
|
27
|
+
}
|
28
|
+
|
29
|
+
.button-container {
|
30
|
+
display: flex;
|
31
|
+
margin-top: auto;
|
32
|
+
margin-left: auto;
|
33
|
+
padding: var(--padding-default);
|
34
|
+
}
|
35
|
+
`
|
36
|
+
]
|
37
|
+
|
38
|
+
@state() dataSetTypes: any
|
36
39
|
|
37
40
|
render() {
|
38
41
|
return html`
|
@@ -44,13 +47,13 @@ class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
|
44
47
|
<input type="month" name="endDate" .value=${moment().format('YYYY-MM')} />
|
45
48
|
<label>${i18next.t('label.data-set-type')}</label>
|
46
49
|
<select name="type" required>
|
47
|
-
${(this.dataSetTypes || []).map(t => html`<option value
|
50
|
+
${(this.dataSetTypes || []).map(t => html`<option value=${t && t.value}>${t && t.display}</option>`)}
|
48
51
|
</select>
|
49
52
|
</fieldset>
|
50
53
|
</form>
|
51
54
|
|
52
55
|
<div class="button-container">
|
53
|
-
<mwc-button raised @click
|
56
|
+
<mwc-button raised @click=${this.requestArchive} label=${String(i18next.t('button.submit'))}></mwc-button>
|
54
57
|
</div>
|
55
58
|
`
|
56
59
|
}
|
@@ -65,9 +68,10 @@ class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
|
65
68
|
serializeFormData() {
|
66
69
|
const obj = {}
|
67
70
|
|
68
|
-
Array.from(this.shadowRoot
|
69
|
-
|
70
|
-
|
71
|
+
Array.from(this.shadowRoot!.querySelectorAll('form#input-form input, select')).forEach((field: Element) => {
|
72
|
+
const input = field as HTMLInputElement
|
73
|
+
if (!input.hasAttribute('hidden') && input.value) {
|
74
|
+
obj[input.name] = input.type === 'checkbox' ? input.checked : input.value
|
71
75
|
}
|
72
76
|
})
|
73
77
|
|
@@ -116,12 +120,12 @@ class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
|
116
120
|
|
117
121
|
this._generateArchiveAndDownloadUrl(dataArchive)
|
118
122
|
|
119
|
-
await
|
123
|
+
await Swal.fire({
|
120
124
|
type: 'info',
|
121
125
|
title: i18next.t('title.ready'),
|
122
126
|
text: i18next.t('text.data-archive waits'),
|
123
127
|
confirmButton: { text: i18next.t('button.confirm') }
|
124
|
-
})
|
128
|
+
} as any)
|
125
129
|
} else {
|
126
130
|
console.error(response.errors)
|
127
131
|
this.showToast(i18next.t('text.failed'))
|
@@ -171,5 +175,3 @@ class DataArchiveRequestPopup extends localize(i18next)(LitElement) {
|
|
171
175
|
]
|
172
176
|
}
|
173
177
|
}
|
174
|
-
|
175
|
-
window.customElements.define('data-archive-request-popup', DataArchiveRequestPopup)
|