@riil-frontend/component-topology 2.15.6 → 2.15.7

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.
@@ -0,0 +1,41 @@
1
+ import corePlugins from "./plugins";
2
+
3
+ var PluginManager = /*#__PURE__*/function () {
4
+ /**
5
+ * @type {Array}
6
+ */
7
+ function PluginManager(topo) {
8
+ this.topo = void 0;
9
+ this.pluginMap = {};
10
+ this.plugins = void 0;
11
+ this.topo = topo;
12
+ this.init(corePlugins);
13
+ }
14
+
15
+ var _proto = PluginManager.prototype;
16
+
17
+ _proto.init = function init(plugins) {
18
+ var _this = this;
19
+
20
+ this.plugins = plugins.map(function (Plugin) {
21
+ var plugin = new Plugin(_this.topo);
22
+ _this.pluginMap[plugin.name] = plugin;
23
+ return plugin;
24
+ });
25
+ };
26
+
27
+ _proto.onTopoDataLoaded = function onTopoDataLoaded(topoData) {
28
+ this.plugins.forEach(function (plugin) {
29
+ if (plugin.onTopoDataLoaded) {
30
+ plugin.onTopoDataLoaded(topoData);
31
+ }
32
+ });
33
+ };
34
+
35
+ _proto.destroy = function destroy() {};
36
+
37
+ return PluginManager;
38
+ }();
39
+
40
+ export { PluginManager as default };
41
+ ;
@@ -16,9 +16,10 @@ import DictCache from "./cache/DictCache";
16
16
  import AttributeMetricDisplay from "./AttributeMetricDisplay";
17
17
  import DataModel from "./DataModel";
18
18
  import GraphDataModel from "./GraphDataModel";
19
- import { updateEdgeExpanded } from "../utils/edgeUtil"; // eslint-disable-next-line no-undef
19
+ import { updateEdgeExpanded } from "../utils/edgeUtil";
20
+ import PluginManager from "./PluginManager"; // eslint-disable-next-line no-undef
20
21
 
21
- var version = typeof "2.15.6" === 'string' ? "2.15.6" : null;
22
+ var version = typeof "2.15.7" === 'string' ? "2.15.7" : null;
22
23
  console.info("\u62D3\u6251\u7248\u672C: " + version);
23
24
  var topoDebug = {};
24
25
  window.topoDebug = topoDebug;
@@ -72,7 +73,8 @@ var Topo = /*#__PURE__*/function () {
72
73
  this.view = new TopoGraphView();
73
74
  this.view.setStore(this.store);
74
75
  this.dataModel = new DataModel(this);
75
- this.graphDataModel = new GraphDataModel(this); // 初始化插件 ============================
76
+ this.graphDataModel = new GraphDataModel(this);
77
+ this.pluginManager = new PluginManager(this); // 初始化插件 ============================
76
78
  // 告警
77
79
 
78
80
  this.alarm.init(this); // 指标
@@ -490,7 +492,30 @@ var Topo = /*#__PURE__*/function () {
490
492
 
491
493
  _proto.isGraphLoaded = function isGraphLoaded() {
492
494
  return this.store.getModelState('topoMod').graphLoaded;
493
- }
495
+ };
496
+
497
+ _proto.onTopoDataLoaded = /*#__PURE__*/function () {
498
+ var _onTopoDataLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(topoData) {
499
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
500
+ while (1) {
501
+ switch (_context11.prev = _context11.next) {
502
+ case 0:
503
+ this.pluginManager.onTopoDataLoaded(topoData);
504
+
505
+ case 1:
506
+ case "end":
507
+ return _context11.stop();
508
+ }
509
+ }
510
+ }, _callee11, this);
511
+ }));
512
+
513
+ function onTopoDataLoaded(_x9) {
514
+ return _onTopoDataLoaded.apply(this, arguments);
515
+ }
516
+
517
+ return onTopoDataLoaded;
518
+ }()
494
519
  /**
495
520
  * 进入编辑模式
496
521
  */
