@things-factory/dataset 6.0.25 → 6.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -11
- package/assets/images/data-collect.png +0 -0
- package/assets/images/ooc.png +0 -0
- package/assets/images/oos.png +0 -0
- package/client/{bootstrap.js → bootstrap.ts} +5 -1
- package/client/components/data-collect-activity-view.ts +100 -0
- package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
- package/client/components/ooc-resolve-activity-view.ts +174 -0
- package/client/components/ooc-review-activity-view.ts +153 -0
- package/client/pages/data-archive/{data-archive-list-page.js → data-archive-list-page.ts} +67 -53
- package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts} +41 -39
- package/client/pages/data-entry/{data-entry-list-page.js → data-entry-list-page.ts} +41 -38
- package/client/pages/data-key-set/{data-key-item-list.js → data-key-item-list.ts} +31 -39
- package/client/pages/data-key-set/data-key-set-importer.ts +95 -0
- package/client/pages/data-key-set/{data-key-set-list-page.js → data-key-set-list-page.ts} +54 -35
- package/client/pages/data-ooc/{data-ooc-list-page.js → data-ooc-list-page.ts} +56 -36
- package/client/pages/data-ooc/data-ooc-view-page.ts +115 -0
- package/client/pages/data-ooc/data-ooc-view.ts +124 -0
- package/client/pages/data-report/{data-report-embed-page.js → data-report-embed-page.ts} +25 -34
- package/client/pages/data-report/{data-report-list-page.js → data-report-list-page.ts} +49 -43
- package/client/pages/data-report/{data-report-samples-page.js → data-report-samples-page.ts} +29 -43
- package/client/pages/data-report/{jasper-report-oocs-page.js → jasper-report-oocs-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-crosstab-page.js → jasper-report-samples-crosstab-page.ts} +22 -34
- package/client/pages/data-report/{jasper-report-samples-page.js → jasper-report-samples-page.ts} +22 -34
- package/client/pages/data-sample/{data-sample-list-page.js → data-sample-list-page.ts} +49 -36
- package/client/pages/data-sample/{data-sample-search-page.js → data-sample-search-page.ts} +53 -39
- package/client/pages/data-sample/{data-sample-view.js → data-sample-view.ts} +29 -33
- package/client/pages/data-sensor/{data-sensor-list-page.js → data-sensor-list-page.ts} +41 -35
- package/client/pages/data-set/{data-item-list.js → data-item-list.ts} +31 -37
- package/client/pages/data-set/data-set-importer.ts +96 -0
- package/client/pages/data-set/{data-set-list-page.js → data-set-list-page.ts} +173 -40
- package/client/{route.js → route.ts} +5 -1
- package/client/tsconfig.json +11 -0
- package/config/config.development.js +30 -30
- package/config/config.production.js +31 -31
- package/dist-client/bootstrap.d.ts +5 -0
- package/dist-client/bootstrap.js +16 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/data-collect-activity-view.d.ts +19 -0
- package/dist-client/components/data-collect-activity-view.js +101 -0
- package/dist-client/components/data-collect-activity-view.js.map +1 -0
- package/dist-client/components/data-entry-form.d.ts +15 -0
- package/dist-client/components/data-entry-form.js +83 -0
- package/dist-client/components/data-entry-form.js.map +1 -0
- package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
- package/dist-client/components/data-ooc-activity-view.js +154 -0
- package/dist-client/components/data-ooc-activity-view.js.map +1 -0
- package/dist-client/components/ooc-resolve-activity-view.d.ts +1 -0
- package/dist-client/components/ooc-resolve-activity-view.js +175 -0
- package/dist-client/components/ooc-resolve-activity-view.js.map +1 -0
- package/dist-client/components/ooc-review-activity-view.d.ts +1 -0
- package/dist-client/components/ooc-review-activity-view.js +155 -0
- package/dist-client/components/ooc-review-activity-view.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-list-page.d.ts +71 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js +287 -0
- package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js +161 -0
- package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -0
- package/dist-client/pages/data-entry/data-entry-list-page.d.ts +36 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js +383 -0
- package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-item-list.d.ts +18 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js +188 -0
- package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +9 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js +100 -0
- package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +60 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js +450 -0
- package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +58 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js +479 -0
- package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view-page.d.ts +18 -0
- package/dist-client/pages/data-ooc/data-ooc-view-page.js +114 -0
- package/dist-client/pages/data-ooc/data-ooc-view-page.js.map +1 -0
- package/dist-client/pages/data-ooc/data-ooc-view.d.ts +15 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js +130 -0
- package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -0
- package/dist-client/pages/data-report/data-report-embed-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-embed-page.js +101 -0
- package/dist-client/pages/data-report/data-report-embed-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-list-page.d.ts +36 -0
- package/dist-client/pages/data-report/data-report-list-page.js +431 -0
- package/dist-client/pages/data-report/data-report-list-page.js.map +1 -0
- package/dist-client/pages/data-report/data-report-samples-page.d.ts +32 -0
- package/dist-client/pages/data-report/data-report-samples-page.js +164 -0
- package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-oocs-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js.map +1 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.d.ts +2 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js +101 -0
- package/dist-client/pages/data-report/jasper-report-samples-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-list-page.d.ts +58 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js +412 -0
- package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-search-page.d.ts +63 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js +413 -0
- package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -0
- package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -0
- package/dist-client/pages/data-sample/data-sample-view.js +109 -0
- package/dist-client/pages/data-sample/data-sample-view.js.map +1 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +49 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js +419 -0
- package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -0
- package/dist-client/pages/data-set/data-item-list.d.ts +1 -0
- package/dist-client/pages/data-set/data-item-list.js +267 -0
- package/dist-client/pages/data-set/data-item-list.js.map +1 -0
- package/dist-client/pages/data-set/data-set-importer.d.ts +10 -0
- package/dist-client/pages/data-set/data-set-importer.js +103 -0
- package/dist-client/pages/data-set/data-set-importer.js.map +1 -0
- package/dist-client/pages/data-set/data-set-list-page.d.ts +73 -0
- package/dist-client/pages/data-set/data-set-list-page.js +861 -0
- package/dist-client/pages/data-set/data-set-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +50 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/activity-template/activity-data-collect.js +82 -0
- package/dist-server/controllers/activity-template/activity-data-collect.js.map +1 -0
- package/dist-server/controllers/activity-template/activity-ooc-resolve.js +100 -0
- package/dist-server/controllers/activity-template/activity-ooc-resolve.js.map +1 -0
- package/dist-server/controllers/activity-template/activity-ooc-review.js +107 -0
- package/dist-server/controllers/activity-template/activity-ooc-review.js.map +1 -0
- package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
- package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
- package/dist-server/controllers/create-data-sample.js +53 -14
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/controllers/data-use-case.js +1 -1
- package/dist-server/controllers/data-use-case.js.map +1 -1
- package/dist-server/controllers/index.js +7 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +1 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +47 -3
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc-query.js +22 -2
- package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc.js +26 -0
- package/dist-server/service/data-ooc/data-ooc.js.map +1 -1
- package/dist-server/service/data-set/data-set-mutation.js +88 -0
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +38 -4
- package/dist-server/service/data-set/data-set-query.js.map +1 -1
- package/dist-server/service/data-set/data-set-type.js +16 -0
- package/dist-server/service/data-set/data-set-type.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +55 -3
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/data-set-history/data-set-history-query.js +4 -3
- package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/dataset/data-ooc.md +5 -4
- package/package.json +17 -12
- package/server/controllers/activity-template/activity-data-collect.ts +84 -0
- package/server/controllers/activity-template/activity-ooc-resolve.ts +114 -0
- package/server/controllers/activity-template/activity-ooc-review.ts +118 -0
- package/server/controllers/create-data-sample.ts +61 -21
- package/server/controllers/data-use-case.ts +1 -1
- package/server/controllers/index.ts +11 -0
- package/server/index.ts +1 -2
- package/server/routes.ts +62 -5
- package/server/service/data-ooc/data-ooc-query.ts +12 -2
- package/server/service/data-ooc/data-ooc.ts +23 -0
- package/server/service/data-set/data-set-mutation.ts +99 -0
- package/server/service/data-set/data-set-query.ts +39 -5
- package/server/service/data-set/data-set-type.ts +14 -0
- package/server/service/data-set/data-set.ts +43 -2
- package/server/service/data-set-history/data-set-history-query.ts +4 -3
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +6 -2
- package/translations/en.json +3 -1
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/client/pages/data-key-set/data-key-set-importer.js +0 -105
- package/client/pages/data-ooc/data-ooc-view.js +0 -188
- package/client/pages/data-set/data-set-importer.js +0 -103
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/tsconfig.json +0 -9
- /package/assets/{data-report.jpg → images/data-report.jpg} +0 -0
- /package/assets/{data-samples.jpg → images/data-samples.jpg} +0 -0
- /package/assets/{diagram.jpg → images/dataset-diagram.jpg} +0 -0
- /package/assets/{glue-table-indices.png → images/glue-table-indices-for-dataset.png} +0 -0
- /package/client/{index.js → index.ts} +0 -0
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
|
Binary file
|
@@ -1,3 +1,7 @@
|
|
1
|
+
import './components/data-collect-activity-view' /* refered by the activity template (activity-data-collect) on server */
|
2
|
+
import './components/ooc-review-activity-view' /* refered by the activity template (activity-ooc-review) on server */
|
3
|
+
import './components/ooc-resolve-activity-view' /* refered by the activity template (activity-ooc-resolve) on server */
|
4
|
+
|
1
5
|
import '@operato/app/filter-renderer.js' /* register resource-object filter renderer */
|
2
6
|
|
3
7
|
import { OxGristEditorCode } from '@operato/app/grist-editor/ox-grist-editor-code.js'
|
@@ -6,7 +10,7 @@ import {
|
|
6
10
|
registerEditor as registerGristEditor,
|
7
11
|
registerRenderer as registerGristRenderer
|
8
12
|
} from '@operato/data-grist'
|
9
|
-
import { OxGristEditorDataItemSpec } from '@operato/dataset/grist-editor'
|
13
|
+
import { OxGristEditorDataItemSpec } from '@operato/dataset/grist-editor/ox-grist-editor-data-item-spec.js'
|
10
14
|
import { OxGristEditorPartitionKeys } from '@operato/grist-editor/ox-grist-editor-partition-keys.js'
|
11
15
|
|
12
16
|
export default function bootstrap() {
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import '@operato/dataset/ox-data-entry-form.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
|
+
import { OxDataEntryForm } from '@operato/dataset/ox-data-entry-form.js'
|
11
|
+
import { DataSet } from '@operato/dataset'
|
12
|
+
|
13
|
+
@customElement('data-collect-activity-view')
|
14
|
+
export class DataCollectActivityView extends localize(i18next)(LitElement) {
|
15
|
+
static styles = [
|
16
|
+
ScrollbarStyles,
|
17
|
+
css`
|
18
|
+
:host {
|
19
|
+
display: flex;
|
20
|
+
flex-direction: column;
|
21
|
+
|
22
|
+
background-color: #fff;
|
23
|
+
}
|
24
|
+
|
25
|
+
ox-data-entry-form {
|
26
|
+
flex: 1;
|
27
|
+
padding: 10px;
|
28
|
+
overflow: auto;
|
29
|
+
}
|
30
|
+
`
|
31
|
+
]
|
32
|
+
|
33
|
+
@property({ type: Object }) input?: any
|
34
|
+
@property({ type: Object }) output?: any
|
35
|
+
|
36
|
+
@state() dataSet?: DataSet & { id: string }
|
37
|
+
|
38
|
+
@query('ox-data-entry-form') entryForm!: OxDataEntryForm
|
39
|
+
|
40
|
+
render() {
|
41
|
+
return html`
|
42
|
+
<ox-data-entry-form
|
43
|
+
.dataSet=${this.dataSet}
|
44
|
+
.value=${this.output}
|
45
|
+
@change=${this._updateDataItems}
|
46
|
+
></ox-data-entry-form>
|
47
|
+
`
|
48
|
+
}
|
49
|
+
|
50
|
+
async _updateDataItems() {
|
51
|
+
this.output = this.entryForm.value
|
52
|
+
|
53
|
+
this.dispatchEvent(
|
54
|
+
new CustomEvent('change', {
|
55
|
+
detail: this.output
|
56
|
+
})
|
57
|
+
)
|
58
|
+
}
|
59
|
+
|
60
|
+
updated(changes) {
|
61
|
+
if (changes.has('input')) {
|
62
|
+
this.fetchDataSet()
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
async fetchDataSet() {
|
67
|
+
const id = this.input.dataSetId
|
68
|
+
|
69
|
+
if (id) {
|
70
|
+
const response = await client.query({
|
71
|
+
query: gql`
|
72
|
+
query ($id: String!) {
|
73
|
+
dataSet(id: $id) {
|
74
|
+
id
|
75
|
+
name
|
76
|
+
description
|
77
|
+
useCase
|
78
|
+
dataItems {
|
79
|
+
name
|
80
|
+
description
|
81
|
+
active
|
82
|
+
tag
|
83
|
+
type
|
84
|
+
unit
|
85
|
+
options
|
86
|
+
quota
|
87
|
+
spec
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
`,
|
92
|
+
variables: {
|
93
|
+
id
|
94
|
+
}
|
95
|
+
})
|
96
|
+
|
97
|
+
this.dataSet = response.data.dataSet
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
@@ -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,174 @@
|
|
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('ooc-resolve-activity-view')
|
12
|
+
class OocResolveActivityView 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-sample-view {
|
32
|
+
flex: 1;
|
33
|
+
padding: var(--padding-wide);
|
34
|
+
overflow: auto;
|
35
|
+
}
|
36
|
+
|
37
|
+
div[instruction] {
|
38
|
+
display: flex;
|
39
|
+
flex-direction: column;
|
40
|
+
|
41
|
+
padding: var(--padding-wide);
|
42
|
+
}
|
43
|
+
|
44
|
+
div[instruction] div {
|
45
|
+
display: flex;
|
46
|
+
}
|
47
|
+
|
48
|
+
div[instruction] div[content] {
|
49
|
+
display: flex;
|
50
|
+
min-height: 50px;
|
51
|
+
}
|
52
|
+
|
53
|
+
label[action] {
|
54
|
+
display: flex;
|
55
|
+
flex-direction: column;
|
56
|
+
|
57
|
+
padding: var(--padding-wide);
|
58
|
+
}
|
59
|
+
|
60
|
+
label[action] div {
|
61
|
+
display: flex;
|
62
|
+
}
|
63
|
+
|
64
|
+
mwc-icon {
|
65
|
+
color: var(--status-danger-color);
|
66
|
+
}
|
67
|
+
|
68
|
+
textarea {
|
69
|
+
border: var(--input-field-border);
|
70
|
+
border-radius: var(--input-border-radius);
|
71
|
+
padding: var(--input-field-padding);
|
72
|
+
font: var(--input-field-font);
|
73
|
+
}
|
74
|
+
|
75
|
+
.button-container {
|
76
|
+
display: flex;
|
77
|
+
margin-left: auto;
|
78
|
+
padding: var(--padding-default);
|
79
|
+
}
|
80
|
+
`
|
81
|
+
]
|
82
|
+
|
83
|
+
@property({ type: Object }) input?: any
|
84
|
+
@property({ type: Object }) output?: any
|
85
|
+
|
86
|
+
@state() dataOoc?: any
|
87
|
+
|
88
|
+
@query('textarea') actionTextArea!: HTMLTextAreaElement
|
89
|
+
|
90
|
+
render() {
|
91
|
+
const action = this.output?.action
|
92
|
+
|
93
|
+
return html`
|
94
|
+
<div content>
|
95
|
+
<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div instruction>
|
99
|
+
<div><mwc-icon>build_circle</mwc-icon> <span>corrective instruction</span></div>
|
100
|
+
<div content>${this.input?.instruction}</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<label action>
|
104
|
+
<div><mwc-icon>build_circle</mwc-icon> <span>corrective action</span></div>
|
105
|
+
<textarea
|
106
|
+
placeholder="시정 및 예방을 위한 조치 이행 사항을 입력해주세요."
|
107
|
+
.value=${action || ''}
|
108
|
+
@change=${this.onChangeAction}
|
109
|
+
></textarea>
|
110
|
+
</label>
|
111
|
+
`
|
112
|
+
}
|
113
|
+
|
114
|
+
onChangeAction(e: Event) {
|
115
|
+
this.output ||= {}
|
116
|
+
this.output.action = (e.target as HTMLTextAreaElement).value
|
117
|
+
|
118
|
+
this.dispatchEvent(
|
119
|
+
new CustomEvent('change', {
|
120
|
+
detail: this.output
|
121
|
+
})
|
122
|
+
)
|
123
|
+
}
|
124
|
+
|
125
|
+
updated(changes) {
|
126
|
+
if (changes.has('input')) {
|
127
|
+
this.fetchDataOoc()
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
async fetchDataOoc() {
|
132
|
+
const id = this.input.dataOocId
|
133
|
+
|
134
|
+
if (id) {
|
135
|
+
const response = await client.query({
|
136
|
+
query: gql`
|
137
|
+
query ($id: String!) {
|
138
|
+
dataOoc(id: $id) {
|
139
|
+
id
|
140
|
+
name
|
141
|
+
description
|
142
|
+
ooc
|
143
|
+
oos
|
144
|
+
state
|
145
|
+
type
|
146
|
+
useCase
|
147
|
+
data
|
148
|
+
judgment
|
149
|
+
dataItems {
|
150
|
+
name
|
151
|
+
description
|
152
|
+
active
|
153
|
+
tag
|
154
|
+
type
|
155
|
+
unit
|
156
|
+
options
|
157
|
+
quota
|
158
|
+
spec
|
159
|
+
}
|
160
|
+
workDate
|
161
|
+
workShift
|
162
|
+
collectedAt
|
163
|
+
}
|
164
|
+
}
|
165
|
+
`,
|
166
|
+
variables: {
|
167
|
+
id
|
168
|
+
}
|
169
|
+
})
|
170
|
+
|
171
|
+
this.dataOoc = response.data.dataOoc
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
@@ -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('ooc-review-activity-view')
|
12
|
+
class OocReviewActivityView 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-sample-view {
|
32
|
+
flex: 1;
|
33
|
+
padding: var(--padding-wide);
|
34
|
+
overflow: auto;
|
35
|
+
}
|
36
|
+
|
37
|
+
label[instruction] {
|
38
|
+
display: flex;
|
39
|
+
flex-direction: column;
|
40
|
+
|
41
|
+
padding: var(--padding-wide);
|
42
|
+
}
|
43
|
+
|
44
|
+
label[instruction] 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') instructionTextArea!: HTMLTextAreaElement
|
73
|
+
|
74
|
+
render() {
|
75
|
+
const instruction = this.output?.instruction
|
76
|
+
|
77
|
+
return html`
|
78
|
+
<div content>
|
79
|
+
<ox-data-sample-view .dataSample=${this.dataOoc}></ox-data-sample-view>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<label instruction>
|
83
|
+
<div><mwc-icon>build_circle</mwc-icon> <span>corrective instruction</span></div>
|
84
|
+
<textarea
|
85
|
+
placeholder="시정 및 예방을 위한 조치 지시 사항을 입력해주세요."
|
86
|
+
.value=${instruction || ''}
|
87
|
+
@change=${this.onChangeInstruction}
|
88
|
+
></textarea>
|
89
|
+
</label>
|
90
|
+
`
|
91
|
+
}
|
92
|
+
|
93
|
+
onChangeInstruction(e: Event) {
|
94
|
+
this.output ||= {}
|
95
|
+
this.output.instruction = (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
|
+
}
|