@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.
Files changed (181) hide show
  1. package/attachments/1aa35791-259f-42f3-9bab-faf4dc81c54a.png +0 -0
  2. package/attachments/39e79f93-f50c-4d0d-9016-12ef6fc72d04.pptx +0 -0
  3. package/attachments/5705d276-f428-44d6-a0b8-9667671fc011.png +0 -0
  4. package/attachments/5f63a469-132c-4ddd-a7a8-37d01f693c9d.png +0 -0
  5. package/attachments/69808491-8e6b-45e2-9bf8-dccea1c5b52e.png +0 -0
  6. package/attachments/6c3b55e5-8a42-4afa-a456-9f540972a4b5.png +0 -0
  7. package/attachments/7927fe8e-2246-453d-9869-7072b983437c.png +0 -0
  8. package/attachments/7d150574-01b8-4439-96a0-d57299f3ffcf.png +0 -0
  9. package/attachments/8bacec9a-bd5d-4dbf-bbcb-9f08dd7b60d5.png +0 -0
  10. package/attachments/a1cf142c-f3c2-442c-b8d5-a7f9cc6a59b3.png +0 -0
  11. package/attachments/aedcc3d7-a4ab-4ada-98bd-0db6fa5061ba.png +0 -0
  12. package/attachments/c1cd9051-bcf4-4711-89a2-63dfefbd969a.png +0 -0
  13. package/attachments/cb3ac834-ece0-4802-bef0-dfdc0fcd93bd.png +0 -0
  14. package/attachments/fb06c90b-df44-4ac7-b71c-056278439290.png +0 -0
  15. package/client/bootstrap.js +21 -11
  16. package/client/components/ocr-viewpart.js +1 -1
  17. package/client/editors/id-editor.js +1 -1
  18. package/client/editors/id-selector.js +1 -1
  19. package/client/menu.js +10 -5
  20. package/client/pages/data-entry/data-entry-form.js +117 -0
  21. package/client/pages/data-entry/data-entry-generator-popup.js +110 -0
  22. package/client/pages/data-set/data-item-list.js +277 -0
  23. package/client/pages/data-set/data-set-importer.js +103 -0
  24. package/client/pages/data-set/data-set-list-page.js +738 -0
  25. package/client/pages/ocr-page.js +1 -1
  26. package/client/pages/operation/operation-api.js +85 -0
  27. package/client/pages/operation/operation-master.js +432 -0
  28. package/client/pages/pending-job-page.js +1 -1
  29. package/client/pages/product/product-api.js +150 -0
  30. package/client/pages/product/product-master.js +888 -0
  31. package/client/pages/product-combination-settings-popup.js +395 -0
  32. package/client/pages/product-combinations-popup.js +372 -0
  33. package/client/pages/product-details-popup.js +744 -0
  34. package/client/pages/upload-page.js +1 -1
  35. package/client/route.js +12 -0
  36. package/config/config.development.js +1 -1
  37. package/config.development.js +16 -2
  38. package/db.sqlite +0 -0
  39. package/dist-server/constants/index.js +18 -0
  40. package/dist-server/constants/index.js.map +1 -0
  41. package/dist-server/constants/type-constants.js +26 -0
  42. package/dist-server/constants/type-constants.js.map +1 -0
  43. package/dist-server/controllers/create-data-sample-mockup.js +236 -0
  44. package/dist-server/controllers/create-data-sample-mockup.js.map +1 -0
  45. package/dist-server/controllers/index.js +17 -0
  46. package/dist-server/controllers/index.js.map +1 -1
  47. package/dist-server/service/data-sample-mockup/data-sample-mockup-mutation.js +40 -0
  48. package/dist-server/service/data-sample-mockup/data-sample-mockup-mutation.js.map +1 -0
  49. package/dist-server/service/data-sample-mockup/data-sample-mockup-type.js +28 -0
  50. package/dist-server/service/data-sample-mockup/data-sample-mockup-type.js.map +1 -0
  51. package/dist-server/service/data-sample-mockup/index.js +7 -0
  52. package/dist-server/service/data-sample-mockup/index.js.map +1 -0
  53. package/dist-server/service/index.js +5 -2
  54. package/dist-server/service/index.js.map +1 -1
  55. package/dist-server/service/reference/reference-mutation.js +6 -3
  56. package/dist-server/service/reference/reference-mutation.js.map +1 -1
  57. package/dist-server/service/reference/reference-query.js +7 -4
  58. package/dist-server/service/reference/reference-query.js.map +1 -1
  59. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +4 -4
  60. package/logs/.33a2b6820ab05dbb0f8bea4849090e12685d0b36-audit.json +3 -8
  61. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +29 -4
  62. package/logs/application-2022-06-16-13.log +4 -0
  63. package/logs/application-2022-06-16-20.log +4 -0
  64. package/logs/application-2022-06-16-21.log +7 -0
  65. package/logs/application-2022-07-22-10.log +26 -0
  66. package/logs/{connections-2022-01-17-14.log → connections-2022-01-01-00.log} +0 -0
  67. package/logs/{connections-2022-01-17-15.log → connections-2022-06-05-11.log} +0 -0
  68. package/logs/{connections-2022-06-20-13.log → connections-2022-06-08-11.log} +0 -0
  69. package/logs/connections-2022-06-08-12.log +0 -0
  70. package/logs/connections-2022-06-08-13.log +0 -0
  71. package/logs/connections-2022-06-08-15.log +0 -0
  72. package/logs/connections-2022-06-08-16.log +0 -0
  73. package/logs/connections-2022-06-08-17.log +0 -0
  74. package/logs/connections-2022-06-08-18.log +0 -0
  75. package/logs/connections-2022-06-09-00.log +0 -0
  76. package/logs/connections-2022-06-10-10.log +0 -0
  77. package/logs/connections-2022-06-10-15.log +0 -0
  78. package/logs/connections-2022-06-12-17.log +0 -0
  79. package/logs/connections-2022-06-12-19.log +0 -0
  80. package/logs/connections-2022-06-16-13.log +0 -0
  81. package/logs/connections-2022-06-16-20.log +0 -0
  82. package/logs/connections-2022-06-16-21.log +0 -0
  83. package/logs/connections-2022-07-12-00.log +0 -0
  84. package/logs/connections-2022-07-14-14.log +0 -0
  85. package/logs/connections-2022-07-14-15.log +0 -0
  86. package/logs/connections-2022-07-14-16.log +0 -0
  87. package/logs/connections-2022-07-14-17.log +0 -0
  88. package/logs/connections-2022-07-22-10.log +0 -0
  89. package/logs/system/.de213bae5e079f641b78bdb917979b79dcc8e501-audit.json +15 -0
  90. package/logs/system/scenario-1-2022-04-15-16.log +176 -0
  91. package/package.json +58 -56
  92. package/server/constants/index.ts +1 -0
  93. package/server/constants/type-constants.ts +24 -0
  94. package/server/controllers/create-data-sample-mockup.ts +268 -0
  95. package/server/controllers/index.ts +1 -0
  96. package/server/service/data-sample-mockup/data-sample-mockup-mutation.ts +18 -0
  97. package/server/service/data-sample-mockup/data-sample-mockup-type.ts +10 -0
  98. package/server/service/data-sample-mockup/index.ts +4 -0
  99. package/server/service/index.ts +5 -2
  100. package/server/service/reference/reference-mutation.ts +5 -3
  101. package/server/service/reference/reference-query.ts +8 -7
  102. package/things-factory.config.js +8 -0
  103. package/translations/en.json +6 -1
  104. package/translations/ko.json +7 -1
  105. package/attachments/02d2c4ea-147a-411e-a34e-5dbd96eea3f8.jpeg +0 -0
  106. package/attachments/05284c84-1330-4b54-a698-bcd3020d9d90.png +0 -0
  107. package/attachments/0554c8c2-aefe-4ce5-b030-94c643976577.jpeg +0 -0
  108. package/attachments/0598f578-ddd9-4b8c-8726-74ea5fe13778.jpeg +0 -0
  109. package/attachments/09fd9f4d-1909-4fbb-b5bd-b3604dd44d83.pdf +0 -0
  110. package/attachments/0c759fb7-b15a-4eba-b55f-1c97c9320e12.jpeg +0 -0
  111. package/attachments/0ca13d71-3df4-4932-b834-0057a6454776.jpeg +0 -0
  112. package/attachments/0fe94be8-c2bf-44ea-b8bd-3b2e5d65cb07.png +0 -0
  113. package/attachments/105aff20-62d2-41ae-a9ab-8ea1eb03a064.jpeg +0 -0
  114. package/attachments/124d6ef2-6ab9-4963-8b0b-5f8607b79a5b.png +0 -0
  115. package/attachments/1a4edbc9-b06c-4e1b-8b7a-4af7a8a08720.jpeg +0 -0
  116. package/attachments/1aaa7721-7a6c-47fa-a375-b186b82dd3b1.jpeg +0 -0
  117. package/attachments/1e647161-13ff-4540-9115-0fe383860516.jpeg +0 -0
  118. package/attachments/1e7fec94-e08f-468e-af89-e108904e4401.png +0 -0
  119. package/attachments/1ee44a5b-b946-4609-bf09-bc4f741325f1.png +0 -0
  120. package/attachments/244fbab5-0821-4e57-8c7e-745feaac12b3.jpeg +0 -0
  121. package/attachments/2b1cfec6-4d1c-4130-8ac5-5dffa64ac4d5.png +0 -0
  122. package/attachments/3a328a7f-b7fd-4ea1-9c4c-005e24e1e897.png +0 -0
  123. package/attachments/3c562896-8cc8-489b-8760-5109602b631a.jpeg +0 -0
  124. package/attachments/426bd3d4-aaec-496c-8d20-a84692d574dc.jpeg +0 -0
  125. package/attachments/4412432a-b79b-49b8-81b2-af6b927703b4.png +0 -0
  126. package/attachments/5427ece0-13b3-48a8-ac14-b25dcfae3cd9.jpeg +0 -0
  127. package/attachments/56aad6a3-e99d-4186-985b-d8d3ccd4ab68.jpeg +0 -0
  128. package/attachments/5a4d23c9-6fa0-43ce-87d1-27fbb252438d.jpeg +0 -0
  129. package/attachments/5a564ed4-1858-4656-8d88-b6a490bc0309.jpeg +0 -0
  130. package/attachments/5ba01610-dc05-483e-8988-da9d34c141df.jpeg +0 -0
  131. package/attachments/5d34b97a-61b9-472f-a88f-636b85c1e45c.jpeg +0 -0
  132. package/attachments/5dc41b95-4970-4221-accb-86afa94b4f3b.png +0 -0
  133. package/attachments/60ca3d2a-cfa4-4f14-b952-a96be9f64f96.png +0 -0
  134. package/attachments/62232866-32ef-43fe-b84b-993d074c173d.png +0 -0
  135. package/attachments/6309383a-7c72-4a2c-8fb9-b14fe4f1905a.jpeg +0 -0
  136. package/attachments/63142721-6030-4889-b52d-d21e8ddd52cd.jpeg +0 -0
  137. package/attachments/6a284a40-de4a-4e79-adbb-fe2ac6f123d4.png +0 -0
  138. package/attachments/6b1839fa-098b-4881-9d26-f950282f0ee7.pdf +0 -0
  139. package/attachments/6cb59217-600f-47a1-91fc-299c27e5e248.png +0 -0
  140. package/attachments/6da5c66a-08a0-409b-8f35-1a953cf44c3f.jpeg +0 -0
  141. package/attachments/709a2c9d-c919-42ca-8001-6b1688daf978.jpeg +0 -0
  142. package/attachments/70bd97b9-0cfe-4c43-9cba-3c0dbedfff70.jpeg +0 -0
  143. package/attachments/71a71839-5521-456b-8eee-134b5f0a6c1c.jpeg +0 -0
  144. package/attachments/79d67c49-a3a0-4cd9-a78c-a012732d9d8b.jpeg +0 -0
  145. package/attachments/7f4f78ba-bfe5-466c-88b4-b31824263b84.png +0 -0
  146. package/attachments/82214212-6296-4c73-812f-18a509368247.jpeg +0 -0
  147. package/attachments/8488bba6-353a-4f77-84be-1526c92f7b7f.png +0 -0
  148. package/attachments/891d2e46-a01d-408d-b715-4513fcb52240.jpeg +0 -0
  149. package/attachments/8a240663-dffe-4c20-a6a0-51e4561c2037.png +0 -0
  150. package/attachments/8b82bd3d-10ed-4c9e-94d5-7f01400b1fe1.jpeg +0 -0
  151. package/attachments/8cee2fe7-1bb9-48b1-b759-1efd0164b8c9.jpeg +0 -0
  152. package/attachments/90ea058c-ed47-4802-a694-bce0e86c217f.png +0 -0
  153. package/attachments/92be3157-e6b1-4104-b86c-4e510895a71e.jpeg +0 -0
  154. package/attachments/93a9638b-34b6-4625-9a23-dc088d5ed615.jpeg +0 -0
  155. package/attachments/9c92e78d-afcb-4d62-b51e-f73f15211314.png +0 -0
  156. package/attachments/9edcd63b-39e9-4e0c-b3e4-b255ffadc037.jpeg +0 -0
  157. package/attachments/a64d028e-7e33-4455-a1c4-f294250b5650.png +0 -0
  158. package/attachments/b1008da4-9e8a-4360-9600-2aeca8e4503a.pdf +0 -0
  159. package/attachments/b174f420-3f33-463a-8efd-6abad2f709fe.jpeg +0 -0
  160. package/attachments/b27517ec-f2ac-4735-9d8a-353af2fa5f67.png +0 -0
  161. package/attachments/b3b99d3b-6e95-4ac8-a349-b4bcf5d78dcd.png +0 -0
  162. package/attachments/b6c2d24d-8f18-4925-bc2d-4d3bffad4a02.png +0 -0
  163. package/attachments/b8a5d357-e196-4c32-8059-6d9b94470672.jpeg +0 -0
  164. package/attachments/b93a5d06-7395-4409-8680-64e8fa9542bb.jpeg +0 -0
  165. package/attachments/bacf8fe2-a3ef-433b-a00d-f154378db75a.png +0 -0
  166. package/attachments/bcb6e85d-9dae-4271-9ff6-47a235c41488.jpeg +0 -0
  167. package/attachments/c3fdecd2-b06e-461e-b2c7-23c69a30e744.jpeg +0 -0
  168. package/attachments/c47bf238-810c-489b-bc2e-c942033b2ac3.png +0 -0
  169. package/attachments/c5953130-2bc7-4f73-ab00-835e10658027.png +0 -0
  170. package/attachments/c66e06b2-32d5-416e-bc8a-c057cf938491.png +0 -0
  171. package/attachments/c7e77261-cfa2-48e8-8135-383cb0487901.jpeg +0 -0
  172. package/attachments/cc7892b9-fca6-49f9-a10b-3febeef83fd2.png +0 -0
  173. package/attachments/d179dc14-baf5-4549-b79e-580ce6b9b897.jpeg +0 -0
  174. package/attachments/d5ac154b-8c03-4456-9296-e9ce0b24c9ac.png +0 -0
  175. package/attachments/dbf0459a-4f1a-44c6-a4fc-d73adc3e4cfa.png +0 -0
  176. package/attachments/de443f64-d2b8-4b10-9b8c-e55b9ab30944.png +0 -0
  177. package/attachments/de9e417e-9636-41c7-8e27-49ff2c759ddb.jpeg +0 -0
  178. package/attachments/e5bfd176-32ac-48c0-ad7c-d65478950e28.jpeg +0 -0
  179. package/attachments/e6fcee2a-cdda-4131-8f9c-90b1fa06a4f4.png +0 -0
  180. package/attachments/f8a9e56b-6205-4dc8-991e-eec568403810.jpeg +0 -0
  181. package/logs/application-2022-06-20-13.log +0 -4
