@things-factory/integration-ui 4.0.37 → 4.0.41
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.
- package/client/pages/connection.js +42 -90
- package/client/pages/scenario.js +59 -100
- package/package.json +8 -8
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import '@operato/data-grist'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { PageView, client, store } from '@things-factory/shell'
|
|
3
|
+
import gql from 'graphql-tag'
|
|
5
4
|
import { css, html } from 'lit-element'
|
|
6
|
-
import {
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
7
6
|
|
|
8
7
|
import { HelpDecoratedRenderer } from '@things-factory/help'
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
8
|
+
import { i18next, localize } from '@things-factory/i18n-base'
|
|
9
|
+
import { client, PageView, store } from '@things-factory/shell'
|
|
10
|
+
import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
|
|
11
11
|
import { isMobileDevice } from '@things-factory/utils'
|
|
12
12
|
|
|
13
13
|
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
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
83
|
-
return this.
|
|
84
|
+
get filtersForm() {
|
|
85
|
+
return this.renderRoot.querySelector('ox-filters-form')
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
get
|
|
87
|
-
return this.
|
|
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: [
|
|
@@ -161,6 +128,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
161
128
|
record: {
|
|
162
129
|
editable: true
|
|
163
130
|
},
|
|
131
|
+
filter: 'search',
|
|
164
132
|
sortable: true,
|
|
165
133
|
width: 150,
|
|
166
134
|
validation: function (after, before, record, column) {
|
|
@@ -187,6 +155,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
187
155
|
record: {
|
|
188
156
|
editable: true
|
|
189
157
|
},
|
|
158
|
+
filter: 'search',
|
|
190
159
|
width: 200
|
|
191
160
|
},
|
|
192
161
|
{
|
|
@@ -210,6 +179,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
210
179
|
editable: true,
|
|
211
180
|
help: value => this.connectors?.[value]?.help
|
|
212
181
|
},
|
|
182
|
+
filter: 'search',
|
|
213
183
|
sortable: true,
|
|
214
184
|
width: 200
|
|
215
185
|
},
|
|
@@ -220,6 +190,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
220
190
|
record: {
|
|
221
191
|
editable: true
|
|
222
192
|
},
|
|
193
|
+
filter: 'search',
|
|
223
194
|
sortable: true,
|
|
224
195
|
width: 200
|
|
225
196
|
},
|
|
@@ -231,7 +202,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
231
202
|
editable: true,
|
|
232
203
|
options: async (value, column, record, row, field) => {
|
|
233
204
|
const { name, help, parameterSpec: spec } = record.type ? this.connectors?.[record.type] : {}
|
|
234
|
-
const context = this.
|
|
205
|
+
const context = this.grist
|
|
235
206
|
return { name, help, spec, context }
|
|
236
207
|
}
|
|
237
208
|
},
|
|
@@ -272,21 +243,21 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
272
243
|
|
|
273
244
|
await this.updateComplete
|
|
274
245
|
|
|
275
|
-
this.
|
|
246
|
+
this.grist.fetch()
|
|
276
247
|
}
|
|
277
248
|
|
|
278
249
|
async pageUpdated(changes, lifecycle) {
|
|
279
250
|
if (this.active) {
|
|
280
251
|
await this.updateComplete
|
|
281
252
|
|
|
282
|
-
this.
|
|
253
|
+
this.grist.fetch()
|
|
283
254
|
}
|
|
284
255
|
}
|
|
285
256
|
|
|
286
257
|
async fetchHandler({ page, limit, sorters = [] }) {
|
|
287
258
|
const response = await client.query({
|
|
288
259
|
query: gql`
|
|
289
|
-
query($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
260
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
290
261
|
responses: connections(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
291
262
|
items {
|
|
292
263
|
id
|
|
@@ -314,7 +285,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
314
285
|
}
|
|
315
286
|
`,
|
|
316
287
|
variables: {
|
|
317
|
-
filters: this.
|
|
288
|
+
filters: await this.filtersForm.getQueryFilters(),
|
|
318
289
|
pagination: { page, limit },
|
|
319
290
|
sortings: sorters
|
|
320
291
|
}
|
|
@@ -357,25 +328,6 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
357
328
|
}
|
|
358
329
|
}
|
|
359
330
|
|
|
360
|
-
_conditionParser() {
|
|
361
|
-
return this.searchForm.formFields
|
|
362
|
-
.filter(field => (field.type !== 'checkbox' && field.value && field.value !== '') || field.type === 'checkbox')
|
|
363
|
-
.map(field => {
|
|
364
|
-
return {
|
|
365
|
-
name: field.name,
|
|
366
|
-
value:
|
|
367
|
-
field.type === 'text'
|
|
368
|
-
? field.value
|
|
369
|
-
: field.type === 'checkbox'
|
|
370
|
-
? field.checked
|
|
371
|
-
: field.type === 'number'
|
|
372
|
-
? parseFloat(field.value)
|
|
373
|
-
: field.value,
|
|
374
|
-
operator: field.getAttribute('searchOper')
|
|
375
|
-
}
|
|
376
|
-
})
|
|
377
|
-
}
|
|
378
|
-
|
|
379
331
|
async _deleteConnections(name) {
|
|
380
332
|
if (
|
|
381
333
|
confirm(
|
|
@@ -384,11 +336,11 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
384
336
|
})
|
|
385
337
|
)
|
|
386
338
|
) {
|
|
387
|
-
const names = this.
|
|
339
|
+
const names = this.grist.selected.map(record => record.name)
|
|
388
340
|
if (names && names.length > 0) {
|
|
389
341
|
const response = await client.mutate({
|
|
390
342
|
mutation: gql`
|
|
391
|
-
mutation($names: [String!]!) {
|
|
343
|
+
mutation ($names: [String!]!) {
|
|
392
344
|
deleteConnections(names: $names)
|
|
393
345
|
}
|
|
394
346
|
`,
|
|
@@ -398,7 +350,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
398
350
|
})
|
|
399
351
|
|
|
400
352
|
if (!response.errors) {
|
|
401
|
-
this.
|
|
353
|
+
this.grist.fetch()
|
|
402
354
|
await document.dispatchEvent(
|
|
403
355
|
new CustomEvent('notify', {
|
|
404
356
|
detail: {
|
|
@@ -415,13 +367,13 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
415
367
|
|
|
416
368
|
async stateChanged(state) {
|
|
417
369
|
if (this.active && this._currentPopupName && !state.layout.viewparts[this._currentPopupName]) {
|
|
418
|
-
this.
|
|
370
|
+
this.grist.fetch()
|
|
419
371
|
this._currentPopupName = null
|
|
420
372
|
}
|
|
421
373
|
}
|
|
422
374
|
|
|
423
375
|
async _updateConnectionManager() {
|
|
424
|
-
let patches = this.
|
|
376
|
+
let patches = this.grist.dirtyRecords
|
|
425
377
|
if (patches && patches.length) {
|
|
426
378
|
patches = patches.map(connection => {
|
|
427
379
|
let patchField = connection.id ? { id: connection.id } : {}
|
|
@@ -436,7 +388,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
436
388
|
|
|
437
389
|
const response = await client.mutate({
|
|
438
390
|
mutation: gql`
|
|
439
|
-
mutation($patches: [ConnectionPatch!]!) {
|
|
391
|
+
mutation ($patches: [ConnectionPatch!]!) {
|
|
440
392
|
updateMultipleConnection(patches: $patches) {
|
|
441
393
|
name
|
|
442
394
|
}
|
|
@@ -447,14 +399,14 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
447
399
|
}
|
|
448
400
|
})
|
|
449
401
|
|
|
450
|
-
if (!response.errors) this.
|
|
402
|
+
if (!response.errors) this.grist.fetch()
|
|
451
403
|
}
|
|
452
404
|
}
|
|
453
405
|
|
|
454
406
|
async connect(record) {
|
|
455
407
|
var response = await client.mutate({
|
|
456
408
|
mutation: gql`
|
|
457
|
-
mutation($name: String!) {
|
|
409
|
+
mutation ($name: String!) {
|
|
458
410
|
connectConnection(name: $name) {
|
|
459
411
|
state
|
|
460
412
|
}
|
|
@@ -469,7 +421,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
469
421
|
|
|
470
422
|
record.state = state
|
|
471
423
|
|
|
472
|
-
this.
|
|
424
|
+
this.grist.refresh()
|
|
473
425
|
|
|
474
426
|
document.dispatchEvent(
|
|
475
427
|
new CustomEvent('notify', {
|
|
@@ -484,7 +436,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
484
436
|
async disconnect(record) {
|
|
485
437
|
var response = await client.mutate({
|
|
486
438
|
mutation: gql`
|
|
487
|
-
mutation($name: String!) {
|
|
439
|
+
mutation ($name: String!) {
|
|
488
440
|
disconnectConnection(name: $name) {
|
|
489
441
|
state
|
|
490
442
|
}
|
|
@@ -499,7 +451,7 @@ export class Connection extends connect(store)(localize(i18next)(PageView)) {
|
|
|
499
451
|
|
|
500
452
|
record.state = state
|
|
501
453
|
|
|
502
|
-
this.
|
|
454
|
+
this.grist.refresh()
|
|
503
455
|
|
|
504
456
|
document.dispatchEvent(
|
|
505
457
|
new CustomEvent('notify', {
|
package/client/pages/scenario.js
CHANGED
|
@@ -2,16 +2,16 @@ import '@operato/data-grist'
|
|
|
2
2
|
import './scenario-detail'
|
|
3
3
|
import './scenario-importer'
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { PageView, client, navigate, store } from '@things-factory/shell'
|
|
5
|
+
import gql from 'graphql-tag'
|
|
7
6
|
import { css, html } from 'lit-element'
|
|
7
|
+
import moment from 'moment-timezone'
|
|
8
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
9
|
+
|
|
8
10
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
9
11
|
import { notify, openPopup } from '@things-factory/layout-base'
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import gql from 'graphql-tag'
|
|
12
|
+
import { client, navigate, PageView, store } from '@things-factory/shell'
|
|
13
|
+
import { CommonButtonStyles, ScrollbarStyles } from '@things-factory/styles'
|
|
13
14
|
import { isMobileDevice } from '@things-factory/utils'
|
|
14
|
-
import moment from 'moment-timezone'
|
|
15
15
|
|
|
16
16
|
function IS_SCENARIO_RUNNING(state) {
|
|
17
17
|
return state && state !== 'UNLOADED'
|
|
@@ -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
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
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
|
|
109
|
-
return this.renderRoot.querySelector('
|
|
110
|
+
get filtersForm() {
|
|
111
|
+
return this.renderRoot.querySelector('ox-filters-form')
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
get
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
132
|
-
|
|
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: 'eq'
|
|
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.
|
|
180
|
+
@requestRefresh="${() => this.grist.fetch()}"
|
|
206
181
|
></scenario-detail>
|
|
207
182
|
`,
|
|
208
183
|
{
|
|
@@ -223,6 +198,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
223
198
|
record: {
|
|
224
199
|
editable: true
|
|
225
200
|
},
|
|
201
|
+
filter: 'search',
|
|
226
202
|
sortable: true,
|
|
227
203
|
width: 150,
|
|
228
204
|
validation: function (after, before, record, column) {
|
|
@@ -244,6 +220,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
244
220
|
record: {
|
|
245
221
|
editable: true
|
|
246
222
|
},
|
|
223
|
+
filter: 'search',
|
|
247
224
|
width: 100
|
|
248
225
|
},
|
|
249
226
|
{
|
|
@@ -254,6 +231,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
254
231
|
record: {
|
|
255
232
|
editable: true
|
|
256
233
|
},
|
|
234
|
+
filter: 'search',
|
|
257
235
|
width: 200
|
|
258
236
|
},
|
|
259
237
|
{
|
|
@@ -323,7 +301,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
323
301
|
|
|
324
302
|
await this.updateComplete
|
|
325
303
|
|
|
326
|
-
this.
|
|
304
|
+
this.grist.fetch()
|
|
327
305
|
}
|
|
328
306
|
|
|
329
307
|
async pageUpdated(changes, lifecycle) {
|
|
@@ -332,14 +310,14 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
332
310
|
this._updateSearchConfig(lifecycle)
|
|
333
311
|
await this.updateComplete
|
|
334
312
|
|
|
335
|
-
this.
|
|
313
|
+
this.grist.fetch()
|
|
336
314
|
}
|
|
337
315
|
}
|
|
338
316
|
|
|
339
317
|
async fetchHandler({ page, limit, sorters = [] }) {
|
|
340
318
|
const response = await client.query({
|
|
341
319
|
query: gql`
|
|
342
|
-
query($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
320
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
343
321
|
responses: scenarios(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
344
322
|
items {
|
|
345
323
|
id
|
|
@@ -371,7 +349,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
371
349
|
}
|
|
372
350
|
`,
|
|
373
351
|
variables: {
|
|
374
|
-
filters: this.
|
|
352
|
+
filters: await this.filtersForm.getQueryFilters(),
|
|
375
353
|
pagination: { page, limit },
|
|
376
354
|
sortings: sorters
|
|
377
355
|
}
|
|
@@ -415,32 +393,13 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
415
393
|
}
|
|
416
394
|
}
|
|
417
395
|
|
|
418
|
-
_conditionParser() {
|
|
419
|
-
return this.searchForm.formFields
|
|
420
|
-
.filter(field => (field.type !== 'checkbox' && field.value && field.value !== '') || field.type === 'checkbox')
|
|
421
|
-
.map(field => {
|
|
422
|
-
return {
|
|
423
|
-
name: field.name,
|
|
424
|
-
value:
|
|
425
|
-
field.type === 'text'
|
|
426
|
-
? field.value
|
|
427
|
-
: field.type === 'checkbox'
|
|
428
|
-
? field.checked
|
|
429
|
-
: field.type === 'number'
|
|
430
|
-
? parseFloat(field.value)
|
|
431
|
-
: field.value,
|
|
432
|
-
operator: field.getAttribute('searchOper')
|
|
433
|
-
}
|
|
434
|
-
})
|
|
435
|
-
}
|
|
436
|
-
|
|
437
396
|
async _deleteScenario() {
|
|
438
397
|
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
439
|
-
const ids = this.
|
|
398
|
+
const ids = this.grist.selected.map(record => record.id)
|
|
440
399
|
if (ids && ids.length > 0) {
|
|
441
400
|
const response = await client.mutate({
|
|
442
401
|
mutation: gql`
|
|
443
|
-
mutation($ids: [String!]!) {
|
|
402
|
+
mutation ($ids: [String!]!) {
|
|
444
403
|
deleteScenarios(ids: $ids)
|
|
445
404
|
}
|
|
446
405
|
`,
|
|
@@ -450,7 +409,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
450
409
|
})
|
|
451
410
|
|
|
452
411
|
if (!response.errors) {
|
|
453
|
-
this.
|
|
412
|
+
this.grist.fetch()
|
|
454
413
|
notify({
|
|
455
414
|
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
456
415
|
})
|
|
@@ -461,19 +420,19 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
461
420
|
|
|
462
421
|
async stateChanged(state) {
|
|
463
422
|
if (this.active && this._currentPopupName && !state.layout.viewparts[this._currentPopupName]) {
|
|
464
|
-
this.
|
|
423
|
+
this.grist.fetch()
|
|
465
424
|
this._currentPopupName = null
|
|
466
425
|
}
|
|
467
426
|
}
|
|
468
427
|
|
|
469
428
|
async _copyScenario() {
|
|
470
|
-
var selected = this.
|
|
429
|
+
var selected = this.grist.selected
|
|
471
430
|
if (selected.length == 0) return
|
|
472
431
|
|
|
473
432
|
if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') }))) return
|
|
474
433
|
var response = await client.mutate({
|
|
475
434
|
mutation: gql`
|
|
476
|
-
mutation($ids: [String!]!) {
|
|
435
|
+
mutation ($ids: [String!]!) {
|
|
477
436
|
copyScenarios(ids: $ids) {
|
|
478
437
|
id
|
|
479
438
|
}
|
|
@@ -484,11 +443,11 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
484
443
|
}
|
|
485
444
|
})
|
|
486
445
|
|
|
487
|
-
if (!response.errors) this.
|
|
446
|
+
if (!response.errors) this.grist.fetch()
|
|
488
447
|
}
|
|
489
448
|
|
|
490
449
|
async _updateScenario() {
|
|
491
|
-
let patches = this.
|
|
450
|
+
let patches = this.grist.dirtyRecords
|
|
492
451
|
if (patches && patches.length) {
|
|
493
452
|
patches = patches.map(patch => {
|
|
494
453
|
let patchField = patch.id ? { id: patch.id } : {}
|
|
@@ -506,7 +465,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
506
465
|
|
|
507
466
|
const response = await client.mutate({
|
|
508
467
|
mutation: gql`
|
|
509
|
-
mutation($patches: [ScenarioPatch!]!) {
|
|
468
|
+
mutation ($patches: [ScenarioPatch!]!) {
|
|
510
469
|
updateMultipleScenario(patches: $patches) {
|
|
511
470
|
name
|
|
512
471
|
}
|
|
@@ -517,14 +476,14 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
517
476
|
}
|
|
518
477
|
})
|
|
519
478
|
|
|
520
|
-
if (!response.errors) this.
|
|
479
|
+
if (!response.errors) this.grist.fetch()
|
|
521
480
|
}
|
|
522
481
|
}
|
|
523
482
|
|
|
524
483
|
async startScenario(record) {
|
|
525
484
|
var response = await client.mutate({
|
|
526
485
|
mutation: gql`
|
|
527
|
-
mutation($scenarioName: String!, $instanceName: String) {
|
|
486
|
+
mutation ($scenarioName: String!, $instanceName: String) {
|
|
528
487
|
startScenario(scenarioName: $scenarioName, instanceName: $instanceName) {
|
|
529
488
|
state
|
|
530
489
|
}
|
|
@@ -539,7 +498,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
539
498
|
const state = response.data.startScenario.state
|
|
540
499
|
record.state = state
|
|
541
500
|
|
|
542
|
-
this.
|
|
501
|
+
this.grist.refresh()
|
|
543
502
|
|
|
544
503
|
notify({
|
|
545
504
|
level: 'info',
|
|
@@ -550,7 +509,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
550
509
|
async stopScenario(record) {
|
|
551
510
|
var response = await client.mutate({
|
|
552
511
|
mutation: gql`
|
|
553
|
-
mutation($instanceName: String!) {
|
|
512
|
+
mutation ($instanceName: String!) {
|
|
554
513
|
stopScenario(instanceName: $instanceName) {
|
|
555
514
|
state
|
|
556
515
|
}
|
|
@@ -564,7 +523,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
564
523
|
const state = response.data.stopScenario.state
|
|
565
524
|
record.state = state
|
|
566
525
|
|
|
567
|
-
this.
|
|
526
|
+
this.grist.refresh()
|
|
568
527
|
|
|
569
528
|
notify({
|
|
570
529
|
level: 'info',
|
|
@@ -573,7 +532,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
573
532
|
}
|
|
574
533
|
|
|
575
534
|
async exportHandler() {
|
|
576
|
-
const exportTargets = this.
|
|
535
|
+
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
577
536
|
const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'active', 'schedule', 'timezone', 'steps'])
|
|
578
537
|
|
|
579
538
|
return exportTargets.map(scenario => {
|
|
@@ -593,7 +552,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
593
552
|
.scenarios="${records}"
|
|
594
553
|
@imported="${() => {
|
|
595
554
|
history.back()
|
|
596
|
-
this.
|
|
555
|
+
this.grist.fetch()
|
|
597
556
|
}}"
|
|
598
557
|
></scenario-importer>
|
|
599
558
|
`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.41",
|
|
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.
|
|
28
|
-
"@operato/property-editor": "^0.3.
|
|
29
|
-
"@things-factory/export-base": "^4.0.
|
|
30
|
-
"@things-factory/import-base": "^4.0.
|
|
31
|
-
"@things-factory/integration-base": "^4.0.
|
|
32
|
-
"@things-factory/modeller-ui": "^4.0.
|
|
27
|
+
"@operato/data-grist": "^0.3.21",
|
|
28
|
+
"@operato/property-editor": "^0.3.21",
|
|
29
|
+
"@things-factory/export-base": "^4.0.41",
|
|
30
|
+
"@things-factory/import-base": "^4.0.41",
|
|
31
|
+
"@things-factory/integration-base": "^4.0.41",
|
|
32
|
+
"@things-factory/modeller-ui": "^4.0.41",
|
|
33
33
|
"moment-timezone": "^0.5.27",
|
|
34
34
|
"subscriptions-transport-ws": "^0.11.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1dd445b5b5e5b9e37291dc274886131199d7bf6a"
|
|
37
37
|
}
|