@operato/scene-integration 2.0.0-alpha.0 → 2.0.0-alpha.4

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.
@@ -33,6 +33,31 @@ const NATURE: ComponentNature = {
33
33
  type: 'checkbox',
34
34
  label: 'run-on-start',
35
35
  name: 'runOnStart'
36
+ },
37
+ {
38
+ type: 'select',
39
+ label: 'mask-on-error',
40
+ name: 'maskOnError',
41
+ property: {
42
+ options: [
43
+ {
44
+ display: 'none',
45
+ value: ''
46
+ },
47
+ {
48
+ display: 'strong-blur',
49
+ value: 'blur(4px)'
50
+ },
51
+ {
52
+ display: 'weak-blur',
53
+ value: 'blur(2px)'
54
+ },
55
+ {
56
+ display: 'grayscale',
57
+ value: 'grayscale(1)'
58
+ }
59
+ ]
60
+ }
36
61
  }
37
62
  ],
38
63
  'value-property': 'variables',
@@ -135,7 +160,7 @@ export default class ScenarioRun extends DataSource(RectPath(Shape)) {
135
160
  }
136
161
 
137
162
  async requestData() {
138
- let { scenarioName, variables } = this.state
163
+ let { scenarioName, variables, maskOnError } = this.state
139
164
  if (!scenarioName || !this.app.isViewMode) {
140
165
  return
141
166
  }
@@ -147,29 +172,48 @@ export default class ScenarioRun extends DataSource(RectPath(Shape)) {
147
172
  }
148
173
 
149
174
  if (client) {
150
- var response = await client.query({
151
- query: gql`
152
- mutation ($scenarioName: String!, $variables: Object) {
153
- runScenario(scenarioName: $scenarioName, variables: $variables) {
154
- state
155
- message
156
- result
175
+ try {
176
+ var response = await client.query({
177
+ query: gql`
178
+ mutation ($scenarioName: String!, $variables: Object) {
179
+ runScenario(scenarioName: $scenarioName, variables: $variables) {
180
+ state
181
+ message
182
+ result
183
+ }
157
184
  }
185
+ `,
186
+ variables: {
187
+ scenarioName: scenarioName,
188
+ variables
158
189
  }
159
- `,
160
- variables: {
161
- scenarioName: scenarioName,
162
- variables
190
+ })
191
+
192
+ this.data = response?.data?.runScenario?.result
193
+ this.demask()
194
+ } catch (e: any) {
195
+ console.error(`calling runScenario mutation error: ${e?.message ?? e}`)
196
+ this.mask()
197
+ } finally {
198
+ if (this._started && this.state.interval > 0) {
199
+ this._timeout = setTimeout(() => this.requestData(), this.state.interval)
163
200
  }
164
- })
165
-
166
- this.data = response?.data?.runScenario?.result
167
-
168
- if (this._started && this.state.interval > 0) {
169
- this._timeout = setTimeout(() => this.requestData(), this.state.interval)
170
201
  }
171
202
  }
172
203
  }
204
+
205
+ mask() {
206
+ const { maskOnError } = this.state
207
+ if (maskOnError) {
208
+ //@ts-ignore
209
+ this.root.target_element.style.filter = maskOnError
210
+ }
211
+ }
212
+
213
+ demask() {
214
+ //@ts-ignore
215
+ this.root.target_element.style.filter = 'none'
216
+ }
173
217
  }
174
218
 
175
219
  Component.register('scenario-run', ScenarioRun)
@@ -1,4 +1,13 @@
1
1
  {
2
+ "component.data-subscription": "data-subscription",
3
+ "component.scenario-control": "scenario-control",
4
+ "component.scenario-run": "scenario-run",
5
+ "component.scenario-start": "scenario-start",
6
+ "component.scenario-stop": "scenario-stop",
7
+ "component.scenario-instance-subscription": "scenario-instance-subscription",
8
+ "component.scenario-queue-subscription": "scenario-queue-subscription",
9
+ "component.connection-state-subscription": "connection-state-subscription",
10
+ "component.connection-control": "connection-control",
2
11
  "keyword": "keyword",
3
12
  "label.connection-name": "connection name",
4
13
  "label.scenario-name": "Scenario Name",
@@ -6,5 +15,6 @@
6
15
  "label.init-data-endpoint": "Initial Data Endpoint",
7
16
  "label.instance-name": "Instance Name",
8
17
  "label.repeat-interval": "repeat interval",
9
- "label.run-on-start": "Run on Start"
18
+ "label.run-on-start": "Run on Start",
19
+ "label.mask-on-error": "Mask on Error"
10
20
  }