@@ -499,11 +524,11 @@ var Topo = /*#__PURE__*/function () {
499
524
  _proto.enterEditMode =
500
525
  /*#__PURE__*/
501
526
  function () {
502
- var _enterEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
527
+ var _enterEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
503
528
  var topoDispatchers, editDispatchers, iconManageDispatchers;
504
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
529
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
505
530
  while (1) {
506
- switch (_context11.prev = _context11.next) {
531
+ switch (_context12.prev = _context12.next) {
507
532
  case 0:
508
533
  topoDispatchers = this.store.getModelDispatchers('topoMod');
509
534
  topoDispatchers.update({
@@ -511,15 +536,15 @@ var Topo = /*#__PURE__*/function () {
511
536
  });
512
537
 
513
538
  if (!this.options.onSwitchToEditModeBegin) {
514
- _context11.next = 5;
539
+ _context12.next = 5;
515
540
  break;
516
541
  }
517
542
 
518
- _context11.next = 5;
543
+ _context12.next = 5;
519
544
  return this.options.onSwitchToEditModeBegin(this);
520
545
 
521
546
  case 5:
522
- _context11.next = 7;
547
+ _context12.next = 7;
523
548
  return this.view.switchToEditMode();
524
549
 
525
550
  case 7:
@@ -537,10 +562,10 @@ var Topo = /*#__PURE__*/function () {
537
562
 
538
563
  case 13:
539
564
  case "end":
540
- return _context11.stop();
565
+ return _context12.stop();
541
566
  }
542
567
  }
543
- }, _callee11, this);
568
+ }, _callee12, this);
544
569
  }));
545
570
 
546
571
  function enterEditMode() {
@@ -551,13 +576,13 @@ var Topo = /*#__PURE__*/function () {
551
576
  }();
552
577
 
553
578
  _proto.exitEditMode = /*#__PURE__*/function () {
554
- var _exitEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
579
+ var _exitEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
555
580
  var editDispatchers;
556
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
581
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
557
582
  while (1) {
558
- switch (_context12.prev = _context12.next) {
583
+ switch (_context13.prev = _context13.next) {
559
584
  case 0:
560
- _context12.next = 2;
585
+ _context13.next = 2;
561
586
  return this.view.switchToViewMode();
562
587
 
563
588
  case 2:
@@ -570,10 +595,10 @@ var Topo = /*#__PURE__*/function () {
570
595
 
571
596
  case 5:
572
597
  case "end":
573
- return _context12.stop();
598
+ return _context13.stop();
574
599
  }
575
600
  }
576
- }, _callee12, this);
601
+ }, _callee13, this);
577
602
  }));
578
603
 
579
604
  function exitEditMode() {
@@ -590,19 +615,19 @@ var Topo = /*#__PURE__*/function () {
590
615
  _proto.triggerSaveEvent =
591
616
  /*#__PURE__*/
592
617
  function () {
593
- var _triggerSaveEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
594
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
618
+ var _triggerSaveEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
619
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
595
620
  while (1) {
596
- switch (_context13.prev = _context13.next) {
621
+ switch (_context14.prev = _context14.next) {
597
622
  case 0:
598
623
  this.view.topoClient.saveExternal();
599
624
 
600
625
  case 1:
601
626
  case "end":
602
- return _context13.stop();
627
+ return _context14.stop();
603
628
  }
604
629
  }
605
- }, _callee13, this);
630
+ }, _callee14, this);
606
631
  }));
607
632
 
