@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.
Files changed (154) hide show
  1. package/README.md +26 -11
  2. package/assets/images/ooc.png +0 -0
  3. package/assets/images/oos.png +0 -0
  4. package/client/{bootstrap.js → bootstrap.ts} +2 -0
  5. package/client/components/{data-entry-form.js → data-entry-form.ts} +30 -33
  6. package/client/components/data-ooc-activity-view.ts +153 -0
  7. package/client/pages/data-archive/{data-archive-list-page.js → data-archive-list-page.ts} +67 -53
  8. package/client/pages/data-archive/{data-archive-request-popup.js → data-archive-request-popup.ts} +41 -39
  9. package/client/pages/data-entry/{data-entry-list-page.js → data-entry-list-page.ts} +41 -38
  10. package/client/pages/data-key-set/{data-key-item-list.js → data-key-item-list.ts} +31 -39
  11. package/client/pages/data-key-set/data-key-set-importer.ts +95 -0
  12. package/client/pages/data-key-set/{data-key-set-list-page.js → data-key-set-list-page.ts} +54 -35
  13. package/client/pages/data-ooc/{data-ooc-list-page.js → data-ooc-list-page.ts} +50 -36
  14. package/client/pages/data-ooc/{data-ooc-view.js → data-ooc-view.ts} +66 -76
  15. package/client/pages/data-report/{data-report-embed-page.js → data-report-embed-page.ts} +25 -34
  16. package/client/pages/data-report/{data-report-list-page.js → data-report-list-page.ts} +49 -43
  17. package/client/pages/data-report/{data-report-samples-page.js → data-report-samples-page.ts} +29 -43
  18. package/client/pages/data-report/{jasper-report-oocs-page.js → jasper-report-oocs-page.ts} +22 -34
  19. package/client/pages/data-report/{jasper-report-samples-crosstab-page.js → jasper-report-samples-crosstab-page.ts} +22 -34
  20. package/client/pages/data-report/{jasper-report-samples-page.js → jasper-report-samples-page.ts} +22 -34
  21. package/client/pages/data-sample/{data-sample-list-page.js → data-sample-list-page.ts} +49 -36
  22. package/client/pages/data-sample/{data-sample-search-page.js → data-sample-search-page.ts} +53 -39
  23. package/client/pages/data-sample/{data-sample-view.js → data-sample-view.ts} +29 -33
  24. package/client/pages/data-sensor/{data-sensor-list-page.js → data-sensor-list-page.ts} +41 -35
  25. package/client/pages/data-set/{data-item-list.js → data-item-list.ts} +31 -37
  26. package/client/pages/data-set/data-set-importer.ts +96 -0
  27. package/client/pages/data-set/{data-set-list-page.js → data-set-list-page.ts} +62 -36
  28. package/client/{route.js → route.ts} +1 -1
  29. package/client/tsconfig.json +11 -0
  30. package/dist-client/bootstrap.d.ts +3 -0
  31. package/dist-client/bootstrap.js +14 -0
  32. package/dist-client/bootstrap.js.map +1 -0
  33. package/dist-client/components/data-entry-form.d.ts +15 -0
  34. package/dist-client/components/data-entry-form.js +83 -0
  35. package/dist-client/components/data-entry-form.js.map +1 -0
  36. package/dist-client/components/data-ooc-activity-view.d.ts +1 -0
  37. package/dist-client/components/data-ooc-activity-view.js +154 -0
  38. package/dist-client/components/data-ooc-activity-view.js.map +1 -0
  39. package/dist-client/index.d.ts +1 -0
  40. package/dist-client/index.js +2 -0
  41. package/dist-client/index.js.map +1 -0
  42. package/dist-client/pages/data-archive/data-archive-list-page.d.ts +71 -0
  43. package/dist-client/pages/data-archive/data-archive-list-page.js +287 -0
  44. package/dist-client/pages/data-archive/data-archive-list-page.js.map +1 -0
  45. package/dist-client/pages/data-archive/data-archive-request-popup.d.ts +1 -0
  46. package/dist-client/pages/data-archive/data-archive-request-popup.js +161 -0
  47. package/dist-client/pages/data-archive/data-archive-request-popup.js.map +1 -0
  48. package/dist-client/pages/data-entry/data-entry-list-page.d.ts +36 -0
  49. package/dist-client/pages/data-entry/data-entry-list-page.js +383 -0
  50. package/dist-client/pages/data-entry/data-entry-list-page.js.map +1 -0
  51. package/dist-client/pages/data-key-set/data-key-item-list.d.ts +18 -0
  52. package/dist-client/pages/data-key-set/data-key-item-list.js +188 -0
  53. package/dist-client/pages/data-key-set/data-key-item-list.js.map +1 -0
  54. package/dist-client/pages/data-key-set/data-key-set-importer.d.ts +9 -0
  55. package/dist-client/pages/data-key-set/data-key-set-importer.js +100 -0
  56. package/dist-client/pages/data-key-set/data-key-set-importer.js.map +1 -0
  57. package/dist-client/pages/data-key-set/data-key-set-list-page.d.ts +60 -0
  58. package/dist-client/pages/data-key-set/data-key-set-list-page.js +450 -0
  59. package/dist-client/pages/data-key-set/data-key-set-list-page.js.map +1 -0
  60. package/dist-client/pages/data-ooc/data-ooc-list-page.d.ts +58 -0
  61. package/dist-client/pages/data-ooc/data-ooc-list-page.js +473 -0
  62. package/dist-client/pages/data-ooc/data-ooc-list-page.js.map +1 -0
  63. package/dist-client/pages/data-ooc/data-ooc-view.d.ts +1 -0
  64. package/dist-client/pages/data-ooc/data-ooc-view.js +179 -0
  65. package/dist-client/pages/data-ooc/data-ooc-view.js.map +1 -0
  66. package/dist-client/pages/data-report/data-report-embed-page.d.ts +36 -0
  67. package/dist-client/pages/data-report/data-report-embed-page.js +101 -0
  68. package/dist-client/pages/data-report/data-report-embed-page.js.map +1 -0
  69. package/dist-client/pages/data-report/data-report-list-page.d.ts +36 -0
  70. package/dist-client/pages/data-report/data-report-list-page.js +431 -0
  71. package/dist-client/pages/data-report/data-report-list-page.js.map +1 -0
  72. package/dist-client/pages/data-report/data-report-samples-page.d.ts +32 -0
  73. package/dist-client/pages/data-report/data-report-samples-page.js +164 -0
  74. package/dist-client/pages/data-report/data-report-samples-page.js.map +1 -0
  75. package/dist-client/pages/data-report/jasper-report-oocs-page.d.ts +2 -0
  76. package/dist-client/pages/data-report/jasper-report-oocs-page.js +101 -0
  77. package/dist-client/pages/data-report/jasper-report-oocs-page.js.map +1 -0
  78. package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.d.ts +2 -0
  79. package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js +101 -0
  80. package/dist-client/pages/data-report/jasper-report-samples-crosstab-page.js.map +1 -0
  81. package/dist-client/pages/data-report/jasper-report-samples-page.d.ts +2 -0
  82. package/dist-client/pages/data-report/jasper-report-samples-page.js +101 -0
  83. package/dist-client/pages/data-report/jasper-report-samples-page.js.map +1 -0
  84. package/dist-client/pages/data-sample/data-sample-list-page.d.ts +58 -0
  85. package/dist-client/pages/data-sample/data-sample-list-page.js +412 -0
  86. package/dist-client/pages/data-sample/data-sample-list-page.js.map +1 -0
  87. package/dist-client/pages/data-sample/data-sample-search-page.d.ts +63 -0
  88. package/dist-client/pages/data-sample/data-sample-search-page.js +413 -0
  89. package/dist-client/pages/data-sample/data-sample-search-page.js.map +1 -0
  90. package/dist-client/pages/data-sample/data-sample-view.d.ts +1 -0
  91. package/dist-client/pages/data-sample/data-sample-view.js +109 -0
  92. package/dist-client/pages/data-sample/data-sample-view.js.map +1 -0
  93. package/dist-client/pages/data-sensor/data-sensor-list-page.d.ts +49 -0
  94. package/dist-client/pages/data-sensor/data-sensor-list-page.js +419 -0
  95. package/dist-client/pages/data-sensor/data-sensor-list-page.js.map +1 -0
  96. package/dist-client/pages/data-set/data-item-list.d.ts +1 -0
  97. package/dist-client/pages/data-set/data-item-list.js +267 -0
  98. package/dist-client/pages/data-set/data-item-list.js.map +1 -0
  99. package/dist-client/pages/data-set/data-set-importer.d.ts +10 -0
  100. package/dist-client/pages/data-set/data-set-importer.js +103 -0
  101. package/dist-client/pages/data-set/data-set-importer.js.map +1 -0
  102. package/dist-client/pages/data-set/data-set-list-page.d.ts +71 -0
  103. package/dist-client/pages/data-set/data-set-list-page.js +759 -0
  104. package/dist-client/pages/data-set/data-set-list-page.js.map +1 -0
  105. package/dist-client/route.d.ts +1 -0
  106. package/dist-client/route.js +47 -0
  107. package/dist-client/route.js.map +1 -0
  108. package/dist-client/tsconfig.tsbuildinfo +1 -0
  109. package/dist-server/controllers/activity-template/activity-ooc.js +59 -0
  110. package/dist-server/controllers/activity-template/activity-ooc.js.map +1 -0
  111. package/dist-server/controllers/create-data-sample.js +38 -1
  112. package/dist-server/controllers/create-data-sample.js.map +1 -1
  113. package/dist-server/controllers/index.js +5 -0
  114. package/dist-server/controllers/index.js.map +1 -1
  115. package/dist-server/index.js +1 -2
  116. package/dist-server/index.js.map +1 -1
  117. package/dist-server/routes.js +2 -2
  118. package/dist-server/routes.js.map +1 -1
  119. package/dist-server/service/data-set/data-set-query.js +5 -4
  120. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  121. package/dist-server/service/data-set/data-set.js +3 -0
  122. package/dist-server/service/data-set/data-set.js.map +1 -1
  123. package/dist-server/service/data-set-history/data-set-history-query.js +4 -3
  124. package/dist-server/service/data-set-history/data-set-history-query.js.map +1 -1
  125. package/dist-server/tsconfig.tsbuildinfo +1 -1
  126. package/package.json +15 -12
  127. package/server/controllers/activity-template/activity-ooc.ts +55 -0
  128. package/server/controllers/create-data-sample.ts +48 -3
  129. package/server/controllers/index.ts +9 -0
  130. package/server/index.ts +1 -2
  131. package/server/routes.ts +2 -4
  132. package/server/service/data-set/data-set-query.ts +5 -4
  133. package/server/service/data-set/data-set.ts +3 -0
  134. package/server/service/data-set-history/data-set-history-query.ts +4 -3
  135. package/server/tsconfig.json +10 -0
  136. package/things-factory.config.js +2 -2
  137. package/translations/en.json +1 -1
  138. package/translations/ko.json +1 -1
  139. package/translations/ms.json +1 -0
  140. package/translations/zh.json +1 -0
  141. package/client/pages/data-key-set/data-key-set-importer.js +0 -105
  142. package/client/pages/data-set/data-set-importer.js +0 -103
  143. package/dist-server/middlewares/index.js +0 -8
  144. package/dist-server/middlewares/index.js.map +0 -1
  145. package/dist-server/migrations/index.js +0 -12
  146. package/dist-server/migrations/index.js.map +0 -1
  147. package/server/middlewares/index.ts +0 -3
  148. package/server/migrations/index.ts +0 -9
  149. package/tsconfig.json +0 -9
  150. /package/assets/{data-report.jpg → images/data-report.jpg} +0 -0
  151. /package/assets/{data-samples.jpg → images/data-samples.jpg} +0 -0
  152. /package/assets/{diagram.jpg → images/dataset-diagram.jpg} +0 -0
  153. /package/assets/{glue-table-indices.png → images/glue-table-indices-for-dataset.png} +0 -0
  154. /package/client/{index.js → index.ts} +0 -0