@@ -1,4 +1,13 @@
1
1
  {
2
+ "component.data-subscription": "data-subscription",
3
+ "component.scenario-control": "scenario-control",
4
+ "component.scenario-run": "scenario-run",
5
+ "component.scenario-start": "scenario-start",
6
+ "component.scenario-stop": "scenario-stop",
7
+ "component.scenario-instance-subscription": "scenario-instance-subscription",
8
+ "component.scenario-queue-subscription": "scenario-queue-subscription",
9
+ "component.connection-state-subscription": "connection-state-subscription",
10
+ "component.connection-control": "connection-control",
2
11
  "keyword": "キーワード",
3
12
  "label.connection-name": "接続名",
4
13
  "label.scenario-name": "シナリオ名",
@@ -6,5 +15,6 @@
6
15
  "label.init-data-endpoint": "初期データエンドポイント",
7
16
  "label.instance-name": "インスタンス名",
8
17
  "label.repeat-interval": "繰り返し間隔",
9
- "label.run-on-start": "開始時に実行"
18
+ "label.run-on-start": "開始時に実行",
19
+ "label.mask-on-error": "エラー時にマスクをかける"
10
20
  }
@@ -1,4 +1,13 @@
1
1
  {
2
+ "component.data-subscription": "data-subscription",
3
+ "component.scenario-control": "scenario-control",
4
+ "component.scenario-run": "scenario-run",
5
+ "component.scenario-start": "scenario-start",
6
+ "component.scenario-stop": "scenario-stop",
7
+ "component.scenario-instance-subscription": "scenario-instance-subscription",
8
+ "component.scenario-queue-subscription": "scenario-queue-subscription",
9
+ "component.connection-state-subscription": "connection-state-subscription",
10
+ "component.connection-control": "connection-control",
2
11
  "keyword": "키워드",
3
12
  "label.connection-name": "커넥션 이름",
4
13
  "label.scenario-name": "시나리오 명",
@@ -6,5 +15,6 @@
6
15
  "label.init-data-endpoint": "초기 데이터 엔드포인트",
7
16
  "label.instance-name": "인스턴스 명",
8
17
  "label.repeat-interval": "반복 간격",
9
- "label.run-on-start": "시작시 자동 실행"
18
+ "label.run-on-start": "시작시 자동 실행",
19
+ "label.mask-on-error": "오류시 마스크 적용"
10
20
  }
@@ -1,4 +1,13 @@
1
1
  {
2
+ "component.data-subscription": "data-subscription",
3
+ "component.scenario-control": "scenario-control",
4
+ "component.scenario-run": "scenario-run",
5
+ "component.scenario-start": "scenario-start",
6
+ "component.scenario-stop": "scenario-stop",
7
+ "component.scenario-instance-subscription": "scenario-instance-subscription",
8
+ "component.scenario-queue-subscription": "scenario-queue-subscription",
9
+ "component.connection-state-subscription": "connection-state-subscription",
10
+ "component.connection-control": "connection-control",
2
11
  "keyword": "kata kunci",
3
12
  "label.connection-name": "nama sambungan",
4
13
  "label.scenario-name": "Nama Skenario",
@@ -6,5 +15,6 @@
6
15
  "label.init-data-endpoint": "Titik Akhir Data Awal",
7
16
  "label.instance-name": "Nama Pembolehubah",
8
17
  "label.repeat-interval": "interval berulang",
9
- "label.run-on-start": "Jalankan pada Permulaan"
18
+ "label.run-on-start": "Jalankan pada Permulaan",
19
+ "label.mask-on-error": "Mask pada Kesalahan"
10
20
  }
@@ -1,4 +1,13 @@
1
1
  {
2
+ "component.data-subscription": "data-subscription",
3
+ "component.scenario-control": "scenario-control",
4
+ "component.scenario-run": "scenario-run",
5
+ "component.scenario-start": "scenario-start",
6
+ "component.scenario-stop": "scenario-stop",
7
+ "component.scenario-instance-subscription": "scenario-instance-subscription",
8
+ "component.scenario-queue-subscription": "scenario-queue-subscription",
9
+ "component.connection-state-subscription": "connection-state-subscription",
10
+ "component.connection-control": "connection-control",
2
11
  "keyword": "关键词",
3
12
  "label.connection-name": "连接名称",
4
13
  "label.scenario-name": "场景名称",
@@ -6,5 +15,6 @@
6
15
  "label.init-data-endpoint": "初始数据终端",
7
16
  "label.instance-name": "实例名称",
8
17
  "label.repeat-interval": "重复间隔",
9
- "label.run-on-start": "启动时运行"
18
+ "label.run-on-start": "启动时运行",
19
+ "label.mask-on-error": "错误时启用掩码"
10
20
  }