@things-factory/integration-ui 6.0.69 → 6.0.70
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/scenario.js +78 -1
- package/package.json +3 -3
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
package/client/pages/scenario.js
CHANGED
|
@@ -14,6 +14,9 @@ import { navigate, PageView, store } from '@operato/shell'
|
|
|
14
14
|
import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
|
|
15
15
|
import { isMobileDevice } from '@operato/utils'
|
|
16
16
|
|
|
17
|
+
const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
18
|
+
const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
|
|
19
|
+
|
|
17
20
|
function IS_SCENARIO_RUNNING(state) {
|
|
18
21
|
return state && state !== 'UNLOADED'
|
|
19
22
|
}
|
|
@@ -133,6 +136,25 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
133
136
|
columns: [
|
|
134
137
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
135
138
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
139
|
+
{
|
|
140
|
+
type: 'gutter',
|
|
141
|
+
gutterName: 'button',
|
|
142
|
+
title: i18next.t('title.scenario schedule (un)register'),
|
|
143
|
+
icon: record => (!record || record.scheduleId ? 'event_available' : ''),
|
|
144
|
+
handlers: {
|
|
145
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
146
|
+
if (!record || !record.name) {
|
|
147
|
+
/* TODO record가 새로 추가된 것이면 리턴하도록 한다. */
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
if (record.scheduleId) {
|
|
151
|
+
this.stopScenarioSchedule(record)
|
|
152
|
+
} else {
|
|
153
|
+
this.startScenarioSchedule(record)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
136
158
|
{
|
|
137
159
|
type: 'gutter',
|
|
138
160
|
gutterName: 'button',
|
|
@@ -238,7 +260,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
238
260
|
header: i18next.t('field.timezone'),
|
|
239
261
|
record: {
|
|
240
262
|
editable: true,
|
|
241
|
-
options:
|
|
263
|
+
options: TIMEZONE_OPTIONS
|
|
242
264
|
},
|
|
243
265
|
width: 120
|
|
244
266
|
},
|
|
@@ -306,6 +328,7 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
306
328
|
active
|
|
307
329
|
state
|
|
308
330
|
schedule
|
|
331
|
+
scheduleId
|
|
309
332
|
timezone
|
|
310
333
|
updater {
|
|
311
334
|
id
|
|
@@ -506,6 +529,60 @@ export class Scenario extends connect(store)(localize(i18next)(PageView)) {
|
|
|
506
529
|
this.grist.fetch()
|
|
507
530
|
}
|
|
508
531
|
|
|
532
|
+
async startScenarioSchedule(record) {
|
|
533
|
+
var response = await client.mutate({
|
|
534
|
+
mutation: gql`
|
|
535
|
+
mutation ($scenarioId: String!) {
|
|
536
|
+
startScenarioSchedule(scenarioId: $scenarioId) {
|
|
537
|
+
scheduleId
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
`,
|
|
541
|
+
variables: {
|
|
542
|
+
scenarioId: record.id
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
const scheduleId = response.data.startScenarioSchedule.scheduleId
|
|
547
|
+
record.scheduleId = scheduleId
|
|
548
|
+
|
|
549
|
+
notify({
|
|
550
|
+
level: 'info',
|
|
551
|
+
message: `${record.scheduleId ? 'success' : 'fail'} to start scenario schedule : ${record.name}`
|
|
552
|
+
})
|
|
553
|
+
|
|
554
|
+
this.grist.fetch()
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
async stopScenarioSchedule(record) {
|
|
558
|
+
var response = await client.mutate({
|
|
559
|
+
mutation: gql`
|
|
560
|
+
mutation ($scenarioId: String!) {
|
|
561
|
+
stopScenarioSchedule(scenarioId: $scenarioId) {
|
|
562
|
+
scheduleId
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
`,
|
|
566
|
+
variables: {
|
|
567
|
+
scenarioId: record.id
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
if (!response.errors) {
|
|
572
|
+
notify({
|
|
573
|
+
level: 'info',
|
|
574
|
+
message: `success to stop scenario schedule : ${record.name}`
|
|
575
|
+
})
|
|
576
|
+
} else {
|
|
577
|
+
notify({
|
|
578
|
+
level: 'error',
|
|
579
|
+
message: `${response.errors.map(error => error.message).join('\n')}`
|
|
580
|
+
})
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
this.grist.fetch()
|
|
584
|
+
}
|
|
585
|
+
|
|
509
586
|
async exportHandler() {
|
|
510
587
|
const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
|
|
511
588
|
const targetFieldSet = new Set(['id', 'name', 'type', 'description', 'active', 'schedule', 'timezone', 'steps'])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-ui",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.70",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@operato/utils": "^1.0.1",
|
|
36
36
|
"@things-factory/export-base": "^6.0.67",
|
|
37
37
|
"@things-factory/import-base": "^6.0.67",
|
|
38
|
-
"@things-factory/integration-base": "^6.0.
|
|
38
|
+
"@things-factory/integration-base": "^6.0.70",
|
|
39
39
|
"moment-timezone": "^0.5.40"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "b9c05eb9b7a0aed2bcf7b24bd5851eb047b54391"
|
|
42
42
|
}
|
package/translations/en.json
CHANGED
package/translations/ko.json
CHANGED
package/translations/ms.json
CHANGED
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"label.search-params": "[ms]cari parameter",
|
|
64
64
|
"label.second by second": "saat demi saat",
|
|
65
65
|
"label.second": "saat",
|
|
66
|
+
"label.selectors": "[ms] selectors",
|
|
66
67
|
"label.timeout": "masa tamat",
|
|
67
68
|
"label.username": "nama pengguna",
|
|
68
69
|
"label.vendor-id": "ID vendor",
|