608
633
  function triggerSaveEvent() {
@@ -619,19 +644,19 @@ var Topo = /*#__PURE__*/function () {
619
644
  _proto.save =
620
645
  /*#__PURE__*/
621
646
  function () {
622
- var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
623
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
647
+ var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
648
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
624
649
  while (1) {
625
- switch (_context14.prev = _context14.next) {
650
+ switch (_context15.prev = _context15.next) {
626
651
  case 0:
627
652
  this.triggerSaveEvent();
628
653
 
629
654
  case 1:
630
655
  case "end":
631
- return _context14.stop();
656
+ return _context15.stop();
632
657
  }
633
658
  }
634
- }, _callee14, this);
659
+ }, _callee15, this);
635
660
  }));
636
661
 
637
662
  function save() {
@@ -650,11 +675,11 @@ var Topo = /*#__PURE__*/function () {
650
675
  _proto.exportImage =
651
676
  /*#__PURE__*/
652
677
  function () {
653
- var _exportImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(name) {
678
+ var _exportImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(name) {
654
679
  var fileName;
655
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
680
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
656
681
  while (1) {
657
- switch (_context15.prev = _context15.next) {
682
+ switch (_context16.prev = _context16.next) {
658
683
  case 0:
659
684
  fileName = name;
660
685
 
@@ -665,13 +690,13 @@ var Topo = /*#__PURE__*/function () {
665
690
 
666
691
  case 3:
667
692
  case "end":
668
- return _context15.stop();
693
+ return _context16.stop();
669
694
  }
670
695
  }
671
- }, _callee15, this);
696
+ }, _callee16, this);
672
697
  }));
673
698
 
674
- function exportImage(_x9) {
699
+ function exportImage(_x10) {
675
700
  return _exportImage.apply(this, arguments);
676
701
  }
677
702
 
@@ -691,19 +716,19 @@ var Topo = /*#__PURE__*/function () {
691
716
  _proto.loadAttrsAndMetrics =
692
717
  /*#__PURE__*/
693
718
  function () {
694
- var _loadAttrsAndMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(data) {
695
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
719
+ var _loadAttrsAndMetrics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(data) {
720
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
696
721
  while (1) {
697
- switch (_context16.prev = _context16.next) {
722
+ switch (_context17.prev = _context17.next) {
698
723
  case 0:
699
724
  case "end":
700
- return _context16.stop();
725
+ return _context17.stop();
701
726
  }
702
727
  }
703
- }, _callee16);
728
+ }, _callee17);
704
729
  }));
705
730
 
706
- function loadAttrsAndMetrics(_x10) {
731
+ function loadAttrsAndMetrics(_x11) {
707
732
  return _loadAttrsAndMetrics.apply(this, arguments);
708
733
  }
709
734
 
@@ -711,16 +736,16 @@ var Topo = /*#__PURE__*/function () {
711
736
  }();
712
737
 
713
738
  _proto.switchToViewMode = /*#__PURE__*/function () {
714
- var _switchToViewMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
715
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
739
+ var _switchToViewMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
740
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
716
741
  while (1) {
717
- switch (_context17.prev = _context17.next) {
742
+ switch (_context18.prev = _context18.next) {
718
743
  case 0:
719
744
  case "end":
720
- return _context17.stop();
745
+ return _context18.stop();
721
746
  }
722
747
  }
723
- }, _callee17);
748
+ }, _callee18);
724
749
  }));
725
750
 
726
751
  function switchToViewMode() {
@@ -731,16 +756,16 @@ var Topo = /*#__PURE__*/function () {
731
756
  }();
732
757
 
733
758
  _proto.switchToEditMode = /*#__PURE__*/function () {
734
- var _switchToEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
735
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
759
+ var _switchToEditMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
760
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
736
761
  while (1) {
737
- switch (_context18.prev = _context18.next) {
762
+ switch (_context19.prev = _context19.next) {
738
763
  case 0:
739
764
  case "end":
740
- return _context18.stop();
765
+ return _context19.stop();
741
766
  }
742
767
  }
743
- }, _callee18);
768
+ }, _callee19);
744
769
  }));
745
770
 
