@riil-frontend/component-topology 11.0.12 → 11.0.13
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/components/BatchAttrMetric2/setting.js +23 -6
- package/es/components/BatchAttrMetric2/utils.js +19 -1
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +10 -0
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/tagstips/ElementTagTipConfig.js +2 -1
- package/lib/components/BatchAttrMetric2/setting.js +22 -5
- package/lib/components/BatchAttrMetric2/utils.js +24 -2
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +10 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/tagstips/ElementTagTipConfig.js +2 -1
- package/package.json +2 -2
@@ -6,7 +6,7 @@ import _Message from "@alifd/next/es/message";
|
|
6
6
|
import _extends from "@babel/runtime/helpers/extends";
|
7
7
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
8
8
|
var _excluded = ["value", "defaultSet", "dataSource"];
|
9
|
-
import React, { useState, useMemo } from 'react';
|
9
|
+
import React, { useState, useMemo, useEffect } from 'react';
|
10
10
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
11
11
|
import ActionTree from '@riil-frontend/component-action-tree';
|
12
12
|
import NoDataPage from '@riil-frontend/component-topology-common/es/components/NoDataPage';
|
@@ -28,15 +28,21 @@ var Setting = function Setting(_ref) {
|
|
28
28
|
var allCiSet = useMemo(function () {
|
29
29
|
var map = {};
|
30
30
|
loopTreeNode(dataSource, function (item) {
|
31
|
-
|
31
|
+
if (item.type !== 'folder') {
|
32
|
+
map[item.id] = item;
|
33
|
+
}
|
32
34
|
});
|
33
35
|
return map;
|
34
36
|
}, [dataSource]);
|
35
37
|
|
36
|
-
var _useState = useState(
|
38
|
+
var _useState = useState(utils.getDefaultSelectedCiType(dataSource)),
|
37
39
|
ciType = _useState[0],
|
38
40
|
setCiType = _useState[1];
|
39
41
|
|
42
|
+
useEffect(function () {
|
43
|
+
setCiType(utils.getDefaultSelectedCiType(dataSource));
|
44
|
+
}, [dataSource]);
|
45
|
+
|
40
46
|
var _useState2 = useState(''),
|
41
47
|
search = _useState2[0],
|
42
48
|
setSearch = _useState2[1];
|
@@ -72,7 +78,7 @@ var Setting = function Setting(_ref) {
|
|
72
78
|
var onTreeSelect = function onTreeSelect(_ref2) {
|
73
79
|
var selectedKey = _ref2[0];
|
74
80
|
|
75
|
-
if (selectedKey && allCiSet[selectedKey].type !== 'folder') {
|
81
|
+
if (selectedKey && allCiSet[selectedKey] && allCiSet[selectedKey].type !== 'folder') {
|
76
82
|
setCiType(selectedKey);
|
77
83
|
}
|
78
84
|
};
|
@@ -126,12 +132,23 @@ var Setting = function Setting(_ref) {
|
|
126
132
|
}, /*#__PURE__*/React.createElement(_Grid.Col, {
|
127
133
|
span: 8,
|
128
134
|
className: styles['tree-wrap']
|
129
|
-
}, /*#__PURE__*/React.createElement(ActionTree, {
|
135
|
+
}, dataSource.length && /*#__PURE__*/React.createElement(ActionTree, {
|
130
136
|
dataSource: dataSource,
|
131
137
|
onSelect: onTreeSelect,
|
132
138
|
draggable: false,
|
133
139
|
treeProps: {
|
134
|
-
selectedKeys: [ciType]
|
140
|
+
selectedKeys: [ciType],
|
141
|
+
defaultExpandedKeys: dataSource.filter(function (item) {
|
142
|
+
return item.type === 'folder';
|
143
|
+
}).map(function (item) {
|
144
|
+
return item.id;
|
145
|
+
}),
|
146
|
+
expandedKeys: dataSource.filter(function (item) {
|
147
|
+
return item.type === 'folder';
|
148
|
+
}).map(function (item) {
|
149
|
+
return item.id;
|
150
|
+
}),
|
151
|
+
defaultExpandAll: true
|
135
152
|
}
|
136
153
|
})), /*#__PURE__*/React.createElement(_Grid.Col, {
|
137
154
|
className: styles['table-wrap']
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import styles from "./index.module.scss";
|
3
3
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
4
|
+
import { loopTreeNode } from "../../utils/treeUtil";
|
4
5
|
/**
|
5
6
|
* 获取树结构数据源
|
6
7
|
* @param {*} allCiSet 数据源
|
@@ -77,4 +78,21 @@ export var typeCell = function typeCell(text) {
|
|
77
78
|
}
|
78
79
|
|
79
80
|
return "-";
|
80
|
-
};
|
81
|
+
};
|
82
|
+
/**
|
83
|
+
* 获得默认选中第一个模型
|
84
|
+
* @param {*} tree
|
85
|
+
* @returns
|
86
|
+
*/
|
87
|
+
|
88
|
+
export function getDefaultSelectedCiType(tree) {
|
89
|
+
var ciType = null;
|
90
|
+
loopTreeNode(tree, function (item) {
|
91
|
+
if (item.type !== 'folder') {
|
92
|
+
if (!ciType) {
|
93
|
+
ciType = item.id;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
});
|
97
|
+
return ciType;
|
98
|
+
}
|
@@ -29,6 +29,7 @@ export function getNodeModels(topo) {
|
|
29
29
|
return {
|
30
30
|
id: ciTypeObj.code,
|
31
31
|
label: ciTypeObj.displayName,
|
32
|
+
typeCode: ciTypeObj.typeCode,
|
32
33
|
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
33
34
|
list: buildModelFields(ciTypeObj, 'node')
|
34
35
|
};
|
@@ -65,6 +66,15 @@ export function getNodeModels(topo) {
|
|
65
66
|
name: '资源类型',
|
66
67
|
type: 'custom'
|
67
68
|
}]);
|
69
|
+
|
70
|
+
if (topo.isCMPTopo) {
|
71
|
+
custom.push.apply(custom, [{
|
72
|
+
id: 'p:source',
|
73
|
+
code: 'name',
|
74
|
+
name: '所属平台',
|
75
|
+
type: 'custom'
|
76
|
+
}]);
|
77
|
+
}
|
68
78
|
}
|
69
79
|
|
70
80
|
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
@@ -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 "11.0.
|
27
|
+
var version = typeof "11.0.13" === 'string' ? "11.0.13" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -150,7 +150,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
150
150
|
var metrics = ciTypeModel.metrics.filter(function (m) {
|
151
151
|
return _this2.mtMetricsMap[type] && !!_this2.mtMetricsMap[type][m.code];
|
152
152
|
});
|
153
|
-
return _extends({},
|
153
|
+
return _extends({}, ciTypeModel, baseInfo, {
|
154
154
|
metrics: metrics,
|
155
155
|
metricMap: keyBy(metrics, 'code')
|
156
156
|
});
|
@@ -179,6 +179,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
179
179
|
return {
|
180
180
|
id: ciTypeObj.code,
|
181
181
|
label: ciTypeObj.displayName,
|
182
|
+
typeCode: ciTypeObj.typeCode,
|
182
183
|
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
183
184
|
list: this.buildModelFields(ciTypeObj, type)
|
184
185
|
};
|
@@ -54,15 +54,21 @@ var Setting = function Setting(_ref) {
|
|
54
54
|
var allCiSet = (0, _react.useMemo)(function () {
|
55
55
|
var map = {};
|
56
56
|
(0, _treeUtil.loopTreeNode)(dataSource, function (item) {
|
57
|
-
|
57
|
+
if (item.type !== 'folder') {
|
58
|
+
map[item.id] = item;
|
59
|
+
}
|
58
60
|
});
|
59
61
|
return map;
|
60
62
|
}, [dataSource]);
|
61
63
|
|
62
|
-
var _useState = (0, _react.useState)(
|
64
|
+
var _useState = (0, _react.useState)(utils.getDefaultSelectedCiType(dataSource)),
|
63
65
|
ciType = _useState[0],
|
64
66
|
setCiType = _useState[1];
|
65
67
|
|
68
|
+
(0, _react.useEffect)(function () {
|
69
|
+
setCiType(utils.getDefaultSelectedCiType(dataSource));
|
70
|
+
}, [dataSource]);
|
71
|
+
|
66
72
|
var _useState2 = (0, _react.useState)(''),
|
67
73
|
search = _useState2[0],
|
68
74
|
setSearch = _useState2[1];
|
@@ -98,7 +104,7 @@ var Setting = function Setting(_ref) {
|
|
98
104
|
var onTreeSelect = function onTreeSelect(_ref2) {
|
99
105
|
var selectedKey = _ref2[0];
|
100
106
|
|
101
|
-
if (selectedKey && allCiSet[selectedKey].type !== 'folder') {
|
107
|
+
if (selectedKey && allCiSet[selectedKey] && allCiSet[selectedKey].type !== 'folder') {
|
102
108
|
setCiType(selectedKey);
|
103
109
|
}
|
104
110
|
};
|
@@ -153,12 +159,23 @@ var Setting = function Setting(_ref) {
|
|
153
159
|
}, /*#__PURE__*/_react["default"].createElement(_grid["default"].Col, {
|
154
160
|
span: 8,
|
155
161
|
className: _indexModule["default"]['tree-wrap']
|
156
|
-
}, /*#__PURE__*/_react["default"].createElement(_componentActionTree["default"], {
|
162
|
+
}, dataSource.length && /*#__PURE__*/_react["default"].createElement(_componentActionTree["default"], {
|
157
163
|
dataSource: dataSource,
|
158
164
|
onSelect: onTreeSelect,
|
159
165
|
draggable: false,
|
160
166
|
treeProps: {
|
161
|
-
selectedKeys: [ciType]
|
167
|
+
selectedKeys: [ciType],
|
168
|
+
defaultExpandedKeys: dataSource.filter(function (item) {
|
169
|
+
return item.type === 'folder';
|
170
|
+
}).map(function (item) {
|
171
|
+
return item.id;
|
172
|
+
}),
|
173
|
+
expandedKeys: dataSource.filter(function (item) {
|
174
|
+
return item.type === 'folder';
|
175
|
+
}).map(function (item) {
|
176
|
+
return item.id;
|
177
|
+
}),
|
178
|
+
defaultExpandAll: true
|
162
179
|
}
|
163
180
|
})), /*#__PURE__*/_react["default"].createElement(_grid["default"].Col, {
|
164
181
|
className: _indexModule["default"]['table-wrap']
|
@@ -3,7 +3,9 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
|
-
exports.
|
6
|
+
exports.defaultSelected = void 0;
|
7
|
+
exports.getDefaultSelectedCiType = getDefaultSelectedCiType;
|
8
|
+
exports.typeCell = exports.treeDs = void 0;
|
7
9
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
9
11
|
|
@@ -11,6 +13,8 @@ var _indexModule = _interopRequireDefault(require("./index.module.scss"));
|
|
11
13
|
|
12
14
|
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
13
15
|
|
16
|
+
var _treeUtil = require("../../utils/treeUtil");
|
17
|
+
|
14
18
|
/**
|
15
19
|
* 获取树结构数据源
|
16
20
|
* @param {*} allCiSet 数据源
|
@@ -93,5 +97,23 @@ var typeCell = function typeCell(text) {
|
|
93
97
|
|
94
98
|
return "-";
|
95
99
|
};
|
100
|
+
/**
|
101
|
+
* 获得默认选中第一个模型
|
102
|
+
* @param {*} tree
|
103
|
+
* @returns
|
104
|
+
*/
|
96
105
|
|
97
|
-
|
106
|
+
|
107
|
+
exports.typeCell = typeCell;
|
108
|
+
|
109
|
+
function getDefaultSelectedCiType(tree) {
|
110
|
+
var ciType = null;
|
111
|
+
(0, _treeUtil.loopTreeNode)(tree, function (item) {
|
112
|
+
if (item.type !== 'folder') {
|
113
|
+
if (!ciType) {
|
114
|
+
ciType = item.id;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
});
|
118
|
+
return ciType;
|
119
|
+
}
|
@@ -35,6 +35,7 @@ function getNodeModels(topo) {
|
|
35
35
|
return {
|
36
36
|
id: ciTypeObj.code,
|
37
37
|
label: ciTypeObj.displayName,
|
38
|
+
typeCode: ciTypeObj.typeCode,
|
38
39
|
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
39
40
|
list: buildModelFields(ciTypeObj, 'node')
|
40
41
|
};
|
@@ -71,6 +72,15 @@ function getNodeModels(topo) {
|
|
71
72
|
name: '资源类型',
|
72
73
|
type: 'custom'
|
73
74
|
}]);
|
75
|
+
|
76
|
+
if (topo.isCMPTopo) {
|
77
|
+
custom.push.apply(custom, [{
|
78
|
+
id: 'p:source',
|
79
|
+
code: 'name',
|
80
|
+
name: '所属平台',
|
81
|
+
type: 'custom'
|
82
|
+
}]);
|
83
|
+
}
|
74
84
|
}
|
75
85
|
|
76
86
|
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
@@ -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 "11.0.
|
59
|
+
var version = typeof "11.0.13" === 'string' ? "11.0.13" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -164,7 +164,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
164
164
|
var metrics = ciTypeModel.metrics.filter(function (m) {
|
165
165
|
return _this2.mtMetricsMap[type] && !!_this2.mtMetricsMap[type][m.code];
|
166
166
|
});
|
167
|
-
return (0, _extends2["default"])({},
|
167
|
+
return (0, _extends2["default"])({}, ciTypeModel, baseInfo, {
|
168
168
|
metrics: metrics,
|
169
169
|
metricMap: (0, _keyBy["default"])(metrics, 'code')
|
170
170
|
});
|
@@ -193,6 +193,7 @@ var ElementTagTipConfig = /*#__PURE__*/function () {
|
|
193
193
|
return {
|
194
194
|
id: ciTypeObj.code,
|
195
195
|
label: ciTypeObj.displayName,
|
196
|
+
typeCode: ciTypeObj.typeCode,
|
196
197
|
icon: "/img/model/" + ciTypeObj.icon + ".svg",
|
197
198
|
list: this.buildModelFields(ciTypeObj, type)
|
198
199
|
};
|
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.13",
|
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.13/build/index.html",
|
122
122
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
123
123
|
}
|