@riil-frontend/component-topology 11.0.6 → 11.0.10
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/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +21 -21
- package/es/components/ModelAttrSelectDrawer/index.js +2 -2
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +3 -6
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +4 -7
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +10 -87
- package/es/core/hooks/useTopoEdit.js +8 -12
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/tagstips/ElementTagTipConfig.js +37 -43
- package/lib/components/ModelAttrSelectDrawer/index.js +2 -2
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +3 -7
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +4 -8
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +10 -88
- package/lib/core/hooks/useTopoEdit.js +8 -12
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/tagstips/ElementTagTipConfig.js +37 -43
- package/package.json +2 -2
- package/es/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +0 -82
- package/es/core/components/DisplaySettingDrawer/components/NodeAttrSettingDrawer.js +0 -40
- package/lib/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js +0 -97
- package/lib/core/components/DisplaySettingDrawer/components/NodeAttrSettingDrawer.js +0 -60
@@ -83,7 +83,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
83
83
|
|
84
84
|
_proto.getNodeFiedldMap = function getNodeFiedldMap() {
|
85
85
|
var mtCodes = (0, _utils.getNodeMtCodes)(this.topoData);
|
86
|
-
return this.
|
86
|
+
return this.getFiedldMapByType(mtCodes, 'node');
|
87
87
|
}
|
88
88
|
/**
|
89
89
|
* 获得节点字段配置项map
|
@@ -92,13 +92,8 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
92
92
|
|
93
93
|
_proto.getLinkFidldMap = function getLinkFidldMap() {
|
94
94
|
var mtCodes = (0, _utils.getLinkMtCodes)(this.topoData);
|
95
|
-
return this.
|
96
|
-
}
|
97
|
-
/**
|
98
|
-
* 获取链路标注悬浮框属性配置数据
|
99
|
-
* @returns
|
100
|
-
*/
|
101
|
-
;
|
95
|
+
return this.getFiedldMapByType(mtCodes, 'link');
|
96
|
+
};
|
102
97
|
|
103
98
|
_proto.getLinkConfigItems = function getLinkConfigItems() {
|
104
99
|
var mtCodes = (0, _utils.getLinkMtCodes)(this.topoData);
|
@@ -128,48 +123,47 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
128
123
|
// ]
|
129
124
|
};
|
130
125
|
|
131
|
-
_proto.
|
126
|
+
_proto.getFiedldMapByType = function getFiedldMapByType(mtCodes, type) {
|
132
127
|
var _this = this;
|
133
128
|
|
134
129
|
var map = {};
|
135
130
|
mtCodes.forEach(function (mtCode) {
|
136
131
|
var ciType = _this.mtCiTypeMap[mtCode];
|
137
|
-
map[mtCode] = _this.getFiedldMapByType(ciType, type, mtCode);
|
138
|
-
});
|
139
|
-
return map;
|
140
|
-
};
|
141
132
|
|
142
|
-
|
143
|
-
|
144
|
-
|
133
|
+
var attributes = _this.topo.ciTyeCache.getCiType(ciType).attributes.filter(function (attr) {
|
134
|
+
return !!attr.userVisible;
|
135
|
+
});
|
136
|
+
|
137
|
+
var metrics = _this.getMtMetricModels(mtCode);
|
138
|
+
|
139
|
+
var extItems = type === 'node' ? [{
|
140
|
+
lavel: '图片名称',
|
141
|
+
value: 'graph:name',
|
142
|
+
typeName: null
|
143
|
+
}, {
|
144
|
+
lavel: '资源类型',
|
145
|
+
value: 'ciType:name',
|
146
|
+
typeName: null
|
147
|
+
}] : [];
|
148
|
+
map[mtCode] = [].concat(extItems, attributes.map(function (item) {
|
149
|
+
return {
|
150
|
+
type: 'attribute',
|
151
|
+
id: "attribute:" + item.code,
|
152
|
+
code: "attribute:" + item.code,
|
153
|
+
name: item.name,
|
154
|
+
typeName: '属性'
|
155
|
+
};
|
156
|
+
}), metrics.map(function (item) {
|
157
|
+
return {
|
158
|
+
type: 'metric',
|
159
|
+
id: "metric:" + item.code,
|
160
|
+
code: "metric:" + item.code,
|
161
|
+
name: item.name,
|
162
|
+
typeName: '指标'
|
163
|
+
};
|
164
|
+
}));
|
145
165
|
});
|
146
|
-
|
147
|
-
var extItems = type === 'node' ? [{
|
148
|
-
lavel: '图片名称',
|
149
|
-
value: 'graph:name',
|
150
|
-
typeName: null
|
151
|
-
}, {
|
152
|
-
lavel: '资源类型',
|
153
|
-
value: 'ciType:name',
|
154
|
-
typeName: null
|
155
|
-
}] : [];
|
156
|
-
return [].concat(extItems, attributes.map(function (item) {
|
157
|
-
return {
|
158
|
-
type: 'attribute',
|
159
|
-
id: "attribute:" + item.code,
|
160
|
-
code: "attribute:" + item.code,
|
161
|
-
name: item.name,
|
162
|
-
typeName: '属性'
|
163
|
-
};
|
164
|
-
}), metrics.map(function (item) {
|
165
|
-
return {
|
166
|
-
type: 'metric',
|
167
|
-
id: "metric:" + item.code,
|
168
|
-
code: "metric:" + item.code,
|
169
|
-
name: item.name,
|
170
|
-
typeName: '指标'
|
171
|
-
};
|
172
|
-
}));
|
166
|
+
return map;
|
173
167
|
};
|
174
168
|
|
175
169
|
_proto.getMtMetricModels = function getMtMetricModels(mtCode) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "11.0.
|
3
|
+
"version": "11.0.10",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -118,6 +118,6 @@
|
|
118
118
|
"access": "public"
|
119
119
|
},
|
120
120
|
"license": "MIT",
|
121
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@11.0.
|
121
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@11.0.10/build/index.html",
|
122
122
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
123
123
|
}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
2
|
-
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
3
|
-
import ModelAttrSelectDrawer from "./ModelAttrSelectDrawer";
|
4
|
-
|
5
|
-
function parseValue(value) {
|
6
|
-
var selected = {};
|
7
|
-
Object.keys(value).forEach(function (ciType) {
|
8
|
-
selected[ciType] = value[ciType].map(function (_ref) {
|
9
|
-
var type = _ref.type,
|
10
|
-
code = _ref.code;
|
11
|
-
return type + ":" + code;
|
12
|
-
});
|
13
|
-
});
|
14
|
-
return selected;
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* 资源显示属性、指标配置
|
18
|
-
*/
|
19
|
-
|
20
|
-
|
21
|
-
var MultipleTypeAttributeSelectDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
22
|
-
var value = props.value,
|
23
|
-
data = props.data,
|
24
|
-
showType = props.showType,
|
25
|
-
limit = props.limit,
|
26
|
-
onChange = props.onChange,
|
27
|
-
queryData = props.queryData;
|
28
|
-
var batchAttrMetric = useRef();
|
29
|
-
|
30
|
-
var _useState = useState(parseValue((value === null || value === void 0 ? void 0 : value.data) || {})),
|
31
|
-
selected = _useState[0],
|
32
|
-
setSelected = _useState[1];
|
33
|
-
|
34
|
-
useEffect(function () {
|
35
|
-
setSelected(parseValue((value === null || value === void 0 ? void 0 : value.data) || {}));
|
36
|
-
}, [value]); // 点击选择数据,显示抽屉
|
37
|
-
|
38
|
-
var show = function show() {
|
39
|
-
queryData();
|
40
|
-
batchAttrMetric.current.show({
|
41
|
-
showType: showType
|
42
|
-
});
|
43
|
-
};
|
44
|
-
|
45
|
-
useImperativeHandle(ref, function () {
|
46
|
-
return {
|
47
|
-
show: show
|
48
|
-
};
|
49
|
-
}); // 保存指标设置
|
50
|
-
|
51
|
-
var save = function save(showType, parm) {
|
52
|
-
rlog.debug('saveMarkSetting', showType, parm);
|
53
|
-
var newSelected = {};
|
54
|
-
Object.keys(parm).forEach(function (ciType) {
|
55
|
-
newSelected[ciType] = parm[ciType].map(function (id) {
|
56
|
-
var _id$split = id.split(':'),
|
57
|
-
type = _id$split[0],
|
58
|
-
code = _id$split[1];
|
59
|
-
|
60
|
-
return {
|
61
|
-
code: code,
|
62
|
-
type: type
|
63
|
-
};
|
64
|
-
});
|
65
|
-
});
|
66
|
-
onChange({
|
67
|
-
isCustom: true,
|
68
|
-
data: newSelected
|
69
|
-
});
|
70
|
-
};
|
71
|
-
|
72
|
-
return /*#__PURE__*/React.createElement(ModelAttrSelectDrawer, {
|
73
|
-
ref: batchAttrMetric,
|
74
|
-
value: selected,
|
75
|
-
dataSource: data,
|
76
|
-
limit: limit,
|
77
|
-
showType: showType,
|
78
|
-
onOk: save
|
79
|
-
});
|
80
|
-
});
|
81
|
-
MultipleTypeAttributeSelectDrawer.displayName = 'MultipleTypeAttributeSelectDrawer';
|
82
|
-
export default MultipleTypeAttributeSelectDrawer;
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
-
var _excluded = ["topo", "showType", "value"];
|
4
|
-
import React, { forwardRef, useEffect, useState } from 'react';
|
5
|
-
import PropTypes from 'prop-types';
|
6
|
-
import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
|
7
|
-
import ModelAttrSelectDrawer from "../../../../components/ModelAttrSelectDrawer";
|
8
|
-
import { getNodeModels } from "../../ResourceViewAttributeSetting/nodeCiTypeAttrUtil";
|
9
|
-
/**
|
10
|
-
* 节点标注、悬浮框设置
|
11
|
-
*/
|
12
|
-
|
13
|
-
var NodeAttrSettingDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
14
|
-
var topo = props.topo,
|
15
|
-
showType = props.showType,
|
16
|
-
value = props.value,
|
17
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
18
|
-
|
19
|
-
var _useState = useState([]),
|
20
|
-
data = _useState[0],
|
21
|
-
setData = _useState[1];
|
22
|
-
|
23
|
-
var queryData = function queryData() {
|
24
|
-
rlog.info('属性配置:加载数据');
|
25
|
-
var items = getNodeModels(topo);
|
26
|
-
setData(items);
|
27
|
-
};
|
28
|
-
|
29
|
-
return /*#__PURE__*/React.createElement(ModelAttrSelectDrawer, _extends({
|
30
|
-
ref: ref
|
31
|
-
}, otherProps, {
|
32
|
-
value: value,
|
33
|
-
data: data,
|
34
|
-
showType: showType,
|
35
|
-
queryData: queryData
|
36
|
-
}));
|
37
|
-
});
|
38
|
-
NodeAttrSettingDrawer.displayName = 'NodeAttrSettingDrawer';
|
39
|
-
NodeAttrSettingDrawer.propTypes = {};
|
40
|
-
export default NodeAttrSettingDrawer;
|
package/lib/components/ModelAttrSelectDrawer/components/MultipleTypeAttributeSelectDrawer.js
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
exports.__esModule = true;
|
6
|
-
exports["default"] = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
|
-
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
11
|
-
|
12
|
-
var _ModelAttrSelectDrawer = _interopRequireDefault(require("./ModelAttrSelectDrawer"));
|
13
|
-
|
14
|
-
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); }
|
15
|
-
|
16
|
-
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; }
|
17
|
-
|
18
|
-
function parseValue(value) {
|
19
|
-
var selected = {};
|
20
|
-
Object.keys(value).forEach(function (ciType) {
|
21
|
-
selected[ciType] = value[ciType].map(function (_ref) {
|
22
|
-
var type = _ref.type,
|
23
|
-
code = _ref.code;
|
24
|
-
return type + ":" + code;
|
25
|
-
});
|
26
|
-
});
|
27
|
-
return selected;
|
28
|
-
}
|
29
|
-
/**
|
30
|
-
* 资源显示属性、指标配置
|
31
|
-
*/
|
32
|
-
|
33
|
-
|
34
|
-
var MultipleTypeAttributeSelectDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
35
|
-
var value = props.value,
|
36
|
-
data = props.data,
|
37
|
-
showType = props.showType,
|
38
|
-
limit = props.limit,
|
39
|
-
onChange = props.onChange,
|
40
|
-
queryData = props.queryData;
|
41
|
-
var batchAttrMetric = (0, _react.useRef)();
|
42
|
-
|
43
|
-
var _useState = (0, _react.useState)(parseValue((value === null || value === void 0 ? void 0 : value.data) || {})),
|
44
|
-
selected = _useState[0],
|
45
|
-
setSelected = _useState[1];
|
46
|
-
|
47
|
-
(0, _react.useEffect)(function () {
|
48
|
-
setSelected(parseValue((value === null || value === void 0 ? void 0 : value.data) || {}));
|
49
|
-
}, [value]); // 点击选择数据,显示抽屉
|
50
|
-
|
51
|
-
var show = function show() {
|
52
|
-
queryData();
|
53
|
-
batchAttrMetric.current.show({
|
54
|
-
showType: showType
|
55
|
-
});
|
56
|
-
};
|
57
|
-
|
58
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
59
|
-
return {
|
60
|
-
show: show
|
61
|
-
};
|
62
|
-
}); // 保存指标设置
|
63
|
-
|
64
|
-
var save = function save(showType, parm) {
|
65
|
-
_rlog["default"].debug('saveMarkSetting', showType, parm);
|
66
|
-
|
67
|
-
var newSelected = {};
|
68
|
-
Object.keys(parm).forEach(function (ciType) {
|
69
|
-
newSelected[ciType] = parm[ciType].map(function (id) {
|
70
|
-
var _id$split = id.split(':'),
|
71
|
-
type = _id$split[0],
|
72
|
-
code = _id$split[1];
|
73
|
-
|
74
|
-
return {
|
75
|
-
code: code,
|
76
|
-
type: type
|
77
|
-
};
|
78
|
-
});
|
79
|
-
});
|
80
|
-
onChange({
|
81
|
-
isCustom: true,
|
82
|
-
data: newSelected
|
83
|
-
});
|
84
|
-
};
|
85
|
-
|
86
|
-
return /*#__PURE__*/_react["default"].createElement(_ModelAttrSelectDrawer["default"], {
|
87
|
-
ref: batchAttrMetric,
|
88
|
-
value: selected,
|
89
|
-
dataSource: data,
|
90
|
-
limit: limit,
|
91
|
-
showType: showType,
|
92
|
-
onOk: save
|
93
|
-
});
|
94
|
-
});
|
95
|
-
MultipleTypeAttributeSelectDrawer.displayName = 'MultipleTypeAttributeSelectDrawer';
|
96
|
-
var _default = MultipleTypeAttributeSelectDrawer;
|
97
|
-
exports["default"] = _default;
|
@@ -1,60 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
exports.__esModule = true;
|
6
|
-
exports["default"] = void 0;
|
7
|
-
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
-
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
11
|
-
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
13
|
-
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
15
|
-
|
16
|
-
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/lib/rlog"));
|
17
|
-
|
18
|
-
var _ModelAttrSelectDrawer = _interopRequireDefault(require("../../../../components/ModelAttrSelectDrawer"));
|
19
|
-
|
20
|
-
var _nodeCiTypeAttrUtil = require("../../ResourceViewAttributeSetting/nodeCiTypeAttrUtil");
|
21
|
-
|
22
|
-
var _excluded = ["topo", "showType", "value"];
|
23
|
-
|
24
|
-
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); }
|
25
|
-
|
26
|
-
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; }
|
27
|
-
|
28
|
-
/**
|
29
|
-
* 节点标注、悬浮框设置
|
30
|
-
*/
|
31
|
-
var NodeAttrSettingDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
32
|
-
var topo = props.topo,
|
33
|
-
showType = props.showType,
|
34
|
-
value = props.value,
|
35
|
-
otherProps = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
|
36
|
-
|
37
|
-
var _useState = (0, _react.useState)([]),
|
38
|
-
data = _useState[0],
|
39
|
-
setData = _useState[1];
|
40
|
-
|
41
|
-
var queryData = function queryData() {
|
42
|
-
_rlog["default"].info('属性配置:加载数据');
|
43
|
-
|
44
|
-
var items = (0, _nodeCiTypeAttrUtil.getNodeModels)(topo);
|
45
|
-
setData(items);
|
46
|
-
};
|
47
|
-
|
48
|
-
return /*#__PURE__*/_react["default"].createElement(_ModelAttrSelectDrawer["default"], (0, _extends2["default"])({
|
49
|
-
ref: ref
|
50
|
-
}, otherProps, {
|
51
|
-
value: value,
|
52
|
-
data: data,
|
53
|
-
showType: showType,
|
54
|
-
queryData: queryData
|
55
|
-
}));
|
56
|
-
});
|
57
|
-
NodeAttrSettingDrawer.displayName = 'NodeAttrSettingDrawer';
|
58
|
-
NodeAttrSettingDrawer.propTypes = {};
|
59
|
-
var _default = NodeAttrSettingDrawer;
|
60
|
-
exports["default"] = _default;
|