@things-factory/dataset 5.0.4 → 5.0.5

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.
@@ -112,7 +112,9 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
112
112
  handlers: {
113
113
  click: (columns, data, column, record, rowIndex) => {
114
114
  openPopup(
115
- html` <data-sample-view .dataSample=${record} style="background-color: white;"></data-sample-view> `,
115
+ html`
116
+ <data-sample-view data-sample-id=${record.id} style="background-color: white;"></data-sample-view>
117
+ `,
116
118
  {
117
119
  backdrop: true,
118
120
  size: 'large',
@@ -147,17 +149,6 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
147
149
  width: 150,
148
150
  imex: true
149
151
  },
150
- {
151
- type: 'resource-object',
152
- name: 'dataSet',
153
- header: i18next.t('field.data-set'),
154
- record: {
155
- editable: false
156
- },
157
- sortable: true,
158
- width: 120,
159
- imex: true
160
- },
161
152
  {
162
153
  type: 'string',
163
154
  name: 'key01',
@@ -344,19 +335,7 @@ export class DataSampleListPage extends connect(store)(localize(i18next)(PageVie
344
335
  key03
345
336
  key04
346
337
  key05
347
- dataSet {
348
- id
349
- name
350
- description
351
- }
352
338
  partitionKeys
353
- dataItems {
354
- name
355
- description
356
- tag
357
- unit
358
- spec
359
- }
360
339
  data
361
340
  rawData
362
341
  ooc
@@ -133,6 +133,8 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
133
133
 
134
134
  this.dataKeySet = response.data.dataKeySet
135
135
  this.refreshGristConfig()
136
+
137
+ this.grist.fetch()
136
138
  }
137
139
  }
138
140
 
@@ -168,7 +170,9 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
168
170
  handlers: {
169
171
  click: (columns, data, column, record, rowIndex) => {
170
172
  openPopup(
171
- html` <data-sample-view .dataSample=${record} style="background-color: white;"></data-sample-view> `,
173
+ html`
174
+ <data-sample-view data-sample-id=${record.id} style="background-color: white;"></data-sample-view>
175
+ `,
172
176
  {
173
177
  backdrop: true,
174
178
  size: 'large',
@@ -301,6 +305,10 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
301
305
  }
302
306
 
303
307
  async fetchHandler({ page, limit, sortings = [], filters = [] }) {
308
+ if (!this.dataKeySetId) {
309
+ return { records: [], total: 0 }
310
+ }
311
+
304
312
  const response = await client.query({
305
313
  query: gql`
306
314
  query ($dataKeySetId: String!, $filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -323,18 +331,6 @@ export class DataSampleSearchPage extends connect(store)(localize(i18next)(PageV
323
331
  data
324
332
  ooc
325
333
  oos
326
- dataSet {
327
- id
328
- name
329
- description
330
- }
331
- dataItems {
332
- name
333
- description
334
- tag
335
- unit
336
- spec
337
- }
338
334
  judgment
339
335
  workDate
340
336
  workShift
@@ -1,13 +1,19 @@
1
1
  import '@operato/dataset/ox-data-sample-view.js'
2
2
 
3
+ import gql from 'graphql-tag'
3
4
  import { css, html, LitElement } from 'lit'
4
5
 
6
+ import { client } from '@operato/graphql'
5
7
  import { i18next, localize } from '@operato/i18n'
6
8
  import { ScrollbarStyles } from '@operato/styles'
7
9
 
8
10
  class DataSampleView extends localize(i18next)(LitElement) {
9
11
  static get properties() {
10
12
  return {
13
+ dataSampleId: {
14
+ type: String,
15
+ attribute: 'data-sample-id'
16
+ },
11
17
  dataSample: Object
12
18
  }
13
19
  }
@@ -42,10 +48,67 @@ class DataSampleView extends localize(i18next)(LitElement) {
42
48
  render() {
43
49
  return html`
44
50
  <div content>
45
- <ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>
51
+ ${this.dataSample ? html`<ox-data-sample-view .dataSample=${this.dataSample}></ox-data-sample-view>` : html``}
46
52
  </div>
47
53
  `
48
54
  }
55
+
56
+ updated(changes) {
57
+ if (changes.has('dataSampleId')) {
58
+ this.fetchDataSample()
59
+ }
60
+ }
61
+
62
+ async fetchDataSample() {
63
+ const id = this.dataSampleId
64
+
65
+ const response = await client.query({
66
+ query: gql`
67
+ query ($id: String!) {
68
+ dataSample(id: $id) {
69
+ id
70
+ name
71
+ description
72
+ useCase
73
+ key01
74
+ key02
75
+ key03
76
+ key04
77
+ key05
78
+ data
79
+ ooc
80
+ oos
81
+ dataSet {
82
+ id
83
+ name
84
+ description
85
+ }
86
+ dataItems {
87
+ name
88
+ description
89
+ tag
90
+ unit
91
+ spec
92
+ }
93
+ judgment
94
+ workDate
95
+ workShift
96
+ updater {
97
+ id
98
+ name
99
+ }
100
+ updatedAt
101
+ collectedAt
102
+ }
103
+ }
104
+ `,
105
+ variables: {
106
+ id
107
+ }
108
+ })
109
+
110
+ this.dataSample = response.data.dataSample
111
+ }
49
112
  }
50
113
 
51
114
  window.customElements.define('data-sample-view', DataSampleView)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -43,5 +43,5 @@
43
43
  "cron-parser": "^4.3.0",
44
44
  "moment-timezone": "^0.5.34"
45
45
  },
46
- "gitHead": "53af7004376fb8221cebe0c4c2ff3ed82418c22a"
46
+ "gitHead": "6a82800ed0252cf65918e2fe934ad3f3ba72e153"
47
47
  }