746
771
  function switchToEditMode() {
@@ -1,7 +1,6 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import ContextMenu from "./common/ContextMenu";
4
- import resourceWebControllUrl from "./plugins/resourceWebControllUrl";
5
4
  import Background from "./graph/Background";
6
5
  /**
7
6
  * 拓扑视图,查看和编辑公共部分。
@@ -24,9 +23,7 @@ var TopoGraphView = /*#__PURE__*/function () {
24
23
 
25
24
  _proto.init = function init() {
26
25
  // 初始化核心组件
27
- this.contextMenu = new ContextMenu(); // 初始化插件功能
28
-
29
- this.resourceWebControllUrl = resourceWebControllUrl(this);
26
+ this.contextMenu = new ContextMenu();
30
27
  };
31
28
 
32
29
  _proto.getHtDataModel = function getHtDataModel() {
@@ -106,30 +103,6 @@ var TopoGraphView = /*#__PURE__*/function () {
106
103
  this.background = new Background(this);
107
104
  };
108
105
 
109
- _proto.afterTopoDataLoaded = /*#__PURE__*/function () {
110
- var _afterTopoDataLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(topoData) {
111
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
112
- while (1) {
113
- switch (_context3.prev = _context3.next) {
114
- case 0:
115
- _context3.next = 2;
116
- return this.resourceWebControllUrl.afterTopoDataLoaded(topoData);
117
-
118
- case 2:
119
- case "end":
120
- return _context3.stop();
121
- }
122
- }
123
- }, _callee3, this);
124
- }));
125
-
126
- function afterTopoDataLoaded(_x) {
127
- return _afterTopoDataLoaded.apply(this, arguments);
128
- }
129
-
130
- return afterTopoDataLoaded;
131
- }();
132
-
133
106
  _proto.setStore = function setStore(s) {
134
107
  this.store = s;
135
108
  };