@@ -2,17 +2,22 @@ import '@things-factory/auth-ui' /* for domain-switch */
2
2
  import '@things-factory/barcode-base' /* for <default-label-printer-setting-let> */
3
3
  import '@things-factory/notification' /* for notification-badge */
4
4
  import './components/ocr-viewpart'
5
+ import '@operato/dataset/usecase/ccp'
6
+ import '@operato/dataset/usecase/qc'
7
+ import '@operato/dataset/ox-property-editor-ccp-limits.js'
8
+ import '@operato/dataset/ox-property-editor-qc-limits.js'
5
9
 
6
10
  import { html } from 'lit-html'
7
11
 
8
12
  import { OxGristEditorResourceId } from '@operato/app/grist-editor/ox-grist-editor-resource-id.js'
9
13
  import { registerDefaultGroups } from '@operato/board/register-default-groups.js'
10
14
  import { getEditor, registerEditor, registerRenderer } from '@operato/data-grist'
15
+ import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@operato/layout'
16
+ import { OxPropertyEditor } from '@operato/property-editor'
11
17
  import { isMobileDevice } from '@operato/utils'
12
18
  import { APPEND_APP_TOOL } from '@things-factory/apptool-base'
13
19
  import { auth } from '@things-factory/auth-base'
14
20
  import { setAuthManagementMenus } from '@things-factory/auth-ui'
