@riil-frontend/component-topology 9.0.6 → 9.0.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.
@@ -1,24 +1,7 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
2
  import { useEffect } from 'react';
4
3
  import useTopoEventListener from "./useTopoEventListener";
5
4
  ht.Default.setImage('resource.subIcon.unMoniter', '/img/topo/alarmStatusIcon/未监控.svg');
6
-
7
- function mergeManageStatus(cis, manageStatusDatas) {
8
- return cis.map(function (ci) {
9
- var manageStatusData = manageStatusDatas.find(function (item) {
10
- return item.ciId === ci.id;
11
- });
12
-
13
- if (manageStatusData) {
14
- return _extends({}, ci, {
15
- manageStatus: manageStatusData.manageStatus
16
- });
17
- }
18
-
19
- return ci;
20
- });
21
- }
22
5
  /**
23
6
  * 监听监控状态推送
24
7
  * 节点、连线监控状态置灰
@@ -26,26 +9,18 @@ function mergeManageStatus(cis, manageStatusDatas) {
26
9
  * @param {*} props
27
10
  */
28
11
 
29
-
30
12
  export default function useManageStatus(props) {
31
13
  var topo = props.topo;
32
14
  useTopoEventListener({
33
15
  type: 'manageStatus',
34
16
  onMessage: function onMessage(manageStatusDatas) {
35
- var topoData = topo.store.getModelState('topoMod').data;
36
-
37
- if (topoData) {
38
- var newData = _extends({}, topoData, {
39
- nodes: mergeManageStatus(topoData.nodes, manageStatusDatas),
40
- links: mergeManageStatus(topoData.links, manageStatusDatas),
41
- linkGroups: mergeManageStatus(topoData.linkGroups, manageStatusDatas)
42
- });
43
-
44
- var topoDispatchers = topo.store.getModelDispatchers('topoMod');
45
- topoDispatchers.update({
46
- data: newData
47
- });
48
- }
17
+ var data = manageStatusDatas.map(function (item) {
18
+ return {
19
+ id: item.ciId,
20
+ manageStatus: item.manageStatus
21
+ };
22
+ });
23
+ topo.dataModel.updateData(data);
49
24
  }
50
25
  });
51
26
  }