@@ -0,0 +1,2 @@
1
+ import ResourceWebControllUrl from "./resourceWebControllUrl";
2
+ export default [ResourceWebControllUrl];
@@ -10,7 +10,7 @@ export default function (topo) {
10
10
 
11
11
  function init() {
12
12
  // 注册菜单点击处理
13
- topo.contextMenu.registerCommands({
13
+ topo.view.contextMenu.registerCommands({
14
14
  'Resource.WebConsole.setting': function ResourceWebConsoleSetting(data) {
15
15
  openSettingDialog(data.bussiInformation.id);
16
16
  },
@@ -20,12 +20,12 @@ export default function (topo) {
20
20
  });
21
21
  }
22
22
 
23
- function afterTopoDataLoaded(_x) {
24
- return _afterTopoDataLoaded.apply(this, arguments);
23
+ function onTopoDataLoaded(_x) {
24
+ return _onTopoDataLoaded.apply(this, arguments);
25
25
  }
26
26
 
27
- function _afterTopoDataLoaded() {
28
- _afterTopoDataLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topoData) {
27
+ function _onTopoDataLoaded() {
28
+ _onTopoDataLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topoData) {
29
29
  return _regeneratorRuntime.wrap(function _callee$(_context) {
30
30
  while (1) {
31
31
  switch (_context.prev = _context.next) {
@@ -39,7 +39,7 @@ export default function (topo) {
39
39
  }
40
40
  }, _callee);
41
41
  }));
42
- return _afterTopoDataLoaded.apply(this, arguments);
42
+ return _onTopoDataLoaded.apply(this, arguments);
43
43
  }
44
44
 
45
45
  function initData(_x2) {
@@ -184,8 +184,9 @@ export default function (topo) {
184
184
  }
185
185
 
186
186
  var resourceWebUrl = {
187
+ name: 'resourceWebControllUrl',
187
188
  initData: initData,
188
- afterTopoDataLoaded: afterTopoDataLoaded,
189
+ onTopoDataLoaded: onTopoDataLoaded,
189
190
  getResourceUrl: getResourceUrl,
190
191
  setting: {
191
192
  getCurrentId: function getCurrentId() {
@@ -25,6 +25,7 @@ function BaseInfoRender(type, data) {
25
25
  label: '资源名称:',
26
26
  objKey: 'resource',
27
27
  render: function render(valueData, key) {
28
+ console.log('资源名称:', valueData, key);
28
29
  var display_name = valueData.display_name,
29
30
  link = valueData.link;
30
31
  return /*#__PURE__*/React.createElement("div", {
@@ -211,7 +212,7 @@ export default function ResourceOverview(props) {
211
212
  _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
212
213
  var _topo$options$resourc, _attributeMap$source_, _attributeMap$destina;
213
214
 
214
- var ciTypeMeta, link, linkConnectType, _ciTypeMeta, modelMetrics, ciName, modelAttributeMap, domain, topModelMetrics, isAppTopoFlag, _findItem, attributeMap, metrics, res_address, rated_bandwidth, _modelAttributeMap$;
215
+ var ciTypeMeta, link, linkConnectType, _ciTypeMeta, modelMetrics, ciName, modelAttributeMap, domain, topModelMetrics, isAppTopoFlag, _findItem, attributeMap, metrics, res_address, _attributeMap$, rated_bandwidth, _modelAttributeMap$;
215
216
 
216
217
  return _regeneratorRuntime.wrap(function _callee$(_context) {
217
218
  while (1) {
@@ -249,29 +250,30 @@ export default function ResourceOverview(props) {
249
250
  case 10:
250
251
  // 拓扑(默认) ---------------------------
251
252
  // 基本信息
252
- _findItem = findItem(attrsAndMetrics, 'id', id), attributeMap = _findItem.attributeMap, metrics = _findItem.metrics; // 位置
253
+ _findItem = findItem(attrsAndMetrics, 'id', id), attributeMap = _findItem.attributeMap, metrics = _findItem.metrics;
254
+ console.log('基本信息', attributeMap, attrsAndMetrics); // 位置
253
255
 
254
256
  res_address = false;
255
257
 
256
258
  if (!modelAttributeMap['owned_computer_room']) {
257
- _context.next = 18;
259
+ _context.next = 19;
258
260
  break;
259
261
  }
260
262
 
261
- _context.next = 15;
263
+ _context.next = 16;
262
264
  return getAddressFormat(attributeMap);
263
265
 
264
- case 15:
266
+ case 16:
265
267
  res_address = _context.sent;
266
- _context.next = 19;
268
+ _context.next = 20;
267
269
  break;
268
270
 
269
- case 18:
270
- if (modelAttributeMap[ciType + ".computer_room"]) {
271
- res_address = attributeMap[ciType + ".computer_room"] || attributeMap[ciType + ".area"] ? (attributeMap[ciType + ".computer_room"] || '') + " " + (attributeMap[ciType + ".area"] || '') : '';
271
+ case 19:
272
+ if (modelAttributeMap[ciType + ".computer_room"] || modelAttributeMap[ciType + ".area"]) {
273
+ res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$ = attributeMap[ciType + ".area_object"]) === null || _attributeMap$ === void 0 ? void 0 : _attributeMap$.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
272
274
  }
273
275
 
274
- case 19:
276
+ case 20:
275
277
  // 链路带宽(取实际带宽)
276
278
  rated_bandwidth = false;
277
279
 
@@ -311,7 +313,7 @@ export default function ResourceOverview(props) {
311
313
 
312
314
  getAlarmRiskData(id);
313
315
 
314
- case 24:
316
+ case 25:
315
317
  case "end":
316
318
  return _context.stop();
317
319
  }
@@ -330,7 +332,7 @@ export default function ResourceOverview(props) {
330
332
  _initAppTopo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(topModelMetrics, modelAttributeMap, ciName, domain) {
331
333
  var _topo$options$resourc2, _alarmList;
332
334
 
333
- var _yield$topo$options$r, metrics, alarmList, attributeMap, res_address;
335
+ var _yield$topo$options$r, metrics, alarmList, attributeMap, res_address, _attributeMap$2;
334
336
 
335
337
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
336
338
  while (1) {
@@ -360,10 +362,25 @@ export default function ResourceOverview(props) {
360
362
  // 位置
361
363
  res_address = false;
362
364
 
363
- if (modelAttributeMap[ciType + ".computer_room"]) {
364
- res_address = attributeMap[ciType + ".computer_room"] || attributeMap[ciType + ".area"] ? (attributeMap[ciType + ".computer_room"] || '') + " " + (attributeMap[ciType + ".area"] || '') : '';
365
+ if (!modelAttributeMap['owned_computer_room']) {
366
+ _context2.next = 17;
367
+ break;
368
+ }
369
+
370
+ _context2.next = 14;
371
+ return getAddressFormat(attributeMap);
372
+
373
+ case 14:
374
+ res_address = _context2.sent;
375
+ _context2.next = 18;
376
+ break;
377
+
378
+ case 17:
379
+ if (modelAttributeMap[ciType + ".computer_room"] || modelAttributeMap[ciType + ".area"]) {
380
+ res_address = attributeMap[ciType + ".computer_room "] || attributeMap[ciType + ".area"] ? " " + (((_attributeMap$2 = attributeMap[ciType + ".area_object"]) === null || _attributeMap$2 === void 0 ? void 0 : _attributeMap$2.displayName) || '') + " " + (attributeMap[ciType + ".computer_room"] || '') : false;
365
381
  }
366
382
 
383
+ case 18:
367
384
  setBaseInfo({
368
385
  // 资源
369
386
  //display_name: modelAttributeMap['display_name'] ? attributeMap.display_name : false,
@@ -403,7 +420,7 @@ export default function ResourceOverview(props) {
403
420
  })) || [];
404
421
  setAlarmRiskList(alarmList);
405
422
 
406
- case 16:
423
+ case 22:
407
424
  case "end":
408
425
  return _context2.stop();
409
426
  }
@@ -10,8 +10,8 @@ import styles from "./ResourceWebControllUrlSettingDialog.module.scss";
10
10
  var FormItem = _Form.Item;
11
11
  export default function ResourceWebControllUrlSettingDialog(props) {
12
12
  var topo = props.topo;
13
- var store = topo.store,
14
- resourceWebControllUrl = topo.view.resourceWebControllUrl;
13
+ var store = topo.store;
14
+ var resourceWebControllUrl = topo.pluginManager.pluginMap.resourceWebControllUrl;
15
15
 
16
16
  var _store$useModel = store.useModel('resourceWebControllUrlSetting'),
17
17
  state = _store$useModel[0];
@@ -10,12 +10,13 @@ export default function EditButton(props) {
10
10
  var topo = props.topo,
11
11
  onEnterEdit = props.onEnterEdit,
12
12
  style = props.style;
13
- var store = topo.store; // const [topoState] = store.useModel('topoMod');
14
- // const { topoPermission, } = topoState;
13
+ var store = topo.store;
15
14
 
16
- var functionAuthState = store.useModelState('functionAuth'); // let show = topo.options.usePermission ? topoPermissonUtil.isEditable(topoPermission) : true;
15
+ var _store$useModel = store.useModel('topoMod'),
16
+ topoState = _store$useModel[0];
17
17
 
18
- var show = topo.options.usePermission ? functionAuthState.permissions.createTopo : true;
18
+ var topoPermission = topoState.topoPermission;
19
+ var show = topo.options.usePermission ? topoPermissonUtil.isEditable(topoPermission) : true;
19
20
 
20
21
  if (!show) {
21
22
  return null;
@@ -23,7 +23,8 @@ export default function buildNodeContextmenu(topoApp) {
23
23
  label: '访问',
24
24
  id: 'Resource.WebConsole.open',
25
25
  disable: function disable(data) {
26
- return !topoApp.view.resourceWebControllUrl.getResourceUrl(data.id);
26
+ var resourceWebControllUrl = topoApp.pluginManager.pluginMap.resourceWebControllUrl;
27
+ return !resourceWebControllUrl.getResourceUrl(data.id);
27
28
  }
28
29
  }, {
29
30
  label: '设置',
@@ -26,14 +26,13 @@ export default function (topoApp) {
26
26
  data: null,
27
27
  // 后端返回的分组、连线、节点数据
28
28
  topoData: null,
29
+ // ht 拓扑数据,用于首次load
29
30
  currentTopo: undefined,
30
31
  topoPermission: undefined,
31
32
  currentNode: {
32
33
  id: "",
33
34
  name: "无数据"
34
35
  },
35
- drawVisible: false,
36
- selectNodeId: "",
37
36
  topoAlarmIsOpen: false,
38
37
  // 拓扑通道是否打开
39
38
  alarmPanelIsOpen: false,
@@ -356,8 +355,7 @@ export default function (topoApp) {
356
355
  _this5.update({
357
356
  topoData: null,
358
357
  data: null,
359
- loading: false,
360
- drawVisible: false
358
+ loading: false
361
359
  });
362
360
 
363
361
  topoApp.options.onLoad();
@@ -455,7 +453,7 @@ export default function (topoApp) {
455
453
  topoApp.alarm.open();
456
454
  }
457
455
 
458
- topoApp.view.afterTopoDataLoaded(topoData);
456
+ topoApp.onTopoDataLoaded(topoData);
459
457
  endTime = moment();
460
458
  rlog.info("topoMod.initTopoData 初始化拓扑图数据完成. 耗时: ", endTime.diff(startTime, "seconds", true));
461
459
  topoApp.options.onLoad();
@@ -635,6 +633,25 @@ export default function (topoApp) {
635
633
  rlog.error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context12.t0); // 尚未区分拓扑图不存在还是接口请求报错
636
634
 
637
635
  case 11:
636
+ _context12.next = 13;
637
+ return dispatch.functionAuth.checkAuth('createTopo');
638
+
639
+ case 13:
640
+ if (!_context12.sent) {
641
+ _context12.next = 17;
642
+ break;
643
+ }
644
+
645
+ _context12.t1 = 'delete';
646
+ _context12.next = 18;
647
+ break;
648
+
649
+ case 17:
650
+ _context12.t1 = 'read';
651
+
652
+ case 18:
653
+ topoPermission = _context12.t1;
654
+
638
655
  if (update !== false) {
639
656
  _this9.update({
640
657
  topoPermission: topoPermission
@@ -643,7 +660,7 @@ export default function (topoApp) {
643
660
 
644
661
  return _context12.abrupt("return", topoPermission);
645
662
 
646
- case 13:
663
+ case 21:
647
664
  case "end":
648
665
  return _context12.stop();
649
666
  }
package/es/utils/tree.js CHANGED
@@ -40,7 +40,9 @@ export function formatTree(json, funcPermissions) {
40
40
  type: type,
41
41
  name: name,
42
42
  showDefault: showDefault,
43
- permission: node.operation,
43
+ // permission: node.operation,
44
+ // FIXME 拓扑数据权限临时方案,待移除
45
+ permission: funcPermissions.createTopo ? 'delete' : 'read',
44
46
  children: node !== null && node !== void 0 && node.children ? loop(node.children) : []
45
47
  };
46
48
  });
@@ -133,7 +135,7 @@ export var loopTreeFun = function loopTreeFun(data, callback) {
133
135
  loopTreeFun(item.children, callback);
134
136
  }
135
137
 
136
- return callback(item, index, arr);
138
+ callback(item, index, arr);
137
139
  });
138
140
  };
139
141
  /**