@riil-frontend/component-topology 3.1.9 → 3.1.12

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/build/index.js +40 -40
  3. package/demo/1/345/237/272/346/234/254//345/210/207/346/215/242/345/233/276/346/240/207.md +11 -0
  4. package/demo-mock/basic/topo/v1/api/attributes/once +95 -0
  5. package/demo-mock/basic/topo/v1/api/attributes/once.json +96 -1
  6. package/es/components/BatchAttrMetric/index.js +1 -0
  7. package/es/core/common/icons/icon.js +20 -6
  8. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.module.scss +3 -3
  9. package/es/core/components/ResourceViewAttributeSetting/Setting.js +1 -0
  10. package/es/core/models/TopoApp.js +1 -1
  11. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -0
  12. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +6 -0
  13. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +660 -0
  14. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js +2 -637
  15. package/es/models/customIcon.js +16 -11
  16. package/es/utils/topoData.js +66 -40
  17. package/lib/components/BatchAttrMetric/index.js +1 -0
  18. package/lib/core/common/icons/icon.js +25 -6
  19. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.module.scss +3 -3
  20. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +1 -0
  21. package/lib/core/models/TopoApp.js +1 -1
  22. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +2 -0
  23. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetailPlugin.js +6 -0
  24. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +691 -0
  25. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js +4 -663
  26. package/lib/models/customIcon.js +16 -11
  27. package/lib/utils/topoData.js +68 -40
  28. package/package.json +2 -2