@@ -2,109 +2,101 @@ import '@operato/dataset/ox-data-ooc-view.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 { DataSet } from '@operato/dataset'
9
11
 
12
+ @customElement('data-ooc-view')
10
13
  class DataOocView extends localize(i18next)(LitElement) {
11
- static get styles() {
12
- return [
13
- ScrollbarStyles,
14
- css`
15
- :host {
16
- display: flex;
17
- flex-direction: column;
18
-
19
- background-color: #fff;
20
- }
14
+ static styles = [
15
+ ScrollbarStyles,
16
+ css`
17
+ :host {
18
+ display: flex;
19
+ flex-direction: column;
20
+
21
+ background-color: #fff;
22
+ }
21
23
 
22
- div[content] {
23
- flex: 1;
24
+ div[content] {
25
+ flex: 1;
24
26
 
25
- display: flex;
26
- overflow: auto;
27
- }
27
+ display: flex;
28
+ overflow: auto;
29
+ }
28
30
 
29
- ox-data-ooc-view {
30
- flex: 1;
31
- padding: var(--padding-wide);
32
- overflow: auto;
33
- }
31
+ ox-data-ooc-view {
32
+ flex: 1;
33
+ padding: var(--padding-wide);
34
+ overflow: auto;
35
+ }
34
36
 
35
- label[comment] {
36
- display: flex;
37
- flex-direction: column;
37
+ label[comment] {
38
+ display: flex;
39
+ flex-direction: column;
38
40
 
39
- padding: var(--padding-wide);
40
- }
41
+ padding: var(--padding-wide);
42
+ }
41
43
 
42
- label[comment] div {
43
- display: flex;
44
- }
44
+ label[comment] div {
45
+ display: flex;
46
+ }
45
47
 
46
- mwc-icon {
47
- color: var(--status-danger-color);
48
- }
48
+ mwc-icon {
49
+ color: var(--status-danger-color);
50
+ }
49
51
 
50
- textarea {
51
- border: var(--input-field-border);
52
- border-radius: var(--input-border-radius);
53
- padding: var(--input-field-padding);
54
- font: var(--input-field-font);
55
- }
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
+ }
56
58
 
57
- .button-container {
58
- display: flex;
59
- margin-left: auto;
60
- padding: var(--padding-default);
61
- }
62
- `
63
- ]
64
- }
59
+ .button-container {
60
+ display: flex;
61
+ margin-left: auto;
62
+ padding: var(--padding-default);
63
+ }
64
+ `
65
+ ]
65
66
 
66
- static get properties() {
67
- return {
68
- dataSet: Object,
69
- dataOoc: Object
70
- }
71
- }
67
+ @property({ type: Object }) dataSet?: DataSet
68
+ @property({ type: Object }) dataOoc?: any
72
69
 
73
- get sampleView() {
74
- return this.renderRoot.querySelector('ox-data-ooc-view')
75
- }
70
+ @query('textarea') commentTextArea!: HTMLTextAreaElement
71
+ @query('ox-data-ooc-view') sampleView!: HTMLTextAreaElement
76
72
 
77
73
  render() {
78
- const state = this.dataOoc.state
74
+ const state = this.dataOoc?.state
79
75
 
80
76
  return html`
81
77
  <div content>
82
78
  <ox-data-ooc-view .dataSet=${this.dataSet} .dataOoc=${this.dataOoc}></ox-data-ooc-view>
83
79
  </div>
84
80
 
85
- ${
86
- state === 'CREATED' || state === 'REVIEWED'
87
- ? html`
81
+ ${state === 'CREATED' || state === 'REVIEWED'
82
+ ? html`
88
83
  <label comment>
89
84
  <div><mwc-icon>build_circle</mwc-icon> <span>correction activity</span></div>
90
85
  <textarea placeholder="조치 내용을 입력해주세요."></textarea>
91
86
  </label>
92
87
  `
93
- : html``
94
- }
88
+ : html``}
95
89
 
96
90
  <div class="button-container">
97
- ${
98
- state === 'CREATED'
99
- ? html`<mwc-button raised @click=${() => this._processOoc('REVIEWED')}
100
- >${i18next.t('button.reviewed')}</mwc-button
101
- >`
102
- : state === 'REVIEWED'
103
- ? html`<mwc-button raised @click=${() => this._processOoc('CORRECTED')}
104
- >${i18next.t('button.corrected')}</mwc-button
105
- >`
106
- : html``
107
- }
91
+ ${state === 'CREATED'
92
+ ? html`<mwc-button raised @click=${() => this._processOoc('REVIEWED')}
93
+ >${i18next.t('button.reviewed')}</mwc-button
94
+ >`
95
+ : state === 'REVIEWED'
96
+ ? html`<mwc-button raised @click=${() => this._processOoc('CORRECTED')}
97
+ >${i18next.t('button.corrected')}</mwc-button
98
+ >`
99
+ : html``}
108
100
  </div>
109
101
  `
110
102
  }
@@ -142,7 +134,7 @@ class DataOocView extends localize(i18next)(LitElement) {
142
134
  }
143
135
  `,
144
136
  variables: {
145
- id: this.dataOoc.dataSet.id
137
+ id: this.dataOoc?.dataSet?.id
146
138
  }
147
139
  })
