@things-factory/integration-ui 4.0.38 → 4.0.39

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.
@@ -14,7 +14,6 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
14
14
  static get properties() {
15
15
  return {
16
16
  active: String,
17
- searchConfig: Array,
18
17
  gristConfig: Object,
19
18
  connectors: Object
20
19
  }
@@ -31,15 +30,20 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
31
30
  overflow: hidden;
32
31
  }
33
32
 
34
- search-form {
35
- overflow: visible;
36
- --mdc-icon-size: 24px;
37
- }
38
-
39
33
  ox-grist {
40
34
  overflow-y: auto;
41
35
  flex: 1;
42
36
  }
37
+
38
+ #filters {
39
+ display: flex;
40
+ flex-direction: row;
41
+ justify-content: space-between;
42
+ }
43
+
44
+ #filters > * {
45
+ padding: var(--padding-default) var(--padding-wide);
46
+ }
43
47
  `
44
48
  ]
45
49
  }
@@ -70,61 +74,24 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
70
74
  .config=${this.gristConfig}
71
75
  .fetchHandler=${this.fetchHandler.bind(this)}
72
76
  >
73
- <search-form
74
- slot="headroom"
75
- .fields=${this.searchConfig}
76
- @submit=${async () => this.dataGrist.fetch()}
77
- ></search-form>
77
+ <div slot="headroom" id="filters">
78
+ <ox-filters-form @change=${e => this.grist.fetch()}></ox-filters-form>
79
+ </div>
78
80
  </ox-grist>
79
81
  `
80
82
  }
81
83
 
82
- get searchForm() {
83
- return this.shadowRoot.querySelector('search-form')
84
+ get filtersForm() {
85
+ return this.renderRoot.querySelector('ox-filters-form')
84
86
  }
85
87
 
86
- get dataGrist() {
87
- return this.shadowRoot.querySelector('ox-grist')
88
+ get grist() {
89
+ return this.renderRoot.querySelector('ox-grist')
88
90
  }
89
91
 
90
92
  async pageInitialized() {
91
93
  this.fetchConnectors()
92
94
 
93
- this.searchConfig = [
94
- {
95
- name: 'name',
96
- type: 'text',
97
- props: {
98
- placeholder: i18next.t('field.name'),
99
- searchOper: 'like'
100
- }
101
- },
102
- {
103
- name: 'description',
104
- type: 'text',
105
- props: {
106
- placeholder: i18next.t('field.description'),
107
- searchOper: 'like'
108
- }
109
- },
110
- {
111
- name: 'type',
112
- type: 'text',
113
- props: {
114
- placeholder: i18next.t('field.type'),
115
- searchOper: 'like'
116
- }
117
- },
118
- {
119
- name: 'endpoint',
120
- type: 'text',
121
- props: {
122
- placeholder: i18next.t('field.endpoint'),
123
- searchOper: 'like'
124
- }
125
- }
126
- ]
127
-
128
95
  this.gristConfig = {
129
96
  list: { fields: ['name', 'description', 'type', 'active'] },
130
97
  columns: [
@@ -212,6 +179,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
212
179
  editable: true,
213
180
  help: value => this.connectors?.[value]?.help
214
181
  },
182
+ filter: 'search',
215
183
  sortable: true,
216
184
  width: 200
217
185
  },
@@ -222,6 +190,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
222
190
  record: {
223
191
  editable: true
224
192
  },
193
+ filter: 'search',
225
194
  sortable: true,
226
195
  width: 200
227
196
  },
@@ -233,7 +202,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
233
202
  editable: true,
234
203
  options: async (value, column, record, row, field) => {
235
204
  const { name, help, parameterSpec: spec } = record.type ? this.connectors?.[record.type] : {}
236
- const context = this.dataGrist
205
+ const context = this.grist
237
206
  return { name, help, spec, context }
238
207
  }
239
208
  },
@@ -274,14 +243,14 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
274
243
 
275
244
  await this.updateComplete
276
245
 
277
- this.dataGrist.fetch()
246
+ this.grist.fetch()
278
247
  }
279
248
 
280
249
  async pageUpdated(changes, lifecycle) {
281
250
  if (this.active) {
282
251
  await this.updateComplete
283
252
 
284
- this.dataGrist.fetch()
253
+ this.grist.fetch()
285
254
  }
286
255
  }
287
256
 
@@ -316,7 +285,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
316
285
  }