@@ -167,7 +167,7 @@ function _default(engine) {
167
167
  var _this3 = this;
168
168
 
169
169
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
170
- var data;
170
+ var data, allIcons, newIcons;
171
171
  return _regenerator["default"].wrap(function _callee4$(_context4) {
172
172
  while (1) {
173
173
  switch (_context4.prev = _context4.next) {
@@ -175,26 +175,31 @@ function _default(engine) {
175
175
  data = payload.data;
176
176
 
177
177
  _this3.update({
178
- visible: false,
179
- icons: {
180
- node: [].concat(rootState.customIcon.icons.node, data.map(addIconUrlData)),
181
- container: []
182
- }
183
- });
178
+ visible: false
179
+ }); // 注册
180
+
184
181
 
185
182
  data.forEach(function (icon) {
186
183
  var iconUrl = _topo["default"].icon.getIconImageUrl(icon.id);
187
184
 
188
185
  window.ht.Default.setImage((0, _icon.getCustomIconHtId)(icon.id), iconUrl);
186
+ });
187
+ _context4.next = 5;
188
+ return _this3.loadCustomIcons();
189
+
190
+ case 5:
191
+ allIcons = _context4.sent;
192
+ newIcons = allIcons.node.filter(function (icon) {
193
+ return !!data.find(function (item) {
194
+ return item.id === icon.id;
195
+ });
189
196
  }); // 通知ht
190
197
 
191
198
  engine.view.topoClient.emitEvent('topo_shape_upload_finish', (0, _extends2["default"])({}, payload, {
192
- data: (0, _icon.transformCustomIcons2HtIcons)(data)
199
+ data: (0, _icon.transformCustomIcons2HtIcons)(newIcons)
193
200
  }));
194
- _context4.next = 6;
195
- return _this3.loadCustomIcons();
196
201
 
197
- case 6:
202
+ case 8:
198
203
  case "end":
199
204
  return _context4.stop();
200
205
  }
@@ -10,6 +10,7 @@ exports.formatGroups = formatGroups;
10
10
  exports.getAlarmSwitch = getAlarmSwitch;
11
11
  exports.getCiModSet = getCiModSet;
12
12
  exports.getCiTypes = getCiTypes;
13
+ exports.getCiTypesFromCiElements = getCiTypesFromCiElements;
13
14
  exports.getLinksBetweenTwoNodes = getLinksBetweenTwoNodes;
14
15
  exports.parseTopoData = parseTopoData;
15
16
  exports.updateCiDoc = exports.updateAllCiDoc = exports.sortList = void 0;
@@ -166,8 +167,7 @@ var tfLink = function tfLink(engine, link, nodes) {
166
167
  });
167
168
  };
168
169
 
169
- function getCiTypes(topoData) {
170
- var allCi = [].concat(topoData.nodes, topoData.links, topoData.linkGroups);
170
+ function getCiTypesFromCiElements(allCi) {
171
171
  var ciTypes = [];
172
172
  allCi.forEach(function (element) {
173
173
  if (element.ciType && ciTypes.indexOf(element.ciType) < 0) {
@@ -177,6 +177,11 @@ function getCiTypes(topoData) {
177
177
  return ciTypes;
178
178
  }
179
179
 
180
+ function getCiTypes(topoData) {
181
+ var allCi = [].concat(topoData.nodes, topoData.links, topoData.linkGroups);
182
+ return getCiTypesFromCiElements(allCi);
183
+ }
184
+
180
185
  function getAlarmSwitch(topoData) {
181
186
  var _topoData$global;
182
187
 
@@ -448,6 +453,7 @@ var combTopoData = function combTopoData(_ref3) {
448
453
  })
449
454
  }, getCiModSet({
450
455
  engine: engine,
456
+ data: result,
451
457
  allCis: allCis,
452
458
  ciTypeMap: ciTypeMap,
453
459
  globalConfig: globalConfig
@@ -462,7 +468,8 @@ var combTopoData = function combTopoData(_ref3) {
462
468
  exports.combTopoData = combTopoData;
463
469
 
464
470
  function getCiModSet(params) {
465
- var engine = params.engine,
471
+ var data = params.data,
472
+ engine = params.engine,
466
473
  allCis = params.allCis,
467
474
  ciTypeMap = params.ciTypeMap,
468
475
  globalConfig = params.globalConfig; // 当前拓扑资源字典
@@ -471,49 +478,70 @@ function getCiModSet(params) {
471
478
  var ciTypesDoc = {}; //
472
479
 
473
480
  var bindingCiSet = {};
474
- var allCiModSet = {};
475
- var allLinkModSet = {};
476
- Object.keys(ciTypeMap).forEach(function (key) {
477
- var ciTypeObj = {};
478
- var linkKeyArr = [{
479
- code: "phy",
480
- key: "phy",
481
- name: "物理链路"
482
- }, {
483
- code: "agg",
484
- key: "agg",
485
- name: "聚合链路"
486
- }, {
487
- code: "export_link",
488
- key: "exp",
489
- name: "出口链路"
490
- }];
491
-
492
- if (key === "network_link") {
493
- linkKeyArr.map(function (link, index) {
494
- ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType(link.key);
495
-
496
- if (ciTypeObj) {
497
- allLinkModSet[link.code] = {
498
- name: link.name,
499
- code: link.code,
500
- icon: ciTypeObj.icon,
501
- list: ciModfilter(ciTypeObj, globalConfig, "link", link.code)
502
- };
503
- }
481
+ var allCiModSet = getNodeModSet();
482
+ var allLinkModSet = getLinkModSet();
504
483
 
505
- return link.code;
506
- });
507
- } else {
508
- ciTypeObj = ciTypeMap[key];
509
- allCiModSet[key] = {
484
+ function getNodeModSet() {
485
+ var ciTypes = getCiTypesFromCiElements(data.nodes);
486
+ return getModSet(ciTypes);
487
+ }
488
+
489
+ function getLinkModSet() {
490
+ var ciTypes = getCiTypesFromCiElements([].concat(data.links, data.linkGroups));
491
+ return getModSet(ciTypes);
492
+ }
493
+ /**
494
+ *
495
+ * @param {array} ciTypeCodes
496
+ * @returns
497
+ */
498
+
499
+
500
+ function getModSet(ciTypeCodes) {
501
+ var modSet = {};
502
+ Object.keys(ciTypeMap).filter(function (item) {
503
+ return ciTypeCodes.includes(item);
504
+ }).forEach(function (key) {
505
+ var ciTypeObj = ciTypeMap[key];
506
+ modSet[key] = {
510
507
  name: ciTypeObj.displayName,
511
508
  code: ciTypeObj.code,
512
509
  icon: ciTypeObj.icon,
513
510
  list: ciModfilter(ciTypeObj, globalConfig, "node", ciTypeObj.code)
514
511
  };
515
- }
516
- });
512
+
513
+ if (key === "network_link") {
514
+ var linkKeyArr = [{
515
+ code: "phy",
516
+ key: "phy",
517
+ name: "物理链路"
518
+ }, {
519
+ code: "agg",
520
+ key: "agg",
521
+ name: "聚合链路"
522
+ }, {
523
+ code: "exit",
524
+ key: "exit",
525
+ name: "出口链路"
526
+ }];
527
+ linkKeyArr.map(function (link, index) {
528
+ ciTypeObj = engine.ciTyeCache.getNetworkLinkCiType(link.key);
529
+
530
+ if (ciTypeObj) {
531
+ modSet[link.code] = {
532
+ name: link.name,
533
+ code: link.code,
534
+ icon: ciTypeObj.icon,
535
+ list: ciModfilter(ciTypeObj, globalConfig, "link", link.code)
536
+ };
537
+ }
538
+
539
+ return link.code;
540
+ });
541
+ }
542
+ });
543
+ return modSet;
544
+ }
517
545
 
518
546
  if (allCis.length > 0) {
519
547
  allCis.forEach(function (element, index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "3.1.9",
3
+ "version": "3.1.12",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.1.9/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.1.12/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }