@riil-frontend/component-topology 7.0.1 → 7.0.3
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/build/index.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +2 -2
- package/es/core/models/AttributeMetricDisplay.js +24 -10
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/attributeFormatter/index.js +4 -0
- package/es/core/utils/manageStatusUtil.js +4 -0
- package/es/style.js +1 -1
- package/es/utils/topoData.js +6 -67
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +2 -2
- package/lib/core/models/AttributeMetricDisplay.js +25 -10
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/attributeFormatter/index.js +4 -0
- package/lib/core/utils/manageStatusUtil.js +9 -0
- package/lib/style.js +1 -1
- package/lib/utils/topoData.js +7 -75
- package/package.json +2 -2
@@ -157,8 +157,8 @@ function FontColorDropdown(props) {
|
|
157
157
|
unit: "%",
|
158
158
|
list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
|
159
159
|
onChange: backOpacityChange,
|
160
|
-
defaultValue: opacity === undefined ? opacity : Math.round(opacity * 100)
|
161
|
-
|
160
|
+
defaultValue: opacity === undefined ? opacity : Math.round(opacity * 100) // disabled={!background}
|
161
|
+
|
162
162
|
})), /*#__PURE__*/React.createElement("div", {
|
163
163
|
style: {
|
164
164
|
marginTop: '10px',
|
@@ -7,6 +7,7 @@ import { keyBy } from 'lodash';
|
|
7
7
|
import { DEFAULT_NODE_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
8
8
|
import { findItem } from "../../utils/topoData";
|
9
9
|
import { queryCisByIds } from "../services";
|
10
|
+
import { isMonitoring } from "../utils/manageStatusUtil";
|
10
11
|
import AttributeFormatter from "./attributeFormatter";
|
11
12
|
import DictCache from "./cache/DictCache";
|
12
13
|
|
@@ -22,12 +23,7 @@ function filterUnExistedFields(fields, ciTypeMeta) {
|
|
22
23
|
return fields.filter(function (item) {
|
23
24
|
return isFieldExisted(item, ciTypeMeta);
|
24
25
|
});
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
var filterByPermission = function filterByPermission(resource, items) {
|
29
|
-
return resource.operation ? items : [];
|
30
|
-
};
|
26
|
+
}
|
31
27
|
/**
|
32
28
|
* 资源标注、悬浮框数据
|
33
29
|
*/
|
@@ -134,13 +130,31 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
134
130
|
type: 'node',
|
135
131
|
id: node.id,
|
136
132
|
ciType: ciType,
|
137
|
-
tags:
|
138
|
-
tips:
|
133
|
+
tags: _this.filterCiFiledConfigItems(node, ciTypeConfig.tags),
|
134
|
+
tips: _this.filterCiFiledConfigItems(node, ciTypeConfig.tips)
|
139
135
|
};
|
140
136
|
});
|
141
137
|
} // eslint-disable-next-line class-methods-use-this
|
142
138
|
;
|
143
139
|
|
140
|
+
_proto.filterCiFiledConfigItems = function filterCiFiledConfigItems(data, ciTypeItemConfigs) {
|
141
|
+
// 无权限不显示标注、悬浮框
|
142
|
+
var filterByPermission = function filterByPermission(resource, items) {
|
143
|
+
return resource.operation ? items : [];
|
144
|
+
};
|
145
|
+
|
146
|
+
var list = filterByPermission(data, ciTypeItemConfigs); // 未监控不显示指标
|
147
|
+
|
148
|
+
if (!isMonitoring(data)) {
|
149
|
+
list = list.filter(function (item) {
|
150
|
+
return item.type !== 'metric';
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
return list;
|
155
|
+
} // eslint-disable-next-line class-methods-use-this
|
156
|
+
;
|
157
|
+
|
144
158
|
_proto.getModelType = function getModelType(ci) {
|
145
159
|
if (ci.ciType === 'network_link') {
|
146
160
|
return ci.attributes.support_templates;
|
@@ -203,8 +217,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
203
217
|
id: link.id,
|
204
218
|
ciType: ciType
|
205
219
|
}, tagTipConfig, {
|
206
|
-
tags:
|
207
|
-
tips:
|
220
|
+
tags: _this2.filterCiFiledConfigItems(link, tagTipConfig.tags),
|
221
|
+
tips: _this2.filterCiFiledConfigItems(link, tagTipConfig.tips)
|
208
222
|
});
|
209
223
|
});
|
210
224
|
}
|
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
|
|
23
23
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
24
24
|
import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
|
25
25
|
|
26
|
-
var version = typeof "7.0.
|
26
|
+
var version = typeof "7.0.3" === 'string' ? "7.0.3" : null;
|
27
27
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
28
28
|
/**
|
29
29
|
* 拓扑显示和编辑
|
@@ -81,6 +81,10 @@ var AttributeFormatter = /*#__PURE__*/function () {
|
|
81
81
|
};
|
82
82
|
|
83
83
|
_proto.metricTransform = function metricTransform(item, ciData) {
|
84
|
+
if (ciData.id === '000000000381ef35') {
|
85
|
+
console.error(111, item, ciData);
|
86
|
+
}
|
87
|
+
|
84
88
|
return this.commonTransform(item, ciData, 'metric');
|
85
89
|
};
|
86
90
|
|
package/es/style.js
CHANGED
@@ -2,11 +2,11 @@ import '@riil-frontend/component-topology-graph/es/style';
|
|
2
2
|
import '@alifd/next/es/box/style';
|
3
3
|
import '@alifd/next/es/message/style';
|
4
4
|
import '@riil-frontend/component-topology-utils/es/style';
|
5
|
-
import '@riil-frontend/utils/es/style';
|
6
5
|
import '@riil-frontend/component-riil-event-emitter/es/style';
|
7
6
|
import '@alifd/next/es/drawer/style';
|
8
7
|
import '@alifd/next/es/menu-button/style';
|
9
8
|
import '@alifd/next/es/search/style';
|
9
|
+
import '@riil-frontend/utils/es/style';
|
10
10
|
import '@alifd/next/es/tab/style';
|
11
11
|
import '@alifd/next/es/table/style';
|
12
12
|
import '@riil-frontend/component-table-layout/es/style';
|
package/es/utils/topoData.js
CHANGED
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
var _excluded = ["extraConfig"];
|
4
4
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
5
|
-
import { isAvailableArray } from "@riil-frontend/utils";
|
6
5
|
import _ from "lodash";
|
7
6
|
import topoPermissionUtil from "./topoPermissionUtil";
|
8
7
|
import buildViewerContextMenu from "../core/viewer/contextmenu/buildContextmenu";
|
@@ -21,54 +20,14 @@ import { isGroup } from "./htElementUtils";
|
|
21
20
|
*/
|
22
21
|
|
23
22
|
export var findItem = function findItem(arr, key, value) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
for (var i = 0; i < arr.length; i++) {
|
28
|
-
var item = arr[i];
|
29
|
-
|
30
|
-
if (item[key] && item[key] === value) {
|
31
|
-
result = item;
|
32
|
-
break;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
return result;
|
37
|
-
} else {
|
38
|
-
return undefined;
|
39
|
-
}
|
23
|
+
return (arr || []).find(function (item) {
|
24
|
+
return item[key] && item[key] === value;
|
25
|
+
});
|
40
26
|
};
|
41
27
|
export var findItemIndex = function findItemIndex(arr, key, value) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
for (var i = 0; i < arr.length; i++) {
|
46
|
-
var item = arr[i];
|
47
|
-
|
48
|
-
if (item[key] && item[key] === value) {
|
49
|
-
result = i;
|
50
|
-
break;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
return result;
|
55
|
-
} else {
|
56
|
-
return -1;
|
57
|
-
}
|
58
|
-
};
|
59
|
-
/**
|
60
|
-
* 告警列表排序
|
61
|
-
* @param {} a
|
62
|
-
* @param {*} b
|
63
|
-
* @returns
|
64
|
-
*/
|
65
|
-
|
66
|
-
export var sortList = function sortList(a, b) {
|
67
|
-
if (a.level === b.level) {
|
68
|
-
return a.obj.createTime - b.obj.createTime;
|
69
|
-
} else {
|
70
|
-
return a.level - b.level;
|
71
|
-
}
|
28
|
+
return (arr || []).findIndex(function (item) {
|
29
|
+
return item[key] && item[key] === value;
|
30
|
+
});
|
72
31
|
}; // 格式化容器
|
73
32
|
|
74
33
|
export function formatGroup(group) {
|
@@ -138,26 +97,6 @@ export function getCiTypes(topoData) {
|
|
138
97
|
var allCi = [].concat(topoData.nodes, topoData.links, topoData.linkGroups);
|
139
98
|
return getCiTypesFromCiElements(allCi);
|
140
99
|
}
|
141
|
-
/**
|
142
|
-
* 获得监控模板code列表
|
143
|
-
* @param {*} cis
|
144
|
-
* @returns
|
145
|
-
*/
|
146
|
-
|
147
|
-
export function getMonitorTemplateCodes(cis) {
|
148
|
-
var codes = [];
|
149
|
-
cis.forEach(function (element) {
|
150
|
-
var _element$attributes;
|
151
|
-
|
152
|
-
// eslint-disable-next-line camelcase
|
153
|
-
var code = (_element$attributes = element.attributes) === null || _element$attributes === void 0 ? void 0 : _element$attributes.support_templates;
|
154
|
-
|
155
|
-
if (code && codes.indexOf(code) < 0) {
|
156
|
-
codes.push(code);
|
157
|
-
}
|
158
|
-
});
|
159
|
-
return codes;
|
160
|
-
}
|
161
100
|
/**
|
162
101
|
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
163
102
|
* @param {} ciTypeObj
|
@@ -175,8 +175,8 @@ function FontColorDropdown(props) {
|
|
175
175
|
unit: "%",
|
176
176
|
list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
|
177
177
|
onChange: backOpacityChange,
|
178
|
-
defaultValue: opacity === undefined ? opacity : Math.round(opacity * 100)
|
179
|
-
|
178
|
+
defaultValue: opacity === undefined ? opacity : Math.round(opacity * 100) // disabled={!background}
|
179
|
+
|
180
180
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
181
181
|
style: {
|
182
182
|
marginTop: '10px',
|
@@ -23,6 +23,8 @@ var _topoData = require("../../utils/topoData");
|
|
23
23
|
|
24
24
|
var _services = require("../services");
|
25
25
|
|
26
|
+
var _manageStatusUtil = require("../utils/manageStatusUtil");
|
27
|
+
|
26
28
|
var _attributeFormatter = _interopRequireDefault(require("./attributeFormatter"));
|
27
29
|
|
28
30
|
var _DictCache = _interopRequireDefault(require("./cache/DictCache"));
|
@@ -39,12 +41,7 @@ function filterUnExistedFields(fields, ciTypeMeta) {
|
|
39
41
|
return fields.filter(function (item) {
|
40
42
|
return isFieldExisted(item, ciTypeMeta);
|
41
43
|
});
|
42
|
-
}
|
43
|
-
|
44
|
-
|
45
|
-
var filterByPermission = function filterByPermission(resource, items) {
|
46
|
-
return resource.operation ? items : [];
|
47
|
-
};
|
44
|
+
}
|
48
45
|
/**
|
49
46
|
* 资源标注、悬浮框数据
|
50
47
|
*/
|
@@ -151,13 +148,31 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
151
148
|
type: 'node',
|
152
149
|
id: node.id,
|
153
150
|
ciType: ciType,
|
154
|
-
tags:
|
155
|
-
tips:
|
151
|
+
tags: _this.filterCiFiledConfigItems(node, ciTypeConfig.tags),
|
152
|
+
tips: _this.filterCiFiledConfigItems(node, ciTypeConfig.tips)
|
156
153
|
};
|
157
154
|
});
|
158
155
|
} // eslint-disable-next-line class-methods-use-this
|
159
156
|
;
|
160
157
|
|
158
|
+
_proto.filterCiFiledConfigItems = function filterCiFiledConfigItems(data, ciTypeItemConfigs) {
|
159
|
+
// 无权限不显示标注、悬浮框
|
160
|
+
var filterByPermission = function filterByPermission(resource, items) {
|
161
|
+
return resource.operation ? items : [];
|
162
|
+
};
|
163
|
+
|
164
|
+
var list = filterByPermission(data, ciTypeItemConfigs); // 未监控不显示指标
|
165
|
+
|
166
|
+
if (!(0, _manageStatusUtil.isMonitoring)(data)) {
|
167
|
+
list = list.filter(function (item) {
|
168
|
+
return item.type !== 'metric';
|
169
|
+
});
|
170
|
+
}
|
171
|
+
|
172
|
+
return list;
|
173
|
+
} // eslint-disable-next-line class-methods-use-this
|
174
|
+
;
|
175
|
+
|
161
176
|
_proto.getModelType = function getModelType(ci) {
|
162
177
|
if (ci.ciType === 'network_link') {
|
163
178
|
return ci.attributes.support_templates;
|
@@ -220,8 +235,8 @@ var AttributeMetricDisplay = /*#__PURE__*/function () {
|
|
220
235
|
id: link.id,
|
221
236
|
ciType: ciType
|
222
237
|
}, tagTipConfig, {
|
223
|
-
tags:
|
224
|
-
tips:
|
238
|
+
tags: _this2.filterCiFiledConfigItems(link, tagTipConfig.tags),
|
239
|
+
tips: _this2.filterCiFiledConfigItems(link, tagTipConfig.tips)
|
225
240
|
});
|
226
241
|
});
|
227
242
|
}
|
@@ -54,7 +54,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
|
|
54
54
|
var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "7.0.
|
57
|
+
var version = typeof "7.0.3" === 'string' ? "7.0.3" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
@@ -93,6 +93,10 @@ var AttributeFormatter = /*#__PURE__*/function () {
|
|
93
93
|
};
|
94
94
|
|
95
95
|
_proto.metricTransform = function metricTransform(item, ciData) {
|
96
|
+
if (ciData.id === '000000000381ef35') {
|
97
|
+
console.error(111, item, ciData);
|
98
|
+
}
|
99
|
+
|
96
100
|
return this.commonTransform(item, ciData, 'metric');
|
97
101
|
};
|
98
102
|
|
package/lib/style.js
CHANGED
@@ -2,11 +2,11 @@ require('@riil-frontend/component-topology-graph/lib/style');
|
|
2
2
|
require('@alifd/next/lib/box/style');
|
3
3
|
require('@alifd/next/lib/message/style');
|
4
4
|
require('@riil-frontend/component-topology-utils/lib/style');
|
5
|
-
require('@riil-frontend/utils/lib/style');
|
6
5
|
require('@riil-frontend/component-riil-event-emitter/lib/style');
|
7
6
|
require('@alifd/next/lib/drawer/style');
|
8
7
|
require('@alifd/next/lib/menu-button/style');
|
9
8
|
require('@alifd/next/lib/search/style');
|
9
|
+
require('@riil-frontend/utils/lib/style');
|
10
10
|
require('@alifd/next/lib/tab/style');
|
11
11
|
require('@alifd/next/lib/table/style');
|
12
12
|
require('@riil-frontend/component-table-layout/lib/style');
|
package/lib/utils/topoData.js
CHANGED
@@ -13,9 +13,7 @@ exports.getCiModSet = getCiModSet;
|
|
13
13
|
exports.getCiTypes = getCiTypes;
|
14
14
|
exports.getCiTypesFromCiElements = getCiTypesFromCiElements;
|
15
15
|
exports.getLinksBetweenTwoNodes = getLinksBetweenTwoNodes;
|
16
|
-
exports.getMonitorTemplateCodes = getMonitorTemplateCodes;
|
17
16
|
exports.parseTopoData = parseTopoData;
|
18
|
-
exports.sortList = void 0;
|
19
17
|
exports.transtormElementsToMap = transtormElementsToMap;
|
20
18
|
exports.updateCiDoc = exports.updateAllCiDoc = void 0;
|
21
19
|
|
@@ -25,8 +23,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
25
23
|
|
26
24
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
27
25
|
|
28
|
-
var _utils = require("@riil-frontend/utils");
|
29
|
-
|
30
26
|
var _lodash = _interopRequireDefault(require("lodash"));
|
31
27
|
|
32
28
|
var _topoPermissionUtil = _interopRequireDefault(require("./topoPermissionUtil"));
|
@@ -55,64 +51,21 @@ var _excluded = ["extraConfig"];
|
|
55
51
|
* @returns {*}
|
56
52
|
*/
|
57
53
|
var findItem = function findItem(arr, key, value) {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
for (var i = 0; i < arr.length; i++) {
|
62
|
-
var item = arr[i];
|
63
|
-
|
64
|
-
if (item[key] && item[key] === value) {
|
65
|
-
result = item;
|
66
|
-
break;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
|
70
|
-
return result;
|
71
|
-
} else {
|
72
|
-
return undefined;
|
73
|
-
}
|
54
|
+
return (arr || []).find(function (item) {
|
55
|
+
return item[key] && item[key] === value;
|
56
|
+
});
|
74
57
|
};
|
75
58
|
|
76
59
|
exports.findItem = findItem;
|
77
60
|
|
78
61
|
var findItemIndex = function findItemIndex(arr, key, value) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
for (var i = 0; i < arr.length; i++) {
|
83
|
-
var item = arr[i];
|
84
|
-
|
85
|
-
if (item[key] && item[key] === value) {
|
86
|
-
result = i;
|
87
|
-
break;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
return result;
|
92
|
-
} else {
|
93
|
-
return -1;
|
94
|
-
}
|
95
|
-
};
|
96
|
-
/**
|
97
|
-
* 告警列表排序
|
98
|
-
* @param {} a
|
99
|
-
* @param {*} b
|
100
|
-
* @returns
|
101
|
-
*/
|
102
|
-
|
103
|
-
|
104
|
-
exports.findItemIndex = findItemIndex;
|
105
|
-
|
106
|
-
var sortList = function sortList(a, b) {
|
107
|
-
if (a.level === b.level) {
|
108
|
-
return a.obj.createTime - b.obj.createTime;
|
109
|
-
} else {
|
110
|
-
return a.level - b.level;
|
111
|
-
}
|
62
|
+
return (arr || []).findIndex(function (item) {
|
63
|
+
return item[key] && item[key] === value;
|
64
|
+
});
|
112
65
|
}; // 格式化容器
|
113
66
|
|
114
67
|
|
115
|
-
exports.
|
68
|
+
exports.findItemIndex = findItemIndex;
|
116
69
|
|
117
70
|
function formatGroup(group) {
|
118
71
|
return (0, _extends2["default"])({}, group, {
|
@@ -184,27 +137,6 @@ function getCiTypes(topoData) {
|
|
184
137
|
var allCi = [].concat(topoData.nodes, topoData.links, topoData.linkGroups);
|
185
138
|
return getCiTypesFromCiElements(allCi);
|
186
139
|
}
|
187
|
-
/**
|
188
|
-
* 获得监控模板code列表
|
189
|
-
* @param {*} cis
|
190
|
-
* @returns
|
191
|
-
*/
|
192
|
-
|
193
|
-
|
194
|
-
function getMonitorTemplateCodes(cis) {
|
195
|
-
var codes = [];
|
196
|
-
cis.forEach(function (element) {
|
197
|
-
var _element$attributes;
|
198
|
-
|
199
|
-
// eslint-disable-next-line camelcase
|
200
|
-
var code = (_element$attributes = element.attributes) === null || _element$attributes === void 0 ? void 0 : _element$attributes.support_templates;
|
201
|
-
|
202
|
-
if (code && codes.indexOf(code) < 0) {
|
203
|
-
codes.push(code);
|
204
|
-
}
|
205
|
-
});
|
206
|
-
return codes;
|
207
|
-
}
|
208
140
|
/**
|
209
141
|
* 过滤ci元数据中的属性和指标,用于属性和指标显示设置
|
210
142
|
* @param {} ciTypeObj
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "7.0.
|
3
|
+
"version": "7.0.3",
|
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@7.0.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@7.0.3/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|