@things-factory/integration-ui 9.1.19 → 10.0.0-beta.2
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.ts +209 -326
- package/client/pages/scenario.ts +260 -408
- package/client/pages/state-register.ts +117 -181
- package/client/viewparts/scenario-instance-log-view.ts +1 -4
- package/client/viewparts/scenario-instance-view.ts +5 -9
- package/dist-client/pages/connection.d.ts +0 -6
- package/dist-client/pages/connection.js +91 -172
- package/dist-client/pages/connection.js.map +1 -1
- package/dist-client/pages/scenario.d.ts +0 -6
- package/dist-client/pages/scenario.js +113 -212
- package/dist-client/pages/scenario.js.map +1 -1
- package/dist-client/pages/state-register.d.ts +0 -6
- package/dist-client/pages/state-register.js +55 -105
- package/dist-client/pages/state-register.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/viewparts/scenario-instance-log-view.d.ts +1 -9
- package/dist-client/viewparts/scenario-instance-log-view.js +1 -3
- package/dist-client/viewparts/scenario-instance-log-view.js.map +1 -1
- package/dist-client/viewparts/scenario-instance-view.d.ts +2 -11
- package/dist-client/viewparts/scenario-instance-view.js +7 -11
- package/dist-client/viewparts/scenario-instance-view.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
|
@@ -5,12 +5,6 @@ import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
|
5
5
|
import { PageView } from '@operato/shell';
|
|
6
6
|
import { FetchOption } from '@operato/data-grist';
|
|
7
7
|
declare const Scenario_base: (new (...args: any[]) => {
|
|
8
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
9
|
-
connectedCallback(): void;
|
|
10
|
-
disconnectedCallback(): void;
|
|
11
|
-
stateChanged(_state: unknown): void;
|
|
12
|
-
readonly isConnected: boolean;
|
|
13
|
-
}) & (new (...args: any[]) => {
|
|
14
8
|
__preferenceProviders: {
|
|
15
9
|
[element: string]: import("@operato/p13n").PagePreferenceProvider;
|
|
16
10
|
};
|
|
@@ -5,19 +5,18 @@ import './scenario-importer.js';
|
|
|
5
5
|
import gql from 'graphql-tag';
|
|
6
6
|
import { css, html } from 'lit';
|
|
7
7
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
8
|
-
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
9
8
|
import { DataGrist } from '@operato/data-grist/ox-grist.js';
|
|
10
9
|
import { client } from '@operato/graphql';
|
|
11
10
|
import { i18next, localize } from '@operato/i18n';
|
|
12
11
|
import { notify, openPopup } from '@operato/layout';
|
|
13
|
-
import { navigate, PageView
|
|
12
|
+
import { navigate, PageView } from '@operato/shell';
|
|
14
13
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
15
14
|
import { isMobileDevice } from '@operato/utils';
|
|
16
15
|
import { p13n } from '@operato/p13n';
|
|
17
16
|
function IS_SCENARIO_RUNNING(state) {
|
|
18
17
|
return state && state !== 'UNLOADED';
|
|
19
18
|
}
|
|
20
|
-
let Scenario = class Scenario extends
|
|
19
|
+
let Scenario = class Scenario extends p13n(localize(i18next)(PageView)) {
|
|
21
20
|
constructor() {
|
|
22
21
|
super(...arguments);
|
|
23
22
|
this.active = false;
|
|
@@ -27,67 +26,55 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
27
26
|
CommonGristStyles,
|
|
28
27
|
ScrollbarStyles,
|
|
29
28
|
css `
|
|
30
|
-
:host {
|
|
31
|
-
display: flex;
|
|
29
|
+
:host { display: flex;
|
|
32
30
|
flex-direction: column;
|
|
33
31
|
|
|
34
32
|
overflow: hidden;
|
|
35
|
-
|
|
33
|
+
}
|
|
36
34
|
|
|
37
|
-
ox-grist {
|
|
38
|
-
overflow-y: auto;
|
|
35
|
+
ox-grist { overflow-y: auto;
|
|
39
36
|
flex: 1;
|
|
40
|
-
|
|
37
|
+
}
|
|
41
38
|
`
|
|
42
39
|
];
|
|
43
40
|
}
|
|
44
41
|
get context() {
|
|
45
|
-
return {
|
|
46
|
-
|
|
47
|
-
search: {
|
|
48
|
-
handler: search => {
|
|
42
|
+
return { title: i18next.t('text.scenario list'),
|
|
43
|
+
search: { handler: search => {
|
|
49
44
|
this.grist.searchText = search;
|
|
50
45
|
},
|
|
51
46
|
value: this.grist?.searchText || ''
|
|
52
47
|
},
|
|
53
48
|
// 필터가 설정되면, 아래 코멘트 해제
|
|
54
|
-
// filter: {
|
|
55
|
-
// handler: () => {
|
|
56
|
-
// const display = this.headroom.style.display
|
|
49
|
+
// filter: { // handler: () => { // const display = this.headroom.style.display
|
|
57
50
|
// this.headroom.style.display = display !== 'none' ? 'none' : 'flex'
|
|
58
|
-
//
|
|
51
|
+
// }
|
|
59
52
|
// },
|
|
60
53
|
help: 'integration/ui/scenario',
|
|
61
54
|
actions: [
|
|
62
|
-
{
|
|
63
|
-
title: i18next.t('button.start monitor'),
|
|
55
|
+
{ title: i18next.t('button.start monitor'),
|
|
64
56
|
action: () => {
|
|
65
57
|
navigate('integration-monitor');
|
|
66
58
|
},
|
|
67
59
|
...CommonButtonStyles.preview
|
|
68
60
|
},
|
|
69
|
-
{
|
|
70
|
-
title: i18next.t('button.copy'),
|
|
61
|
+
{ title: i18next.t('button.copy'),
|
|
71
62
|
action: this._copyScenario.bind(this),
|
|
72
63
|
...CommonButtonStyles.copy
|
|
73
64
|
},
|
|
74
|
-
{
|
|
75
|
-
title: i18next.t('button.save'),
|
|
65
|
+
{ title: i18next.t('button.save'),
|
|
76
66
|
action: this._updateScenario.bind(this),
|
|
77
67
|
...CommonButtonStyles.save
|
|
78
68
|
},
|
|
79
|
-
{
|
|
80
|
-
title: i18next.t('button.delete'),
|
|
69
|
+
{ title: i18next.t('button.delete'),
|
|
81
70
|
action: this._deleteScenario.bind(this),
|
|
82
71
|
...CommonButtonStyles.delete
|
|
83
72
|
}
|
|
84
73
|
],
|
|
85
|
-
exportable: {
|
|
86
|
-
name: i18next.t('text.scenario list'),
|
|
74
|
+
exportable: { name: i18next.t('text.scenario list'),
|
|
87
75
|
data: this.exportHandler.bind(this)
|
|
88
76
|
},
|
|
89
|
-
importable: {
|
|
90
|
-
handler: this.importHandler.bind(this)
|
|
77
|
+
importable: { handler: this.importHandler.bind(this)
|
|
91
78
|
}
|
|
92
79
|
};
|
|
93
80
|
}
|
|
@@ -105,18 +92,15 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
105
92
|
}
|
|
106
93
|
async pageInitialized(lifecycle) {
|
|
107
94
|
this.fetchTaskTypes();
|
|
108
|
-
this.gristConfig = {
|
|
109
|
-
list: { fields: ['name', 'description', 'schedule', 'active'] },
|
|
95
|
+
this.gristConfig = { list: { fields: ['name', 'description', 'schedule', 'active'] },
|
|
110
96
|
columns: [
|
|
111
97
|
{ type: 'gutter', gutterName: 'sequence', fixed: true },
|
|
112
98
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },
|
|
113
|
-
{
|
|
114
|
-
type: 'gutter',
|
|
99
|
+
{ type: 'gutter',
|
|
115
100
|
gutterName: 'button',
|
|
116
101
|
icon: record => (!record ? 'calendar_add_on' : !record.id || !record.scheduleId ? '' : 'event_available'),
|
|
117
102
|
title: i18next.t('button.schedule-task'),
|
|
118
|
-
handlers: {
|
|
119
|
-
click: (columns, data, column, record, rowIndex) => {
|
|
103
|
+
handlers: { click: (columns, data, column, record, rowIndex) => {
|
|
120
104
|
if (!record || !record.id || (!record.scheduleId && !record.schedule)) {
|
|
121
105
|
return;
|
|
122
106
|
}
|
|
@@ -129,8 +113,7 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
129
113
|
}
|
|
130
114
|
}
|
|
131
115
|
},
|
|
132
|
-
{
|
|
133
|
-
type: 'gutter',
|
|
116
|
+
{ type: 'gutter',
|
|
134
117
|
gutterName: 'button',
|
|
135
118
|
name: 'state',
|
|
136
119
|
fixed: true,
|
|
@@ -144,10 +127,8 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
144
127
|
: i18next.t('button.start')
|
|
145
128
|
: '',
|
|
146
129
|
width: 72,
|
|
147
|
-
handlers: {
|
|
148
|
-
|
|
149
|
-
if (!record || !record.name) {
|
|
150
|
-
/* TODO record가 새로 추가된 것이면 리턴하도록 한다. */
|
|
130
|
+
handlers: { click: (columns, data, column, record, rowIndex) => {
|
|
131
|
+
if (!record || !record.name) { /* TODO record가 새로 추가된 것이면 리턴하도록 한다. */
|
|
151
132
|
return;
|
|
152
133
|
}
|
|
153
134
|
if (IS_SCENARIO_RUNNING(record.state)) {
|
|
@@ -159,16 +140,14 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
159
140
|
}
|
|
160
141
|
}
|
|
161
142
|
},
|
|
162
|
-
{
|
|
163
|
-
type: 'gutter',
|
|
143
|
+
{ type: 'gutter',
|
|
164
144
|
gutterName: 'button',
|
|
165
145
|
fixed: true,
|
|
166
146
|
icon: record => (!record ? 'reorder' : record.id ? 'reorder' : ''),
|
|
167
147
|
iconOnly: false,
|
|
168
148
|
title: record => (!record ? i18next.t('button.detail') : record.id ? i18next.t('button.detail') : ''),
|
|
169
149
|
width: 72,
|
|
170
|
-
handlers: {
|
|
171
|
-
click: (columns, data, column, record, rowIndex) => {
|
|
150
|
+
handlers: { click: (columns, data, column, record, rowIndex) => {
|
|
172
151
|
if (!record.id)
|
|
173
152
|
return;
|
|
174
153
|
openPopup(html `
|
|
@@ -177,8 +156,7 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
177
156
|
.taskTypes=${this.taskTypes}
|
|
178
157
|
@requestRefresh="${() => this.grist.fetch()}"
|
|
179
158
|
></scenario-detail>
|
|
180
|
-
`, {
|
|
181
|
-
backdrop: true,
|
|
159
|
+
`, { backdrop: true,
|
|
182
160
|
help: 'integration/ui/scenario-detail',
|
|
183
161
|
size: 'large',
|
|
184
162
|
title: i18next.t('title.scenario-detail')
|
|
@@ -186,24 +164,20 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
186
164
|
}
|
|
187
165
|
}
|
|
188
166
|
},
|
|
189
|
-
{
|
|
190
|
-
type: 'string',
|
|
167
|
+
{ type: 'string',
|
|
191
168
|
name: 'name',
|
|
192
169
|
fixed: true,
|
|
193
170
|
label: true,
|
|
194
171
|
header: i18next.t('field.name'),
|
|
195
|
-
record: {
|
|
196
|
-
editable: true,
|
|
172
|
+
record: { editable: true,
|
|
197
173
|
mandatory: true
|
|
198
174
|
},
|
|
199
175
|
filter: 'search',
|
|
200
176
|
sortable: true,
|
|
201
177
|
width: 300,
|
|
202
178
|
validation: function (after, before, record, column) {
|
|
203
|
-
/* connected 상태에서는 이름을 바꿀 수 없다. */
|
|
204
179
|
if (IS_SCENARIO_RUNNING(record.state)) {
|
|
205
|
-
notify({
|
|
206
|
-
level: 'warn',
|
|
180
|
+
notify({ level: 'warn',
|
|
207
181
|
message: 'scenario name cannot be changed during execution.'
|
|
208
182
|
});
|
|
209
183
|
return false;
|
|
@@ -211,120 +185,96 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
211
185
|
return true;
|
|
212
186
|
}
|
|
213
187
|
},
|
|
214
|
-
{
|
|
215
|
-
type: 'string',
|
|
188
|
+
{ type: 'string',
|
|
216
189
|
name: 'type',
|
|
217
190
|
header: i18next.t('field.type'),
|
|
218
|
-
record: {
|
|
219
|
-
editable: true
|
|
191
|
+
record: { editable: true
|
|
220
192
|
},
|
|
221
193
|
filter: 'search',
|
|
222
194
|
sortable: true,
|
|
223
195
|
width: 100
|
|
224
196
|
},
|
|
225
|
-
{
|
|
226
|
-
type: 'string',
|
|
197
|
+
{ type: 'string',
|
|
227
198
|
name: 'description',
|
|
228
199
|
label: true,
|
|
229
200
|
header: i18next.t('field.description'),
|
|
230
|
-
record: {
|
|
231
|
-
editable: true
|
|
201
|
+
record: { editable: true
|
|
232
202
|
},
|
|
233
203
|
filter: 'search',
|
|
234
204
|
width: 400
|
|
235
205
|
},
|
|
236
|
-
{
|
|
237
|
-
type: 'select',
|
|
206
|
+
{ type: 'select',
|
|
238
207
|
name: 'iteration',
|
|
239
208
|
header: i18next.t('field.iteration-scope'),
|
|
240
|
-
record: {
|
|
241
|
-
editable: true,
|
|
209
|
+
record: { editable: true,
|
|
242
210
|
options: ['', 'SELF', 'CHILDREN', 'SELF & CHILDREN']
|
|
243
211
|
},
|
|
244
212
|
width: 120
|
|
245
213
|
},
|
|
246
|
-
{
|
|
247
|
-
type: 'crontab',
|
|
214
|
+
{ type: 'crontab',
|
|
248
215
|
name: 'schedule',
|
|
249
216
|
label: true,
|
|
250
217
|
header: i18next.t('field.schedule'),
|
|
251
|
-
record: {
|
|
252
|
-
editable: true
|
|
218
|
+
record: { editable: true
|
|
253
219
|
},
|
|
254
220
|
width: 110
|
|
255
221
|
},
|
|
256
|
-
{
|
|
257
|
-
type: 'timezone',
|
|
222
|
+
{ type: 'timezone',
|
|
258
223
|
name: 'timezone',
|
|
259
224
|
header: i18next.t('field.timezone'),
|
|
260
|
-
record: {
|
|
261
|
-
editable: true
|
|
225
|
+
record: { editable: true
|
|
262
226
|
},
|
|
263
227
|
width: 120
|
|
264
228
|
},
|
|
265
|
-
{
|
|
266
|
-
type: 'number',
|
|
229
|
+
{ type: 'number',
|
|
267
230
|
name: 'ttl',
|
|
268
231
|
header: i18next.t('field.ttl-seconds'),
|
|
269
|
-
record: {
|
|
270
|
-
editable: true
|
|
232
|
+
record: { editable: true
|
|
271
233
|
},
|
|
272
234
|
width: 80
|
|
273
235
|
},
|
|
274
|
-
{
|
|
275
|
-
type: 'resource-object',
|
|
236
|
+
{ type: 'resource-object',
|
|
276
237
|
name: 'role',
|
|
277
238
|
label: true,
|
|
278
239
|
header: i18next.t('field.required role'),
|
|
279
|
-
record: {
|
|
280
|
-
|
|
281
|
-
options: {
|
|
282
|
-
title: i18next.t('title.lookup role'),
|
|
240
|
+
record: { editable: true,
|
|
241
|
+
options: { title: i18next.t('title.lookup role'),
|
|
283
242
|
queryName: 'roles'
|
|
284
243
|
}
|
|
285
244
|
},
|
|
286
245
|
width: 200
|
|
287
246
|
},
|
|
288
|
-
{
|
|
289
|
-
type: 'checkbox',
|
|
247
|
+
{ type: 'checkbox',
|
|
290
248
|
name: 'active',
|
|
291
249
|
label: true,
|
|
292
250
|
header: i18next.t('field.startup-scenario'),
|
|
293
|
-
record: {
|
|
294
|
-
align: 'center',
|
|
251
|
+
record: { align: 'center',
|
|
295
252
|
editable: true
|
|
296
253
|
},
|
|
297
254
|
sortable: true,
|
|
298
255
|
width: 60
|
|
299
256
|
},
|
|
300
|
-
{
|
|
301
|
-
type: 'object',
|
|
257
|
+
{ type: 'object',
|
|
302
258
|
name: 'updater',
|
|
303
259
|
header: i18next.t('field.updater'),
|
|
304
|
-
record: {
|
|
305
|
-
editable: false
|
|
260
|
+
record: { editable: false
|
|
306
261
|
},
|
|
307
262
|
width: 85
|
|
308
263
|
},
|
|
309
|
-
{
|
|
310
|
-
type: 'datetime',
|
|
264
|
+
{ type: 'datetime',
|
|
311
265
|
name: 'updatedAt',
|
|
312
266
|
header: i18next.t('field.updated_at'),
|
|
313
|
-
record: {
|
|
314
|
-
editable: false
|
|
267
|
+
record: { editable: false
|
|
315
268
|
},
|
|
316
269
|
sortable: true,
|
|
317
270
|
width: 180
|
|
318
271
|
}
|
|
319
272
|
],
|
|
320
|
-
rows: {
|
|
321
|
-
selectable: {
|
|
322
|
-
multiple: true
|
|
273
|
+
rows: { selectable: { multiple: true
|
|
323
274
|
}
|
|
324
275
|
},
|
|
325
276
|
sorters: [
|
|
326
|
-
{
|
|
327
|
-
name: 'name'
|
|
277
|
+
{ name: 'name'
|
|
328
278
|
}
|
|
329
279
|
]
|
|
330
280
|
};
|
|
@@ -335,12 +285,8 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
335
285
|
}
|
|
336
286
|
}
|
|
337
287
|
async fetchHandler({ page, limit, sortings = [], filters = [] }) {
|
|
338
|
-
const response = await client.query({
|
|
339
|
-
|
|
340
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
341
|
-
responses: scenarios(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
342
|
-
items {
|
|
343
|
-
id
|
|
288
|
+
const response = await client.query({ query: gql `
|
|
289
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: scenarios(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
344
290
|
name
|
|
345
291
|
type
|
|
346
292
|
description
|
|
@@ -351,18 +297,15 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
351
297
|
scheduleId
|
|
352
298
|
timezone
|
|
353
299
|
ttl
|
|
354
|
-
role {
|
|
355
|
-
id
|
|
300
|
+
role { id
|
|
356
301
|
name
|
|
357
302
|
description
|
|
358
|
-
|
|
359
|
-
updater {
|
|
360
|
-
id
|
|
303
|
+
}
|
|
304
|
+
updater { id
|
|
361
305
|
name
|
|
362
|
-
|
|
306
|
+
}
|
|
363
307
|
updatedAt
|
|
364
|
-
steps {
|
|
365
|
-
name
|
|
308
|
+
steps { name
|
|
366
309
|
description
|
|
367
310
|
sequence
|
|
368
311
|
task
|
|
@@ -370,43 +313,36 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
370
313
|
log
|
|
371
314
|
connection
|
|
372
315
|
params
|
|
373
|
-
|
|
374
|
-
|
|
316
|
+
}
|
|
317
|
+
}
|
|
375
318
|
total
|
|
376
|
-
|
|
377
|
-
|
|
319
|
+
}
|
|
320
|
+
}
|
|
378
321
|
`,
|
|
379
|
-
variables: {
|
|
380
|
-
filters,
|
|
322
|
+
variables: { filters,
|
|
381
323
|
pagination: { page, limit },
|
|
382
324
|
sortings
|
|
383
325
|
}
|
|
384
326
|
});
|
|
385
|
-
return {
|
|
386
|
-
total: response.data.responses.total || 0,
|
|
327
|
+
return { total: response.data.responses.total || 0,
|
|
387
328
|
records: response.data.responses.items || []
|
|
388
329
|
};
|
|
389
330
|
}
|
|
390
331
|
async fetchTaskTypes() {
|
|
391
|
-
const response = await client.query({
|
|
392
|
-
|
|
393
|
-
query {
|
|
394
|
-
taskTypes {
|
|
395
|
-
items {
|
|
396
|
-
name
|
|
332
|
+
const response = await client.query({ query: gql `
|
|
333
|
+
query { taskTypes { items { name
|
|
397
334
|
description
|
|
398
335
|
help
|
|
399
|
-
parameterSpec {
|
|
400
|
-
type
|
|
336
|
+
parameterSpec { type
|
|
401
337
|
name
|
|
402
338
|
label
|
|
403
339
|
placeholder
|
|
404
340
|
property
|
|
405
341
|
styles
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
410
346
|
`
|
|
411
347
|
});
|
|
412
348
|
if (!response.errors) {
|
|
@@ -423,20 +359,16 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
423
359
|
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
424
360
|
const ids = this.grist.selected.map(record => record.id);
|
|
425
361
|
if (ids && ids.length > 0) {
|
|
426
|
-
const response = await client.mutate({
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
deleteScenarios(ids: $ids)
|
|
430
|
-
}
|
|
362
|
+
const response = await client.mutate({ mutation: gql `
|
|
363
|
+
mutation ($ids: [String!]!) { deleteScenarios(ids: $ids)
|
|
364
|
+
}
|
|
431
365
|
`,
|
|
432
|
-
variables: {
|
|
433
|
-
ids
|
|
366
|
+
variables: { ids
|
|
434
367
|
}
|
|
435
368
|
});
|
|
436
369
|
if (!response.errors) {
|
|
437
370
|
this.grist.fetch();
|
|
438
|
-
notify({
|
|
439
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
371
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
440
372
|
});
|
|
441
373
|
}
|
|
442
374
|
}
|
|
@@ -448,16 +380,12 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
448
380
|
return;
|
|
449
381
|
if (!confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.copy') })))
|
|
450
382
|
return;
|
|
451
|
-
var response = await client.mutate({
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
id
|
|
456
|
-
}
|
|
457
|
-
}
|
|
383
|
+
var response = await client.mutate({ mutation: gql `
|
|
384
|
+
mutation ($ids: [String!]!) { copyScenarios(ids: $ids) { id
|
|
385
|
+
}
|
|
386
|
+
}
|
|
458
387
|
`,
|
|
459
|
-
variables: {
|
|
460
|
-
ids: selected.map(r => r.id)
|
|
388
|
+
variables: { ids: selected.map(r => r.id)
|
|
461
389
|
}
|
|
462
390
|
});
|
|
463
391
|
if (!response.errors)
|
|
@@ -477,16 +405,12 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
477
405
|
patchField.cuFlag = patch.__dirty__;
|
|
478
406
|
return patchField;
|
|
479
407
|
});
|
|
480
|
-
const response = await client.mutate({
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
name
|
|
485
|
-
}
|
|
486
|
-
}
|
|
408
|
+
const response = await client.mutate({ mutation: gql `
|
|
409
|
+
mutation ($patches: [ScenarioPatch!]!) { updateMultipleScenario(patches: $patches) { name
|
|
410
|
+
}
|
|
411
|
+
}
|
|
487
412
|
`,
|
|
488
|
-
variables: {
|
|
489
|
-
patches
|
|
413
|
+
variables: { patches
|
|
490
414
|
}
|
|
491
415
|
});
|
|
492
416
|
if (!response.errors)
|
|
@@ -494,98 +418,76 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
494
418
|
}
|
|
495
419
|
}
|
|
496
420
|
async startScenario(record) {
|
|
497
|
-
var { data, errors } = await client.mutate({
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
state
|
|
502
|
-
}
|
|
503
|
-
}
|
|
421
|
+
var { data, errors } = await client.mutate({ mutation: gql `
|
|
422
|
+
mutation ($scenarioName: String!, $instanceName: String) { startScenario(scenarioName: $scenarioName, instanceName: $instanceName) { state
|
|
423
|
+
}
|
|
424
|
+
}
|
|
504
425
|
`,
|
|
505
|
-
variables: {
|
|
506
|
-
scenarioName: record.name,
|
|
426
|
+
variables: { scenarioName: record.name,
|
|
507
427
|
instanceName: record.name
|
|
508
428
|
}
|
|
509
429
|
});
|
|
510
430
|
if (data && data.startScenario) {
|
|
511
431
|
record.state = data.startScenario.state;
|
|
512
|
-
notify({
|
|
513
|
-
level: 'info',
|
|
432
|
+
notify({ level: 'info',
|
|
514
433
|
message: `${IS_SCENARIO_RUNNING(state) ? 'success' : 'fail'} to start scenario : ${record.name}`
|
|
515
434
|
});
|
|
516
435
|
}
|
|
517
436
|
this.grist.fetch();
|
|
518
437
|
}
|
|
519
438
|
async stopScenario(record) {
|
|
520
|
-
var response = await client.mutate({
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
state
|
|
525
|
-
}
|
|
526
|
-
}
|
|
439
|
+
var response = await client.mutate({ mutation: gql `
|
|
440
|
+
mutation ($instanceName: String!) { stopScenario(instanceName: $instanceName) { state
|
|
441
|
+
}
|
|
442
|
+
}
|
|
527
443
|
`,
|
|
528
|
-
variables: {
|
|
529
|
-
instanceName: record.name
|
|
444
|
+
variables: { instanceName: record.name
|
|
530
445
|
}
|
|
531
446
|
});
|
|
532
447
|
if (!response.errors) {
|
|
533
|
-
notify({
|
|
534
|
-
level: 'info',
|
|
448
|
+
notify({ level: 'info',
|
|
535
449
|
message: `success to stop scenario : ${record.name}`
|
|
536
450
|
});
|
|
537
451
|
}
|
|
538
452
|
else {
|
|
539
|
-
notify({
|
|
540
|
-
level: 'error',
|
|
453
|
+
notify({ level: 'error',
|
|
541
454
|
message: `${response.errors.map(error => error.message).join('\n')}`
|
|
542
455
|
});
|
|
543
456
|
}
|
|
544
457
|
this.grist.fetch();
|
|
545
458
|
}
|
|
546
459
|
async startScenarioSchedule(record) {
|
|
547
|
-
var response = await client.mutate({
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
scheduleId
|
|
552
|
-
}
|
|
553
|
-
}
|
|
460
|
+
var response = await client.mutate({ mutation: gql `
|
|
461
|
+
mutation ($scenarioId: String!) { startScenarioSchedule(scenarioId: $scenarioId) { scheduleId
|
|
462
|
+
}
|
|
463
|
+
}
|
|
554
464
|
`,
|
|
555
|
-
variables: {
|
|
556
|
-
scenarioId: record.id
|
|
465
|
+
variables: { scenarioId: record.id
|
|
557
466
|
}
|
|
558
467
|
});
|
|
559
468
|
const scheduleId = response.data.startScenarioSchedule.scheduleId;
|
|
560
469
|
record.scheduleId = scheduleId;
|
|
561
|
-
notify({
|
|
562
|
-
level: 'info',
|
|
470
|
+
notify({ level: 'info',
|
|
563
471
|
message: `${record.scheduleId ? 'success' : 'fail'} to start scenario schedule : ${record.name}`
|
|
564
472
|
});
|
|
565
473
|
this.grist.fetch();
|
|
566
474
|
}
|
|
567
475
|
async stopScenarioSchedule(record) {
|
|
568
|
-
var response = await client.mutate({
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
scheduleId
|
|
573
|
-
}
|
|
574
|
-
}
|
|
476
|
+
var response = await client.mutate({ mutation: gql `
|
|
477
|
+
mutation ($scenarioId: String!) { stopScenarioSchedule(scenarioId: $scenarioId) { scheduleId
|
|
478
|
+
}
|
|
479
|
+
}
|
|
575
480
|
`,
|
|
576
|
-
variables: {
|
|
577
|
-
scenarioId: record.id
|
|
481
|
+
variables: { scenarioId: record.id
|
|
578
482
|
}
|
|
579
483
|
});
|
|
580
484
|
if (!response.errors) {
|
|
581
|
-
notify({
|
|
582
|
-
level: 'info',
|
|
485
|
+
notify({ level: 'info',
|
|
583
486
|
message: `success to stop scenario schedule : ${record.name}`
|
|
584
487
|
});
|
|
585
488
|
}
|
|
586
489
|
else {
|
|
587
|
-
notify({
|
|
588
|
-
level: 'error',
|
|
490
|
+
notify({ level: 'error',
|
|
589
491
|
message: `${response.errors.map(error => error.message).join('\n')}`
|
|
590
492
|
});
|
|
591
493
|
}
|
|
@@ -611,8 +513,7 @@ let Scenario = class Scenario extends connect(store)(p13n(localize(i18next)(Page
|
|
|
611
513
|
this.grist.fetch();
|
|
612
514
|
}}"
|
|
613
515
|
></scenario-importer>
|
|
614
|
-
`, {
|
|
615
|
-
backdrop: true,
|
|
516
|
+
`, { backdrop: true,
|
|
616
517
|
size: 'large',
|
|
617
518
|
title: i18next.t('title.import scenario')
|
|
618
519
|
});
|