15
- import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@things-factory/layout-base'
16
21
  import { setupMenuPart, updateMenuTemplate } from '@things-factory/lite-menu'
17
22
  import { ADD_MORENDA } from '@things-factory/more-base'
18
23
  import { ADD_SETTING } from '@things-factory/setting-base'
@@ -39,6 +44,11 @@ export default function bootstrap() {
39
44
  registerEditor('id', OxGristEditorResourceId)
40
45
  registerEditor('barcode', getEditor('string'))
41
46
 
47
+ OxPropertyEditor.register({
48
+ 'ccp-limits': 'ox-property-editor-ccp-limits',
49
+ 'qc-limits': 'ox-property-editor-qc-limits'
50
+ })
51
+
42
52
  /* set board-modeller group and default templates */
43
53
  registerDefaultGroups()
44
54
 
@@ -131,16 +141,16 @@ export default function bootstrap() {
131
141
  }
132
142
  })
133
143
 
134
- store.dispatch({
135
- type: ADD_MORENDA,
136
- morenda: {
137
- icon: html` <mwc-icon>help</mwc-icon> `,
138
- name: html` <i18n-msg msgid="text.help"></i18n-msg> `,
139
- action: () => {
140
- navigate('help')
141
- }
142
- }
143
- })
144
+ // store.dispatch({
145
+ // type: ADD_MORENDA,
146
+ // morenda: {
147
+ // icon: html` <mwc-icon>help</mwc-icon> `,
148
+ // name: html` <i18n-msg msgid="text.help"></i18n-msg> `,
149
+ // action: () => {
150
+ // navigate('help')
151
+ // }
152
+ // }
153
+ // })
144
154
 
