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