@riil-frontend/component-topology 3.1.11 → 3.2.0

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 (26) hide show
  1. package/build/index.js +5 -5
  2. package/demo/CHANGELOG/CHANGELOG.md +15 -1
  3. package/demo-mock/basic/topo/v1/api/attributes/once +95 -0
  4. package/demo-mock/basic/topo/v1/api/attributes/once.json +96 -1
  5. package/es/components/BatchAttrMetric/index.js +1 -0
  6. package/es/core/common/icons/icon.js +21 -6
  7. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.module.scss +3 -3
  8. package/es/core/components/ResourceViewAttributeSetting/Setting.js +1 -0
  9. package/es/core/models/TopoApp.js +1 -1
  10. package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +10 -5
  11. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +660 -0
  12. package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js +2 -637
  13. package/es/models/topoMod.js +1 -0
  14. package/es/utils/topoData.js +73 -47
  15. package/lib/components/BatchAttrMetric/index.js +1 -0
  16. package/lib/core/common/icons/icon.js +27 -6
  17. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/CommonCheckboxGroup.module.scss +3 -3
  18. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +1 -0
  19. package/lib/core/models/TopoApp.js +1 -1
  20. package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +11 -5
  21. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +691 -0
  22. package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/index.js +4 -663
  23. package/lib/models/topoMod.js +1 -0
  24. package/lib/utils/topoData.js +75 -47
  25. package/package.json +2 -2
  26. package/CHANGELOG.md +0 -23
@@ -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
 
@@ -305,7 +310,7 @@ function buildTopoGraphData() {// TODO 构造拓扑图数据移到这里
305
310
  }
306
311
 
307
312
  function buildGlobal(_ref2) {
308
- var _result$config, _engine$viewProps, _result$global2, _engine$options$viewe, _engine$options$edito, _engine$options$edito2;
313
+ var _result$config, _engine$viewProps, _result$global2, _result$customGlobal, _result$customGlobal2, _engine$options$viewe, _engine$options$edito, _engine$options$edito2;
309
314
 
310
315
  var result = _ref2.data,
311
316
  permission = _ref2.permission,
@@ -332,14 +337,15 @@ function buildGlobal(_ref2) {
332
337
  };
333
338
  }
334
339
 
335
- return (0, _extends2["default"])({
340
+ console.error(111, result);
341
+ return {
336
342
  // 背景图
337
343
  backgroundImgUrl: (_engine$viewProps = engine.viewProps) !== null && _engine$viewProps !== void 0 && _engine$viewProps.hideBackground ? null : (0, _backgroundUtil.getBackgroundImageUrl)(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.background),
338
344
  control: (0, _extends2["default"])({
339
345
  editable: _topoPermissionUtil["default"].isEditable(permission),
340
346
  // 是否可编辑----控制[编辑]按钮
341
347
  moveable: true
342
- }, (result === null || result === void 0 ? void 0 : (_result$global2 = result.global) === null || _result$global2 === void 0 ? void 0 : _result$global2.control) || {}),
348
+ }, (result === null || result === void 0 ? void 0 : (_result$global2 = result.global) === null || _result$global2 === void 0 ? void 0 : _result$global2.control) || {}, (result === null || result === void 0 ? void 0 : (_result$customGlobal = result.customGlobal) === null || _result$customGlobal === void 0 ? void 0 : _result$customGlobal.control) || {}),
343
349
  topoDisplayConfig: (0, _extends2["default"])({
344
350
  // alarmSwitch: (result.global || {}).alarmSwitch ?? true,
345
351
  showLog: false,
@@ -352,9 +358,8 @@ function buildGlobal(_ref2) {
352
358
  // 是否显示链路名称
353
359
  nodeLabelStyle: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.nodeLabelStyle,
354
360
  edgeFlow: edgeFlow
355
- }, (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.topoDisplayConfig) || {}),
356
- linkTo: linkTo
357
- }, result.global || {}, {
361
+ }, (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.topoDisplayConfig) || {}, (result === null || result === void 0 ? void 0 : (_result$customGlobal2 = result.customGlobal) === null || _result$customGlobal2 === void 0 ? void 0 : _result$customGlobal2.topoDisplayConfig) || {}),
362
+ linkTo: linkTo,
358
363
  viewMode: {
359
364
  // 右键菜单
360
365
  contextMenu: (0, _mergeContextmenu["default"])((0, _buildContextmenu["default"])(engine), (_engine$options$viewe = engine.options.viewer) === null || _engine$options$viewe === void 0 ? void 0 : _engine$options$viewe.contextmenu, engine)
@@ -367,7 +372,7 @@ function buildGlobal(_ref2) {
367
372
  icons: (0, _icon.getEditorIcons)(engine),
368
373
  // 获取默认节点图标,可选参数。如果无返回值则继续使用内部默认
369
374
  getDefaultNodeIcon: engine.options.getDefaultNodeIcon
370
- });
375
+ };
371
376
  }
372
377
  /**
373
378
  * 将从后端接收的数据转化为topo组件中需要的数据
@@ -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.11",
3
+ "version": "3.2.0",
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.11/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@3.2.0/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }
package/CHANGELOG.md DELETED
@@ -1,23 +0,0 @@
1
- ## 3.1.10 2022-4-19 11:20:01
2
-
3
- - 支持不显示区域添加资源按钮
4
- - fix NEWITOM-16174【拓扑】上传自定义图片后,点击图片的属性面板,显示图片中显示的自定义图片显示顺序与上传后顺序不一致
5
- ## 3.1.8
6
-
7
- - 支持自定义链路概览基本信息
8
- - 编辑模式节点属性面板设置支持不显示图标设置
9
-
10
- ## v2.1.8
11
-
12
- - 支持自定义分层添加资源组件
13
- - 支持添加节点、连线接口 `addElements(data)`
14
-
15
- ## v2.1.3
16
-
17
- - 支持自定义图标
18
-
19
- ## v2.0.1
20
-
21
- 新增功能
22
- - 拓扑图全量更新数据接口,更新时保留元素样式
23
- - 编辑模式右键菜单