317
286
  `,
318
287
  variables: {
319
- filters: this._conditionParser(),
288
+ filters: await this.filtersForm.getQueryFilters(),
320
289
  pagination: { page, limit },
321
290
  sortings: sorters
322
291
  }
@@ -359,25 +328,6 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
359
328
  }
360
329
  }
361
330
 
362
- _conditionParser() {
363
- return this.searchForm.formFields
364
- .filter(field => (field.type !== 'checkbox' && field.value && field.value !== '') || field.type === 'checkbox')
365
- .map(field => {
366
- return {
367
- name: field.name,
368
- value:
369
- field.type === 'text'
370
- ? field.value
371
- : field.type === 'checkbox'
372
- ? field.checked
373
- : field.type === 'number'
374
- ? parseFloat(field.value)
375
- : field.value,
376
- operator: field.getAttribute('searchOper')
377
- }
378
- })
379
- }
380
-
381
331
  async _deleteConnections(name) {
382
332
  if (
383
333
  confirm(
@@ -386,7 +336,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
386
336
  })
387
337
  )
388
338
  ) {
389
- const names = this.dataGrist.selected.map(record => record.name)
339
+ const names = this.grist.selected.map(record => record.name)
390
340
  if (names && names.length > 0) {
391
341
  const response = await client.mutate({
392
342
  mutation: gql`
@@ -400,7 +350,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
400
350
  })
401
351
 
