@things-factory/dataset 8.0.26 → 8.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.
Files changed (54) hide show
  1. package/client/activities/activity-data-collect-edit.ts +18 -32
  2. package/client/activities/activity-data-review-edit.ts +7 -11
  3. package/client/activities/activity-data-review-view.ts +5 -7
  4. package/client/activities/activity-ooc-review-edit.ts +7 -14
  5. package/client/components/checklist-entry-form.ts +109 -0
  6. package/client/components/data-entry-form.ts +2 -49
  7. package/client/pages/data-entry/data-entry-list-page.ts +14 -2
  8. package/client/pages/data-ooc/data-ooc-list-page.ts +2 -2
  9. package/client/pages/data-sample/data-sample-view.ts +6 -9
  10. package/client/pages/data-set/data-set-list-page.ts +19 -3
  11. package/client/route.ts +0 -4
  12. package/dist-client/activities/activity-data-collect-edit.d.ts +1 -1
  13. package/dist-client/activities/activity-data-collect-edit.js +18 -34
  14. package/dist-client/activities/activity-data-collect-edit.js.map +1 -1
  15. package/dist-client/activities/activity-data-review-edit.d.ts +1 -1
  16. package/dist-client/activities/activity-data-review-edit.js +7 -12
  17. package/dist-client/activities/activity-data-review-edit.js.map +1 -1
  18. package/dist-client/activities/activity-data-review-view.js +5 -8
  19. package/dist-client/activities/activity-data-review-view.js.map +1 -1
  20. package/dist-client/activities/activity-ooc-review-edit.js +7 -15
  21. package/dist-client/activities/activity-ooc-review-edit.js.map +1 -1
  22. package/dist-client/components/checklist-entry-form.d.ts +21 -0
  23. package/dist-client/components/checklist-entry-form.js +108 -0
  24. package/dist-client/components/checklist-entry-form.js.map +1 -0
  25. package/dist-client/components/data-entry-form.d.ts +0 -6
  26. package/dist-client/components/data-entry-form.js +1 -51
  27. package/dist-client/components/data-entry-form.js.map +1 -1
  28. package/dist-client/pages/data-entry/data-entry-list-page.d.ts +1 -0
  29. package/dist-client/pages/data-entry/data-entry-list-page.js +10 -1
  30. package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -1
  31. package/dist-client/pages/data-ooc/data-ooc-list-page.js +2 -2
  32. package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -1
  33. package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -1
  34. package/dist-client/pages/data-sample/data-sample-view.js +6 -10
  35. package/dist-client/pages/data-sample/data-sample-view.js.map +1 -1
  36. package/dist-client/pages/data-set/data-set-list-page.d.ts +1 -0
  37. package/dist-client/pages/data-set/data-set-list-page.js +15 -2
  38. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -1
  39. package/dist-client/route.js +0 -3
  40. package/dist-client/route.js.map +1 -1
  41. package/dist-client/tsconfig.tsbuildinfo +1 -1
  42. package/dist-server/service/data-ooc/index.d.ts +1 -1
  43. package/dist-server/service/data-set/data-set-mutation.js +2 -2
  44. package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
  45. package/dist-server/service/data-set/data-set.d.ts +1 -0
  46. package/dist-server/service/data-set/data-set.js +5 -0
  47. package/dist-server/service/data-set/data-set.js.map +1 -1
  48. package/dist-server/service/data-set/index.d.ts +1 -1
  49. package/dist-server/service/index.d.ts +2 -2
  50. package/dist-server/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +2 -2
  52. package/server/service/data-set/data-set-mutation.ts +2 -2
  53. package/server/service/data-set/data-set.ts +5 -0
  54. package/client/pages/data-entry/checklist-entry-page.ts +0 -211
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "8.0.26",
3
+ "version": "8.0.28",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -56,5 +56,5 @@
56
56
  "simple-statistics": "^7.8.3",
57
57
  "statistics": "^3.3.0"
58
58
  },
59
- "gitHead": "027198de3239e511184dde702c2370a84a1a98fb"
59
+ "gitHead": "866d611ddc3ac6a6db283b27a896898a98bccf35"
60
60
  }