148
140
 
@@ -151,7 +143,7 @@ class DataOocView extends localize(i18next)(LitElement) {
151
143
  }
152
144
 
153
145
  async _processOoc(state) {
154
- const commentTextArea = this.renderRoot.querySelector('textarea')
146
+ const commentTextArea = this.commentTextArea
155
147
  const comment = commentTextArea && commentTextArea.value
156
148
  if (!comment || !comment.trim()) {
157
149
  commentTextArea.focus()
@@ -172,7 +164,7 @@ class DataOocView extends localize(i18next)(LitElement) {
172
164
  }
173
165
  `,
174
166
  variables: {
175
- id: this.dataOoc.id,
167
+ id: this.dataOoc?.id,
176
168
  patch
177
169
  }
178
170
  })
@@ -184,5 +176,3 @@ class DataOocView extends localize(i18next)(LitElement) {
184
176
  }
185
177
  }
186
178
  }
187
-
188
- window.customElements.define('data-ooc-view', DataOocView)
@@ -6,41 +6,34 @@ import '@operato/data-grist'
6
6
  import '@things-factory/form-ui'
7
7
 
8
8
  import { css, html } from 'lit'
9
+ import { customElement, property, query, state } from 'lit/decorators.js'
9
10
 
11
+ import { PageView } from '@operato/shell'
10
12
  import { i18next, localize } from '@operato/i18n'
11
13
  import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
12
- import { PageView } from '@things-factory/shell'
13
- import { encodeUrlParams, getCookie } from '@things-factory/utils'
14
+ import { encodeUrlParams } from '@operato/utils'
14
15
 
15
- class DataReportEmbedPage extends localize(i18next)(PageView) {
16
- static get properties() {
17
- return {
18
- _grnNo: String,
19
- _status: String,
20
- resourceId: String,
21
- params: Object
22
- }
23
- }
16
+ @customElement('data-report-embed-page')
17
+ export class DataReportEmbedPage extends localize(i18next)(PageView) {
18
+ static styles = [
19
+ ScrollbarStyles,
20
+ css`
21
+ :host {
22
+ display: flex;
23
+ flex-direction: column;
24
+ padding: 0;
25
+ }
24
26
 
25
- static get styles() {
26
- return [
27
- ScrollbarStyles,
28
- css`
29
- :host {
30
- display: flex;
31
- flex-direction: column;
32
- padding: 0;
33
- }
27
+ #container {
28
+ flex: 1;
29
+ padding: 0;
30
+ margin: 0;
31
+ border: 0;
32
+ }
33
+ `
34
+ ]
34
35
 
35
- #container {
36
- flex: 1;
37
- padding: 0;
38
- margin: 0;
39
- border: 0;
40
- }
41
- `
42
- ]
43
- }
36
+ @query('iframe') iframe!: HTMLIFrameElement
44
37
 
45
38
  get context() {
46
39
  const filters = [
@@ -55,7 +48,7 @@ class DataReportEmbedPage extends localize(i18next)(PageView) {
55
48
  {
56
49
  title: i18next.t('button.print'),
57
50
  action: () => {
58
- this.renderRoot.querySelector('iframe').contentWindow.print()
51
+ this.iframe.contentWindow?.print()
59
52
  },
60
53
  ...CommonButtonStyles.print
61
54
  }
@@ -76,7 +69,7 @@ class DataReportEmbedPage extends localize(i18next)(PageView) {
76
69
  }}
77
70
  ?url-params-sensitive=${this.active}
78
71
  ></ox-filters-form-base>
79
- <iframe id="container" frameborder="0" style="border:0"></iframe>
72
+ <iframe frameborder="0" style="border:0"></iframe>
80
73
  `
81
74
  }
82
75
 
@@ -110,8 +103,6 @@ class DataReportEmbedPage extends localize(i18next)(PageView) {
110
103
 
111
104
  const encodedUrlParams = encodeUrlParams(urlParams)
112
105
 
113
- this.shadowRoot.querySelector('#container').src = `/data-report/${reportType}/?${encodedUrlParams}`
106
+ this.iframe.src = `/data-report/${reportType}/?${encodedUrlParams}`
114
107
  }
115
108
  }