145
155
  store.dispatch({
146
156
  type: ADD_SETTING,
@@ -2,7 +2,7 @@ import './camera-capturer'
2
2
  import '@material/mwc-button'
3
3
  import '@operato/ocr/ox-ocr-helper.js'
4
4
 
5
- import { gql } from 'graphql-tag'
5
+ import gql from 'graphql-tag'
6
6
  import { css, html, LitElement } from 'lit'
7
7
 
8
8
  import { client } from '@things-factory/shell'
@@ -3,7 +3,7 @@ import './id-selector'
3
3
 
4
4
  import { css, html, LitElement } from 'lit'
5
5
 
6
- import { openPopup } from '@things-factory/layout-base'
6
+ import { openPopup } from '@operato/layout'
7
7
 
8
8
  export class IdEditor extends LitElement {
9
9
  static get properties() {
@@ -70,7 +70,7 @@ export class IdSelector extends LitElement {
70
70
  .selectedRecords=${this.selectedRecords}
71
71
  >
72
72
  <div id="filters" slot="headroom">
73
- <ox-filters-form></ox-filters-form>
73
+ <ox-filters-form autofocus></ox-filters-form>
74
74
  </div>
75
75
  </ox-grist>
76
76
 
package/client/menu.js CHANGED
@@ -140,6 +140,16 @@ export function getMenuTemplate() {
140
140
  icon: 'settings',
141
141
  description: '데이타 수집을 위한 개념과 기능들을 소개합니다.',
142
142
  menus: [
143
+ {
144
+ name: 'Operation',
145
+ icon: 'schema',
146
+ path: 'operation_master'
147
+ },
148
+ {
149
+ name: 'Product',
150
+ icon: 'inventory',
151
+ path: 'product_master'
152
+ },
143
153
  {
144
154
  icon: 'display_settings',
145
155
  name: 'Data Set Master',
@@ -169,11 +179,6 @@ export function getMenuTemplate() {
169
179
  icon: 'newspaper',
170
180
  name: 'Data Report',
171
181
  path: 'data-report-list'
172
- },
173
- {
174
- icon: 'newspaper',
175
- name: 'Jasper Data Report',
176
- path: 'jasper-report-dev-samples'
177
182
  }
178
183
  ]
179
184
  }
@@ -0,0 +1,117 @@
1
+ import '@operato/dataset/ox-data-entry-form.js'
2
+
3
+ import gql from 'graphql-tag'
4
+ import { css, html, LitElement } from 'lit'
5
+
6
+ import { openPopup } from '@operato/layout'
7
+ import { client } from '@operato/graphql'
8
+ import { i18next, localize } from '@operato/i18n'
9
+ import { ScrollbarStyles } from '@operato/styles'
10
+
11
+ import './data-entry-generator-popup'
12
+
13
+ class DataEntryForm extends localize(i18next)(LitElement) {
14
+ static get properties() {
15
+ return {
16
+ dataSet: Object
17
+ }
18
+ }
19
+
20
+ static get styles() {
21
+ return [
22
+ ScrollbarStyles,
23
+ css`
24
+ :host {
25
+ display: flex;
26
+ flex-direction: column;
27
+
28
+ background-color: #fff;
29
+ }
30
+
31
+ ox-data-entry-form {
32
+ flex: 1;
33
+ padding: 10px;
34
+ overflow: auto;
35
+ }
36
+
37
+ .button-container {
38
+ display: flex;
39
+ margin-left: auto;
40
+ padding: var(--padding-default);
41
+ }
42
+
43
+ mwc-button {
44
+ margin-left: var(--margin-default);
45
+ }
46
+ `
47
+ ]
48
+ }
49
+
50
+ get entryForm() {
51
+ return this.renderRoot.querySelector('ox-data-entry-form')
52
+ }
53
+
54
+ render() {
55
+ return html`
56
+ <ox-data-entry-form .dataSet=${this.dataSet}></ox-data-entry-form>
57
+ <div class="button-container">
58
+ ${process.env.NODE_ENV == 'development'
59
+ ? html`<mwc-button raised @click=${this._generateMockupData.bind(this)}>${i18next.t('button.generate_mockup')}</mwc-button>`
60
+ : html``
61
+ }
62
+ <mwc-button raised @click=${this._updateDataItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
63
+ </div>
64
+ `
65
+ }
66
+
67
+ async _generateMockupData() {
68
+ this.popup = openPopup(
69
+ html`
70
+ <data-entry-generator-popup
71
+ .dataSetId="${this.dataSet.id}"
72
+ @created="${e => {
73
+ this.popup && this.popup.close()
74
+ }}"
75
+ ></data-entry-generator-popup>
76
+ `,
77
+ {
78
+ backdrop: true,
79
+ escapable: false,
80
+ size: 'small',
81
+ title: `${i18next.t('title.generate_mockup')}`
82
+ }
83
+ )
84
+ }
85
+
86
+ async _updateDataItems() {
87
+ const data = this.entryForm.buildValue()
88
+ const dataSample = {
89
+ dataSet: {
90
+ id: this.dataSet.id
91
+ },
92
+ data
93
+ }
94
+
95
+ const response = await client.mutate({
96
+ mutation: gql`
97
+ mutation ($dataSample: NewDataSample!) {
98
+ createDataSample(dataSample: $dataSample) {
99
+ id
100
+ collectedAt
101
+ }
102
+ }
103
+ `,
104
+ variables: {
105
+ dataSample
106
+ }
107
+ })
108
+
109
+ if (!response.errors) {
110
+ document.dispatchEvent(
111
+ new CustomEvent('notify', { detail: { message: i18next.t('text.data sample created successfully') } })
112
+ )
113
+ }
114
+ }
115
+ }
116
+
117
+ window.customElements.define('data-entry-form', DataEntryForm)
@@ -0,0 +1,110 @@
1
+ import { SingleColumnFormStyles } from '@things-factory/form-ui'
2
+ import '@things-factory/grist-ui'
3
+ import { i18next, localize } from '@things-factory/i18n-base'
4
+ import { client } from '@things-factory/shell'
5
+ import { gqlBuilder } from '@things-factory/utils'
6
+ import gql from 'graphql-tag'
7
+ import { css, html, LitElement } from 'lit-element'
8
+ import { notify } from '@things-factory/layout-base'
9
+
10
+ class DataEntryGeneratorPopup extends localize(i18next)(LitElement) {
11
+ static get properties() {
12
+ return {
13
+ dataSetId: String,
14
+ numSamples: Number
15
+ }
16
+ }
17
+
18
+ static get styles() {
19
+ return [
20
+ SingleColumnFormStyles,
21
+ css`
22
+ :host {
23
+ padding: 10px;
24
+ display: flex;
25
+ flex-direction: column;
26
+ overflow-x: overlay;
27
+ background-color: var(--main-section-background-color);
28
+ }
29
+ .button-container {
30
+ padding: var(--button-container-padding);
31
+ margin: var(--button-container-margin);
32
+ text-align: var(--button-container-align);
33
+ background-color: var(--button-container-background);
34
+ height: var(--button-container-height);
35
+ }
36
+ `
37
+ ]
38
+ }
39
+
40
+ render() {
41
+ return html`
42
+ <form id="input-form" name="generation" class="single-column-form" @submit=${e => this.onSubmit(e)}>
43
+ <fieldset>
44
+ <label>${i18next.t('label.num_samples')}</label>
45
+ <input type="number" .value=${this.numSamples} min="1" name="num_samples" required/>
46
+ </fieldset>
47
+ </form>
48
+
49
+ <div class="button-container">
50
+ <mwc-button raised @click="${this.generateMockupData}" label="${i18next.t('button.submit')}"></mwc-button>
51
+ </div>
52
+ `
53
+ }
54
+
55
+ async firstUpdated() {
56
+
57
+ }
58
+
59
+ async onSubmit(e) {
60
+ e.preventDefault()
61
+ this.generateMockupData()
62
+ }
63
+
64
+
65
+ serializeFormData() {
66
+ let obj = {}
67
+
68
+ Array.from(this.shadowRoot.querySelectorAll('form#input-form input')).forEach(field => {
69
+ if (!field.hasAttribute('hidden') && field.value) {
70
+ obj[field.name] = field.type === 'checkbox' ? field.checked : field.value
71
+ }
72
+ })
73
+
74
+ return obj
75
+ }
76
+
77
+ async generateMockupData() {
78
+ const params = this.serializeFormData()
79
+
80
+ const response = await client.mutate({
81
+ mutation: gql`
82
+ mutation ($params: DataSampleMockupInfo!) {
83
+ generateMockupData(params: $params)
84
+ }
85
+ `,
86
+ variables: {
87
+ params: {
88
+ dataSetId: this.dataSetId,
89
+ numSamples: parseInt(params['num_samples'])
90
+ }
91
+ }
92
+ })
93
+
94
+ if (!response.errors) {
95
+ this.dispatchEvent(new CustomEvent('created', {}))
96
+
97
+ document.dispatchEvent(
98
+ new CustomEvent('notify', { detail: { message: i18next.t('text.mockup data created successfully') } })
99
+ )
100
+
101
+ }
102
+ }
103
+
104
+ constructor() {
105
+ super()
106
+ this.numSamples = 1
107
+ }
108
+ }
109
+
110
+ window.customElements.define('data-entry-generator-popup', DataEntryGeneratorPopup)
@@ -0,0 +1,277 @@
1
+ import gql from 'graphql-tag'
2
+ import { css, html, LitElement } from 'lit'
3
+
4
+ import { client } from '@operato/graphql'
5
+ import { i18next, localize } from '@operato/i18n'
6
+ import { isMobileDevice } from '@operato/utils'
7
+
8
+ class DataItemList extends localize(i18next)(LitElement) {
9
+ static get properties() {
10
+ return {
11
+ dataSet: Object,
12
+ gristConfig: Object
13
+ }
14
+ }
15
+
16
+ static get styles() {
17
+ return [
18
+ css`
19
+ :host {
20
+ display: flex;
21
+ flex-direction: column;
22
+
23
+ background-color: #fff;
24
+ }
25
+
26
+ ox-grist {
27
+ flex: 1;
28
+ }
29
+
30
+ .button-container {
31
+ display: flex;
32
+ margin-left: auto;
33
+ padding: var(--padding-default);
34
+ }
35
+
36
+ [danger] {
37
+ --mdc-theme-primary: var(--mdc-danger-button-primary-color);
38
+ }
39
+ mwc-button {
40
+ margin-left: var(--margin-default);
41
+ }
42
+ `
43
+ ]
44
+ }
45
+
46
+ get grist() {
47
+ return this.renderRoot.querySelector('ox-grist')
48
+ }
49
+
50
+ render() {
51
+ return html`
52
+ <ox-grist
53
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
54
+ .config=${this.gristConfig}
55
+ .fetchHandler=${this.fetchHandler.bind(this)}
56
+ ></ox-grist>
57
+ <div class="button-container">
58
+ <mwc-button raised danger @click=${this._deleteDataItems.bind(this)}>${i18next.t('button.delete')}</mwc-button>
59
+ <mwc-button raised @click=${this._updateDataItems.bind(this)}>${i18next.t('button.save')}</mwc-button>
60
+ </div>
61
+ `
62
+ }
63
+
64
+ async firstUpdated() {
65
+ this.gristConfig = {
66
+ list: { fields: ['name', 'description', 'active'] },
67
+ columns: [
68
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
69
+ {
70
+ type: 'gutter',
71
+ gutterName: 'button',
72
+ icon: 'add',
73
+ handlers: {
74
+ click: 'record-copy'
75
+ }
76
+ },
77
+ { type: 'gutter', gutterName: 'sequence' },
78
+ {
79
+ type: 'gutter',
80
+ gutterName: 'button',
81
+ icon: 'arrow_upward',
82
+ handlers: {
83
+ click: 'move-up'
84
+ }
85
+ },
86
+ {
87
+ type: 'gutter',
88
+ gutterName: 'button',
89
+ icon: 'arrow_downward',
90
+ handlers: {
91
+ click: 'move-down'
92
+ }
93
+ },
94
+ {
95
+ type: 'string',
96
+ name: 'name',
97
+ header: i18next.t('field.name'),
98
+ record: {
99
+ editable: true
100
+ },
101
+ width: 140
102
+ },
103
+ {
104
+ type: 'string',
105
+ name: 'description',
106
+ header: i18next.t('field.description'),
107
+ record: {
108
+ editable: true
109
+ },
110
+ width: 180
111
+ },
112
+ {
113
+ type: 'checkbox',
114
+ name: 'active',
115
+ label: true,
116
+ header: i18next.t('field.active'),
117
+ record: {
118
+ editable: true
119
+ },
120
+ sortable: true,
121
+ width: 60
122
+ },
123
+ {
124
+ type: 'checkbox',
125
+ name: 'hidden',
126
+ label: true,
127
+ header: i18next.t('field.hidden'),
128
+ record: {
129
+ editable: true
130
+ },
131
+ sortable: true,
132
+ width: 60
133
+ },
134
+ {
135
+ type: 'string',
136
+ name: 'tag',
137
+ header: i18next.t('field.tag'),
138
+ record: {
139
+ editable: true
140
+ },
141
+ width: 180
142
+ },
143
+ {
144
+ type: 'select',
145
+ name: 'type',
146
+ header: i18next.t('field.type'),
147
+ record: {
148
+ options: ['', 'number', 'text', 'select', 'boolean', 'file'],
149
+ editable: true
150
+ },
151
+ width: 120
152
+ },
153
+ {
154
+ type: 'parameters',
155
+ name: 'options',
156
+ header: i18next.t('field.options'),
157
+ record: {
158
+ editable: true,
159
+ renderer: 'json5',
160
+ options: async (value, column, record, row, field) => {
161
+ return {
162
+ name: record.type,
163
+ help: '',
164
+ spec:
165
+ record.type === 'select'
166
+ ? [
167
+ {
168
+ type: 'options' /* property-editor type */,
169
+ name: 'options',
170
+ label: 'options'
171
+ }
172
+ ]
173
+ : [],
174
+ context: this.grist,
175
+ objectified: true
176
+ }
177
+ }
178
+ },
179
+ width: 120
180
+ },
181
+ {
182
+ type: 'string',
183
+ name: 'unit',
184
+ header: i18next.t('field.unit'),
185
+ record: {
186
+ editable: true
187
+ },
188
+ width: 120
189
+ },
190
+ {
191
+ type: 'number',
192
+ name: 'quota',
193
+ header: i18next.t('field.quota'),
194
+ record: {
195
+ editable: true
196
+ },
197
+ width: 60
198
+ },
199
+ {
200
+ type: 'data-item-spec',
201
+ name: 'spec',
202
+ header: i18next.t('field.spec'),
203
+ record: {
204
+ editable: true,
205
+ options: {
206
+ name: '',
207
+ help: '',
208
+ objectified: true /* prevent from stringifying */
209
+ }
210
+ },
211
+ width: 200
212
+ }
213
+ ],
214
+ rows: {
215
+ selectable: {
216
+ multiple: true
217
+ }
218
+ },
219
+ pagination: {
220
+ infinite: true
221
+ },
222
+ sorters: []
223
+ }
224
+ }
225
+
226
+ async fetchHandler({ filters, page, limit, sortings = [] }) {
227
+ const dataItems = this.dataSet.dataItems || []
228
+
229
+ return {
230
+ total: dataItems.length,
231
+ records: dataItems
232
+ }
233
+ }
234
+
235
+ async _updateDataItems() {
236
+ this.grist.commit()
237
+
238
+ const response = await client.mutate({
239
+ mutation: gql`
240
+ mutation ($id: String!, $patch: DataSetPatch!) {
241
+ updateDataSet(id: $id, patch: $patch) {
242
+ name
243
+ }
244
+ }
245
+ `,
246
+ variables: {
247
+ id: this.dataSet.id,
248
+ patch: {
249
+ dataItems: this.grist.data.records,
250
+ cuFlag: 'M'
251
+ }
252
+ }
253
+ })
254
+
255
+ if (!response.errors) {
256
+ await document.dispatchEvent(
257
+ new CustomEvent('notify', {
258
+ detail: {
259
+ message: i18next.t('text.info_x_successfully', {
260
+ x: i18next.t('button.save')
261
+ })
262
+ }
263
+ })
264
+ )
265
+ }
266
+ }
267
+
268
+ async _deleteDataItems() {
269
+ if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
270
+ return
271
+ }
272
+
273
+ this.grist.deleteSelectedRecords(false)
274
+ }
275
+ }
276
+
277
+ window.customElements.define('data-item-list', DataItemList)