@riil-frontend/component-topology 11.0.12 → 11.0.14
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/DisplaySettingDrawer/hooks/useDisplaySetting.js +1 -2
- package/es/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +10 -0
- package/es/core/components/TopoView/topoView.js +4 -1
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/attributeFormatter/formatter/attributeTransform.js +4 -0
- package/es/core/models/attributeFormatter/formatter/ciTypeAttrTransform.js +15 -0
- package/es/core/models/attributeFormatter/formatter/commonTransform.js +51 -0
- package/es/core/models/attributeFormatter/formatter/graphTransform.js +24 -0
- package/es/core/models/attributeFormatter/formatter/metricTransform.js +4 -0
- package/es/core/models/attributeFormatter/index.js +19 -92
- package/es/core/models/tagstips/ElementTagTipConfig.js +2 -1
- package/es/networkTopo/getTopoData.js +13 -9
- package/lib/components/BatchAttrMetric2/setting.js +22 -5
- package/lib/components/BatchAttrMetric2/utils.js +24 -2
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +1 -3
- package/lib/core/components/ResourceViewAttributeSetting/nodeCiTypeAttrUtil.js +10 -0
- package/lib/core/components/TopoView/topoView.js +4 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/attributeFormatter/formatter/attributeTransform.js +12 -0
- package/lib/core/models/attributeFormatter/formatter/ciTypeAttrTransform.js +20 -0
- package/lib/core/models/attributeFormatter/formatter/commonTransform.js +61 -0
- package/lib/core/models/attributeFormatter/formatter/graphTransform.js +32 -0
- package/lib/core/models/attributeFormatter/formatter/metricTransform.js +12 -0
- package/lib/core/models/attributeFormatter/index.js +20 -93
- package/lib/core/models/tagstips/ElementTagTipConfig.js +2 -1
- package/lib/networkTopo/getTopoData.js +13 -9
- 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
|
+
}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import topoService from '@riil-frontend/component-topology-common/es/services/topo';
|
5
4
|
export default (function (props) {
|
6
5
|
var topo = props.topo,
|
7
6
|
displaySettingProps = props.displaySettingProps,
|
@@ -21,7 +20,7 @@ export default (function (props) {
|
|
21
20
|
prevDisplayConfig = topo.store.getModelState('displayConfig');
|
22
21
|
displayConfig = _extends({}, prevDisplayConfig, values);
|
23
22
|
_context.next = 5;
|
24
|
-
return
|
23
|
+
return topo.serverApi.saveTopoSettings(topo.id, {
|
25
24
|
alarmSwitch: displayConfig.alarmSwitch,
|
26
25
|
alarmListDefaultOpen: displayConfig.alarmListDefaultOpen,
|
27
26
|
extraConfig: JSON.stringify(_extends({}, displayConfig))
|
@@ -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: 'cmpNode:source',
|
73
|
+
code: 'name',
|
74
|
+
name: '所属平台',
|
75
|
+
type: 'custom'
|
76
|
+
}]);
|
77
|
+
}
|
68
78
|
}
|
69
79
|
|
70
80
|
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
@@ -266,7 +266,10 @@ var Topology = function Topology(props) {
|
|
266
266
|
|
267
267
|
return /*#__PURE__*/React.createElement("div", {
|
268
268
|
className: styles.topoView,
|
269
|
-
"data-version": topo.version
|
269
|
+
"data-version": topo.version,
|
270
|
+
onFocus: function onFocus() {
|
271
|
+
window.topo = topo;
|
272
|
+
}
|
270
273
|
}, titleBar !== false && titleBar, isEditMode && /*#__PURE__*/React.createElement(EditorToolbar, {
|
271
274
|
topo: topo,
|
272
275
|
topoEdit: topoEdit,
|
@@ -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.14" === 'string' ? "11.0.14" : null;
|
28
28
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
29
29
|
/**
|
30
30
|
* 拓扑显示和编辑
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export default function ciTypeAttrTransform(options) {
|
2
|
+
var item = options.item,
|
3
|
+
ciData = options.ciData,
|
4
|
+
topo = options.topo;
|
5
|
+
var ciTypeMeta = topo.ciTyeCache.getCiType(ciData.ciType);
|
6
|
+
return {
|
7
|
+
type: item.type,
|
8
|
+
code: item.code,
|
9
|
+
// 属性code
|
10
|
+
name: "资源类型",
|
11
|
+
// 属性名称
|
12
|
+
value: ciTypeMeta.name // 属性数值
|
13
|
+
|
14
|
+
};
|
15
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { metricValueFormat } from '@riil-frontend/utils';
|
2
|
+
import DictCache from "../../cache/DictCache";
|
3
|
+
/**
|
4
|
+
* 格式化指标
|
5
|
+
* @param {*} val
|
6
|
+
* @param {*} metricInfo
|
7
|
+
* @returns
|
8
|
+
*/
|
9
|
+
|
10
|
+
export function formatMetric(val, metricInfo) {
|
11
|
+
// rlog.debug('formatMetric', item, metricInfo);
|
12
|
+
if (metricInfo) {
|
13
|
+
var result = metricValueFormat({
|
14
|
+
value: val,
|
15
|
+
dataType: metricInfo.dataType,
|
16
|
+
dict: DictCache.getDictObject(),
|
17
|
+
unit: metricInfo.unit,
|
18
|
+
code: metricInfo.code
|
19
|
+
});
|
20
|
+
return result.value + " " + (result.value === '-' ? '' : result.unit);
|
21
|
+
} else {
|
22
|
+
return "" + val;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
export default function commonTransform(options) {
|
26
|
+
var item = options.item,
|
27
|
+
ciData = options.ciData,
|
28
|
+
topo = options.topo;
|
29
|
+
var fieldCode = item.code;
|
30
|
+
var attrType = item.type;
|
31
|
+
var ciTypeModel = topo.ciTyeCache.getCiType(ciData.ciType);
|
32
|
+
var fieldMeta = ciTypeModel[attrType + "Map"][fieldCode];
|
33
|
+
var fieldValue = (ciData[attrType + "Map"] || ciData[attrType + "s"])[fieldCode]; // 引用属性
|
34
|
+
|
35
|
+
if (attrType === 'attribute') {
|
36
|
+
if (ciData[attrType + "Map"][fieldCode + "_object"]) {
|
37
|
+
fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
return {
|
42
|
+
type: item.type,
|
43
|
+
code: item.code,
|
44
|
+
// 属性code
|
45
|
+
name: (fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.name) || '',
|
46
|
+
// 属性名称
|
47
|
+
value: formatMetric(fieldValue, fieldMeta),
|
48
|
+
// 属性值
|
49
|
+
originValue: fieldValue
|
50
|
+
};
|
51
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
2
|
+
export default function graphTransform(options) {
|
3
|
+
var item = options.item,
|
4
|
+
ciData = options.ciData,
|
5
|
+
topo = options.topo;
|
6
|
+
var value = '-';
|
7
|
+
|
8
|
+
try {
|
9
|
+
var node = topo.getDataModel().getDataByTag(ciData.id);
|
10
|
+
value = (node === null || node === void 0 ? void 0 : node.a('customName')) || (node === null || node === void 0 ? void 0 : node.a('name')) || '-';
|
11
|
+
} catch (error) {
|
12
|
+
rlog.error(error);
|
13
|
+
}
|
14
|
+
|
15
|
+
return {
|
16
|
+
type: item.type,
|
17
|
+
code: item.code,
|
18
|
+
// 属性code
|
19
|
+
name: '图片名称',
|
20
|
+
// 属性名称
|
21
|
+
value: value // 属性值
|
22
|
+
|
23
|
+
};
|
24
|
+
}
|
@@ -1,28 +1,8 @@
|
|
1
|
-
import rlog from
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
* @param {*} val
|
7
|
-
* @param {*} metricInfo
|
8
|
-
* @returns
|
9
|
-
*/
|
10
|
-
|
11
|
-
export function formatMetric(val, metricInfo) {
|
12
|
-
// rlog.debug('formatMetric', item, metricInfo);
|
13
|
-
if (metricInfo) {
|
14
|
-
var result = metricValueFormat({
|
15
|
-
value: val,
|
16
|
-
dataType: metricInfo.dataType,
|
17
|
-
dict: DictCache.getDictObject(),
|
18
|
-
unit: metricInfo.unit,
|
19
|
-
code: metricInfo.code
|
20
|
-
});
|
21
|
-
return result.value + " " + (result.value === "-" ? "" : result.unit);
|
22
|
-
} else {
|
23
|
-
return "" + val;
|
24
|
-
}
|
25
|
-
}
|
1
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
2
|
+
import attributeTransform from "./formatter/attributeTransform";
|
3
|
+
import metricTransform from "./formatter/metricTransform";
|
4
|
+
import ciTypeAttrTransform from "./formatter/ciTypeAttrTransform";
|
5
|
+
import graphTransform from "./formatter/graphTransform";
|
26
6
|
/**
|
27
7
|
* 标注值格式化
|
28
8
|
*/
|
@@ -31,10 +11,10 @@ var AttributeFormatter = /*#__PURE__*/function () {
|
|
31
11
|
function AttributeFormatter(topo) {
|
32
12
|
this.topo = topo;
|
33
13
|
this.transformMap = {
|
34
|
-
attribute:
|
35
|
-
metric:
|
36
|
-
ciType:
|
37
|
-
graph:
|
14
|
+
attribute: attributeTransform,
|
15
|
+
metric: metricTransform,
|
16
|
+
ciType: ciTypeAttrTransform,
|
17
|
+
graph: graphTransform
|
38
18
|
};
|
39
19
|
}
|
40
20
|
|
@@ -45,76 +25,23 @@ var AttributeFormatter = /*#__PURE__*/function () {
|
|
45
25
|
|
46
26
|
return items.map(function (item) {
|
47
27
|
return _this.transformAttr(item, ciData);
|
28
|
+
}).filter(function (item) {
|
29
|
+
return !!item;
|
48
30
|
});
|
49
31
|
};
|
50
32
|
|
51
33
|
_proto.transformAttr = function transformAttr(item, ciData) {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
var fieldCode = item.code;
|
57
|
-
var fieldMeta = this.topo.ciTyeCache.getCiType(ciData.ciType)[attrType + "Map"][fieldCode];
|
58
|
-
var fieldValue = (ciData[attrType + "Map"] || ciData[attrType + "s"])[fieldCode]; // 引用属性
|
59
|
-
|
60
|
-
if (attrType === "attribute") {
|
61
|
-
if (ciData[attrType + "Map"][fieldCode + "_object"]) {
|
62
|
-
fieldValue = ciData[attrType + "Map"][fieldCode + "_object"].displayName;
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
return {
|
67
|
-
type: item.type,
|
68
|
-
code: item.code,
|
69
|
-
// 属性code
|
70
|
-
name: (fieldMeta === null || fieldMeta === void 0 ? void 0 : fieldMeta.name) || "",
|
71
|
-
// 属性名称
|
72
|
-
value: formatMetric(fieldValue, fieldMeta),
|
73
|
-
// 属性值
|
74
|
-
originValue: fieldValue
|
34
|
+
var options = {
|
35
|
+
item: item,
|
36
|
+
ciData: ciData,
|
37
|
+
topo: this.topo
|
75
38
|
};
|
39
|
+
var transform = this.transformMap[item.type];
|
40
|
+
return transform(options);
|
76
41
|
};
|
77
42
|
|
78
|
-
_proto.
|
79
|
-
|
80
|
-
};
|
81
|
-
|
82
|
-
_proto.metricTransform = function metricTransform(item, ciData) {
|
83
|
-
return this.commonTransform(item, ciData, "metric");
|
84
|
-
};
|
85
|
-
|
86
|
-
_proto.ciTypeAttrTransform = function ciTypeAttrTransform(item, ciData) {
|
87
|
-
var ciTypeMeta = this.topo.ciTyeCache.getCiType(ciData.ciType);
|
88
|
-
return {
|
89
|
-
type: item.type,
|
90
|
-
code: item.code,
|
91
|
-
// 属性code
|
92
|
-
name: "资源类型",
|
93
|
-
// 属性名称
|
94
|
-
value: ciTypeMeta.name // 属性数值
|
95
|
-
|
96
|
-
};
|
97
|
-
};
|
98
|
-
|
99
|
-
_proto.graphTransform = function graphTransform(item, ciData) {
|
100
|
-
var value = "-";
|
101
|
-
|
102
|
-
try {
|
103
|
-
var node = this.topo.getDataModel().getDataByTag(ciData.id);
|
104
|
-
value = (node === null || node === void 0 ? void 0 : node.a("customName")) || (node === null || node === void 0 ? void 0 : node.a("name")) || "-";
|
105
|
-
} catch (error) {
|
106
|
-
rlog.error(error);
|
107
|
-
}
|
108
|
-
|
109
|
-
return {
|
110
|
-
type: item.type,
|
111
|
-
code: item.code,
|
112
|
-
// 属性code
|
113
|
-
name: "图片名称",
|
114
|
-
// 属性名称
|
115
|
-
value: value // 属性值
|
116
|
-
|
117
|
-
};
|
43
|
+
_proto.addTransform = function addTransform(name, transform) {
|
44
|
+
this.transformMap[name] = transform;
|
118
45
|
};
|
119
46
|
|
120
47
|
return AttributeFormatter;
|
@@ -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
|
};
|
@@ -56,13 +56,17 @@ function fixNodeGroupId(data) {
|
|
56
56
|
});
|
57
57
|
}
|
58
58
|
|
59
|
+
function isNetworkLink(link) {
|
60
|
+
return link.ciType === 'network_link' || link.typeCode === 'network_link';
|
61
|
+
}
|
62
|
+
|
59
63
|
export function addLinkData(_x) {
|
60
64
|
return _addLinkData.apply(this, arguments);
|
61
65
|
} // FIXME 业务拓扑不需要链路相关逻辑
|
62
66
|
|
63
67
|
function _addLinkData() {
|
64
68
|
_addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
|
65
|
-
var links, nodes, networkLinks, otherLinks;
|
69
|
+
var links, nodes, prevNetworkLinks, networkLinks, otherLinks;
|
66
70
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
67
71
|
while (1) {
|
68
72
|
switch (_context.prev = _context.next) {
|
@@ -70,23 +74,23 @@ function _addLinkData() {
|
|
70
74
|
links = data.links || [];
|
71
75
|
nodes = data.nodes || []; // 如果是网络链路,补充详情信息
|
72
76
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
prevNetworkLinks = links.filter(function (link) {
|
78
|
+
return isNetworkLink(link);
|
79
|
+
});
|
80
|
+
_context.next = 5;
|
81
|
+
return getLinksDetail(prevNetworkLinks, nodes);
|
77
82
|
|
78
|
-
case
|
83
|
+
case 5:
|
79
84
|
networkLinks = _context.sent;
|
80
|
-
// console.log("如果是网络链路,补充详情信息", networkLinks);
|
81
85
|
otherLinks = links.filter(function (link) {
|
82
|
-
return link
|
86
|
+
return !isNetworkLink(link);
|
83
87
|
});
|
84
88
|
return _context.abrupt("return", _extends({}, data, {
|
85
89
|
links: [].concat(networkLinks, otherLinks),
|
86
90
|
linkGroups: []
|
87
91
|
}));
|
88
92
|
|
89
|
-
case
|
93
|
+
case 8:
|
90
94
|
case "end":
|
91
95
|
return _context.stop();
|
92
96
|
}
|
@@ -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
|
+
}
|
@@ -11,8 +11,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
11
11
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
13
|
|
14
|
-
var _topo = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/services/topo"));
|
15
|
-
|
16
14
|
var _default = function _default(props) {
|
17
15
|
var topo = props.topo,
|
18
16
|
displaySettingProps = props.displaySettingProps,
|
@@ -32,7 +30,7 @@ var _default = function _default(props) {
|
|
32
30
|
prevDisplayConfig = topo.store.getModelState('displayConfig');
|
33
31
|
displayConfig = (0, _extends2["default"])({}, prevDisplayConfig, values);
|
34
32
|
_context.next = 5;
|
35
|
-
return
|
33
|
+
return topo.serverApi.saveTopoSettings(topo.id, {
|
36
34
|
alarmSwitch: displayConfig.alarmSwitch,
|
37
35
|
alarmListDefaultOpen: displayConfig.alarmListDefaultOpen,
|
38
36
|
extraConfig: JSON.stringify((0, _extends2["default"])({}, displayConfig))
|
@@ -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: 'cmpNode:source',
|
79
|
+
code: 'name',
|
80
|
+
name: '所属平台',
|
81
|
+
type: 'custom'
|
82
|
+
}]);
|
83
|
+
}
|
74
84
|
}
|
75
85
|
|
76
86
|
var attributes = ciTypeObj.attributes.filter(function (attr) {
|
@@ -311,7 +311,10 @@ var Topology = function Topology(props) {
|
|
311
311
|
|
312
312
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
313
313
|
className: _TopoViewModule["default"].topoView,
|
314
|
-
"data-version": topo.version
|
314
|
+
"data-version": topo.version,
|
315
|
+
onFocus: function onFocus() {
|
316
|
+
window.topo = topo;
|
317
|
+
}
|
315
318
|
}, titleBar !== false && titleBar, isEditMode && /*#__PURE__*/_react["default"].createElement(_EditorToolbar["default"], {
|
316
319
|
topo: topo,
|
317
320
|
topoEdit: topoEdit,
|
@@ -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.14" === 'string' ? "11.0.14" : null;
|
60
60
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
61
61
|
/**
|
62
62
|
* 拓扑显示和编辑
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports["default"] = attributeTransform;
|
7
|
+
|
8
|
+
var _commonTransform = _interopRequireDefault(require("./commonTransform"));
|
9
|
+
|
10
|
+
function attributeTransform(options) {
|
11
|
+
return (0, _commonTransform["default"])(options);
|
12
|
+
}
|