116
-
117
- window.customElements.define('data-report-embed-page', DataReportEmbedPage)
@@ -3,17 +3,20 @@ import '@operato/board/ox-board-viewer.js'
3
3
 
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit'
6
+ import { customElement, property, query, state } from 'lit/decorators.js'
6
7
  import { connect } from 'pwa-helpers/connect-mixin'
7
8
 
8
- import { getRenderer } from '@operato/data-grist'
9
+ import { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
9
10
  import { OxDataUseCase } from '@operato/dataset'
10
11
  import { client } from '@operato/graphql'
11
12
  import { i18next, localize } from '@operato/i18n'
12
13
  import { openPopup } from '@operato/layout'
13
14
  import { navigate, PageView, store } from '@operato/shell'
14
15
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
16
+ import { OxPopup } from '@operato/popup'
17
+ import { encodeUrlParams } from '@operato/utils'
18
+
15
19
  import { provider } from '@things-factory/board-ui'
16
- import { encodeUrlParams } from '@things-factory/utils'
17
20
 
18
21
  const USECASE_OPTIONS = () => {
19
22
  return ['', ...OxDataUseCase.getUseCaseNames()].map(name => {
@@ -62,6 +65,9 @@ const showMonitorView = (columns, data, column, record, rowIndex) => {
62
65
  // navigate(`board-viewer/${monitorView}?interactive=true&title=${title}`)
63
66
  break
64
67
 
68
+ case 'custom-element':
69
+ break
70
+
65
71
  case 'page':
66
72
  navigate(monitorView)
67
73
  break
@@ -73,8 +79,8 @@ const showMonitorView = (columns, data, column, record, rowIndex) => {
73
79
  }
74
80
 
75
81
  const showReportView = (columns, data, column, record, rowIndex) => {
76
- const { id:datasetId, dataKeySet, name, reportType, reportView, reportTemplate } = record
77
- const { id:dataKeySetId } = dataKeySet || { id: '' }
82
+ const { id: datasetId, dataKeySet, name, reportType, reportView, reportTemplate } = record
83
+ const { id: dataKeySetId } = dataKeySet || { id: '' }
78
84
  const title = `${name} - ${i18next.t('title.data-report-view')}`
79
85
 
80
86
  switch (reportType) {
@@ -89,55 +95,63 @@ const showReportView = (columns, data, column, record, rowIndex) => {
89
95
  case 'embed':
90
96
  break
91
97
 
98
+ case 'custom-element':
99
+ break
100
+
92
101
  case 'page':
93
102
  break
94
103
 
95
104
  case 'external':
96
105
  window.open(reportView, '_blank')
97
106
  break
98
-
107
+
99
108
  case 'jasper':
100
109
  case 'shiny':
101
110
  const encodedUrlParams = encodeUrlParams({ datasetId, dataKeySetId, reportType, reportView, reportTemplate })
102
111
  navigate(`/data-report-samples/?${encodedUrlParams}`)
103
112
  break
104
-
113
+
105
114
  default:
106
115
  break
107
116
  }
108
117
  }
109
118
 
119
+ @customElement('data-report-list-page')
110
120
  export class DataReportListPage extends connect(store)(localize(i18next)(PageView)) {
111
- static get properties() {
112
- return {
113
- active: String,
114
- gristConfig: Object,
115
- filters: Object,
116
- sorters: Object,
117
- mode: String
118
- }
119
- }
121
+ static styles = [
122
+ ScrollbarStyles,
123
+ CommonGristStyles,
124
+ css`
125
+ :host {
126
+ display: flex;
120
127
 
121
- static get styles() {
122
- return [
123
- ScrollbarStyles,
124
- CommonGristStyles,
125
- css`
126
- :host {
127
- display: flex;
128
+ width: 100%;
128
129
 
129
- width: 100%;
130
+ --grid-record-emphasized-background-color: red;
131
+ --grid-record-emphasized-color: yellow;
132
+ }
133
+ `
134
+ ]
130
135
 
131
- --grid-record-emphasized-background-color: red;
132
- --grid-record-emphasized-color: yellow;
133
- }
134
- `
135
- ]
136
- }
136
+ @state() gristConfig: any
137
+ @state() mode: 'CARD' | 'GRID' | 'LIST' = 'CARD'
138
+ @query('ox-grist') private grist!: DataGrist
139
+ @query('#sorter-control') private sortersControl!: OxPopup
137
140
 
138
141
  get context() {
139
142
  return {
140
- title: i18next.t('title.data-report list'),
143
+ search: {
144
+ handler: (search: string) => {
145
+ this.grist.searchText = search
146
+ },
147
+ placeholder: i18next.t('title.data-report list'),
148
+ value: this.grist.searchText
149
+ },
150
+ filter: {
151
+ handler: () => {
152
+ this.grist.toggleHeadroom()
153
+ }
154
+ },
141
155
  help: 'dataset/data-report-list'
142
156
  }
143
157
  }
@@ -149,13 +163,12 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
149
163
  <ox-grist
150
164
  .mode=${mode}
151
165
  .config=${this.gristConfig}
152
- .filters=${this.filters}
153
- .orders=${this.orders}
154
166
  .fetchHandler=${this.fetchHandler.bind(this)}
167
+ ?url-params-sensitive=${this.active}
155
168
  >
156
169
  <div slot="headroom">
157
170
  <div id="filters">
158
- <ox-filters-form autofocus></ox-filters-form>
171
+ <ox-filters-form autofocus without-search></ox-filters-form>
159
172
  </div>
160
173
 
161
174
  <div id="sorters">
@@ -163,7 +176,7 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
163
176
  <mwc-icon
164
177
  @click=${e => {
165
178
  const target = e.currentTarget
166
- this.renderRoot.querySelector('#sorter-control').open({
179
+ this.sortersControl.open({
167
180
  right: 0,
168
181
  top: target.offsetTop + target.offsetHeight
169
182
  })
@@ -179,10 +192,6 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
179
192
  `
180
193
  }
181
194
 
182
- get grist() {
183
- return this.renderRoot.querySelector('ox-grist')
184
- }
185
-
186
195
  async pageInitialized(lifecycle) {
187
196
  this.gristConfig = {
188
197
  list: {
@@ -275,8 +284,7 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
275
284
  record: {
276
285
  editable: false
277
286
  },
278
- width: 80,
279
- label: true
287
+ width: 80
280
288
  },
281
289
  {
282
290
  type: 'resource-object',
@@ -358,7 +366,7 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
358
366
  }
359
367
  }
360
368
 
361
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
369
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
362
370
  const response = await client.query({
363
371
  query: gql`
364
372
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -430,5 +438,3 @@ export class DataReportListPage extends connect(store)(localize(i18next)(PageVie
430
438
  }
431
439
  }
432
440
  }
433
-
434
- window.customElements.define('data-report-list-page', DataReportListPage)
@@ -6,46 +6,41 @@ import '@operato/data-grist'
6
6
 
7
7
  import gql from 'graphql-tag'
8
8
  import { css, html } from 'lit'
9
+ import { customElement, property, query, state } from 'lit/decorators.js'
9
10
  import { connect } from 'pwa-helpers/connect-mixin'
10
11
 
11
12
  import { client } from '@operato/graphql'
12
13
  import { i18next, localize } from '@operato/i18n'
13
14
  import { PageView, store } from '@operato/shell'
14
15
  import { ScrollbarStyles } from '@operato/styles'
16
+ import { encodeUrlParams } from '@operato/utils'
17
+ import { FetchOption } from '@operato/data-grist'
15
18
 
16
- import { encodeUrlParams } from '@things-factory/utils'
17
-
19
+ @customElement('data-report-samples-page')
18
20
  export class DataReportSamplesPage extends connect(store)(localize(i18next)(PageView)) {
19
- static get properties() {
20
- return {
21
- dataKeySetId: String,
22
- dataKeySet: Object,
23
- active: String
24
- }
25
- }
21
+ static styles = [
22
+ ScrollbarStyles,
23
+ css`
24
+ :host {
25
+ display: flex;
26
+ flex-direction: column;
27
+ padding: 0;
28
+ }
26
29
 
27
- static get styles() {
28
- return [
29
- ScrollbarStyles,
30
- css`
31
- :host {
32
- display: flex;
33
- flex-direction: column;
34
- padding: 0;
35
- }
30
+ #container {
31
+ flex: 1;
32
+ padding: 0;
33
+ margin: 0;
34
+ border: 0;
35
+ }
36
+ `
37
+ ]
36
38
 
37
- #container {
38
- flex: 1;
39
- padding: 0;
40
- margin: 0;
41
- border: 0;
42
- }
43
- `
44
- ]
45
- }
39
+ @state() dataKeySetId?: string
40
+ @state() dataKeySet: any
41
+ @query('iframe') container!: HTMLIFrameElement
46
42
 
47
43
  get context() {
48
-
49
44
  const today = new Date().toISOString().split('T')[0]
50
45
 
51
46
  const filters = [
@@ -82,12 +77,7 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
82
77
 
83
78
  render() {
84
79
  // clear if pre-loaded
85
- const container = this.shadowRoot.querySelector('#container')
86
- if (container) {
87
- container.src = ""
88
- // @TODO: Clear filters
89
- /** */
90
- }
80
+ this.container.src = ''
91
81
 
92
82
  return html`
93
83
  <ox-filters-form-base
@@ -98,7 +88,8 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
98
88
  }}
99
89
  ?url-params-sensitive=${this.active}
100
90
  ></ox-filters-form-base>
101
- <iframe id="container"></iframe>
91
+
92
+ <iframe></iframe>
102
93
  `
103
94
  }
104
95
 
@@ -132,7 +123,7 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
132
123
  const encodedUrlParams = encodeUrlParams(urlParams)
133
124
 
134
125
  const reportUrl = `/data-report/${urlParams.reportType}/`
135
- this.shadowRoot.querySelector('#container').src = `${reportUrl}?${encodedUrlParams}`
126
+ this.container.src = `${reportUrl}?${encodedUrlParams}`
136
127
  }
137
128
 
138
129
  pageUpdated(changes, lifecycle) {
@@ -143,14 +134,12 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
143
134
  }
144
135
  }
145
136
 
146
- async fetchHandler({ page, limit, sortings = [], filters = [] }) {
147
-
148
- }
137
+ async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {}
149
138
 
150
139
  async updated(changes) {
151
140
  if (changes.has('dataKeySetId')) {
152
141
  if (!this.dataKeySetId) {
153
- this.dataKeySet = null
142
+ this.dataKeySet = null
154
143
  return
155
144
  }
156
145
 
@@ -180,7 +169,4 @@ export class DataReportSamplesPage extends connect(store)(localize(i18next)(Page
180
169
  this.dataKeySet = response.data.dataKeySet
181
170
  }
182
171
  }
183
-
184
172
  }
185
-
186
- window.customElements.define('data-report-samples-page', DataReportSamplesPage)