@riil-frontend/component-topology 11.0.27 → 11.0.29
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/README.md +2 -1
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +20 -20
- package/es/components/BatchAttrMetric/index.js +9 -19
- package/es/components/BatchAttrMetric/setting.js +64 -30
- package/es/components/BatchAttrMetric/utils.js +14 -199
- package/es/components/ModelAttrSelectDrawer/components/ModelAttrSelectDrawer.js +1 -1
- package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +6 -7
- package/es/core/components/ResourceViewAttributeSetting/Setting.js +30 -58
- package/es/core/components/TopoView/topoView.js +0 -1
- package/es/core/components/titlebar/TitleBar.module.scss +0 -9
- package/es/core/components/titlebar/widgets/TitleWidget.js +2 -5
- package/es/core/editor/components/BottomFloatTool/HelpIcon.js +1 -4
- package/es/core/editor/components/BottomFloatTool/HelpIcon.module.scss +10 -8
- package/es/core/editor/components/Sidebar/views/BackgroundPanel/BackgroundPanel.js +1 -2
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +1 -4
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +1 -4
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +3 -6
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +2 -5
- package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +1 -4
- package/es/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +1 -4
- package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +1 -4
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/box.js +0 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +1 -2
- package/es/core/hooks/usePolling.js +8 -8
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/topoData.js +2 -2
- package/es/core/store/models/topoConfig.js +3 -4
- package/es/core/test/Test.js +4 -5
- package/es/utils/topoData.js +0 -142
- package/lib/components/BatchAttrMetric/index.js +9 -19
- package/lib/components/BatchAttrMetric/setting.js +58 -24
- package/lib/components/BatchAttrMetric/utils.js +16 -206
- package/lib/components/ModelAttrSelectDrawer/components/ModelAttrSelectDrawer.js +1 -1
- package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +5 -6
- package/lib/core/components/ResourceViewAttributeSetting/Setting.js +28 -56
- package/lib/core/components/TopoView/topoView.js +0 -1
- package/lib/core/components/titlebar/TitleBar.module.scss +0 -9
- package/lib/core/components/titlebar/widgets/TitleWidget.js +2 -7
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.js +1 -4
- package/lib/core/editor/components/BottomFloatTool/HelpIcon.module.scss +10 -8
- package/lib/core/editor/components/Sidebar/views/BackgroundPanel/BackgroundPanel.js +1 -2
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +1 -4
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +1 -4
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +3 -6
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -4
- package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +1 -4
- package/lib/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +1 -4
- package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +3 -4
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/box.js +0 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +1 -2
- package/lib/core/hooks/usePolling.js +8 -8
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/topoData.js +2 -2
- package/lib/core/store/models/topoConfig.js +3 -6
- package/lib/core/test/Test.js +4 -5
- package/lib/utils/topoData.js +0 -145
- package/package.json +2 -2
- package/es/components/BatchAttrMetric2/SelectTable.js +0 -21
- package/es/components/BatchAttrMetric2/constant.js +0 -30
- package/es/components/BatchAttrMetric2/index.js +0 -68
- package/es/components/BatchAttrMetric2/index.module.scss +0 -76
- package/es/components/BatchAttrMetric2/setting.js +0 -181
- package/es/components/BatchAttrMetric2/utils.js +0 -42
- package/es/components/IndexSettingDrawer/CiList.js +0 -26
- package/es/components/IndexSettingDrawer/CiListItem.js +0 -37
- package/es/components/IndexSettingDrawer/IndexList.js +0 -62
- package/es/components/IndexSettingDrawer/index.js +0 -60
- package/es/components/IndexSettingDrawer/index.module.scss +0 -44
- package/es/components/ModelAttrSelectDrawer/components/ModelAttrSelect.js +0 -5
- package/es/core/components/TopoApp.js +0 -7
- package/es/core/components/TopoAppView.js +0 -24
- package/es/core/editor/components/Toolbar/widgets/Dropdown.js +0 -12
- package/es/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +0 -28
- package/es/networkTopo/components/Link/index copy.js +0 -213
- package/es/networkTopo/store/linkDynamicStyle.js +0 -259
- package/es/networkTopo/store/linkDynamicStyleConfig.js +0 -180
- package/es/networkTopo/store/linkManager.js +0 -38
- package/lib/components/BatchAttrMetric2/SelectTable.js +0 -26
- package/lib/components/BatchAttrMetric2/constant.js +0 -36
- package/lib/components/BatchAttrMetric2/index.js +0 -75
- package/lib/components/BatchAttrMetric2/index.module.scss +0 -76
- package/lib/components/BatchAttrMetric2/setting.js +0 -189
- package/lib/components/BatchAttrMetric2/utils.js +0 -48
- package/lib/components/IndexSettingDrawer/CiList.js +0 -32
- package/lib/components/IndexSettingDrawer/CiListItem.js +0 -43
- package/lib/components/IndexSettingDrawer/IndexList.js +0 -70
- package/lib/components/IndexSettingDrawer/index.js +0 -68
- package/lib/components/IndexSettingDrawer/index.module.scss +0 -44
- package/lib/components/ModelAttrSelectDrawer/components/ModelAttrSelect.js +0 -11
- package/lib/core/components/TopoApp.js +0 -13
- package/lib/core/components/TopoAppView.js +0 -32
- package/lib/core/editor/components/Toolbar/widgets/Dropdown.js +0 -18
- package/lib/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +0 -34
- package/lib/networkTopo/components/Link/index copy.js +0 -220
- package/lib/networkTopo/store/linkDynamicStyle.js +0 -263
- package/lib/networkTopo/store/linkDynamicStyleConfig.js +0 -186
- package/lib/networkTopo/store/linkManager.js +0 -42
@@ -1,7 +1,7 @@
|
|
1
1
|
import _Drawer from "@alifd/next/es/drawer";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
4
|
-
var _excluded = ["saveCb"],
|
4
|
+
var _excluded = ["saveCb", "showType"],
|
5
5
|
_excluded2 = ["drawerTitle", "drawerWidth"];
|
6
6
|
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
7
7
|
import { useBoolean } from 'ahooks';
|
@@ -13,34 +13,25 @@ import { SELECT_TYPE, DATA_TYPE } from "./constant";
|
|
13
13
|
/**
|
14
14
|
* 属性指标配置抽屉
|
15
15
|
*/
|
16
|
-
var BatchAttrMetricDrawer = /*#__PURE__*/forwardRef(function (
|
17
|
-
var _saveCb =
|
18
|
-
|
16
|
+
var BatchAttrMetricDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
17
|
+
var _saveCb = props.saveCb,
|
18
|
+
showType = props.showType,
|
19
|
+
settingProps = _objectWithoutPropertiesLoose(props, _excluded);
|
19
20
|
var _useBoolean = useBoolean(false),
|
20
21
|
visible = _useBoolean[0],
|
21
22
|
_useBoolean$ = _useBoolean[1],
|
22
23
|
setTrue = _useBoolean$.setTrue,
|
23
24
|
setFalse = _useBoolean$.setFalse;
|
24
|
-
// 选择类型,single/batch
|
25
25
|
var selectType = 'batch';
|
26
|
-
// 数据类型,tip/tag
|
27
|
-
var _useState = useState(),
|
28
|
-
showType = _useState[0],
|
29
|
-
setShowType = _useState[1];
|
30
26
|
useImperativeHandle(ref, function () {
|
31
27
|
return {
|
32
28
|
/**
|
33
29
|
* 展开抽屉
|
34
|
-
* @param {*} entryConfig 入口配置对象,必须
|
35
|
-
* @param {*} entryConfig.selectType 选择类型(single/batch),必须
|
36
|
-
* @param {*} entryConfig.dataType 数据类型(tip/tag),必须
|
37
30
|
*/
|
38
31
|
show: function show(entryConfig) {
|
39
32
|
if (entryConfig === void 0) {
|
40
33
|
entryConfig = {};
|
41
34
|
}
|
42
|
-
// setSelectType(entryConfig.selectType);
|
43
|
-
setShowType(entryConfig.showType);
|
44
35
|
setTrue();
|
45
36
|
}
|
46
37
|
};
|
@@ -56,19 +47,18 @@ var BatchAttrMetricDrawer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
56
47
|
title: drawerTitle,
|
57
48
|
className: styles.drawer,
|
58
49
|
width: drawerWidth
|
59
|
-
}, visible && /*#__PURE__*/React.createElement(SettingPage, _extends({}, pageConfig,
|
60
|
-
showType: showType,
|
50
|
+
}, visible && /*#__PURE__*/React.createElement(SettingPage, _extends({}, pageConfig, settingProps, {
|
61
51
|
cancelCb: setFalse,
|
62
52
|
saveCb: function saveCb(values) {
|
63
53
|
setFalse();
|
64
|
-
_saveCb(showType, values
|
54
|
+
_saveCb(showType, values);
|
65
55
|
}
|
66
56
|
})));
|
67
57
|
});
|
68
|
-
BatchAttrMetricDrawer.displayName = '
|
58
|
+
BatchAttrMetricDrawer.displayName = 'BatchAttrMetricDrawerV2';
|
69
59
|
BatchAttrMetricDrawer.propTypes = {
|
70
60
|
// 数据项
|
71
|
-
|
61
|
+
dataSource: PropTypes.array.isRequired,
|
72
62
|
// 保存回调
|
73
63
|
saveCb: PropTypes.func
|
74
64
|
};
|
@@ -5,30 +5,39 @@ import _Grid from "@alifd/next/es/grid";
|
|
5
5
|
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
|
-
var _excluded = ["value", "defaultSet", "
|
9
|
-
import React, { useState, useMemo } from
|
10
|
-
import rlog from
|
11
|
-
import ActionTree from
|
12
|
-
import NoDataPage from
|
13
|
-
import TableLayout from
|
14
|
-
import RiilHooks from
|
8
|
+
var _excluded = ["value", "defaultSet", "dataSource"];
|
9
|
+
import React, { useState, useMemo, useEffect } from 'react';
|
10
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
11
|
+
import ActionTree from '@riil-frontend/component-action-tree';
|
12
|
+
import NoDataPage from '@riil-frontend/component-topology-common/es/components/NoDataPage';
|
13
|
+
import TableLayout from '@riil-frontend/component-table-layout';
|
14
|
+
import RiilHooks from '@riil-frontend/hooks';
|
15
15
|
import * as utils from "./utils";
|
16
16
|
import styles from "./index.module.scss";
|
17
|
+
import { loopTreeNode } from "../../utils/treeUtil";
|
17
18
|
var Setting = function Setting(_ref) {
|
18
19
|
var _ref$value = _ref.value,
|
19
20
|
value = _ref$value === void 0 ? {} : _ref$value,
|
20
21
|
defaultSet = _ref.defaultSet,
|
21
|
-
|
22
|
-
showType = _ref.showType,
|
22
|
+
dataSource = _ref.dataSource,
|
23
23
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
24
|
-
// const allCiSet = utils.dsTransform(props.allCiSet);
|
25
|
-
|
26
24
|
var limit = props.limit,
|
27
|
-
saveCb = props.saveCb
|
28
|
-
|
29
|
-
|
25
|
+
saveCb = props.saveCb;
|
26
|
+
var allCiSet = useMemo(function () {
|
27
|
+
var map = {};
|
28
|
+
loopTreeNode(dataSource, function (item) {
|
29
|
+
if (item.type !== 'folder') {
|
30
|
+
map[item.id] = item;
|
31
|
+
}
|
32
|
+
});
|
33
|
+
return map;
|
34
|
+
}, [dataSource]);
|
35
|
+
var _useState = useState(utils.getDefaultSelectedCiType(dataSource)),
|
30
36
|
ciType = _useState[0],
|
31
37
|
setCiType = _useState[1];
|
38
|
+
useEffect(function () {
|
39
|
+
setCiType(utils.getDefaultSelectedCiType(dataSource));
|
40
|
+
}, [dataSource]);
|
32
41
|
var _useState2 = useState(''),
|
33
42
|
search = _useState2[0],
|
34
43
|
setSearch = _useState2[1];
|
@@ -37,31 +46,46 @@ var Setting = function Setting(_ref) {
|
|
37
46
|
setSelected = _useState3[1];
|
38
47
|
var selectedRowKeys = selected[ciType] || [];
|
39
48
|
var _RiilHooks$useTableCo = RiilHooks.useTableColumn({
|
40
|
-
columns:
|
49
|
+
columns: [{
|
50
|
+
width: '100%',
|
51
|
+
dataIndex: 'name',
|
52
|
+
title: '数据',
|
53
|
+
cellOption: {
|
54
|
+
nowrap: true
|
55
|
+
}
|
56
|
+
}, {
|
57
|
+
width: '70px',
|
58
|
+
dataIndex: 'type',
|
59
|
+
title: '类型',
|
60
|
+
cellOption: {
|
61
|
+
nowrap: {
|
62
|
+
nowrapCell: utils.typeCell,
|
63
|
+
title: utils.typeCell
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}]
|
41
67
|
}),
|
42
68
|
columnNodes = _RiilHooks$useTableCo.columnNodes;
|
43
69
|
var onTreeSelect = function onTreeSelect(_ref2) {
|
44
70
|
var selectedKey = _ref2[0];
|
45
|
-
if (selectedKey) {
|
71
|
+
if (selectedKey && allCiSet[selectedKey] && allCiSet[selectedKey].type !== 'folder') {
|
46
72
|
setCiType(selectedKey);
|
47
73
|
}
|
48
74
|
};
|
49
75
|
var onTableSelect = function onTableSelect(selectedKeys) {
|
50
76
|
var values = _extends({}, selected);
|
51
|
-
rlog.debug(
|
77
|
+
rlog.debug('Setting-allCiSet-onTableSelect', limit, selectedKeys, selected);
|
52
78
|
values[ciType] = selectedKeys;
|
53
79
|
setSelected(values);
|
54
80
|
};
|
55
81
|
var saveSelected = function saveSelected() {
|
56
|
-
saveCb(
|
82
|
+
saveCb(selected);
|
57
83
|
};
|
58
84
|
var onReset = function onReset() {
|
59
|
-
|
60
|
-
setSelected(values);
|
85
|
+
setSelected({});
|
61
86
|
};
|
62
87
|
var tableData = useMemo(function () {
|
63
88
|
var _allCiSet$ciType;
|
64
|
-
// console.log('allCiSet,ciType,search', allCiSet, ciType, search);
|
65
89
|
var list = ((_allCiSet$ciType = allCiSet[ciType]) === null || _allCiSet$ciType === void 0 ? void 0 : _allCiSet$ciType.list) || [];
|
66
90
|
if (search) {
|
67
91
|
list = list.filter(function (item) {
|
@@ -71,9 +95,8 @@ var Setting = function Setting(_ref) {
|
|
71
95
|
}
|
72
96
|
return list;
|
73
97
|
}, [allCiSet, ciType, search]);
|
74
|
-
function onSearch(
|
75
|
-
|
76
|
-
setSearch(value);
|
98
|
+
function onSearch(searchValue) {
|
99
|
+
setSearch(searchValue);
|
77
100
|
}
|
78
101
|
return /*#__PURE__*/React.createElement("div", {
|
79
102
|
className: styles.layout
|
@@ -83,18 +106,29 @@ var Setting = function Setting(_ref) {
|
|
83
106
|
type: "notice"
|
84
107
|
}, props.label + "\u6570\u636E\uFF1A\u9009\u62E9\u7684\u6307\u6807\u548C\u5C5E\u6027\u5C06\u4F1A\u663E\u793A\u5728" + props.poslabel + "\uFF0C\u6700\u591A\u652F\u6301\u52FE\u9009 " + limit + " \u9879\u3002")), /*#__PURE__*/React.createElement(_Grid.Row, {
|
85
108
|
className: styles.content
|
86
|
-
},
|
109
|
+
}, /*#__PURE__*/React.createElement(_Grid.Col, {
|
87
110
|
span: 8,
|
88
|
-
className: styles[
|
89
|
-
}, /*#__PURE__*/React.createElement(ActionTree, {
|
90
|
-
dataSource:
|
111
|
+
className: styles['tree-wrap']
|
112
|
+
}, dataSource.length && /*#__PURE__*/React.createElement(ActionTree, {
|
113
|
+
dataSource: dataSource,
|
91
114
|
onSelect: onTreeSelect,
|
92
115
|
draggable: false,
|
93
116
|
treeProps: {
|
94
|
-
selectedKeys: [ciType]
|
117
|
+
selectedKeys: [ciType],
|
118
|
+
defaultExpandedKeys: dataSource.filter(function (item) {
|
119
|
+
return item.type === 'folder';
|
120
|
+
}).map(function (item) {
|
121
|
+
return item.id;
|
122
|
+
}),
|
123
|
+
expandedKeys: dataSource.filter(function (item) {
|
124
|
+
return item.type === 'folder';
|
125
|
+
}).map(function (item) {
|
126
|
+
return item.id;
|
127
|
+
}),
|
128
|
+
defaultExpandAll: true
|
95
129
|
}
|
96
130
|
})), /*#__PURE__*/React.createElement(_Grid.Col, {
|
97
|
-
className: styles[
|
131
|
+
className: styles['table-wrap']
|
98
132
|
}, /*#__PURE__*/React.createElement(TableLayout, {
|
99
133
|
filterItems: /*#__PURE__*/React.createElement("div", {
|
100
134
|
className: styles.filter
|
@@ -1,8 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
3
|
-
var _excluded = ["list"];
|
4
|
-
import React from 'react';
|
5
|
-
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
1
|
+
import { loopTreeNode } from "../../utils/treeUtil";
|
6
2
|
|
7
3
|
/**
|
8
4
|
* 获取树结构数据源
|
@@ -19,144 +15,7 @@ export var treeDs = function treeDs(allCiSet) {
|
|
19
15
|
};
|
20
16
|
});
|
21
17
|
};
|
22
|
-
|
23
|
-
// 由于属性和指标code存在重复,拼接code与类型作为id
|
24
|
-
var toId = function toId(_ref) {
|
25
|
-
var code = _ref.code,
|
26
|
-
type = _ref.type;
|
27
|
-
return type ? code + "-" + type : code;
|
28
|
-
};
|
29
|
-
|
30
|
-
// id反解析回对象
|
31
|
-
var reverseToId = function reverseToId(id) {
|
32
|
-
var _id$split = id.split('-'),
|
33
|
-
code = _id$split[0],
|
34
|
-
type = _id$split[1];
|
35
|
-
return {
|
36
|
-
code: code,
|
37
|
-
type: type
|
38
|
-
};
|
39
|
-
};
|
40
|
-
|
41
|
-
/**
|
42
|
-
* 数据源转换,追加id
|
43
|
-
* @param {*} allCiSet 数据源
|
44
|
-
* @returns
|
45
|
-
*/
|
46
|
-
export var dsTransform = function dsTransform(allCiSet) {
|
47
|
-
var values = {};
|
48
|
-
Object.keys(_extends({}, allCiSet)).forEach(function (key) {
|
49
|
-
var _allCiSet$key3 = allCiSet[key],
|
50
|
-
list = _allCiSet$key3.list,
|
51
|
-
value = _objectWithoutPropertiesLoose(_allCiSet$key3, _excluded);
|
52
|
-
var data = list.map(function (item) {
|
53
|
-
return _extends({}, item, {
|
54
|
-
id: toId(item)
|
55
|
-
});
|
56
|
-
});
|
57
|
-
values[key] = _extends({
|
58
|
-
list: data
|
59
|
-
}, value);
|
60
|
-
});
|
61
|
-
return values;
|
62
|
-
};
|
63
|
-
|
64
|
-
/**
|
65
|
-
* 保存时的转换,将id转为对象
|
66
|
-
* @param {*} submit 保存的数据
|
67
|
-
* @returns
|
68
|
-
*/
|
69
|
-
export var saveTransform = function saveTransform(submit) {
|
70
|
-
var values = {};
|
71
|
-
Object.keys(submit).forEach(function (key) {
|
72
|
-
values[key] = submit[key].map(function (item) {
|
73
|
-
return reverseToId(item);
|
74
|
-
});
|
75
|
-
});
|
76
|
-
return values;
|
77
|
-
};
|
78
|
-
|
79
|
-
/**
|
80
|
-
* 获取初始选中项
|
81
|
-
* @param {*} allCiSet 数据源
|
82
|
-
* @param {*} showType 数据类型
|
83
|
-
* @returns
|
84
|
-
*/
|
85
|
-
export var initSelected = function initSelected(allCiSet, showType) {
|
86
|
-
rlog.debug('initSelected-allCiSet, dataType', allCiSet, showType);
|
87
|
-
var values = {};
|
88
|
-
Object.keys(allCiSet).forEach(function (key) {
|
89
|
-
var _value$list;
|
90
|
-
var value = allCiSet[key];
|
91
|
-
var result = [];
|
92
|
-
(_value$list = value.list) === null || _value$list === void 0 ? void 0 : _value$list.forEach(function (item) {
|
93
|
-
if (item[showType]) {
|
94
|
-
result.push(item.id);
|
95
|
-
}
|
96
|
-
});
|
97
|
-
values[key] = result;
|
98
|
-
});
|
99
|
-
rlog.debug('initSelected-allCiSet-result, dataType', values);
|
100
|
-
return values;
|
101
|
-
};
|
102
|
-
|
103
|
-
/**
|
104
|
-
* 更新保存选择结果
|
105
|
-
* @param {*} selected
|
106
|
-
* @param {*} allCiSet
|
107
|
-
* @returns
|
108
|
-
*/
|
109
|
-
export var updateCiSetSeleted = function updateCiSetSeleted(selected, allCiSet, showType) {
|
110
|
-
var newCiSet = _extends({}, allCiSet);
|
111
|
-
Object.keys(selected).forEach(function (key) {
|
112
|
-
var selectedArr = selected[key];
|
113
|
-
var list = allCiSet[key].list.map(function (item) {
|
114
|
-
var obj = showType === 'tag' ? _extends({}, item, {
|
115
|
-
tag: selectedArr.indexOf(item.id) >= 0
|
116
|
-
}) : _extends({}, item, {
|
117
|
-
tip: selectedArr.indexOf(item.id) >= 0
|
118
|
-
});
|
119
|
-
return obj;
|
120
|
-
});
|
121
|
-
newCiSet[key] = _extends({}, allCiSet[key], {
|
122
|
-
list: list
|
123
|
-
});
|
124
|
-
});
|
125
|
-
rlog.debug('updateCiSetSeleted-selected,newCiSet', selected, newCiSet);
|
126
|
-
return newCiSet;
|
127
|
-
};
|
128
|
-
|
129
|
-
/**
|
130
|
-
* 获取默认选择项,用于重置
|
131
|
-
* @param {*} allCiSet 数据源
|
132
|
-
* @param {*} defaultSet 默认选择项数据源
|
133
|
-
* @param {*} dataType 数据类型
|
134
|
-
* @returns
|
135
|
-
*/
|
136
|
-
export var defaultSelected = function defaultSelected(allCiSet, defaultSet, dataType) {
|
137
|
-
if (defaultSet === void 0) {
|
138
|
-
defaultSet = {};
|
139
|
-
}
|
140
|
-
var values = {};
|
141
|
-
Object.keys(allCiSet).forEach(function (key) {
|
142
|
-
var ciTypeSelected = defaultSet[key] || defaultSet[allCiSet[key].code];
|
143
|
-
// 没有ci类型对应的默认配置 -> 使用通用的配置项
|
144
|
-
// const selected = (ciTypeSelected || defaultSet['common'])[dataType] || [];
|
145
|
-
var selected = [];
|
146
|
-
var selectedIds = selected.map(function (item) {
|
147
|
-
return toId(item);
|
148
|
-
});
|
149
|
-
var data = allCiSet[key].list;
|
150
|
-
var selectedData = data === null || data === void 0 ? void 0 : data.filter(function (item) {
|
151
|
-
return selectedIds.includes(item.id);
|
152
|
-
});
|
153
|
-
values[key] = selectedData.map(function (item) {
|
154
|
-
return item.id;
|
155
|
-
}) || [];
|
156
|
-
});
|
157
|
-
return values;
|
158
|
-
};
|
159
|
-
var typeCell = function typeCell(text) {
|
18
|
+
export var typeCell = function typeCell(text) {
|
160
19
|
if (text === 'attribute') {
|
161
20
|
return '属性';
|
162
21
|
} else if (text === 'metric') {
|
@@ -166,62 +25,18 @@ var typeCell = function typeCell(text) {
|
|
166
25
|
};
|
167
26
|
|
168
27
|
/**
|
169
|
-
*
|
170
|
-
* @param {*}
|
171
|
-
* @
|
172
|
-
* @returns
|
28
|
+
* 获得默认选中第一个模型
|
29
|
+
* @param {*} tree
|
30
|
+
* @returns
|
173
31
|
*/
|
174
|
-
export
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
dataIndex: 'name',
|
181
|
-
title: '数据',
|
182
|
-
cellOption: {
|
183
|
-
nowrap: true
|
184
|
-
}
|
185
|
-
},
|
186
|
-
// {
|
187
|
-
// width: '50%',
|
188
|
-
// dataIndex: ciNumKey,
|
189
|
-
// title: '匹配资源',
|
190
|
-
// cell: (text, index, record) => {
|
191
|
-
// const trigger = (
|
192
|
-
// <Button text type="primary">
|
193
|
-
// {text || 0}
|
194
|
-
// </Button>
|
195
|
-
// );
|
196
|
-
// return (
|
197
|
-
// <Balloon
|
198
|
-
// needAdjust
|
199
|
-
// trigger={trigger}
|
200
|
-
// closable={false}
|
201
|
-
// triggerType={text ? 'hover' : []}
|
202
|
-
// >
|
203
|
-
// <div className={styles['tip-content']}>
|
204
|
-
// {record[ciArrKey].map((ci, i) => (
|
205
|
-
// <div key={i}>{ci}</div>
|
206
|
-
// ))}
|
207
|
-
// </div>
|
208
|
-
// </Balloon>
|
209
|
-
// );
|
210
|
-
// },
|
211
|
-
// },
|
212
|
-
{
|
213
|
-
width: '70px',
|
214
|
-
dataIndex: 'type',
|
215
|
-
title: '类型',
|
216
|
-
cellOption: {
|
217
|
-
nowrap: {
|
218
|
-
nowrapCell: typeCell,
|
219
|
-
title: typeCell
|
32
|
+
export function getDefaultSelectedCiType(tree) {
|
33
|
+
var ciType = null;
|
34
|
+
loopTreeNode(tree, function (item) {
|
35
|
+
if (item.type !== 'folder') {
|
36
|
+
if (!ciType) {
|
37
|
+
ciType = item.id;
|
220
38
|
}
|
221
39
|
}
|
222
|
-
}
|
223
|
-
return
|
224
|
-
|
225
|
-
// ? values
|
226
|
-
// : values.filter((item) => item.dataIndex !== ciNumKey);
|
227
|
-
};
|
40
|
+
});
|
41
|
+
return ciType;
|
42
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { forwardRef } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
-
import BatchAttrMetricDrawer from "../../
|
3
|
+
import BatchAttrMetricDrawer from "../../BatchAttrMetric";
|
4
4
|
var ModelAttrSelectDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
5
5
|
var value = props.value,
|
6
6
|
dataSource = props.dataSource,
|
@@ -1,19 +1,18 @@
|
|
1
1
|
import _Button from "@alifd/next/es/button";
|
2
2
|
import _Box from "@alifd/next/es/box";
|
3
3
|
import _Radio from "@alifd/next/es/radio";
|
4
|
-
import React, {
|
5
|
-
import
|
4
|
+
import React, { useImperativeHandle, useRef } from 'react';
|
5
|
+
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
6
6
|
import { DEFAULT_CUSTOM_CONFIG } from "../../../../constants/ResourceInfoDisplay";
|
7
7
|
import CommonCheckboxGroup from "./CommonCheckboxGroup";
|
8
8
|
import ResourceDiplayInfoSetting from "../../ResourceViewAttributeSetting/Setting";
|
9
|
-
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
10
9
|
|
11
10
|
/**
|
12
11
|
* 配置类型
|
13
12
|
*/
|
14
13
|
var ConfigType = {
|
15
|
-
DEFAULT:
|
16
|
-
CUSTOM:
|
14
|
+
DEFAULT: '0',
|
15
|
+
CUSTOM: '1'
|
17
16
|
};
|
18
17
|
function BasicConfig(props, ref) {
|
19
18
|
var topo = props.topo,
|
@@ -45,7 +44,7 @@ function BasicConfig(props, ref) {
|
|
45
44
|
};
|
46
45
|
// 默认选择框change
|
47
46
|
var handleCommonCheckboxGroupChange = function handleCommonCheckboxGroupChange(selected) {
|
48
|
-
rlog.debug(
|
47
|
+
rlog.debug('handleCommonCheckboxGroupChange', selected);
|
49
48
|
onChange({
|
50
49
|
isCustom: isCustom,
|
51
50
|
data: selected
|
@@ -58,7 +57,7 @@ function BasicConfig(props, ref) {
|
|
58
57
|
};
|
59
58
|
// 自定义选择框change
|
60
59
|
var handleCustomChange = function handleCustomChange(parm) {
|
61
|
-
rlog.debug(
|
60
|
+
rlog.debug('handleCustomChange', parm);
|
62
61
|
onChange(parm);
|
63
62
|
};
|
64
63
|
// 渲染自定义配置抽屉
|
@@ -1,70 +1,42 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
-
import
|
3
|
-
|
4
|
-
import
|
5
|
-
import
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["topo", "elementType", "showType", "value"];
|
4
|
+
import React, { forwardRef, useState } from 'react';
|
5
|
+
import rlog from '@riil-frontend/component-topology-utils/lib/rlog';
|
6
|
+
import { getNodeModels } from "./nodeCiTypeAttrUtil";
|
7
|
+
import ModelAttrSelectDrawer from "../../../components/ModelAttrSelectDrawer";
|
6
8
|
|
7
9
|
/**
|
8
|
-
*
|
10
|
+
* 标注、悬浮框设置
|
9
11
|
*/
|
10
|
-
var
|
11
|
-
var
|
12
|
-
topo = props.topo,
|
12
|
+
var AttrSettingDrawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
13
|
+
var topo = props.topo,
|
13
14
|
elementType = props.elementType,
|
14
15
|
showType = props.showType,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
setMarkarkData(queryData());
|
16
|
+
value = props.value,
|
17
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
18
|
+
var _useState = useState([]),
|
19
|
+
data = _useState[0],
|
20
|
+
setData = _useState[1];
|
21
|
+
var queryData = function queryData() {
|
22
|
+
rlog.info('属性配置:加载数据');
|
23
|
+
if (elementType === 'node') {
|
24
|
+
var items = getNodeModels(topo);
|
25
|
+
setData(items);
|
26
26
|
} else {
|
27
|
-
|
28
|
-
|
29
|
-
}) : undefined);
|
27
|
+
var _items = topo.elementTagTipConfig.getLinkConfigItems();
|
28
|
+
setData(_items);
|
30
29
|
}
|
31
|
-
batchAttrMetric.current.show({
|
32
|
-
showType: showType
|
33
|
-
});
|
34
30
|
};
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
isCustom: true,
|
41
|
-
data: parm
|
42
|
-
});
|
43
|
-
};
|
44
|
-
useImperativeHandle(ref, function () {
|
45
|
-
return {
|
46
|
-
show: openMarkSetting
|
47
|
-
};
|
48
|
-
});
|
49
|
-
var newValue = useMemo(function () {
|
50
|
-
var d = _extends({}, (value === null || value === void 0 ? void 0 : value.data) || {});
|
51
|
-
Object.keys(d).forEach(function (key) {
|
52
|
-
d[key] = (d[key] || []).map(function (item) {
|
53
|
-
return item.code + "-" + item.type;
|
54
|
-
});
|
55
|
-
});
|
56
|
-
return d;
|
57
|
-
}, [value]);
|
58
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BatchAttrMetricDrawer, {
|
59
|
-
ref: batchAttrMetric,
|
60
|
-
value: newValue,
|
61
|
-
allCiSet: markData,
|
62
|
-
limit: limit,
|
63
|
-
topo: topo,
|
64
|
-
elementType: elementType,
|
31
|
+
return /*#__PURE__*/React.createElement(ModelAttrSelectDrawer, _extends({
|
32
|
+
ref: ref
|
33
|
+
}, otherProps, {
|
34
|
+
value: value,
|
35
|
+
data: data,
|
65
36
|
showType: showType,
|
66
|
-
|
37
|
+
queryData: queryData
|
67
38
|
}));
|
68
39
|
});
|
69
|
-
|
70
|
-
|
40
|
+
AttrSettingDrawer.displayName = 'AttrSettingDrawer';
|
41
|
+
AttrSettingDrawer.propTypes = {};
|
42
|
+
export default AttrSettingDrawer;
|
@@ -36,7 +36,6 @@ var Topology = function Topology(props) {
|
|
36
36
|
var topo = props.topo,
|
37
37
|
defaultEnterEditMode = props.defaultEnterEditMode,
|
38
38
|
titleBar = props.titleBar,
|
39
|
-
toolbar = props.toolbar,
|
40
39
|
buildLoadOptions = props.buildLoadOptions,
|
41
40
|
onReady = props.onReady,
|
42
41
|
onLoaded = props.onLoaded,
|
@@ -1,14 +1,11 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react';
|
2
2
|
import styles from "../TitleBar.module.scss";
|
3
3
|
export default function TitleWidget(props) {
|
4
4
|
var topo = props.topo;
|
5
5
|
var store = topo.store;
|
6
|
-
var
|
7
|
-
topoState = _store$useModel[0],
|
8
|
-
topoDispatchers = _store$useModel[1];
|
6
|
+
var topoState = store.useModelState('topoMod');
|
9
7
|
var _topoState$currentTop = topoState.currentTopo,
|
10
8
|
_topoState$currentTop2 = _topoState$currentTop === void 0 ? {} : _topoState$currentTop,
|
11
|
-
topoId = _topoState$currentTop2.id,
|
12
9
|
topoName = _topoState$currentTop2.name;
|
13
10
|
return /*#__PURE__*/React.createElement("div", {
|
14
11
|
className: styles.title
|
@@ -48,10 +48,7 @@ function HelpIcon(props) {
|
|
48
48
|
align: "t",
|
49
49
|
trigger: /*#__PURE__*/React.createElement("div", {
|
50
50
|
ref: topoViewerRef,
|
51
|
-
className: classNames(styles.topoHelpIconBtn, styles["topoHelpIconBtn-" + helpIconNames])
|
52
|
-
onClick: function onClick() {
|
53
|
-
open;
|
54
|
-
}
|
51
|
+
className: classNames(styles.topoHelpIconBtn, styles["topoHelpIconBtn-" + helpIconNames])
|
55
52
|
}, /*#__PURE__*/React.createElement("img", {
|
56
53
|
src: "/img/topo/editor/bottomTool/help_icon_" + helpIconName + ".svg",
|
57
54
|
alt: ""
|