@@ -132,6 +132,44 @@ var DataModel = /*#__PURE__*/function () {
132
132
 
133
133
  _proto.getAllEdgesBetweenTwoSelectionNodes = function getAllEdgesBetweenTwoSelectionNodes() {
134
134
  return [].concat(this.getEdgesBetweenTwoSelectionNodes(), this.getEdgeGroupsBetweenTwoSelectionNodes());
135
+ }
136
+ /**
137
+ * 更新数据
138
+ * @param {[{id: '', attributes: {}}]} ciDatas
139
+ */
140
+ ;
141
+
142
+ _proto.updateData = function updateData(ciDatas) {
143
+ var topoData = this.topo.store.getModelState('topoMod').data;
144
+
145
+ if (topoData) {
146
+ var newData = _extends({}, topoData, {
147
+ nodes: mergeData(topoData.nodes, ciDatas),
148
+ links: mergeData(topoData.links, ciDatas),
149
+ linkGroups: mergeData(topoData.linkGroups, ciDatas)
150
+ });
151
+
152
+ var topoDispatchers = this.topo.store.getModelDispatchers('topoMod');
153
+ topoDispatchers.update({
154
+ data: newData
155
+ });
156
+ }
157
+
158
+ function mergeData(cis, arr) {
159
+ return cis.map(function (ci) {
160
+ var dataItem = arr.find(function (item) {
161
+ return item.id === ci.id;
162
+ });
163
+
164
+ if (dataItem) {
165
+ return _extends({}, ci, dataItem, {
166
+ attributes: dataItem.attributes ? _extends({}, ci.attributes, dataItem.attributes) : ci.attributes
167
+ });
168
+ }
169
+
170
+ return ci;
171
+ });
172
+ }
135
173
  };
136
174
 
137
175
  return DataModel;
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "9.0.6" === 'string' ? "9.0.6" : null;
27
+ var version = typeof "9.0.7" === 'string' ? "9.0.7" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -3,8 +3,8 @@ import _Switch from "@alifd/next/es/switch";
3
3
  import React, { useState } from 'react';
4
4
  import BaseInfoBlock from "./BaseInfoBlock";
5
5
  import Configurator from "./components/Configurator";
6
- // import { isExitLink } from '@/core/models/utils/linkUtils';
7
- // 基本信息
6
+ import { isExitLink } from "../../../../../../models/utils/linkUtils"; // 基本信息
7
+
8
8
  export default function NetworkBaseInfo(props) {
9
9
  var loading = props.loading,
10
10
  topo = props.topo,
@@ -45,7 +45,7 @@ export default function NetworkBaseInfo(props) {
45
45
 
46
46
  var crucialBaseInfo = {};
47
47
 
48
- if (targetNode.permission.writeable && sourceNode.permission.writeable) {
48
+ if (isExitLink(edge) && sourceNode.permission.writeable || !isExitLink(edge) && targetNode.permission.writeable && sourceNode.permission.writeable) {
49
49
  crucialBaseInfo = {
50
50
  contentTitle: topo.dataModel.getDataById(data.id).attributes['network_link.is_crucial'] ? '是' : '否',
51
51
  dataIndex: 'isCrucial',
@@ -5,16 +5,20 @@
5
5
  }
6
6
 
7
7
  .base-info {
8
- margin-top: 16px;
8
+ margin-top: 0px;
9
9
  margin-right: -25px;
10
10
  overflow: hidden;
11
+ .item:last-child{
12
+ margin-bottom: 0px;
13
+ }
11
14
  .item {
12
15
  width: 220px;
13
16
  max-width: 100%;
14
17
  margin-right: 25px;
15
- margin-bottom: 8px;
18
+ margin-bottom: 4px;
16
19
  display: flex;
17
20
  float: left;
21
+ line-height: 22px;
18
22
  .label {
19
23
  white-space: nowrap;
20
24
  }
@@ -5,8 +5,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports["default"] = useManageStatus;
7
7
 
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
-
10
8
  var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
11
9
 
12
10
  var _react = require("react");
@@ -14,22 +12,6 @@ var _react = require("react");
14
12
  var _useTopoEventListener = _interopRequireDefault(require("./useTopoEventListener"));
15
13
 
16
14
  ht.Default.setImage('resource.subIcon.unMoniter', '/img/topo/alarmStatusIcon/未监控.svg');
17
-
18
- function mergeManageStatus(cis, manageStatusDatas) {
19
- return cis.map(function (ci) {
20
- var manageStatusData = manageStatusDatas.find(function (item) {
21
- return item.ciId === ci.id;
22
- });
23
-
24
- if (manageStatusData) {
25
- return (0, _extends2["default"])({}, ci, {
26
- manageStatus: manageStatusData.manageStatus
27
- });
28
- }
29
-
30
- return ci;
31
- });
32
- }
33
15
  /**
34
16
  * 监听监控状态推送
35
17
  * 节点、连线监控状态置灰
@@ -37,25 +19,18 @@ function mergeManageStatus(cis, manageStatusDatas) {
37
19
  * @param {*} props
38
20
  */
39
21
 
40
-
41
22
  function useManageStatus(props) {
42
23
  var topo = props.topo;
43
24
  (0, _useTopoEventListener["default"])({
44
25
  type: 'manageStatus',
45
26
  onMessage: function onMessage(manageStatusDatas) {
46
- var topoData = topo.store.getModelState('topoMod').data;
47
-
48
- if (topoData) {
49
- var newData = (0, _extends2["default"])({}, topoData, {
50
- nodes: mergeManageStatus(topoData.nodes, manageStatusDatas),
51
- links: mergeManageStatus(topoData.links, manageStatusDatas),
52
- linkGroups: mergeManageStatus(topoData.linkGroups, manageStatusDatas)
53
- });
54
- var topoDispatchers = topo.store.getModelDispatchers('topoMod');
55
- topoDispatchers.update({
56
- data: newData
57
- });
58
- }
27
+ var data = manageStatusDatas.map(function (item) {
28
+ return {
29
+ id: item.ciId,
30
+ manageStatus: item.manageStatus
31
+ };
32
+ });
33
+ topo.dataModel.updateData(data);
59
34
  }
60
35
  });
61
36
  }
@@ -140,6 +140,43 @@ var DataModel = /*#__PURE__*/function () {
140
140
 
141
141
  _proto.getAllEdgesBetweenTwoSelectionNodes = function getAllEdgesBetweenTwoSelectionNodes() {
142
142
  return [].concat(this.getEdgesBetweenTwoSelectionNodes(), this.getEdgeGroupsBetweenTwoSelectionNodes());
143
+ }
144
+ /**
145
+ * 更新数据
146
+ * @param {[{id: '', attributes: {}}]} ciDatas
147
+ */
148
+ ;
149
+
150
+ _proto.updateData = function updateData(ciDatas) {
151
+ var topoData = this.topo.store.getModelState('topoMod').data;
152
+
153
+ if (topoData) {
154
+ var newData = (0, _extends2["default"])({}, topoData, {
155
+ nodes: mergeData(topoData.nodes, ciDatas),
156
+ links: mergeData(topoData.links, ciDatas),
157
+ linkGroups: mergeData(topoData.linkGroups, ciDatas)
158
+ });
159
+ var topoDispatchers = this.topo.store.getModelDispatchers('topoMod');
160
+ topoDispatchers.update({
161
+ data: newData
162
+ });
163
+ }
164
+
165
+ function mergeData(cis, arr) {
166
+ return cis.map(function (ci) {
167
+ var dataItem = arr.find(function (item) {
168
+ return item.id === ci.id;
169
+ });
170
+
171
+ if (dataItem) {
172
+ return (0, _extends2["default"])({}, ci, dataItem, {
173
+ attributes: dataItem.attributes ? (0, _extends2["default"])({}, ci.attributes, dataItem.attributes) : ci.attributes
174
+ });
175
+ }
176
+
177
+ return ci;
178
+ });
179
+ }
143
180
  };
144
181
 
145
182
  return DataModel;
@@ -56,7 +56,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
56
56
  var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
57
57
 
58
58
  // eslint-disable-next-line no-undef
59
- var version = typeof "9.0.6" === 'string' ? "9.0.6" : null;
59
+ var version = typeof "9.0.7" === 'string' ? "9.0.7" : null;
60
60
  console.info("\u62D3\u6251\u7248\u672C: " + version);
61
61
  /**
62
62
  * 拓扑显示和编辑
@@ -15,11 +15,12 @@ var _BaseInfoBlock = _interopRequireDefault(require("./BaseInfoBlock"));
15
15
 
16
16
  var _Configurator = _interopRequireDefault(require("./components/Configurator"));
17
17
 
18
+ var _linkUtils = require("../../../../../../models/utils/linkUtils");
19
+
18
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
21
 
20
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
23
 
22
- // import { isExitLink } from '@/core/models/utils/linkUtils';
23
24
  // 基本信息
24
25
  function NetworkBaseInfo(props) {
25
26
  var loading = props.loading,
@@ -61,7 +62,7 @@ function NetworkBaseInfo(props) {
61
62
 
62
63
  var crucialBaseInfo = {};
63
64
 
64
- if (targetNode.permission.writeable && sourceNode.permission.writeable) {
65
+ if ((0, _linkUtils.isExitLink)(edge) && sourceNode.permission.writeable || !(0, _linkUtils.isExitLink)(edge) && targetNode.permission.writeable && sourceNode.permission.writeable) {
65
66
  crucialBaseInfo = {
66
67
  contentTitle: topo.dataModel.getDataById(data.id).attributes['network_link.is_crucial'] ? '是' : '否',
67
68
  dataIndex: 'isCrucial',
@@ -5,16 +5,20 @@
5
5
  }
6
6
 
7
7
  .base-info {
8
- margin-top: 16px;
8
+ margin-top: 0px;
9
9
  margin-right: -25px;
10
10
  overflow: hidden;
11
+ .item:last-child{
12
+ margin-bottom: 0px;
13
+ }
11
14
  .item {
12
15
  width: 220px;
13
16
  max-width: 100%;
14
17
  margin-right: 25px;
15
- margin-bottom: 8px;
18
+ margin-bottom: 4px;
16
19
  display: flex;
17
20
  float: left;
21
+ line-height: 22px;
18
22
  .label {
19
23
  white-space: nowrap;
20
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "9.0.6",
3
+ "version": "9.0.7",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.6/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@9.0.7/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }