coolcare-lite-scada-component 4.1.4 → 4.1.6
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/README.md +3 -1
- package/es/components/DialogImagePicker/Gallery/index.js +7 -2
- package/es/element/ElePointValue/Component.js +1 -5
- package/es/integration/EditorGateway.js +85 -0
- package/es/integration/ThreeScene.js +315 -0
- package/es/integration/legacy-resource-adapter.js +819 -0
- package/es/integration/platform-resources.js +5 -0
- package/es/integration/platform-scenes.js +284 -0
- package/es/integration/platform-session.js +33 -0
- package/es/integration/platform-telemetry.js +436 -0
- package/es/integration/resource-adapter.js +1 -0
- package/es/integration/resource-groups.js +3 -0
- package/es/integration/resource-seed.json +3380 -0
- package/es/integration/scene-format.js +35 -0
- package/es/pages/display/Player/index.js +26 -10
- package/es/pages/display/index.js +75 -14
- package/es/pages/editor/PanelLeft/MineImgGroup/index.js +4 -1
- package/es/pages/editor/PanelLeft/SystemImgGroupList/index.js +4 -1
- package/es/pages/editor/PanelTop/Save/index.js +46 -33
- package/es/pages/editor/index.js +59 -35
- package/es/typings.d.ts +224 -223
- package/package.json +8 -5
package/es/pages/editor/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { GetCompanyConfigurationPage } from "../../services/gateway/CompanyConfi
|
|
|
11
11
|
import { useQuery } from "../../hooks";
|
|
12
12
|
import GraphCore from "../../graph/graphCore";
|
|
13
13
|
import { defaultDeviceMobileSize, defaultDevicePCSize } from "../../constant";
|
|
14
|
+
import { assertLegacyScene } from "../../integration/scene-format";
|
|
14
15
|
import { buildScadaConfigSnapshot, captureScadaScreenshot, setScadaConfigSnapshotToStorage } from "./utils/scadaChangeLog";
|
|
15
16
|
import Palette from "./Palette";
|
|
16
17
|
import PanelTop from "./PanelTop";
|
|
@@ -25,6 +26,8 @@ import "../../element/register";
|
|
|
25
26
|
// 濞夈劌鍞介懛顏勭暰娑?edge
|
|
26
27
|
import "../../edge/register";
|
|
27
28
|
export default (function () {
|
|
29
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
30
|
+
initialConfig = _ref.initialConfig;
|
|
28
31
|
var paletteWrapRef = useRef(null);
|
|
29
32
|
var query = useQuery();
|
|
30
33
|
var _useModel = useModel('useEditor', function (model) {
|
|
@@ -42,7 +45,7 @@ export default (function () {
|
|
|
42
45
|
fetchUserDeviceList = _useModel.fetchUserDeviceList,
|
|
43
46
|
setInitialScadaConfigSnapshot = _useModel.setInitialScadaConfigSnapshot;
|
|
44
47
|
var cacheScadaConfig = useCallback(/*#__PURE__*/function () {
|
|
45
|
-
var
|
|
48
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(pageConfigValue) {
|
|
46
49
|
var _graphCoreRef$current;
|
|
47
50
|
var graph, snapshot, _t, _t2, _t3;
|
|
48
51
|
return _regenerator().w(function (_context) {
|
|
@@ -64,7 +67,7 @@ export default (function () {
|
|
|
64
67
|
}, _callee);
|
|
65
68
|
}));
|
|
66
69
|
return function (_x) {
|
|
67
|
-
return
|
|
70
|
+
return _ref2.apply(this, arguments);
|
|
68
71
|
};
|
|
69
72
|
}(), [graphCoreRef, query, setInitialScadaConfigSnapshot]);
|
|
70
73
|
useEffect(function () {
|
|
@@ -75,7 +78,7 @@ export default (function () {
|
|
|
75
78
|
}, []);
|
|
76
79
|
useEffect(function () {
|
|
77
80
|
var handler = /*#__PURE__*/function () {
|
|
78
|
-
var
|
|
81
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
|
|
79
82
|
var _graphCoreRef$current2;
|
|
80
83
|
var graph, data, configJSON, _graphCoreRef$current3, width, height, initialPageConfig;
|
|
81
84
|
return _regenerator().w(function (_context2) {
|
|
@@ -92,6 +95,7 @@ export default (function () {
|
|
|
92
95
|
break;
|
|
93
96
|
}
|
|
94
97
|
configJSON = JSON.parse(data.payload || '{}');
|
|
98
|
+
assertLegacyScene(configJSON);
|
|
95
99
|
graph === null || graph === void 0 ? void 0 : graph.fromJSON(configJSON);
|
|
96
100
|
// 缂傗晜鏂侀悽璇茬閸愬懎顔愰敍灞煎▏閻㈣绔烽崘鍛啇閸忓懏寮х憴鍡楀經
|
|
97
101
|
graph === null || graph === void 0 ? void 0 : graph.zoomToFit({
|
|
@@ -125,7 +129,7 @@ export default (function () {
|
|
|
125
129
|
}, _callee2);
|
|
126
130
|
}));
|
|
127
131
|
return function handler(_x2) {
|
|
128
|
-
return
|
|
132
|
+
return _ref3.apply(this, arguments);
|
|
129
133
|
};
|
|
130
134
|
}();
|
|
131
135
|
window.addEventListener('message', handler);
|
|
@@ -159,7 +163,7 @@ export default (function () {
|
|
|
159
163
|
}
|
|
160
164
|
if (query.scene === 'device') {
|
|
161
165
|
var fetchDeviceScadaConfig = /*#__PURE__*/function () {
|
|
162
|
-
var
|
|
166
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
163
167
|
var hideMsg, _yield$GetDeviceConfi, success, data, activeScada, configJSON, width, height, initialPageConfig, _t4;
|
|
164
168
|
return _regenerator().w(function (_context3) {
|
|
165
169
|
while (1) switch (_context3.p = _context3.n) {
|
|
@@ -190,6 +194,7 @@ export default (function () {
|
|
|
190
194
|
break;
|
|
191
195
|
}
|
|
192
196
|
configJSON = JSON.parse(activeScada.config || '{}');
|
|
197
|
+
assertLegacyScene(configJSON);
|
|
193
198
|
graphCore.graph.fromJSON(configJSON);
|
|
194
199
|
if (configJSON.pageConfig) {
|
|
195
200
|
setPageConfig(configJSON.pageConfig);
|
|
@@ -237,43 +242,62 @@ export default (function () {
|
|
|
237
242
|
}, _callee3, null, [[1, 7, 8, 9]]);
|
|
238
243
|
}));
|
|
239
244
|
return function fetchDeviceScadaConfig() {
|
|
240
|
-
return
|
|
245
|
+
return _ref4.apply(this, arguments);
|
|
241
246
|
};
|
|
242
247
|
}();
|
|
243
248
|
fetchDeviceScadaConfig();
|
|
244
249
|
}
|
|
245
250
|
if (query.scene === 'freedom') {
|
|
246
251
|
var fetchScadaConfig = /*#__PURE__*/function () {
|
|
247
|
-
var
|
|
248
|
-
var hideMsg, _data$list,
|
|
252
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
253
|
+
var hideMsg, _data$list, _ref6, success, data, scadaConfig, _configJSON$cells, configJSON, width, height, initialPageConfig, _t5, _t6;
|
|
249
254
|
return _regenerator().w(function (_context4) {
|
|
250
255
|
while (1) switch (_context4.p = _context4.n) {
|
|
251
256
|
case 0:
|
|
252
257
|
hideMsg = message.loading('Loading scada config');
|
|
253
258
|
_context4.p = 1;
|
|
254
|
-
|
|
259
|
+
if (!(initialConfig !== undefined)) {
|
|
260
|
+
_context4.n = 2;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
_t5 = {
|
|
264
|
+
success: true,
|
|
265
|
+
data: {
|
|
266
|
+
list: [{
|
|
267
|
+
config: JSON.stringify(initialConfig)
|
|
268
|
+
}]
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
_context4.n = 4;
|
|
272
|
+
break;
|
|
273
|
+
case 2:
|
|
274
|
+
_context4.n = 3;
|
|
255
275
|
return GetCompanyConfigurationPage({
|
|
256
276
|
companyConfigurationId: Number(query.scadaId),
|
|
257
277
|
isGetConfig: true,
|
|
258
278
|
companyId: Number(query.companyId)
|
|
259
279
|
});
|
|
260
|
-
case
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
280
|
+
case 3:
|
|
281
|
+
_t5 = _context4.v;
|
|
282
|
+
case 4:
|
|
283
|
+
_ref6 = _t5;
|
|
284
|
+
success = _ref6.success;
|
|
285
|
+
data = _ref6.data;
|
|
264
286
|
if (!(!success || !(data === null || data === void 0 ? void 0 : (_data$list = data.list) === null || _data$list === void 0 ? void 0 : _data$list.length))) {
|
|
265
|
-
_context4.n =
|
|
287
|
+
_context4.n = 5;
|
|
266
288
|
break;
|
|
267
289
|
}
|
|
268
290
|
message.error('Load configuration failed');
|
|
269
291
|
return _context4.a(2);
|
|
270
|
-
case
|
|
292
|
+
case 5:
|
|
271
293
|
scadaConfig = data.list[0].config;
|
|
272
294
|
if (!scadaConfig) {
|
|
273
|
-
_context4.n =
|
|
295
|
+
_context4.n = 7;
|
|
274
296
|
break;
|
|
275
297
|
}
|
|
276
|
-
configJSON = JSON.parse(scadaConfig || '{}');
|
|
298
|
+
configJSON = JSON.parse(scadaConfig || '{}');
|
|
299
|
+
assertLegacyScene(configJSON);
|
|
300
|
+
// 娣囶喖顦查崥搴n伂娣囨繂鐡ㄩ弫鐗堝祦閺冭绱濋崶鐖卻on閺佺増宓佺粔宥呯摠閸?%"閼板苯顕遍懛瀵告畱"%"閺佺増宓佹稉銏犮亼闂傤噣顣?
|
|
277
301
|
if (configJSON === null || configJSON === void 0 ? void 0 : (_configJSON$cells = configJSON.cells) === null || _configJSON$cells === void 0 ? void 0 : _configJSON$cells.length) {
|
|
278
302
|
configJSON === null || configJSON === void 0 ? void 0 : configJSON.cells.forEach(function (item) {
|
|
279
303
|
var _item$attrs, _item$attrs$body, _item$attrs2, _item$attrs2$body, _item$attrs2$body$ref, _item$attrs3, _item$attrs3$body, _item$attrs5, _item$attrs5$body, _item$attrs6, _item$attrs6$body, _item$attrs6$body$ref, _item$attrs7, _item$attrs7$body;
|
|
@@ -297,12 +321,12 @@ export default (function () {
|
|
|
297
321
|
// 鏉堢绐?
|
|
298
322
|
preserveAspectRatio: true // 閺勵垰鎯佹穱婵囧瘮闂€鍨啍濮f柣鈧?
|
|
299
323
|
});
|
|
300
|
-
_context4.n = 4;
|
|
301
|
-
return cacheScadaConfig(configJSON.pageConfig || {});
|
|
302
|
-
case 4:
|
|
303
324
|
_context4.n = 6;
|
|
325
|
+
return cacheScadaConfig(configJSON.pageConfig || {});
|
|
326
|
+
case 6:
|
|
327
|
+
_context4.n = 8;
|
|
304
328
|
break;
|
|
305
|
-
case
|
|
329
|
+
case 7:
|
|
306
330
|
width = 1366;
|
|
307
331
|
height = 768;
|
|
308
332
|
initialPageConfig = {
|
|
@@ -314,32 +338,32 @@ export default (function () {
|
|
|
314
338
|
};
|
|
315
339
|
setPageConfig(initialPageConfig);
|
|
316
340
|
graphCore.initScadaContainer(width, height);
|
|
317
|
-
_context4.n = 6;
|
|
318
|
-
return cacheScadaConfig(initialPageConfig);
|
|
319
|
-
case 6:
|
|
320
341
|
_context4.n = 8;
|
|
342
|
+
return cacheScadaConfig(initialPageConfig);
|
|
343
|
+
case 8:
|
|
344
|
+
_context4.n = 10;
|
|
321
345
|
break;
|
|
322
|
-
case
|
|
323
|
-
_context4.p =
|
|
324
|
-
|
|
325
|
-
console.error(
|
|
346
|
+
case 9:
|
|
347
|
+
_context4.p = 9;
|
|
348
|
+
_t6 = _context4.v;
|
|
349
|
+
console.error(_t6);
|
|
326
350
|
message.error('Load configuration failed');
|
|
327
|
-
case
|
|
328
|
-
_context4.p =
|
|
351
|
+
case 10:
|
|
352
|
+
_context4.p = 10;
|
|
329
353
|
hideMsg();
|
|
330
|
-
return _context4.f(
|
|
331
|
-
case
|
|
354
|
+
return _context4.f(10);
|
|
355
|
+
case 11:
|
|
332
356
|
return _context4.a(2);
|
|
333
357
|
}
|
|
334
|
-
}, _callee4, null, [[1,
|
|
358
|
+
}, _callee4, null, [[1, 9, 10, 11]]);
|
|
335
359
|
}));
|
|
336
360
|
return function fetchScadaConfig() {
|
|
337
|
-
return
|
|
361
|
+
return _ref5.apply(this, arguments);
|
|
338
362
|
};
|
|
339
363
|
}();
|
|
340
364
|
fetchScadaConfig();
|
|
341
365
|
}
|
|
342
|
-
}, [cacheScadaConfig, graphCoreRef, query, setPageConfig]);
|
|
366
|
+
}, [cacheScadaConfig, graphCoreRef, query, setPageConfig, initialConfig]);
|
|
343
367
|
useEffect(function () {
|
|
344
368
|
if (process.env.NODE_ENV === 'production') {
|
|
345
369
|
window.onbeforeunload = function (e) {
|