402
352
  if (!response.errors) {
403
- this.dataGrist.fetch()
353
+ this.grist.fetch()
404
354
  await document.dispatchEvent(
405
355
  new CustomEvent('notify', {
406
356
  detail: {
@@ -417,13 +367,13 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
417
367
 
418
368
  async stateChanged(state) {
419
369
  if (this.active && this._currentPopupName && !state.layout.viewparts[this._currentPopupName]) {
420
- this.dataGrist.fetch()
370
+ this.grist.fetch()
421
371
  this._currentPopupName = null
422
372
  }
423
373
  }
424
374
 
425
375
  async _updateConnectionManager() {
426
- let patches = this.dataGrist.dirtyRecords
376
+ let patches = this.grist.dirtyRecords
427
377
  if (patches && patches.length) {
428
378
  patches = patches.map(connection => {
429
379
  let patchField = connection.id ? { id: connection.id } : {}
@@ -449,7 +399,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
449
399
  }
450
400
  })
451
401
 
452
- if (!response.errors) this.dataGrist.fetch()
402
+ if (!response.errors) this.grist.fetch()
453
403
  }
454
404
  }
455
405
 
@@ -471,7 +421,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
471
421
 
472
422
  record.state = state
473
423
 
474
- this.dataGrist.refresh()
424
+ this.grist.refresh()
475
425
 
476
426
  document.dispatchEvent(
477
427
  new CustomEvent('notify', {
@@ -501,7 +451,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
501
451
 
502
452
  record.state = state
503
453
 
504
- this.dataGrist.refresh()
454
+ this.grist.refresh()
505
455
 
506
456
  document.dispatchEvent(
507
457
  new CustomEvent('notify', {
@@ -21,7 +21,6 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
21
21
  static get properties() {
22
22
  return {
23
23
  active: String,
24
- searchConfig: Array,
25
24
  gristConfig: Object,
26
25
  taskTypes: Object
27
26
  }
@@ -38,15 +37,20 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
38
37
  overflow: hidden;
39
38
  }
40
39
 
41
- search-form {
42
- overflow: visible;
43
- --mdc-icon-size: 24px;
44
- }
45
-
46
40
  ox-grist {
47
41
  overflow-y: auto;
48
42
  flex: 1;
49
43
  }
44
+
45
+ #filters {
46
+ display: flex;
47
+ flex-direction: row;
48
+ justify-content: space-between;
49
+ }
50
+
51
+ #filters > * {
52
+ padding: var(--padding-default) var(--padding-wide);
53
+ }
50
54
  `
51
55
  ]
52
56
  }
@@ -96,74 +100,45 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
96
100
  .config=${this.gristConfig}
97
101
  .fetchHandler=${this.fetchHandler.bind(this)}
98
102
  >
99
- <search-form
100
- slot="headroom"
101
- .fields=${this.searchConfig}
102
- @submit=${async () => this.dataGrist.fetch()}
103
- ></search-form>
103
+ <div slot="headroom" id="filters">
104
+ <ox-filters-form @change=${e => this.grist.fetch()}></ox-filters-form>
105
+ </div>
104
106
  </ox-grist>
105
107
  `
106
108
  }
107
109
 
108
- get searchForm() {
109
- return this.renderRoot.querySelector('search-form')
110
+ get filtersForm() {
111
+ return this.renderRoot.querySelector('ox-filters-form')
110
112
  }
111
113
 
112
- get dataGrist() {
114
+ get grist() {
113
115
  return this.renderRoot.querySelector('ox-grist')
114
116
  }
115
117
 
116
118
  // update with url params value
117
119
  _updateSearchConfig(lifecycle) {
118
- this.searchConfig = this.searchConfig.map(conf => {
119
- if (conf.name in lifecycle.params) {
120
- conf.value = lifecycle.params[conf.name]
121
- } else {
122
- delete conf.value
123
- }
124
- return conf
125
- })
120
+ // this.searchConfig = this.searchConfig.map(conf => {
121
+ // if (conf.name in lifecycle.params) {
122
+ // conf.value = lifecycle.params[conf.name]
123
+ // } else {
124
+ // delete conf.value
125
+ // }
126
+ // return conf
127
+ // })
126
128
  }
127
129
 
128
130
  // set default field value to record with searchConfig
129
131
  _setDefaultFieldsValue(fields) {
130
- this.searchConfig.forEach(conf => {
131
- if (!fields[conf.name] && conf.value) {
132
- fields[conf.name] = conf.value
133
- }
134
- })
132
+ // this.searchConfig.forEach(conf => {
133
+ // if (!fields[conf.name] && conf.value) {
134
+ // fields[conf.name] = conf.value
135
+ // }
136
+ // })
135
137
  }
136
138
 
137
139
  async pageInitialized(lifecycle) {
138
140
  this.fetchTaskTypes()
139
141
 
140
- this.searchConfig = [
141
- {
142
- name: 'name',
143
- type: 'text',
144
- props: {
145
- placeholder: i18next.t('field.name'),
146
- searchOper: 'like'
147
- }
148
- },
149
- {
150
- name: 'type',
151
- type: 'text',
152
- props: {
153
- placeholder: i18next.t('field.type'),
154
- searchOper: 'like'
155
- }
156
- },
157
- {
158
- name: 'description',
159
- type: 'text',
160
- props: {
161
- placeholder: i18next.t('field.description'),
162
- searchOper: 'like'
163
- }
164
- }
165
- ]
166
-
167
142
  this._updateSearchConfig(lifecycle)
168
143
 
169
144
  this.gristConfig = {
@@ -202,7 +177,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
202
177
  <scenario-detail
203
178
  .scenario=${record}
204
179
  .taskTypes=${this.taskTypes}
205
- @requestRefresh="${() => this.dataGrist.fetch()}"
180
+ @requestRefresh="${() => this.grist.fetch()}"
206
181
  ></scenario-detail>
207
182
  `,
208
183
  {
@@ -245,6 +220,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
245
220
  record: {
246
221
  editable: true
247
222
  },
223
+ filter: 'search',
248
224
  width: 100
249
225
  },
250
226
  {
@@ -325,7 +301,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
325
301
 
326
302
  await this.updateComplete
327
303
 
328
- this.dataGrist.fetch()
304
+ this.grist.fetch()
329
305
  }
330
306
 
331
307
  async pageUpdated(changes, lifecycle) {
@@ -334,7 +310,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
334
310
  this._updateSearchConfig(lifecycle)
335
311
  await this.updateComplete
336
312
 
337
- this.dataGrist.fetch()
313
+ this.grist.fetch()
338
314
  }
339
315
  }
340
316
 
@@ -373,7 +349,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
373
349
  }
374
350
  `,
375
351
  variables: {
376
- filters: this._conditionParser(),
352
+ filters: await this.filtersForm.getQueryFilters(),
377
353
  pagination: { page, limit },
378
354
  sortings: sorters
379
355
  }
@@ -417,28 +393,9 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
417
393
  }
418
394
  }
419
395
 
420
- _conditionParser() {
421
- return this.searchForm.formFields
422
- .filter(field => (field.type !== 'checkbox' && field.value && field.value !== '') || field.type === 'checkbox')
423
- .map(field => {
424
- return {
425
- name: field.name,
426
- value:
427
- field.type === 'text'
428
- ? field.value
429
- : field.type === 'checkbox'
430
- ? field.checked
431
- : field.type === 'number'
432
- ? parseFloat(field.value)
433
- : field.value,
434
- operator: field.getAttribute('searchOper')
435
- }
436
- })
437
- }
438
-
439
396
  async _deleteScenario() {
440
397
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
441
- const ids = this.dataGrist.selected.map(record => record.id)
398
+ const ids = this.grist.selected.map(record => record.id)
442
399
  if (ids && ids.length > 0) {
443
400
  const response = await client.mutate({
444
401
  mutation: gql`
@@ -452,7 +409,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
452
409
  })
453
410
 
454
411
  if (!response.errors) {
455
- this.dataGrist.fetch()
412
+ this.grist.fetch()
456
413
  notify({
457
414
  message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
458
415
  })
@@ -463,13 +420,13 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
463
420
 
464
421
  async stateChanged(state) {
465
422
  if (this.active && this._currentPopupName && !state.layout.viewparts[this._currentPopupName]) {
466
- this.dataGrist.fetch()
423
+ this.grist.fetch()
467
424
  this._currentPopupName = null
468
425
  }
469
426
  }
470
427
 
471
428
  async _copyScenario() {
472
- var selected = this.dataGrist.selected
429
+ var selected = this.grist.selected
473
430
  if (selected.length == 0) return
474
431
 
475
432
  if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') }))) return
@@ -486,11 +443,11 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
486
443
  }
487
444
  })
488
445
 
489
- if (!response.errors) this.dataGrist.fetch()
446
+ if (!response.errors) this.grist.fetch()
490
447
  }
491
448
 
492
449
  async _updateScenario() {
493
- let patches = this.dataGrist.dirtyRecords
450
+ let patches = this.grist.dirtyRecords
494
451
  if (patches && patches.length) {
495
452
  patches = patches.map(patch => {
496
453
  let patchField = patch.id ? { id: patch.id } : {}
@@ -519,7 +476,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
519
476
  }
520
477
  })
521
478
 
522
- if (!response.errors) this.dataGrist.fetch()
479
+ if (!response.errors) this.grist.fetch()
523
480
  }
524
481
  }
525
482
 
@@ -541,7 +498,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
541
498
  const state = response.data.startScenario.state
542
499
  record.state = state
543
500
 
544
- this.dataGrist.refresh()
501
+ this.grist.refresh()
545
502
 
546
503
  notify({
547
504
  level: 'info',
@@ -566,7 +523,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
566
523
  const state = response.data.stopScenario.state
567
524
  record.state = state
568
525
 
569
- this.dataGrist.refresh()
526
+ this.grist.refresh()
570
527
 
571
528
  notify({
572
529
  level: 'info',
@@ -575,7 +532,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
575
532
  }
576
533
 
577
534
  async exportHandler() {
578
- const exportTargets = this.dataGrist.selected.length ? this.dataGrist.selected : this.dataGrist.dirtyData.records
535
+ const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
579
536
  const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'active', 'schedule', 'timezone', 'steps'])
580
537
 
581
538
  return exportTargets.map(scenario => {
@@ -595,7 +552,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
595
552
  .scenarios="${records}"
596
553
  @imported="${() => {
597
554
  history.back()
598
- this.dataGrist.fetch()
555
+ this.grist.fetch()
599
556
  }}"
600
557
  ></scenario-importer>
601
558
  `,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-ui",
3
- "version": "4.0.38",
3
+ "version": "4.0.39",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,14 +24,14 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@operato/data-grist": "^0.3.18",
28
- "@operato/property-editor": "^0.3.18",
29
- "@things-factory/export-base": "^4.0.38",
30
- "@things-factory/import-base": "^4.0.38",
31
- "@things-factory/integration-base": "^4.0.38",
32
- "@things-factory/modeller-ui": "^4.0.38",
27
+ "@operato/data-grist": "^0.3.19",
28
+ "@operato/property-editor": "^0.3.19",
29
+ "@things-factory/export-base": "^4.0.39",
30
+ "@things-factory/import-base": "^4.0.39",
31
+ "@things-factory/integration-base": "^4.0.39",
32
+ "@things-factory/modeller-ui": "^4.0.39",
33
33
  "moment-timezone": "^0.5.27",
34
34
  "subscriptions-transport-ws": "^0.11.0"
35
35
  },
36
- "gitHead": "c2b2638e6efec319d4024cedc8da513d560c126e"
36
+ "gitHead": "a4f93ea85a26cf70ae0aa2fcd298aa59b55dd039"
37
37
  }