@operato/scene-integration 2.0.0-alpha.0 → 2.0.0-alpha.10
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/CHANGELOG.md +55 -0
- package/dist/scenario-run.d.ts +2 -0
- package/dist/scenario-run.js +65 -18
- package/dist/scenario-run.js.map +1 -1
- package/package.json +4 -4
- package/src/scenario-run.ts +62 -18
- package/translations/en.json +17 -8
- package/translations/ja.json +11 -2
- package/translations/ko.json +11 -2
- package/translations/ms.json +16 -7
- package/translations/zh.json +12 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -15
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -15
- package/logs/application-2023-09-08-11.log +0 -6
- package/logs/connections-2023-09-08-11.log +0 -38
- package/logs/system/.ce832741a58883a058e9af6fb7483de16a838e2c-audit.json +0 -20
- package/logs/system/scenario-NOW-2023-09-08-11.log +0 -2970
- package/logs/system/scenario-NOW-2023-09-08-12.log +0 -440
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,61 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.0-alpha.10](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2024-04-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* 다국어 컴포넌트 도형 속성 상속, 시나리오 옵셔널 추가 ([857c55b](https://github.com/things-scene/operato-scene/commit/857c55ba725e7973124c017a7b82342835721cec))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [2.0.0-alpha.9](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2024-04-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :bug: Bug Fix
|
|
19
|
+
|
|
20
|
+
* things-factory@7.0.1 ([a9f4c18](https://github.com/things-scene/operato-scene/commit/a9f4c1873b80c540e4c2e16649e127ccffcf9a4c))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [2.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2024-03-24)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### :bug: Bug Fix
|
|
28
|
+
|
|
29
|
+
* translation ([266d423](https://github.com/things-scene/operato-scene/commit/266d423d9d6992464f45a437acc90ccf8ed33bf6))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [2.0.0-alpha.5](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2024-03-21)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### :bug: Bug Fix
|
|
37
|
+
|
|
38
|
+
* 컴포넌트 명 다국어 ([fbc26d9](https://github.com/things-scene/operato-scene/commit/fbc26d9fb24e858541598ba55e2b8d33f2df8d8a))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [2.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2024-03-21)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### :bug: Bug Fix
|
|
46
|
+
|
|
47
|
+
* 컴포넌트 명 다국어 ([64e1f08](https://github.com/things-scene/operato-scene/commit/64e1f08af32d2ac193c3d31b0025f8d06f569ca4))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [2.0.0-alpha.1](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.0...v2.0.0-alpha.1) (2024-02-04)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### :bug: Bug Fix
|
|
55
|
+
|
|
56
|
+
* add an exceptiono handler for scenario-run ([a2be945](https://github.com/things-scene/operato-scene/commit/a2be94596518a9530e393522fd9170fd0908d03d))
|
|
57
|
+
* 시나리오런 컴포넌트에 네트워크오류시 화면 마스크 기능 추가 ([a57610a](https://github.com/things-scene/operato-scene/commit/a57610aeaabc8bfda9a43165abf1fb856b53f092))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
6
61
|
## [2.0.0-alpha.0](https://github.com/things-scene/operato-scene/compare/v1.3.9...v2.0.0-alpha.0) (2024-01-14)
|
|
7
62
|
|
|
8
63
|
|
package/dist/scenario-run.d.ts
CHANGED
package/dist/scenario-run.js
CHANGED
|
@@ -30,6 +30,31 @@ const NATURE = {
|
|
|
30
30
|
type: 'checkbox',
|
|
31
31
|
label: 'run-on-start',
|
|
32
32
|
name: 'runOnStart'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'select',
|
|
36
|
+
label: 'mask-on-error',
|
|
37
|
+
name: 'maskOnError',
|
|
38
|
+
property: {
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
display: 'none',
|
|
42
|
+
value: ''
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
display: 'strong-blur',
|
|
46
|
+
value: 'blur(4px)'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
display: 'weak-blur',
|
|
50
|
+
value: 'blur(2px)'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
display: 'grayscale',
|
|
54
|
+
value: 'grayscale(1)'
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
33
58
|
}
|
|
34
59
|
],
|
|
35
60
|
'value-property': 'variables',
|
|
@@ -114,8 +139,8 @@ export default class ScenarioRun extends DataSource(RectPath(Shape)) {
|
|
|
114
139
|
this.setState('variables', variables);
|
|
115
140
|
}
|
|
116
141
|
async requestData() {
|
|
117
|
-
var _a, _b;
|
|
118
|
-
let { scenarioName, variables } = this.state;
|
|
142
|
+
var _a, _b, _c;
|
|
143
|
+
let { scenarioName, variables, maskOnError } = this.state;
|
|
119
144
|
if (!scenarioName || !this.app.isViewMode) {
|
|
120
145
|
return;
|
|
121
146
|
}
|
|
@@ -126,27 +151,49 @@ export default class ScenarioRun extends DataSource(RectPath(Shape)) {
|
|
|
126
151
|
console.warn('runScenario mutation variable is not an object');
|
|
127
152
|
}
|
|
128
153
|
if (client) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
154
|
+
try {
|
|
155
|
+
var response = await client.query({
|
|
156
|
+
query: gql `
|
|
157
|
+
mutation ($scenarioName: String!, $variables: Object) {
|
|
158
|
+
runScenario(scenarioName: $scenarioName, variables: $variables) {
|
|
159
|
+
state
|
|
160
|
+
message
|
|
161
|
+
result
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
variables: {
|
|
166
|
+
scenarioName: scenarioName,
|
|
167
|
+
variables
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
this.data = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.runScenario) === null || _b === void 0 ? void 0 : _b.result;
|
|
171
|
+
this.demask();
|
|
136
172
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
173
|
+
catch (e) {
|
|
174
|
+
console.error(`calling runScenario mutation error: ${(_c = e === null || e === void 0 ? void 0 : e.message) !== null && _c !== void 0 ? _c : e}`);
|
|
175
|
+
this.mask();
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
if (this._started && this.state.interval > 0) {
|
|
179
|
+
this._timeout = setTimeout(() => this.requestData(), this.state.interval);
|
|
142
180
|
}
|
|
143
|
-
});
|
|
144
|
-
this.data = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.runScenario) === null || _b === void 0 ? void 0 : _b.result;
|
|
145
|
-
if (this._started && this.state.interval > 0) {
|
|
146
|
-
this._timeout = setTimeout(() => this.requestData(), this.state.interval);
|
|
147
181
|
}
|
|
148
182
|
}
|
|
149
183
|
}
|
|
184
|
+
mask() {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
const { maskOnError } = this.state;
|
|
187
|
+
if (maskOnError) {
|
|
188
|
+
//@ts-ignore
|
|
189
|
+
(_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.target_element) === null || _b === void 0 ? void 0 : _b.style.filter = maskOnError;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
demask() {
|
|
193
|
+
var _a, _b;
|
|
194
|
+
//@ts-ignore
|
|
195
|
+
(_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.target_element) === null || _b === void 0 ? void 0 : _b.style.filter = 'none';
|
|
196
|
+
}
|
|
150
197
|
}
|
|
151
198
|
Component.register('scenario-run', ScenarioRun);
|
|
152
199
|
//# sourceMappingURL=scenario-run.js.map
|
package/dist/scenario-run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario-run.js","sourceRoot":"","sources":["../src/scenario-run.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAc,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,eAAe;YACtB,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE;gBACR,OAAO,EAAE,SAAS;aACnB;SACF;QACD;YACE,IAAI,EAAE,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AAC,IAAI,GAAG,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,WAAW,0CAAE,MAAM,CAAA;gBAC/C,IAAI,CAAC,MAAM,EAAE,CAAA;YACf,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,OAAO,CAAC,KAAK,CAAC,uCAAuC,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,OAAO,mCAAI,CAAC,EAAE,CAAC,CAAA;gBACvE,IAAI,CAAC,IAAI,EAAE,CAAA;YACb,CAAC;oBAAS,CAAC;gBACT,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;oBAC7C,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBAC3E,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI;;QACF,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAClC,IAAI,WAAW,EAAE,CAAC;YAChB,YAAY;YACZ,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA;QACvD,CAAC;IACH,CAAC;IAED,MAAM;;QACJ,YAAY;QACZ,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;IAClD,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA","sourcesContent":["import gql from 'graphql-tag'\n\nimport { Component, ComponentNature, DataSource, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport { client } from '@operato/graphql'\n\nimport { scenarios } from './client-api'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'scenario-name',\n name: 'scenarioName',\n property: {\n options: scenarios\n }\n },\n {\n type: 'data',\n label: 'variables',\n name: 'variables'\n },\n {\n type: 'number',\n label: 'repeat-interval',\n name: 'interval',\n placeholder: 'milli-seconds'\n },\n {\n type: 'checkbox',\n label: 'run-on-start',\n name: 'runOnStart'\n },\n {\n type: 'select',\n label: 'mask-on-error',\n name: 'maskOnError',\n property: {\n options: [\n {\n display: 'none',\n value: ''\n },\n {\n display: 'strong-blur',\n value: 'blur(4px)'\n },\n {\n display: 'weak-blur',\n value: 'blur(2px)'\n },\n {\n display: 'grayscale',\n value: 'grayscale(1)'\n }\n ]\n }\n }\n ],\n 'value-property': 'variables',\n help: 'scene/component/scenario-run'\n}\n\nexport default class ScenarioRun extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!ScenarioRun._image) {\n ScenarioRun._image = new Image()\n ScenarioRun._image.src = new URL('../icons/symbol-scenario-run.png', import.meta.url).href\n }\n return ScenarioRun._image\n }\n\n private _started: boolean = false\n private _raf: number = 0\n private _timeout: NodeJS.Timeout | null = null\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n context.beginPath()\n this.drawImage(context, ScenarioRun.image, left, top, width, height)\n }\n\n ready() {\n super.ready()\n\n if (this.app.isViewMode) {\n if (this.state.runOnStart) {\n this.started = true\n }\n }\n }\n\n dispose(): void {\n this.stop()\n super.dispose()\n }\n\n get nature() {\n return NATURE\n }\n\n onchange(after: Properties) {\n if ('variables' in after) {\n this.requestData()\n }\n }\n\n set started(started: boolean) {\n this.setState('started')\n\n if (started) {\n this.start()\n } else {\n this.stop()\n }\n }\n\n get started() {\n return this.state.started\n }\n\n start() {\n if (this._started) {\n return\n }\n\n this._started = true\n\n this._raf = requestAnimationFrame(() => this.requestData())\n }\n\n stop() {\n if (!this._started) {\n return\n }\n\n this._started = false\n\n if (this._raf) {\n cancelAnimationFrame(this._raf)\n this._raf = 0\n }\n if (this._timeout) {\n clearTimeout(this._timeout)\n this._timeout = null\n }\n }\n\n get variables() {\n return this.state.variables\n }\n\n set variables(variables) {\n this.setState('variables', variables)\n }\n\n async requestData() {\n let { scenarioName, variables, maskOnError } = this.state\n if (!scenarioName || !this.app.isViewMode) {\n return\n }\n\n try {\n variables = typeof variables == 'string' ? JSON.parse(variables) : variables\n } catch (e) {\n console.warn('runScenario mutation variable is not an object')\n }\n\n if (client) {\n try {\n var response = await client.query({\n query: gql`\n mutation ($scenarioName: String!, $variables: Object) {\n runScenario(scenarioName: $scenarioName, variables: $variables) {\n state\n message\n result\n }\n }\n `,\n variables: {\n scenarioName: scenarioName,\n variables\n }\n })\n\n this.data = response?.data?.runScenario?.result\n this.demask()\n } catch (e: any) {\n console.error(`calling runScenario mutation error: ${e?.message ?? e}`)\n this.mask()\n } finally {\n if (this._started && this.state.interval > 0) {\n this._timeout = setTimeout(() => this.requestData(), this.state.interval)\n }\n }\n }\n }\n\n mask() {\n const { maskOnError } = this.state\n if (maskOnError) {\n //@ts-ignore\n this.root?.target_element?.style.filter = maskOnError\n }\n }\n\n demask() {\n //@ts-ignore\n this.root?.target_element?.style.filter = 'none'\n }\n}\n\nComponent.register('scenario-run', ScenarioRun)\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/scene-integration",
|
|
3
3
|
"description": "Things factory integration component for things-scene",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.10",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
36
|
-
"@things-factory/builder": "^7.0.
|
|
37
|
-
"@things-factory/operato-board": "^7.0.
|
|
36
|
+
"@things-factory/builder": "^7.0.1-alpha.0",
|
|
37
|
+
"@things-factory/operato-board": "^7.0.1-alpha.0",
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
39
39
|
"@typescript-eslint/parser": "^4.33.0",
|
|
40
40
|
"@web/dev-server": "^0.1.28",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"prettier --write"
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "084ebb126e71f315faeb667ef4d6b0c274afeab2"
|
|
63
63
|
}
|
package/src/scenario-run.ts
CHANGED
|
@@ -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
|
-
|
|
151
|
-
query
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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)
|
package/translations/en.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
2
|
+
"component.data-subscription": "Data subscription",
|
|
3
|
+
"component.scenario-control": "Scenario control",
|
|
4
|
+
"component.scenario-run": "Run scenario",
|
|
5
|
+
"component.scenario-start": "Start scenario",
|
|
6
|
+
"component.scenario-stop": "Stop scenario",
|
|
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",
|
|
11
|
+
"label.connection-name": "Connection name",
|
|
12
|
+
"label.scenario-name": "Scenario name",
|
|
13
|
+
"label.control-type": "Control type",
|
|
14
|
+
"label.init-data-endpoint": "Initial data endpoint",
|
|
15
|
+
"label.instance-name": "Instance name",
|
|
16
|
+
"label.repeat-interval": "Repeat interval",
|
|
17
|
+
"label.run-on-start": "Run on start",
|
|
18
|
+
"label.mask-on-error": "Mask on error"
|
|
10
19
|
}
|
package/translations/ja.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"component.data-subscription": "データサブスクリプション",
|
|
3
|
+
"component.scenario-control": "シナリオ制御",
|
|
4
|
+
"component.scenario-run": "シナリオ実行",
|
|
5
|
+
"component.scenario-start": "シナリオ開始",
|
|
6
|
+
"component.scenario-stop": "シナリオ停止",
|
|
7
|
+
"component.scenario-instance-subscription": "シナリオインスタンスのサブスクリプション",
|
|
8
|
+
"component.scenario-queue-subscription": "シナリオキューサブスクリプション",
|
|
9
|
+
"component.connection-state-subscription": "接続状態のサブスクリプション",
|
|
10
|
+
"component.connection-control": "接続制御",
|
|
3
11
|
"label.connection-name": "接続名",
|
|
4
12
|
"label.scenario-name": "シナリオ名",
|
|
5
13
|
"label.control-type": "制御タイプ",
|
|
6
14
|
"label.init-data-endpoint": "初期データエンドポイント",
|
|
7
15
|
"label.instance-name": "インスタンス名",
|
|
8
16
|
"label.repeat-interval": "繰り返し間隔",
|
|
9
|
-
"label.run-on-start": "開始時に実行"
|
|
17
|
+
"label.run-on-start": "開始時に実行",
|
|
18
|
+
"label.mask-on-error": "エラー時にマスク"
|
|
10
19
|
}
|
package/translations/ko.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"component.data-subscription": "데이타 구독",
|
|
3
|
+
"component.scenario-control": "시나리오 컨트롤",
|
|
4
|
+
"component.scenario-run": "시나리오 실행",
|
|
5
|
+
"component.scenario-start": "시나리오 시작",
|
|
6
|
+
"component.scenario-stop": "시나리오 종료",
|
|
7
|
+
"component.scenario-instance-subscription": "시나리오 인스턴스 구독",
|
|
8
|
+
"component.scenario-queue-subscription": "시나리오 큐 구독",
|
|
9
|
+
"component.connection-state-subscription": "커넥션 상태 구독",
|
|
10
|
+
"component.connection-control": "커넥션 컨트롤",
|
|
3
11
|
"label.connection-name": "커넥션 이름",
|
|
4
12
|
"label.scenario-name": "시나리오 명",
|
|
5
13
|
"label.control-type": "작업 타입",
|
|
6
14
|
"label.init-data-endpoint": "초기 데이터 엔드포인트",
|
|
7
15
|
"label.instance-name": "인스턴스 명",
|
|
8
16
|
"label.repeat-interval": "반복 간격",
|
|
9
|
-
"label.run-on-start": "시작시 자동 실행"
|
|
17
|
+
"label.run-on-start": "시작시 자동 실행",
|
|
18
|
+
"label.mask-on-error": "오류시 마스크 적용"
|
|
10
19
|
}
|
package/translations/ms.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"component.data-subscription": "langganan data",
|
|
3
|
+
"component.scenario-control": "kawal senario",
|
|
4
|
+
"component.scenario-run": "jalankan senario",
|
|
5
|
+
"component.scenario-start": "mula senario",
|
|
6
|
+
"component.scenario-stop": "hentikan senario",
|
|
7
|
+
"component.scenario-instance-subscription": "langganan contoh senario",
|
|
8
|
+
"component.scenario-queue-subscription": "langganan barisan senario",
|
|
9
|
+
"component.connection-state-subscription": "langganan status sambungan",
|
|
10
|
+
"component.connection-control": "kawal sambungan",
|
|
3
11
|
"label.connection-name": "nama sambungan",
|
|
4
|
-
"label.scenario-name": "
|
|
5
|
-
"label.control-type": "
|
|
6
|
-
"label.init-data-endpoint": "
|
|
7
|
-
"label.instance-name": "
|
|
8
|
-
"label.repeat-interval": "
|
|
9
|
-
"label.run-on-start": "
|
|
12
|
+
"label.scenario-name": "nama senario",
|
|
13
|
+
"label.control-type": "jenis kawalan",
|
|
14
|
+
"label.init-data-endpoint": "titik akhir data awal",
|
|
15
|
+
"label.instance-name": "nama contoh",
|
|
16
|
+
"label.repeat-interval": "selang ulangan",
|
|
17
|
+
"label.run-on-start": "jalankan pada permulaan",
|
|
18
|
+
"label.mask-on-error": "mask dalam kes ralat"
|
|
10
19
|
}
|
package/translations/zh.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"component.data-subscription": "数据订阅",
|
|
3
|
+
"component.scenario-control": "场景控制",
|
|
4
|
+
"component.scenario-run": "运行场景",
|
|
5
|
+
"component.scenario-start": "开始场景",
|
|
6
|
+
"component.scenario-stop": "停止场景",
|
|
7
|
+
"component.scenario-instance-subscription": "场景实例订阅",
|
|
8
|
+
"component.scenario-queue-subscription": "场景队列订阅",
|
|
9
|
+
"component.connection-state-subscription": "连接状态订阅",
|
|
10
|
+
"component.connection-control": "连接控制",
|
|
3
11
|
"label.connection-name": "连接名称",
|
|
4
12
|
"label.scenario-name": "场景名称",
|
|
5
13
|
"label.control-type": "控制类型",
|
|
6
|
-
"label.init-data-endpoint": "
|
|
14
|
+
"label.init-data-endpoint": "初始数据端点",
|
|
7
15
|
"label.instance-name": "实例名称",
|
|
8
16
|
"label.repeat-interval": "重复间隔",
|
|
9
|
-
"label.run-on-start": "启动时运行"
|
|
17
|
+
"label.run-on-start": "启动时运行",
|
|
18
|
+
"label.mask-on-error": "错误时掩码"
|
|
10
19
|
}
|