@riil-frontend/component-topology 4.0.0-beta.9 → 4.0.2
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 +32 -32
- package/es/components/BatchAttrMetric/setting.js +47 -7
- package/es/components/Drawer/Drawer.js +60 -0
- package/es/components/Drawer/index.js +1 -59
- package/es/constants/ResourceInfoDisplay.js +1 -4
- package/es/core/components/AlarmListPanel/components/AlarmListItem.js +31 -1
- package/es/core/components/AlarmListPanel/hooks/useAlarmList.js +34 -0
- package/es/core/components/AlarmListPanel/index.js +27 -24
- package/es/core/components/AlarmListPanel/index.module.scss +46 -16
- package/es/core/components/DisplaySettingDrawer/EdgeFlow.js +4 -6
- package/es/core/components/DisplaySettingDrawer/EdgeFlowDirection.js +4 -6
- package/es/core/components/DisplaySettingDrawer/NodeTag.js +3 -5
- package/es/core/components/DisplaySettingDrawer/NodeTip.js +4 -5
- package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +3 -1
- package/es/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSetting.js +25 -0
- package/es/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSettingDrawer.js +8 -0
- package/es/core/components/TopoView/topoView.js +25 -1
- package/es/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +4 -2
- package/es/core/editor/components/settings/propertyViews/group/DataTab/RelateData.js +0 -7
- package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +13 -12
- package/es/core/editor/components/settings/propertyViews/group/GroupPropertyView.js +4 -1
- package/es/core/editor/components/settings/propertyViews/group/{DataTab/ClusterGroupRelateData → cluster}/ClusterGroupRelateData.js +22 -9
- package/es/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +2 -5
- package/es/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +21 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +5 -0
- package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +3 -1
- package/es/core/editor/components/settings/propertyViews/node/Setting/NameInput.js +36 -0
- package/es/core/editor/components/settings/propertyViews/node/Setting/Setting.js +2 -2
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +3 -5
- package/es/core/editor/components/settings/propertyViews/node/data/NodeRelateResourceButton.js +4 -2
- package/es/core/hooks/ht/useHtDataPropertyChangeListener.js +28 -0
- package/es/core/models/AttributeMetricDisplay.js +28 -10
- package/es/core/models/TopoApp.js +12 -7
- package/es/core/models/TopoGraphView.js +3 -1
- package/es/core/models/attributeFormatter/index.js +2 -26
- package/es/core/models/cache/{CiTyeCache.js → CiTypeCache.js} +3 -1
- package/es/core/models/tagstips/ElementTagTipConfig.js +132 -0
- package/es/core/models/tagstips/utils.js +44 -0
- package/es/core/models/utils/linkUtils.js +3 -1
- package/es/core/services/topo.js +30 -0
- package/es/core/utils/edgeUtil.js +8 -0
- package/es/core/utils/graphLinkUtil.js +22 -0
- package/es/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +24 -2
- package/es/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.module.scss +1 -1
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +7 -101
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +13 -3
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +166 -89
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +7 -14
- package/es/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +38 -13
- package/es/core/viewer/components/titlebar/BasicTools.js +5 -2
- package/es/core/viewer/components/titlebar/widgets/NodesDragSwitch.js +4 -2
- package/es/hooks/useAlarm.js +59 -0
- package/es/hooks/useEventData.js +20 -0
- package/es/hooks/useGraphAlarmDisplay.js +68 -18
- package/es/hooks/useManageStatus.js +0 -34
- package/es/hooks/useResourceConfig.js +6 -13
- package/es/hooks/useSelection.js +2 -4
- package/es/hooks/useTopoEdit.js +90 -37
- package/es/models/topoAlarm.js +8 -9
- package/es/models/topoMod.js +16 -8
- package/es/style.js +1 -0
- package/es/topoCenter/components/TopoView.js +6 -1
- package/es/topoCenter/components/Topology.js +7 -1
- package/es/topoCenter/components/editor/propertyViews/LayerRelatedResourceList.js +2 -2
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +35 -15
- package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -2
- package/es/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.js +24 -0
- package/es/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.module.scss +23 -0
- package/es/topoCenter/components/viewer/displaySetting/LinkTagV2.js +87 -0
- package/es/topoCenter/getTopoData.js +18 -6
- package/es/topoCenter/hooks/editor/useGroupSortResources.js +16 -0
- package/es/topoCenter/hooks/useEdgeExpand.js +25 -0
- package/es/topoCenter/hooks/useLinkDynamicStyle.js +1 -1
- package/es/topoCenter/hooks/useTopoEdit.js +3 -0
- package/es/topoCenter/models/LinkDynamicStyleExecutor.js +38 -10
- package/es/topoCenter/models/TopoCenter.js +3 -11
- package/es/topoCenter/store/functionAuth.js +2 -0
- package/es/topoCenter/utils/SortResourcesUtil.js +3 -3
- package/es/topoCenter/utils/exportData.js +13 -7
- package/es/topoCenter/utils/linkUtil.js +8 -0
- package/es/utils/ResourceConfigUtil.js +4 -5
- package/es/utils/clusterUtil.js +27 -2
- package/es/utils/htElementDataUtil.js +22 -1
- package/es/utils/htElementUtils.js +22 -9
- package/es/utils/showGraphManageStatusUtil.js +67 -0
- package/es/utils/topoData.js +57 -32
- package/lib/components/BatchAttrMetric/setting.js +47 -6
- package/lib/components/Drawer/Drawer.js +73 -0
- package/lib/components/Drawer/index.js +2 -64
- package/lib/constants/ResourceInfoDisplay.js +1 -4
- package/lib/core/components/AlarmListPanel/components/AlarmListItem.js +31 -1
- package/lib/core/components/AlarmListPanel/hooks/useAlarmList.js +40 -0
- package/lib/core/components/AlarmListPanel/index.js +30 -24
- package/lib/core/components/AlarmListPanel/index.module.scss +46 -16
- package/lib/core/components/DisplaySettingDrawer/EdgeFlow.js +4 -6
- package/lib/core/components/DisplaySettingDrawer/EdgeFlowDirection.js +4 -6
- package/lib/core/components/DisplaySettingDrawer/NodeTag.js +3 -6
- package/lib/core/components/DisplaySettingDrawer/NodeTip.js +4 -6
- package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +3 -1
- package/lib/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSetting.js +39 -0
- package/lib/core/components/DisplaySettingDrawer/tagtip/CustomSettingDrawer/CustomSettingDrawer.js +17 -0
- package/lib/core/components/TopoView/topoView.js +28 -1
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/GroupNodeList.js +4 -2
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/RelateData.js +0 -8
- package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +13 -13
- package/lib/core/editor/components/settings/propertyViews/group/GroupPropertyView.js +5 -1
- package/lib/core/editor/components/settings/propertyViews/group/{DataTab/ClusterGroupRelateData → cluster}/ClusterGroupRelateData.js +23 -9
- package/lib/core/editor/components/settings/propertyViews/layer/DataTab/NodeList.js +2 -5
- package/lib/core/editor/components/settings/propertyViews/multipleElements/BatchSetNodeIcon.js +31 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementPropertyView.js +6 -0
- package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +3 -1
- package/lib/core/editor/components/settings/propertyViews/node/Setting/NameInput.js +52 -0
- package/lib/core/editor/components/settings/propertyViews/node/Setting/Setting.js +3 -3
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +3 -5
- package/lib/core/editor/components/settings/propertyViews/node/data/NodeRelateResourceButton.js +5 -2
- package/lib/core/hooks/ht/useHtDataPropertyChangeListener.js +37 -0
- package/lib/core/models/AttributeMetricDisplay.js +28 -10
- package/lib/core/models/TopoApp.js +10 -5
- package/lib/core/models/TopoGraphView.js +3 -1
- package/lib/core/models/attributeFormatter/index.js +2 -26
- package/lib/core/models/cache/{CiTyeCache.js → CiTypeCache.js} +3 -1
- package/lib/core/models/tagstips/ElementTagTipConfig.js +142 -0
- package/lib/core/models/tagstips/utils.js +59 -0
- package/lib/core/models/utils/linkUtils.js +3 -1
- package/lib/core/services/topo.js +40 -0
- package/lib/core/utils/edgeUtil.js +12 -0
- package/lib/core/utils/graphLinkUtil.js +27 -0
- package/lib/core/viewer/components/plugins/ResourceDetail/ResourceDetail.js +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.js +25 -2
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ClusterMemberTable.module.scss +1 -1
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfo.js +7 -101
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/BaseInfoBlock.js +13 -3
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverview.js +166 -89
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/ResourceOverviewMetric.js +7 -14
- package/lib/core/viewer/components/plugins/ResourceDetail/components/ResourceOverview/components/Configurator/index.js +38 -13
- package/lib/core/viewer/components/titlebar/BasicTools.js +6 -2
- package/lib/core/viewer/components/titlebar/widgets/NodesDragSwitch.js +4 -2
- package/lib/hooks/useAlarm.js +61 -0
- package/lib/hooks/useEventData.js +28 -0
- package/lib/hooks/useGraphAlarmDisplay.js +69 -18
- package/lib/hooks/useManageStatus.js +0 -34
- package/lib/hooks/useResourceConfig.js +6 -12
- package/lib/hooks/useSelection.js +1 -5
- package/lib/hooks/useTopoEdit.js +94 -36
- package/lib/models/topoAlarm.js +8 -9
- package/lib/models/topoMod.js +15 -8
- package/lib/style.js +1 -0
- package/lib/topoCenter/components/TopoView.js +8 -1
- package/lib/topoCenter/components/Topology.js +8 -1
- package/lib/topoCenter/components/editor/propertyViews/LayerRelatedResourceList.js +1 -1
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +35 -14
- package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +11 -2
- package/lib/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.js +35 -0
- package/lib/topoCenter/components/viewer/displaySetting/LinkTagCommonRidioGroup.module.scss +23 -0
- package/lib/topoCenter/components/viewer/displaySetting/LinkTagV2.js +102 -0
- package/lib/topoCenter/getTopoData.js +19 -6
- package/lib/topoCenter/hooks/editor/useGroupSortResources.js +21 -0
- package/lib/topoCenter/hooks/useEdgeExpand.js +33 -0
- package/lib/topoCenter/hooks/useLinkDynamicStyle.js +1 -1
- package/lib/topoCenter/hooks/useTopoEdit.js +3 -0
- package/lib/topoCenter/models/LinkDynamicStyleExecutor.js +38 -9
- package/lib/topoCenter/models/TopoCenter.js +3 -12
- package/lib/topoCenter/store/functionAuth.js +2 -0
- package/lib/topoCenter/utils/SortResourcesUtil.js +3 -3
- package/lib/topoCenter/utils/exportData.js +14 -7
- package/lib/topoCenter/utils/linkUtil.js +15 -0
- package/lib/utils/ResourceConfigUtil.js +4 -4
- package/lib/utils/clusterUtil.js +34 -2
- package/lib/utils/htElementDataUtil.js +38 -1
- package/lib/utils/htElementUtils.js +24 -9
- package/lib/utils/showGraphManageStatusUtil.js +78 -0
- package/lib/utils/topoData.js +59 -32
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { isClusterHtElement } from "../../utils/clusterUtil";
|
|
3
|
+
import { getEdgeGroupByNodeTags, getEdges, isNode } from "../../utils/htElementUtils";
|
|
4
|
+
import { getLinksBetweenNodes } from "../utils/linkUtil"; // network_link.actual_bandwidth
|
|
4
5
|
|
|
5
6
|
function calcEdgeWidth(actualBandwidth) {
|
|
6
7
|
if (!actualBandwidth) {
|
|
@@ -16,6 +17,26 @@ function calcEdgeWidth(actualBandwidth) {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
var getChildrenNodeCiIds = function getChildrenNodeCiIds(nodes) {
|
|
21
|
+
var ciIds = [];
|
|
22
|
+
nodes.forEach(function (node) {
|
|
23
|
+
if (isNode(node) || isClusterHtElement(node)) {
|
|
24
|
+
var nodeTag = node.getTag();
|
|
25
|
+
|
|
26
|
+
if (nodeTag) {
|
|
27
|
+
ciIds.push(nodeTag);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
nodes.forEach(function (node) {
|
|
32
|
+
if (node instanceof ht.Group) {
|
|
33
|
+
var children = node.getChildren().toArray();
|
|
34
|
+
ciIds.push.apply(ciIds, getChildrenNodeCiIds(children));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return ciIds;
|
|
38
|
+
};
|
|
39
|
+
|
|
19
40
|
var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
20
41
|
function LinkDynamicStyleExecutor(topo) {
|
|
21
42
|
this.calcEdgeWidth = calcEdgeWidth;
|
|
@@ -74,19 +95,26 @@ var LinkDynamicStyleExecutor = /*#__PURE__*/function () {
|
|
|
74
95
|
var edges = getEdges(dataModel);
|
|
75
96
|
edges.forEach(function (edge) {
|
|
76
97
|
try {
|
|
77
|
-
//
|
|
78
|
-
var
|
|
79
|
-
var
|
|
98
|
+
// 获取两端代理节点
|
|
99
|
+
var sourceAgent = edge.getSourceAgent();
|
|
100
|
+
var targetAgent = edge.getTargetAgent();
|
|
101
|
+
var sourceId = sourceAgent.getTag();
|
|
102
|
+
var targetId = targetAgent.getTag(); // 查询是否有聚合链路
|
|
103
|
+
|
|
80
104
|
var aggLink = linkGroups.find(function (link) {
|
|
81
105
|
return link.source === sourceId && link.target === targetId || link.target === sourceId && link.source === targetId;
|
|
82
106
|
}); // 如果连线组未关联链路并可见
|
|
83
107
|
|
|
84
108
|
if (!aggLink && edge.isEdgeGroupAgent()) {
|
|
85
|
-
//
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
109
|
+
// 查询两端代理节点(包含子节点)间的子链路列表
|
|
110
|
+
var sourceCiIds = getChildrenNodeCiIds([sourceAgent]);
|
|
111
|
+
var targetCiIds = getChildrenNodeCiIds([targetAgent]);
|
|
112
|
+
var aggLinks = getLinksBetweenNodes(linkGroups, sourceCiIds, targetCiIds);
|
|
113
|
+
var phyLinks = getLinksBetweenNodes(links, sourceCiIds, targetCiIds);
|
|
114
|
+
var linkBetweenNodes = aggLinks.length ? aggLinks : phyLinks; // 如果有子链路,计算线宽并设置
|
|
115
|
+
|
|
116
|
+
if (linkBetweenNodes.length) {
|
|
117
|
+
var edgeWidth = _this.calcEdgeGroupEdgeWidth(linkBetweenNodes);
|
|
90
118
|
|
|
91
119
|
edge.s('edge.width', edgeWidth);
|
|
92
120
|
}
|
|
@@ -6,11 +6,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
6
6
|
import TopoApp from "../../core/models/TopoApp";
|
|
7
7
|
import createMenuCommands from "../../contextmenu/createMenuCommands";
|
|
8
8
|
import getTopoData from "../getTopoData";
|
|
9
|
-
import _sortResources from "../utils/SortResourcesUtil";
|
|
10
9
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
11
10
|
import customStoreModels from "../store";
|
|
12
|
-
import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay";
|
|
13
|
-
import LinkTagsTipsBuilder from "./LinkTagsTipsBuilder";
|
|
11
|
+
import { DEFAULT_LINK_TAG_COMMON_CONFIG, DEFAULT_TIP_COMMON_CONFIG } from "../../constants/ResourceInfoDisplay"; // import LinkTagsTipsBuilder from './LinkTagsTipsBuilder';
|
|
14
12
|
|
|
15
13
|
var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
16
14
|
_inheritsLoose(TopoCenter, _TopoApp);
|
|
@@ -30,8 +28,8 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
|
30
28
|
},
|
|
31
29
|
getDefaultLinkTipConfig: function getDefaultLinkTipConfig() {
|
|
32
30
|
return DEFAULT_TIP_COMMON_CONFIG;
|
|
33
|
-
},
|
|
34
|
-
|
|
31
|
+
} // ExtElementTagTipBuilder: LinkTagsTipsBuilder,
|
|
32
|
+
|
|
35
33
|
},
|
|
36
34
|
onSwitchToEditModeBegin: function () {
|
|
37
35
|
var _onSwitchToEditModeBegin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topo) {
|
|
@@ -87,12 +85,6 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
|
|
|
87
85
|
id: topo.id
|
|
88
86
|
});
|
|
89
87
|
topoModDispatchers.refreshTopoTree();
|
|
90
|
-
},
|
|
91
|
-
editor: {
|
|
92
|
-
// 分层、区域的关联资源按名称排序
|
|
93
|
-
sortResources: function sortResources(nodes) {
|
|
94
|
-
return _sortResources(_this.store, nodes);
|
|
95
|
-
}
|
|
96
88
|
}
|
|
97
89
|
})) || this;
|
|
98
90
|
_this.resourceConfig = null;
|
|
@@ -4,9 +4,9 @@ export default function sortResources(store, nodes) {
|
|
|
4
4
|
|
|
5
5
|
var resources = [];
|
|
6
6
|
((data === null || data === void 0 ? void 0 : data.nodes) || []).forEach(function (res) {
|
|
7
|
-
var node = nodes.
|
|
8
|
-
return
|
|
9
|
-
})
|
|
7
|
+
var node = nodes.find(function (item) {
|
|
8
|
+
return item.id === res.id;
|
|
9
|
+
});
|
|
10
10
|
|
|
11
11
|
if (node) {
|
|
12
12
|
resources.push(node);
|
|
@@ -2,29 +2,35 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { request } from '@riil-frontend/component-topology-utils';
|
|
4
4
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
5
|
+
import { findClusters, isCluster } from "../../utils/clusterUtil";
|
|
5
6
|
export default function (_x) {
|
|
6
7
|
return _ref.apply(this, arguments);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
function _ref() {
|
|
10
11
|
_ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(topo) {
|
|
11
|
-
var _topo$store$getModelS, nodes, links, params, fileData, fileName, blob, elink;
|
|
12
|
+
var _topo$store$getModelS, nodes, links, linkGroups, clusters, params, fileData, fileName, blob, elink;
|
|
12
13
|
|
|
13
14
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
15
|
while (1) {
|
|
15
16
|
switch (_context.prev = _context.next) {
|
|
16
17
|
case 0:
|
|
17
|
-
_topo$store$getModelS = topo.store.getModelState('topoMod').data, nodes = _topo$store$getModelS.nodes, links = _topo$store$getModelS.links;
|
|
18
|
+
_topo$store$getModelS = topo.store.getModelState('topoMod').data, nodes = _topo$store$getModelS.nodes, links = _topo$store$getModelS.links, linkGroups = _topo$store$getModelS.linkGroups;
|
|
19
|
+
clusters = findClusters(nodes);
|
|
18
20
|
params = {
|
|
19
21
|
id: topo.id,
|
|
20
|
-
'nodes': nodes.
|
|
22
|
+
'nodes': nodes.filter(function (node) {
|
|
23
|
+
return !clusters.find(function (c) {
|
|
24
|
+
return c.id === node.ownerId;
|
|
25
|
+
});
|
|
26
|
+
}).map(function (node) {
|
|
21
27
|
var element = topo.getDataModel().getDataByTag(node.id);
|
|
22
28
|
return {
|
|
23
29
|
'id': node.id,
|
|
24
30
|
'imageName': element.a('customName') || element.a('name') || element.getName()
|
|
25
31
|
};
|
|
26
32
|
}),
|
|
27
|
-
'links': links.map(function (link) {
|
|
33
|
+
'links': [].concat(links, linkGroups).map(function (link) {
|
|
28
34
|
var id = link.id,
|
|
29
35
|
source = link.source,
|
|
30
36
|
target = link.target,
|
|
@@ -40,13 +46,13 @@ function _ref() {
|
|
|
40
46
|
})
|
|
41
47
|
};
|
|
42
48
|
rlog.error('导出数据', params);
|
|
43
|
-
_context.next =
|
|
49
|
+
_context.next = 6;
|
|
44
50
|
return request.post('/topo/v1/api/structure/excel', params, {
|
|
45
51
|
responseType: 'blob' // responseType: 'arraybuffer',
|
|
46
52
|
|
|
47
53
|
});
|
|
48
54
|
|
|
49
|
-
case
|
|
55
|
+
case 6:
|
|
50
56
|
fileData = _context.sent;
|
|
51
57
|
fileName = topo.store.getModelState('topoMod').topoData.config.name + ".xls";
|
|
52
58
|
blob = new Blob([fileData]); // 处理文档流
|
|
@@ -61,7 +67,7 @@ function _ref() {
|
|
|
61
67
|
|
|
62
68
|
document.body.removeChild(elink);
|
|
63
69
|
|
|
64
|
-
case
|
|
70
|
+
case 17:
|
|
65
71
|
case "end":
|
|
66
72
|
return _context.stop();
|
|
67
73
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function isLink(link, id1, id2) {
|
|
2
|
+
return link.source === id1 && link.target === id2 || link.target === id1 && link.source === id2;
|
|
3
|
+
}
|
|
4
|
+
export function getLinksBetweenNodes(links, ids1, ids2) {
|
|
5
|
+
return links.filter(function (link) {
|
|
6
|
+
return ids1.indexOf(link.source) !== -1 && ids2.indexOf(link.target) !== -1 || ids2.indexOf(link.source) !== -1 && ids1.indexOf(link.target) !== -1;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import rlog from "@riil-frontend/component-topology-utils/es/rlog";
|
|
2
2
|
import sortBy from "lodash/sortBy";
|
|
3
3
|
import { isClusterHtElement } from "./clusterUtil";
|
|
4
|
-
import {
|
|
4
|
+
import { getGroupChildrenResourceElements, getLayerChildrenResourceElements } from "./htElementDataUtil";
|
|
5
|
+
import { getEdges, getGroups, getLayers, getNodes } from "./htElementUtils";
|
|
5
6
|
/**
|
|
6
7
|
* 从拓扑图解析出拓扑资源配置
|
|
7
8
|
*
|
|
@@ -21,9 +22,7 @@ function getResourceConfigFromHt(topo) {
|
|
|
21
22
|
name: layerElement.s("label"),
|
|
22
23
|
order: layerElement.a("order"),
|
|
23
24
|
resources: {
|
|
24
|
-
"static":
|
|
25
|
-
return !!node.getTag();
|
|
26
|
-
}).map(function (node) {
|
|
25
|
+
"static": getLayerChildrenResourceElements(layerElement).map(function (node) {
|
|
27
26
|
return node.getTag();
|
|
28
27
|
})
|
|
29
28
|
}
|
|
@@ -94,7 +93,7 @@ function getGroupConfigByElement(groupElement) {
|
|
|
94
93
|
name: groupElement.a("name"),
|
|
95
94
|
order: groupElement.a("order"),
|
|
96
95
|
resources: {
|
|
97
|
-
"static":
|
|
96
|
+
"static": getGroupChildrenResourceElements(groupElement).filter(function (node) {
|
|
98
97
|
return !!node.getTag();
|
|
99
98
|
}).map(function (node) {
|
|
100
99
|
return node.getTag();
|
package/es/utils/clusterUtil.js
CHANGED
|
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
/**
|
|
4
4
|
* 集群处理工具类
|
|
5
5
|
*/
|
|
6
|
+
import { getGroups } from "./htElementUtils";
|
|
6
7
|
export function isCluster(node) {
|
|
7
8
|
return !!node.cluster;
|
|
8
9
|
}
|
|
@@ -16,18 +17,25 @@ export function processCluster(topoData) {
|
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
export function buildClusterGroups(nodes) {
|
|
19
|
-
return nodes
|
|
20
|
+
return findClusters(nodes).map(function (n) {
|
|
20
21
|
return _extends({
|
|
21
22
|
tag: null,
|
|
22
23
|
parentId: n.groupId,
|
|
23
24
|
parentTag: n.groupTag
|
|
24
25
|
}, n, {
|
|
25
26
|
elementTemplate: 'cluster',
|
|
26
|
-
expandable: !!n.operation
|
|
27
|
+
expandable: !!n.operation,
|
|
28
|
+
// 无权限禁用展开折叠
|
|
29
|
+
styles: {
|
|
30
|
+
showExpanded: false // 是否默认展开
|
|
27
31
|
|
|
32
|
+
}
|
|
28
33
|
});
|
|
29
34
|
});
|
|
30
35
|
}
|
|
36
|
+
export function findClusters(nodes) {
|
|
37
|
+
return nodes.filter(isCluster);
|
|
38
|
+
}
|
|
31
39
|
export function processClusterChildrenNodes(nodes, groups) {
|
|
32
40
|
return nodes // 过滤集群
|
|
33
41
|
.filter(function (node) {
|
|
@@ -61,4 +69,21 @@ export function processClusterChildNode(node, groups) {
|
|
|
61
69
|
}
|
|
62
70
|
export function isClusterHtElement(element) {
|
|
63
71
|
return !!element.a('cluster');
|
|
72
|
+
}
|
|
73
|
+
export function isClusterMemberHtElement(element) {
|
|
74
|
+
return element && element.getParent() && isClusterHtElement(element.getParent());
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 集群无权限时收起
|
|
78
|
+
* @param {*} topo
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
export function handleClusterNoPermission(topo) {
|
|
82
|
+
var dm = topo.getHtTopo().getGraphView().dm();
|
|
83
|
+
var groups = getGroups(dm);
|
|
84
|
+
groups.forEach(function (group) {
|
|
85
|
+
if (isClusterHtElement(group) && !group.a('operation') && group.isExpanded()) {
|
|
86
|
+
group.setExpanded(false);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
64
89
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getEdges, getGroupChildren, getLayerChildren } from "./htElementUtils";
|
|
2
|
+
import * as htElementUtils from "./htElementUtils";
|
|
1
3
|
export function isLayer(element) {
|
|
2
4
|
return element.className === 'ht.Grid';
|
|
3
5
|
}
|
|
@@ -12,4 +14,23 @@ export function isEdge(element) {
|
|
|
12
14
|
}
|
|
13
15
|
export function isText(element) {
|
|
14
16
|
return element.className === 'ht.Text' && element.attrObject.isText;
|
|
15
|
-
}
|
|
17
|
+
}
|
|
18
|
+
export function isResourceElement(element) {
|
|
19
|
+
return !!element.a('ciType');
|
|
20
|
+
}
|
|
21
|
+
export function isResourceNodeElement(element) {
|
|
22
|
+
return (htElementUtils.isGroup(element) || htElementUtils.isNode(element)) && isResourceElement(element);
|
|
23
|
+
}
|
|
24
|
+
export function getGroupChildrenResourceElements(element) {
|
|
25
|
+
return getGroupChildren(element).filter(isResourceElement);
|
|
26
|
+
}
|
|
27
|
+
export function getLayerChildrenResourceElements(layerElement) {
|
|
28
|
+
return getLayerChildren(layerElement).filter(isResourceElement);
|
|
29
|
+
}
|
|
30
|
+
export var getAllEdgeResourceIds = function getAllEdgeResourceIds(dm) {
|
|
31
|
+
return getEdges(dm).filter(function (node) {
|
|
32
|
+
return !!node.getTag();
|
|
33
|
+
}).map(function (node) {
|
|
34
|
+
return node.getTag();
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -229,6 +229,20 @@ export function getLayerChildrenNodes(layer) {
|
|
|
229
229
|
|
|
230
230
|
return layer.getChildren().getArray().filter(isNode);
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* 获取分层里的节点列表
|
|
234
|
+
*
|
|
235
|
+
* @param layer
|
|
236
|
+
* @return {*}
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
export function getLayerChildren(layer) {
|
|
240
|
+
if (!layer) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return layer.getChildren().getArray();
|
|
245
|
+
}
|
|
232
246
|
/**
|
|
233
247
|
* 获取容器里的子元素列表
|
|
234
248
|
*
|
|
@@ -286,7 +300,7 @@ export function setElementRuntimeStyle(element, name, value) {
|
|
|
286
300
|
* 判断拓扑图是否存在元素
|
|
287
301
|
*/
|
|
288
302
|
|
|
289
|
-
export function isExistedElement(dataModel, data) {
|
|
303
|
+
export function isExistedElement(htTopo, dataModel, data) {
|
|
290
304
|
var type = data.type,
|
|
291
305
|
id = data.id;
|
|
292
306
|
|
|
@@ -294,15 +308,14 @@ export function isExistedElement(dataModel, data) {
|
|
|
294
308
|
return true;
|
|
295
309
|
}
|
|
296
310
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
311
|
+
var element = getElements(dataModel).find(function (item) {
|
|
312
|
+
return item.a('tag') === data.tag;
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (element) {
|
|
316
|
+
return true;
|
|
317
|
+
} // 连线/连线组
|
|
301
318
|
|
|
302
|
-
if (group) {
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
319
|
|
|
307
320
|
return false;
|
|
308
321
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import rlog from "@riil-frontend/component-topology-utils/lib/rlog";
|
|
2
|
+
import { setElementRuntimeStyle } from "./htElementUtils";
|
|
3
|
+
export function showManageStatus(options) {
|
|
4
|
+
var topo = options.topo,
|
|
5
|
+
resources = options.resources,
|
|
6
|
+
isEditMode = options.isEditMode,
|
|
7
|
+
graphLoaded = options.graphLoaded,
|
|
8
|
+
cisEventLevel = options.cisEventLevel;
|
|
9
|
+
|
|
10
|
+
var hasAlarm = function hasAlarm(id) {
|
|
11
|
+
return !!cisEventLevel.find(function (item) {
|
|
12
|
+
return item.id === id;
|
|
13
|
+
});
|
|
14
|
+
}; // 首次加载和监控状态变化后,更新节点和连线置灰状态
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if (!isEditMode && graphLoaded) {
|
|
18
|
+
resources.forEach(function (resource) {
|
|
19
|
+
var type = resource.type,
|
|
20
|
+
id = resource.id,
|
|
21
|
+
manageStatus = resource.manageStatus,
|
|
22
|
+
permission = resource.permission;
|
|
23
|
+
var isNotMonite = manageStatus === 0;
|
|
24
|
+
var readable = !!(permission !== null && permission !== void 0 && permission.readable);
|
|
25
|
+
var showUnMoniteStatus = !hasAlarm(id) && isNotMonite && readable;
|
|
26
|
+
var element = topo.getDataModel().getDataByTag(id);
|
|
27
|
+
if (!element) return;
|
|
28
|
+
|
|
29
|
+
if (type === 'node') {
|
|
30
|
+
try {
|
|
31
|
+
if (showUnMoniteStatus) {
|
|
32
|
+
topo.getHtTopo().setNodeStyleIcon(element, {
|
|
33
|
+
styleIcon: 'unMoniter',
|
|
34
|
+
icon: 'resource.subIcon.unMoniter'
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
element.removeStyleIcon('unMoniter');
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
rlog.error('设置监控图标异常', element, error);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
setElementRuntimeStyle(element, 'color', showUnMoniteStatus ? '#C9CED2' : undefined);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function removeManageStatus(options) {
|
|
49
|
+
var topo = options.topo,
|
|
50
|
+
resources = options.resources;
|
|
51
|
+
resources.forEach(function (resource) {
|
|
52
|
+
var type = resource.type,
|
|
53
|
+
id = resource.id;
|
|
54
|
+
var element = topo.getDataModel().getDataByTag(id);
|
|
55
|
+
if (!element) return;
|
|
56
|
+
|
|
57
|
+
if (type === 'node') {
|
|
58
|
+
try {
|
|
59
|
+
element.removeStyleIcon('unMoniter');
|
|
60
|
+
} catch (error) {
|
|
61
|
+
rlog.error('设置监控图标异常', element, error);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
setElementRuntimeStyle(element, 'color', undefined);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
package/es/utils/topoData.js
CHANGED
|
@@ -11,6 +11,7 @@ import mergeContextmenu from "../core/common/contextmenu/mergeContextmenu";
|
|
|
11
11
|
import { getEditorIcons } from "../core/common/icons/icon";
|
|
12
12
|
import { getBackgroundImageUrl } from "../core/utils/backgroundUtil";
|
|
13
13
|
import { processCluster } from "./clusterUtil";
|
|
14
|
+
import { isGroup } from "./htElementUtils";
|
|
14
15
|
/**
|
|
15
16
|
* 查找数组中对应key的值为value的元素并返回,只查找第一个符合的元素
|
|
16
17
|
* @param {Array} arr 数组
|
|
@@ -86,40 +87,34 @@ export function formatGroup(group) {
|
|
|
86
87
|
|
|
87
88
|
export function formatGroups(groups) {
|
|
88
89
|
return groups.map(formatGroup);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
* @param attributes {array|object}
|
|
93
|
-
* @return {object}
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
function nodeAttributesAdapter(attributes) {
|
|
97
|
-
if (Array.isArray(attributes)) {
|
|
98
|
-
var map = {};
|
|
99
|
-
attributes.forEach(function (attr) {
|
|
100
|
-
map[attr.code] = attr.value;
|
|
101
|
-
});
|
|
102
|
-
return map;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return attributes || {};
|
|
106
90
|
} // 格式化节点
|
|
107
91
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
var attributes = nodeAttributesAdapter(node.attributes); // rlog.debug('tfNode---------',node);
|
|
111
|
-
|
|
112
|
-
var result = _extends({
|
|
113
|
-
ipAddress: attributes.ipAddress || null
|
|
114
|
-
}, node, {
|
|
115
|
-
operation: node.hasOwnProperty("operation") ? node.operation : null,
|
|
92
|
+
var tfNode = function tfNode(topoEngine, node) {
|
|
93
|
+
return _extends({}, node, {
|
|
116
94
|
metrics: [],
|
|
117
|
-
attributes: []
|
|
118
|
-
isShowName: engine.isViewMode() ? engine.attributeMetricDisplay.getNodeNameVisible(node) : true
|
|
95
|
+
attributes: []
|
|
119
96
|
});
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* ip、是否显示名称
|
|
100
|
+
*
|
|
101
|
+
* @param {*} topoEngine
|
|
102
|
+
* @param {*} topoData
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
120
105
|
|
|
121
|
-
|
|
122
|
-
|
|
106
|
+
|
|
107
|
+
function updateNodeInfo(topoEngine, topoData) {
|
|
108
|
+
return _extends({}, topoData, {
|
|
109
|
+
nodes: topoData.nodes.map(function (node) {
|
|
110
|
+
var attributes = node.attributes;
|
|
111
|
+
return _extends({}, node, {
|
|
112
|
+
ipAddress: node.ipAddress || (attributes === null || attributes === void 0 ? void 0 : attributes.ipAddress) || (attributes === null || attributes === void 0 ? void 0 : attributes.ipv4_address) || null,
|
|
113
|
+
isShowName: topoEngine.attributeMetricDisplay.getNodeNameVisible(node)
|
|
114
|
+
});
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
} // 格式化连线
|
|
123
118
|
|
|
124
119
|
|
|
125
120
|
var tfLink = function tfLink(engine, link) {
|
|
@@ -331,7 +326,37 @@ function buildGlobal(_ref2) {
|
|
|
331
326
|
},
|
|
332
327
|
icons: getEditorIcons(engine),
|
|
333
328
|
// 获取默认节点图标,可选参数。如果无返回值则继续使用内部默认
|
|
334
|
-
getDefaultNodeIcon: engine.options.getDefaultNodeIcon
|
|
329
|
+
getDefaultNodeIcon: engine.options.getDefaultNodeIcon,
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* 编辑界面左侧面板控制元素是否可拖动到区域中node代表拖动的元素,group代表图上的区域
|
|
333
|
+
* 区域不能拖拽到区域
|
|
334
|
+
* 元素不能拖拽到集群
|
|
335
|
+
*/
|
|
336
|
+
canDragElementToGroup: function canDragElementToGroup(element, group) {
|
|
337
|
+
if (!isGroup(group)) {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (element.dtype === 'container' && isGroup(group)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (isGroup(group) && group.a('cluster')) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
console.error(element, group);
|
|
350
|
+
return true;
|
|
351
|
+
},
|
|
352
|
+
// 图上元素能否拖动到区域中
|
|
353
|
+
canDragGraphElementsToGroup: function canDragGraphElementsToGroup(elemetns, group) {
|
|
354
|
+
if (!isGroup(group)) {
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
335
360
|
};
|
|
336
361
|
}
|
|
337
362
|
/**
|
|
@@ -350,7 +375,7 @@ export var combTopoData = function combTopoData(_ref3) {
|
|
|
350
375
|
globalConfig = _ref3.globalConfig,
|
|
351
376
|
ciTypeMap = _ref3.ciTypeMap,
|
|
352
377
|
engine = _ref3.engine;
|
|
353
|
-
var result = processCluster(data); // rlog.debug("combTopoData-接收到数据", result, engine, globalConfig);
|
|
378
|
+
var result = processCluster(updateNodeInfo(engine, data)); // rlog.debug("combTopoData-接收到数据", result, engine, globalConfig);
|
|
354
379
|
|
|
355
380
|
var config = _extends({
|
|
356
381
|
type: "auto"
|
|
@@ -746,7 +771,7 @@ export function findGroupChildren(elements, group) {
|
|
|
746
771
|
var type = element.type,
|
|
747
772
|
groupId = element.groupId,
|
|
748
773
|
groupTag = element.groupTag;
|
|
749
|
-
var isChild = groupId === id || groupTag === tag;
|
|
774
|
+
var isChild = groupId === id || tag && groupTag === tag;
|
|
750
775
|
|
|
751
776
|
if (isChild) {
|
|
752
777
|
children.push(element);
|
|
@@ -9,6 +9,8 @@ var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
|
|
|
9
9
|
|
|
10
10
|
var _table = _interopRequireDefault(require("@alifd/next/lib/table"));
|
|
11
11
|
|
|
12
|
+
var _search = _interopRequireDefault(require("@alifd/next/lib/search"));
|
|
13
|
+
|
|
12
14
|
var _grid = _interopRequireDefault(require("@alifd/next/lib/grid"));
|
|
13
15
|
|
|
14
16
|
var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
|
|
@@ -40,8 +42,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
40
42
|
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; }
|
|
41
43
|
|
|
42
44
|
var Setting = function Setting(_ref) {
|
|
43
|
-
var _allCiSet$ciType;
|
|
44
|
-
|
|
45
45
|
var defaultSet = _ref.defaultSet,
|
|
46
46
|
showType = _ref.showType,
|
|
47
47
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
@@ -69,9 +69,13 @@ var Setting = function Setting(_ref) {
|
|
|
69
69
|
ciType = _useState[0],
|
|
70
70
|
setCiType = _useState[1];
|
|
71
71
|
|
|
72
|
-
var _useState2 = (0, _react.useState)(
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
var _useState2 = (0, _react.useState)(''),
|
|
73
|
+
search = _useState2[0],
|
|
74
|
+
setSearch = _useState2[1];
|
|
75
|
+
|
|
76
|
+
var _useState3 = (0, _react.useState)(utils.initSelected(allCiSet, showType)),
|
|
77
|
+
selected = _useState3[0],
|
|
78
|
+
setSelected = _useState3[1];
|
|
75
79
|
|
|
76
80
|
var selectedRowKeys = selected[ciType];
|
|
77
81
|
|
|
@@ -117,6 +121,28 @@ var Setting = function Setting(_ref) {
|
|
|
117
121
|
setSelected(values);
|
|
118
122
|
};
|
|
119
123
|
|
|
124
|
+
var tableData = (0, _react.useMemo)(function () {
|
|
125
|
+
var _allCiSet$ciType;
|
|
126
|
+
|
|
127
|
+
console.log('allCiSet,ciType,search', allCiSet, ciType, search);
|
|
128
|
+
var list = ((_allCiSet$ciType = allCiSet[ciType]) === null || _allCiSet$ciType === void 0 ? void 0 : _allCiSet$ciType.list) || [];
|
|
129
|
+
|
|
130
|
+
if (search) {
|
|
131
|
+
list = list.filter(function (item) {
|
|
132
|
+
var _item$name;
|
|
133
|
+
|
|
134
|
+
return ((_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.toUpperCase().indexOf(search.toUpperCase())) !== -1;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return list;
|
|
139
|
+
}, [allCiSet, ciType, search]);
|
|
140
|
+
|
|
141
|
+
function onSearch(value) {
|
|
142
|
+
console.log('search', search);
|
|
143
|
+
setSearch(value);
|
|
144
|
+
}
|
|
145
|
+
|
|
120
146
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
121
147
|
className: _indexModule["default"].layout
|
|
122
148
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -138,10 +164,25 @@ var Setting = function Setting(_ref) {
|
|
|
138
164
|
})), /*#__PURE__*/_react["default"].createElement(_grid["default"].Col, {
|
|
139
165
|
className: _indexModule["default"]["table-wrap"]
|
|
140
166
|
}, /*#__PURE__*/_react["default"].createElement(_componentTableLayout["default"], {
|
|
167
|
+
filterItems: /*#__PURE__*/_react["default"].createElement("div", {
|
|
168
|
+
className: _indexModule["default"].filter
|
|
169
|
+
}, /*#__PURE__*/_react["default"].createElement(_search["default"], {
|
|
170
|
+
// className={styles.search}
|
|
171
|
+
style: {
|
|
172
|
+
width: 200
|
|
173
|
+
},
|
|
174
|
+
shape: "simple",
|
|
175
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57",
|
|
176
|
+
onSearch: onSearch,
|
|
177
|
+
onChange: function onChange(val) {
|
|
178
|
+
return !val && onSearch('');
|
|
179
|
+
},
|
|
180
|
+
hasClear: true
|
|
181
|
+
})),
|
|
141
182
|
table: /*#__PURE__*/_react["default"].createElement(_table["default"], {
|
|
142
183
|
fixedHeader: true,
|
|
143
184
|
hasBorder: false,
|
|
144
|
-
dataSource:
|
|
185
|
+
dataSource: tableData,
|
|
145
186
|
emptyContent: /*#__PURE__*/_react["default"].createElement(_NoDataPage["default"], {
|
|
146
187
|
type: "table"
|
|
147
188
|
}),
|