@@ -207,7 +207,7 @@ export class DataSetMutation {
207
207
  async deleteDataSet(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
208
208
  const { domain, tx } = context.state
209
209
 
210
- await getRepository(DataSet, tx).delete({ domain: { id: domain.id }, id })
210
+ await getRepository(DataSet, tx).softDelete({ domain: { id: domain.id }, id })
211
211
  await deleteAttachmentsByRef(null, { refBys: [`report-${id}`] }, context)
212
212
 
213
213
  return true
@@ -219,7 +219,7 @@ export class DataSetMutation {
219
219
  async deleteDataSets(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
220
220
  const { domain, tx } = context.state
221
221
 
222
- await getRepository(DataSet, tx).delete({
222
+ await getRepository(DataSet, tx).softDelete({
223
223
  domain: { id: domain.id },
224
224
  id: In(ids)
225
225
  })
@@ -8,6 +8,7 @@ import {
8
8
  PrimaryGeneratedColumn,
9
9
  RelationId,
10
10
  UpdateDateColumn,
11
+ DeleteDateColumn,
11
12
  VersionColumn
12
13
  } from 'typeorm'
13
14
 
@@ -310,6 +311,10 @@ export class DataSet {
310
311
  @Field({ nullable: true, description: 'The date and time the dataset was last updated' })
311
312
  updatedAt?: Date
312
313
 
314
+ @DeleteDateColumn()
315
+ @Field({ nullable: true, description: 'The date and time the dataset was deleted' })
316
+ deletedAt?: Date
317
+
313
318
  @ManyToOne(type => User, { nullable: true })
314
319
  @Field({ nullable: true, description: 'The user who created the dataset' })
315
320
  creator?: User
@@ -1,211 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/context/ox-context-page-toolbar.js'
3
- import '@operato/board/ox-board-viewer.js'
4
-
5
- import gql from 'graphql-tag'
6
- import { css, html } from 'lit'
7
- import { customElement, property, query, state } from 'lit/decorators.js'
8
-
9
- import { DataSample, DataSet } from '@operato/dataset'
10
- import { client } from '@operato/graphql'
11
- import { i18next, localize } from '@operato/i18n'
12
- import { PageView } from '@operato/shell'
13
- import { ScrollbarStyles } from '@operato/styles'
14
-
15
- @customElement('checklist-entry-page')
16
- export class ChecklistEntryPage extends localize(i18next)(PageView) {
17
- static styles = [
18
- ScrollbarStyles,
19
- css`
20
- :host {
21
- display: flex;
22
- flex-direction: column;
23
-
24
- width: 100%;
25
- }
26
-
27
- div.checklist {
28
- flex: 1;
29
- }
30
-
31
- .footer span {
32
- font-size: 0.8em;
33
- color: var(--md-sys-color-on-surface);
34
- line-height: 1.5;
35
- padding: 10px;
36
- }
37
- `
38
- ]
39
-
40
- get context() {
41
- return {
42
- title: i18next.t('title.checklist entry page'),
43
- help: 'dataset/checklist-entry-page',
44
- toolbar: false
45
- }
46
- }
47
-
48
- @state() private dataSetId?: string
49
- @state() private dataSet?: DataSet
50
- @state() private dataSample?: DataSample | { id: string; collectedAt: Date }
51
-
52
- render() {
53
- return html`
54
- <div class="checklist">
55
- <table>
56
- <thead>
57
- <tr>
58
- <th>주기</th>
59
- <th>관리</th>
60
- <th>점검 내용</th>
61
- <th>기록</th>
62
- </tr>
63
- </thead>
64
- <tbody>
65
- <tr>
66
- <td rowspan="3">일일 (작업전)</td>
67
- <td rowspan="3">개인 위생</td>
68
- <td>위생복장과 외출복장이 구분하여 보관되고 있는가?</td>
69
- <td><input type="checkbox" name="check1" /></td>
70
- </tr>
71
- <tr>
72
- <td>
73
- 종사자의 건강상태가 양호하고 개인장신구 등을 소지하지 않으며, 청결한 위생복장을 착용하고 작업하고
74
- 있는가?
75
- </td>
76
- <td><input type="checkbox" name="check2" /></td>
77
- </tr>
78
- <tr>
79
- <td>위생설비(손세척기 등) 중 이상이 있는 것이 없으며, 종사자는 위생처리를 하고 입실하는가?</td>
80
- <td><input type="checkbox" name="check3" /></td>
81
- </tr>
82
- <tr>
83
- <td rowspan="2">일일 (작업전)</td>
84
- <td rowspan="2">방충 방서</td>
85
- <td>작업장은 밀폐가 잘 이루어지고 있으며, 방충시설(방충망 등)에는 이상이 없는가?</td>
86
- <td><input type="checkbox" name="check4" /></td>
87
- </tr>
88
- <tr>
89
- <td>파손되거나 고장 난 제조설비가 없는가?</td>
90
- <td><input type="checkbox" name="check5" /></td>
91
- </tr>
92
- <tr>
93
- <td rowspan="3">일일 (작업중)</td>
94
- <td rowspan="3">공정 관리</td>
95
- <td>청결구역작업과 일반구역작업이 분리되어 있으며 오염되지 않도록 관리되고 있는가?</td>
96
- <td><input type="checkbox" name="check6" /></td>
97
- </tr>
98
- <tr>
99
- <td>건조 후 냉각 공정이 적절히 관리되고 있는가? (기준: -5℃ ~ 10℃)</td>
100
- <td><input type="checkbox" name="check7" /></td>
101
- </tr>
102
- <tr>
103
- <td>완제품이 포장 상태가 양호한가?</td>
104
- <td><input type="checkbox" name="check8" /></td>
105
- </tr>
106
- </tbody>
107
- </table>
108
- </div>
109
- <div class="footer">
110
- <div filler></div>
111
- ${!this.dataSample
112
- ? html`
113
- <button @click=${this.updateDataItems.bind(this)} done>
114
- <md-icon>save</md-icon>${i18next.t('button.save')}
115
- </button>
116
- `
117
- : html` <span>${i18next.t('field.collected-at')}: ${this.dataSample?.collectedAt?.toLocaleString()}</span> `}
118
- </div>
119
- `
120
- }
121
-
122
- pageUpdated(changes: any, lifecycle: any, before: any) {
123
- if (this.active) {
124
- if (this.dataSetId !== lifecycle.resourceId) {
125
- this.dataSetId = lifecycle.resourceId
126
- this.fetchDataSet()
127
- }
128
- }
129
- }
130
-
131
- async fetchDataSet() {
132
- if (this.dataSetId) {
133
- const response = await client.query({
134
- query: gql`
135
- query ($id: String!) {
136
- dataSet(id: $id) {
137
- id
138
- name
139
- description
140
- useCase
141
- dataItems {
142
- name
143
- description
144
- active
145
- hidden
146
- tag
147
- group
148
- type
149
- unit
150
- options
151
- quota
152
- spec
153
- stat
154
- }
155
- }
156
- }
157
- `,
158
- variables: {
159
- id: this.dataSetId
160
- }
161
- })
162
-
163
- this.dataSet = response.data.dataSet
164
- }
165
- }
166
-
167
- private async updateDataItems() {
168
- //gather user entry data from inputs
169
- const data = {}
170
-
171
- const dataSample = {
172
- dataSet: {
173
- id: this.dataSetId
174
- },
175
- data
176
- } as any
177
-
178
- if (this.dataSample?.collectedAt) {
179
- dataSample.collectedAt = this.dataSample.collectedAt
180
- }
181
-
182
- const response = await client.mutate({
183
- mutation: gql`
184
- mutation ($dataSample: NewDataSample!) {
185
- createDataSample(dataSample: $dataSample) {
186
- id
187
- collectedAt
188
- }
189
- }
190
- `,
191
- variables: {
192
- dataSample
193
- },
194
- context: {
195
- hasUpload: true
196
- }
197
- })
198
-
199
- if (!response.errors) {
200
- const { id, collectedAt } = response.data.createDataSample
201
- this.dataSample = {
202
- id,
203
- collectedAt: new Date(collectedAt)
204
- }
205
-
206
- document.dispatchEvent(
207
- new CustomEvent('notify', { detail: { message: i18next.t('text.data sample created successfully') } })
208
- )
209
- }
210
- }
211
- }