@riil-frontend/component-topology 2.7.2 → 2.8.0
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.css +1 -1
- package/build/index.js +13 -13
- package/es/components/ResourceList/ResourceSelect.js +15 -14
- package/es/components/TagSelect/index.js +60 -0
- package/es/components/TagSelect/index.scss +27 -0
- package/es/components/TemplateButton/index.js +12 -3
- package/es/components/TemplateButton/index.module.scss +13 -26
- package/es/components/TemplateSelect/index.js +40 -18
- package/es/models/linkDynamicStyle.js +21 -6
- package/es/models/topoMod.js +7 -5
- package/es/topoCenter/store/topoTreeMod.js +5 -25
- package/es/utils/template.js +1 -1
- package/es/utils/tree.js +14 -0
- package/lib/components/ResourceList/ResourceSelect.js +15 -15
- package/lib/components/TagSelect/index.js +76 -0
- package/lib/components/TagSelect/index.scss +27 -0
- package/lib/components/TemplateButton/index.js +13 -4
- package/lib/components/TemplateButton/index.module.scss +13 -26
- package/lib/components/TemplateSelect/index.js +42 -18
- package/lib/models/linkDynamicStyle.js +21 -6
- package/lib/models/topoMod.js +7 -5
- package/lib/topoCenter/store/topoTreeMod.js +4 -24
- package/lib/utils/template.js +1 -1
- package/lib/utils/tree.js +16 -0
- package/package.json +5 -4
|
@@ -23,7 +23,7 @@ var getTableData = /*#__PURE__*/function () {
|
|
|
23
23
|
switch (_context.prev = _context.next) {
|
|
24
24
|
case 0:
|
|
25
25
|
_params$current = params.current, current = _params$current === void 0 ? 1 : _params$current, _params$pageSize = params.pageSize, pageSize = _params$pageSize === void 0 ? 20 : _params$pageSize, _params$sortBy = params.sortBy, sortBy = _params$sortBy === void 0 ? 'displayName' : _params$sortBy, _params$sortOrder = params.sortOrder, sortOrder = _params$sortOrder === void 0 ? 'asc' : _params$sortOrder, like = params.like, typeCode = params.typeCode;
|
|
26
|
-
condition = 'category(\'resource\')';
|
|
26
|
+
condition = 'type(\'common_network\',\'switch\',\'switch_cluster\',\'linux\',\'windows\',\'oracle\',\'oracle.asm_disk_group\',\'tomcat\',\'application\',\'service\') && category(\'resource\')';
|
|
27
27
|
|
|
28
28
|
if (like) {
|
|
29
29
|
condition = {
|
|
@@ -67,7 +67,7 @@ var getTableData = /*#__PURE__*/function () {
|
|
|
67
67
|
|
|
68
68
|
};
|
|
69
69
|
});
|
|
70
|
-
return _context.abrupt("return", formatDataForTable(dataSource, data.
|
|
70
|
+
return _context.abrupt("return", formatDataForTable(dataSource, data.totalRecord, data.pageIndex, data.pageSize));
|
|
71
71
|
|
|
72
72
|
case 9:
|
|
73
73
|
case "end":
|
|
@@ -149,7 +149,7 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
149
149
|
|
|
150
150
|
};
|
|
151
151
|
var defaultColumns = [{
|
|
152
|
-
title: '
|
|
152
|
+
title: '资源名称',
|
|
153
153
|
dataIndex: 'displayName',
|
|
154
154
|
sortable: true,
|
|
155
155
|
cell: getTitleCell
|
|
@@ -161,7 +161,7 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
161
161
|
return getTitleCell(getIp(ip));
|
|
162
162
|
}
|
|
163
163
|
}, {
|
|
164
|
-
title: '
|
|
164
|
+
title: '资源类型',
|
|
165
165
|
dataIndex: 'typeCode',
|
|
166
166
|
filters: filters.typeCode,
|
|
167
167
|
cell: function cell(code) {
|
|
@@ -171,16 +171,17 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
171
171
|
var name = dict && dict.label || code;
|
|
172
172
|
return getTitleCell(name);
|
|
173
173
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
174
|
+
} // {
|
|
175
|
+
// title: '厂商',
|
|
176
|
+
// sortable: true,
|
|
177
|
+
// dataIndex: 'company',
|
|
178
|
+
// cell: (code) => {
|
|
179
|
+
// const dict = DICT.get(code);
|
|
180
|
+
// const name = (dict && dict.name) || code;
|
|
181
|
+
// return getTitleCell(name);
|
|
182
|
+
// },
|
|
183
|
+
// }
|
|
184
|
+
];
|
|
184
185
|
return /*#__PURE__*/React.createElement(RiilTable, {
|
|
185
186
|
className: className || styles.table,
|
|
186
187
|
formProps: formProps,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _Box from "@alifd/next/lib/box";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _Tag from "@alifd/next/lib/tag";
|
|
4
|
+
import React, { useState, useEffect, forwardRef } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import "./index.scss";
|
|
7
|
+
var SelectableTag = _Tag.Selectable;
|
|
8
|
+
|
|
9
|
+
var TagSelect = function TagSelect(props) {
|
|
10
|
+
var _onChange = props.onChange,
|
|
11
|
+
value = props.value,
|
|
12
|
+
dataSource = props.dataSource,
|
|
13
|
+
defaultValue = props.defaultValue,
|
|
14
|
+
boxProps = props.boxProps,
|
|
15
|
+
tagProps = props.tagProps;
|
|
16
|
+
|
|
17
|
+
var _useState = useState(value || defaultValue),
|
|
18
|
+
current = _useState[0],
|
|
19
|
+
setCurrent = _useState[1];
|
|
20
|
+
|
|
21
|
+
useEffect(function () {
|
|
22
|
+
if (value) {
|
|
23
|
+
setCurrent(value);
|
|
24
|
+
}
|
|
25
|
+
}, [value]);
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "tag-select-wrap"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(_Box, _extends({
|
|
29
|
+
spacing: 8,
|
|
30
|
+
wrap: true,
|
|
31
|
+
direction: "row"
|
|
32
|
+
}, boxProps), dataSource.map(function (item) {
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "tag-select-item",
|
|
35
|
+
key: "wrap-" + item.key
|
|
36
|
+
}, /*#__PURE__*/React.createElement(SelectableTag, _extends({
|
|
37
|
+
key: item.key,
|
|
38
|
+
checked: current === item.key,
|
|
39
|
+
onChange: function onChange(checked) {
|
|
40
|
+
_onChange && _onChange(item.key);
|
|
41
|
+
|
|
42
|
+
if (!('value' in props)) {
|
|
43
|
+
setCurrent(item.key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, tagProps), item.content));
|
|
47
|
+
})));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
TagSelect.propTypes = {
|
|
51
|
+
onChange: PropTypes.func,
|
|
52
|
+
value: PropTypes.string,
|
|
53
|
+
defaultValue: PropTypes.string,
|
|
54
|
+
dataSource: PropTypes.array,
|
|
55
|
+
boxProps: PropTypes.any
|
|
56
|
+
};
|
|
57
|
+
TagSelect.defaultProps = {
|
|
58
|
+
boxProps: {}
|
|
59
|
+
};
|
|
60
|
+
export default TagSelect;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* write style here */
|
|
2
|
+
@import '@alifd/next/variables.scss';
|
|
3
|
+
.tag-select-wrap {
|
|
4
|
+
.tag-select-item {
|
|
5
|
+
text-align: -webkit-center;
|
|
6
|
+
.#{$css-prefix}tag {
|
|
7
|
+
height: auto;
|
|
8
|
+
line-height: 0;
|
|
9
|
+
&::before {
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
&::after {
|
|
13
|
+
z-index: 1;
|
|
14
|
+
}
|
|
15
|
+
.#{$css-prefix}tag-body {
|
|
16
|
+
width: 100%;
|
|
17
|
+
padding: 0;
|
|
18
|
+
.tag-select-img {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.tag-select-label {
|
|
23
|
+
margin-top: 4px;
|
|
24
|
+
max-width: fit-content;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -7,8 +7,6 @@ import Icon from "./Icon";
|
|
|
7
7
|
import styles from "./index.module.scss";
|
|
8
8
|
|
|
9
9
|
var TemplateButton = function TemplateButton(props) {
|
|
10
|
-
var _classnames;
|
|
11
|
-
|
|
12
10
|
var className = props.className,
|
|
13
11
|
children = props.children,
|
|
14
12
|
icon = props.icon,
|
|
@@ -24,7 +22,18 @@ var TemplateButton = function TemplateButton(props) {
|
|
|
24
22
|
};
|
|
25
23
|
|
|
26
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
className: classnames(styles.card, className
|
|
25
|
+
className: classnames(styles.card, className),
|
|
26
|
+
onClick: handleClick
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: styles.iconWrapper
|
|
29
|
+
}, /*#__PURE__*/React.createElement(Icon, _extends({
|
|
30
|
+
className: styles.icon,
|
|
31
|
+
type: icon
|
|
32
|
+
}, rest))), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: styles.text
|
|
34
|
+
}, children));
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: classnames(styles.card, className),
|
|
28
37
|
onClick: handleClick
|
|
29
38
|
}, /*#__PURE__*/React.createElement(Icon, _extends({
|
|
30
39
|
className: styles.icon,
|
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
@import "@alifd/next/variables";
|
|
2
2
|
|
|
3
3
|
.card {
|
|
4
|
-
display:
|
|
4
|
+
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
border: 1px solid #c4c6cf;
|
|
9
|
-
width: 120px;
|
|
10
|
-
height: 136px;
|
|
11
|
-
background-color: #fff;
|
|
12
|
-
text-align: center;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
13
8
|
cursor: pointer;
|
|
14
|
-
|
|
15
|
-
margin-right: 12px;
|
|
16
|
-
|
|
17
|
-
&:hover, &:focus, &.selected {
|
|
18
|
-
border-color: $color-brand1-5;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.sizeNormal {
|
|
22
|
-
width: 120px;
|
|
23
|
-
height: 136px;
|
|
24
|
-
}
|
|
9
|
+
}
|
|
25
10
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
.iconWrapper {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex: 1;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
30
16
|
}
|
|
31
17
|
|
|
32
18
|
.icon {
|
|
33
|
-
width:
|
|
19
|
+
width: 120px;
|
|
34
20
|
}
|
|
35
21
|
|
|
36
22
|
.text {
|
|
37
|
-
font-size:
|
|
38
|
-
margin-top:
|
|
23
|
+
font-size: 18px;
|
|
24
|
+
margin-top: 16px;
|
|
25
|
+
padding-bottom: 24px;
|
|
39
26
|
color: $color-text1-3;
|
|
40
27
|
outline: none;
|
|
41
28
|
}
|
|
@@ -1,32 +1,54 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _Tag from "@alifd/next/lib/tag";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import TemplateButton from "../TemplateButton";
|
|
4
5
|
import styles from "./index.module.scss";
|
|
5
6
|
import TemplateGroup from "../TemplateGroup";
|
|
7
|
+
import TagSelect from "../TagSelect";
|
|
6
8
|
var TagGroup = _Tag.Group,
|
|
7
9
|
SelectableTag = _Tag.Selectable;
|
|
8
10
|
|
|
9
11
|
var TemplateSelect = function TemplateSelect(props) {
|
|
10
|
-
|
|
12
|
+
var _data$filter$;
|
|
13
|
+
|
|
11
14
|
// return (
|
|
12
|
-
// <
|
|
13
|
-
// {data.map((item) => (
|
|
14
|
-
// <SelectableTag
|
|
15
|
-
// key={item.name}
|
|
16
|
-
// checked={item.selected}
|
|
17
|
-
// onChange={() => {}}
|
|
18
|
-
// >
|
|
19
|
-
// <TemplateButton
|
|
20
|
-
// key={item.id}
|
|
21
|
-
// {...item}
|
|
22
|
-
// size={size}
|
|
23
|
-
// >
|
|
24
|
-
// {item.name}
|
|
25
|
-
// </TemplateButton>
|
|
26
|
-
// </SelectableTag>
|
|
27
|
-
// ))}
|
|
28
|
-
// </TagGroup>
|
|
15
|
+
// <TemplateGroup {...props}/>
|
|
29
16
|
// )
|
|
17
|
+
var _props$data = props.data,
|
|
18
|
+
data = _props$data === void 0 ? [] : _props$data,
|
|
19
|
+
size = props.size,
|
|
20
|
+
boxProps = props.boxProps,
|
|
21
|
+
tagProps = props.tagProps,
|
|
22
|
+
itemProps = props.itemProps;
|
|
23
|
+
var value = (_data$filter$ = data.filter(function (item) {
|
|
24
|
+
return item.selected;
|
|
25
|
+
})[0]) === null || _data$filter$ === void 0 ? void 0 : _data$filter$.id;
|
|
26
|
+
return /*#__PURE__*/React.createElement(TagSelect, {
|
|
27
|
+
defaultValue: value,
|
|
28
|
+
dataSource: data.map(function (item) {
|
|
29
|
+
return {
|
|
30
|
+
key: item.id,
|
|
31
|
+
content: /*#__PURE__*/React.createElement(TemplateButton, _extends({
|
|
32
|
+
key: item.id
|
|
33
|
+
}, item, {
|
|
34
|
+
size: size
|
|
35
|
+
}, itemProps), item.name)
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
boxProps: boxProps,
|
|
39
|
+
tagProps: tagProps
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/React.createElement(TagGroup, null, data.map(function (item) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(SelectableTag, {
|
|
43
|
+
key: item.name,
|
|
44
|
+
checked: item.selected,
|
|
45
|
+
onChange: function onChange() {}
|
|
46
|
+
}, /*#__PURE__*/React.createElement(TemplateButton, _extends({
|
|
47
|
+
key: item.id
|
|
48
|
+
}, item, {
|
|
49
|
+
size: size
|
|
50
|
+
}), item.name));
|
|
51
|
+
}));
|
|
30
52
|
};
|
|
31
53
|
|
|
32
54
|
export default TemplateSelect;
|
|
@@ -210,13 +210,28 @@ export default function (engine) {
|
|
|
210
210
|
|
|
211
211
|
links = [];
|
|
212
212
|
|
|
213
|
-
if (isEdit && rootState.topoCreateMod.elements.links.length) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
if (!(isEdit && rootState.topoCreateMod.elements.links.length)) {
|
|
214
|
+
_context3.next = 9;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
links = rootState.topoCreateMod.elements.links;
|
|
219
|
+
_context3.next = 12;
|
|
220
|
+
break;
|
|
221
|
+
|
|
222
|
+
case 9:
|
|
223
|
+
if (rootState.topoMod.topoData) {
|
|
224
|
+
_context3.next = 11;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return _context3.abrupt("return");
|
|
218
229
|
|
|
230
|
+
case 11:
|
|
231
|
+
links = rootState.topoMod.topoData.links;
|
|
219
232
|
|
|
233
|
+
case 12:
|
|
234
|
+
// 获取属性。无权限的属性为 []
|
|
220
235
|
allLinkAttributes = rootState.topoBizMod.attrsAndMetrics; // 告警
|
|
221
236
|
|
|
222
237
|
alarmMap = rootState.topoBizMod.alarmDoc; // 如果是显示模式,过滤有告警的链路
|
|
@@ -268,7 +283,7 @@ export default function (engine) {
|
|
|
268
283
|
engine.view.topoClient.batchSetLineStyle(linkStyleMap);
|
|
269
284
|
}
|
|
270
285
|
|
|
271
|
-
case
|
|
286
|
+
case 19:
|
|
272
287
|
case "end":
|
|
273
288
|
return _context3.stop();
|
|
274
289
|
}
|
package/es/models/topoMod.js
CHANGED
|
@@ -19,14 +19,13 @@ export default function (topoApp) {
|
|
|
19
19
|
urlParams: {},
|
|
20
20
|
topoLoading: true,
|
|
21
21
|
topoLoadError: false,
|
|
22
|
-
topoId: '',
|
|
23
|
-
topoName: '',
|
|
24
|
-
topoPermission: undefined,
|
|
25
22
|
viewState: 'view',
|
|
26
23
|
// view, create, 2种模式
|
|
27
|
-
|
|
24
|
+
topoId: '',
|
|
25
|
+
topoName: '',
|
|
28
26
|
topoData: null,
|
|
29
27
|
currentTopo: undefined,
|
|
28
|
+
topoPermission: undefined,
|
|
30
29
|
currentNode: {
|
|
31
30
|
id: '',
|
|
32
31
|
name: '无数据'
|
|
@@ -175,7 +174,10 @@ export default function (topoApp) {
|
|
|
175
174
|
},
|
|
176
175
|
clearData: function clearData() {
|
|
177
176
|
this.update({
|
|
178
|
-
|
|
177
|
+
topoId: '',
|
|
178
|
+
topoName: '',
|
|
179
|
+
topoData: null,
|
|
180
|
+
currentTopo: undefined
|
|
179
181
|
});
|
|
180
182
|
},
|
|
181
183
|
switchToViewMode: function switchToViewMode(playload, rootState) {
|
|
@@ -4,31 +4,11 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import topoServer from '@riil-frontend/component-topology-common/es/services/topo';
|
|
5
5
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
|
6
6
|
import { treeMockData, topoInteData } from "../../utils/topoMocks";
|
|
7
|
-
import { formatTree, loopTree, loopTreeFun,
|
|
7
|
+
import { formatTree, loopTree, loopTreeFun, findParentIdsById, treeNodeCount } from "../../utils/tree";
|
|
8
8
|
|
|
9
9
|
var clone = function clone(data) {
|
|
10
10
|
return JSON.parse(JSON.stringify(data));
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function findSelectedParentIds(data, selectedId) {
|
|
15
|
-
// 选中 id 为 -1,则没有默认选中项
|
|
16
|
-
if (selectedId == '-1') return [];
|
|
17
|
-
var node = {};
|
|
18
|
-
loopTree(data, selectedId, function (item, index, arr, pid) {
|
|
19
|
-
node = {
|
|
20
|
-
item: item,
|
|
21
|
-
pid: pid
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
if (!node.item) return [];
|
|
25
|
-
|
|
26
|
-
if (node.pid != -1 && node.item.id) {
|
|
27
|
-
return node.item.type === 0 ? ["" + node.item.id].concat(findSelectedParentIds(data, node.pid)) : [].concat(findSelectedParentIds(data, node.pid));
|
|
28
|
-
} else {
|
|
29
|
-
return ["" + node.item.id];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
11
|
+
};
|
|
32
12
|
/**
|
|
33
13
|
* TODO 导航树相关增删改移到拓扑中心
|
|
34
14
|
*/
|
|
@@ -81,7 +61,7 @@ export default function (topoApp) {
|
|
|
81
61
|
treeData: treeNodeCount(treeData),
|
|
82
62
|
defId: defId,
|
|
83
63
|
selectedNode: [selectedTopoId],
|
|
84
|
-
expandedKeys:
|
|
64
|
+
expandedKeys: findParentIdsById(treeData, selectedTopoId)
|
|
85
65
|
}); // console.log('resTreeData', resTreeData, rootState.topoMod.topoId);
|
|
86
66
|
|
|
87
67
|
|
|
@@ -366,10 +346,10 @@ export default function (topoApp) {
|
|
|
366
346
|
}
|
|
367
347
|
|
|
368
348
|
var expandedKeys = [].concat(treeState.expandedKeys || []);
|
|
369
|
-
var parentIds =
|
|
349
|
+
var parentIds = findParentIdsById(treeState.treeData, id);
|
|
370
350
|
expandedKeys.push.apply(expandedKeys, parentIds);
|
|
371
351
|
this.update({
|
|
372
|
-
selectedNode: [id],
|
|
352
|
+
selectedNode: ["" + id],
|
|
373
353
|
expandedKeys: expandedKeys
|
|
374
354
|
});
|
|
375
355
|
}
|
package/es/utils/template.js
CHANGED
package/es/utils/tree.js
CHANGED
|
@@ -87,6 +87,20 @@ export function findNodeById(tree, id) {
|
|
|
87
87
|
});
|
|
88
88
|
return node;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* 按id查找祖先节点id列表
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
export function findParentIdsById(tree, id) {
|
|
95
|
+
var node = findNodeById(tree, id);
|
|
96
|
+
var parentId = "" + node.parentId;
|
|
97
|
+
|
|
98
|
+
if (parentId === '-1') {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return [parentId].concat(findParentIdsById(tree, parentId));
|
|
103
|
+
}
|
|
90
104
|
/**
|
|
91
105
|
* 递归循环遍历树匹配KEY
|
|
92
106
|
* @param {array} json
|
|
@@ -46,7 +46,7 @@ var getTableData = /*#__PURE__*/function () {
|
|
|
46
46
|
switch (_context.prev = _context.next) {
|
|
47
47
|
case 0:
|
|
48
48
|
_params$current = params.current, current = _params$current === void 0 ? 1 : _params$current, _params$pageSize = params.pageSize, pageSize = _params$pageSize === void 0 ? 20 : _params$pageSize, _params$sortBy = params.sortBy, sortBy = _params$sortBy === void 0 ? 'displayName' : _params$sortBy, _params$sortOrder = params.sortOrder, sortOrder = _params$sortOrder === void 0 ? 'asc' : _params$sortOrder, like = params.like, typeCode = params.typeCode;
|
|
49
|
-
condition = 'category(\'resource\')';
|
|
49
|
+
condition = 'type(\'common_network\',\'switch\',\'switch_cluster\',\'linux\',\'windows\',\'oracle\',\'oracle.asm_disk_group\',\'tomcat\',\'application\',\'service\') && category(\'resource\')';
|
|
50
50
|
|
|
51
51
|
if (like) {
|
|
52
52
|
condition = {
|
|
@@ -90,7 +90,7 @@ var getTableData = /*#__PURE__*/function () {
|
|
|
90
90
|
|
|
91
91
|
};
|
|
92
92
|
});
|
|
93
|
-
return _context.abrupt("return", (0, _format.formatDataForTable)(dataSource, data.
|
|
93
|
+
return _context.abrupt("return", (0, _format.formatDataForTable)(dataSource, data.totalRecord, data.pageIndex, data.pageSize));
|
|
94
94
|
|
|
95
95
|
case 9:
|
|
96
96
|
case "end":
|
|
@@ -172,7 +172,7 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
172
172
|
|
|
173
173
|
};
|
|
174
174
|
var defaultColumns = [{
|
|
175
|
-
title: '
|
|
175
|
+
title: '资源名称',
|
|
176
176
|
dataIndex: 'displayName',
|
|
177
177
|
sortable: true,
|
|
178
178
|
cell: _table.getTitleCell
|
|
@@ -184,7 +184,7 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
184
184
|
return (0, _table.getTitleCell)((0, _format.getIp)(ip));
|
|
185
185
|
}
|
|
186
186
|
}, {
|
|
187
|
-
title: '
|
|
187
|
+
title: '资源类型',
|
|
188
188
|
dataIndex: 'typeCode',
|
|
189
189
|
filters: filters.typeCode,
|
|
190
190
|
cell: function cell(code) {
|
|
@@ -194,17 +194,17 @@ var ResourceList = function ResourceList(props, ref) {
|
|
|
194
194
|
var name = dict && dict.label || code;
|
|
195
195
|
return (0, _table.getTitleCell)(name);
|
|
196
196
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
197
|
+
} // {
|
|
198
|
+
// title: '厂商',
|
|
199
|
+
// sortable: true,
|
|
200
|
+
// dataIndex: 'company',
|
|
201
|
+
// cell: (code) => {
|
|
202
|
+
// const dict = DICT.get(code);
|
|
203
|
+
// const name = (dict && dict.name) || code;
|
|
204
|
+
// return getTitleCell(name);
|
|
205
|
+
// },
|
|
206
|
+
// }
|
|
207
|
+
];
|
|
208
208
|
return /*#__PURE__*/_react["default"].createElement(_FormTable["default"], {
|
|
209
209
|
className: className || _ResourceSelectModule["default"].table,
|
|
210
210
|
formProps: formProps,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
exports.__esModule = true;
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _box = _interopRequireDefault(require("@alifd/next/lib/box"));
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _tag = _interopRequireDefault(require("@alifd/next/lib/tag"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
require("./index.scss");
|
|
21
|
+
|
|
22
|
+
var SelectableTag = _tag["default"].Selectable;
|
|
23
|
+
|
|
24
|
+
var TagSelect = function TagSelect(props) {
|
|
25
|
+
var _onChange = props.onChange,
|
|
26
|
+
value = props.value,
|
|
27
|
+
dataSource = props.dataSource,
|
|
28
|
+
defaultValue = props.defaultValue,
|
|
29
|
+
boxProps = props.boxProps,
|
|
30
|
+
tagProps = props.tagProps;
|
|
31
|
+
|
|
32
|
+
var _useState = (0, _react.useState)(value || defaultValue),
|
|
33
|
+
current = _useState[0],
|
|
34
|
+
setCurrent = _useState[1];
|
|
35
|
+
|
|
36
|
+
(0, _react.useEffect)(function () {
|
|
37
|
+
if (value) {
|
|
38
|
+
setCurrent(value);
|
|
39
|
+
}
|
|
40
|
+
}, [value]);
|
|
41
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
42
|
+
className: "tag-select-wrap"
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement(_box["default"], (0, _extends2["default"])({
|
|
44
|
+
spacing: 8,
|
|
45
|
+
wrap: true,
|
|
46
|
+
direction: "row"
|
|
47
|
+
}, boxProps), dataSource.map(function (item) {
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
49
|
+
className: "tag-select-item",
|
|
50
|
+
key: "wrap-" + item.key
|
|
51
|
+
}, /*#__PURE__*/_react["default"].createElement(SelectableTag, (0, _extends2["default"])({
|
|
52
|
+
key: item.key,
|
|
53
|
+
checked: current === item.key,
|
|
54
|
+
onChange: function onChange(checked) {
|
|
55
|
+
_onChange && _onChange(item.key);
|
|
56
|
+
|
|
57
|
+
if (!('value' in props)) {
|
|
58
|
+
setCurrent(item.key);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, tagProps), item.content));
|
|
62
|
+
})));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
TagSelect.propTypes = {
|
|
66
|
+
onChange: _propTypes["default"].func,
|
|
67
|
+
value: _propTypes["default"].string,
|
|
68
|
+
defaultValue: _propTypes["default"].string,
|
|
69
|
+
dataSource: _propTypes["default"].array,
|
|
70
|
+
boxProps: _propTypes["default"].any
|
|
71
|
+
};
|
|
72
|
+
TagSelect.defaultProps = {
|
|
73
|
+
boxProps: {}
|
|
74
|
+
};
|
|
75
|
+
var _default = TagSelect;
|
|
76
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* write style here */
|
|
2
|
+
@import '@alifd/next/variables.scss';
|
|
3
|
+
.tag-select-wrap {
|
|
4
|
+
.tag-select-item {
|
|
5
|
+
text-align: -webkit-center;
|
|
6
|
+
.#{$css-prefix}tag {
|
|
7
|
+
height: auto;
|
|
8
|
+
line-height: 0;
|
|
9
|
+
&::before {
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
&::after {
|
|
13
|
+
z-index: 1;
|
|
14
|
+
}
|
|
15
|
+
.#{$css-prefix}tag-body {
|
|
16
|
+
width: 100%;
|
|
17
|
+
padding: 0;
|
|
18
|
+
.tag-select-img {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.tag-select-label {
|
|
23
|
+
margin-top: 4px;
|
|
24
|
+
max-width: fit-content;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -11,7 +11,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
16
|
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
17
17
|
|
|
@@ -20,8 +20,6 @@ var _indexModule = _interopRequireDefault(require("./index.module.scss"));
|
|
|
20
20
|
var _excluded = ["className", "children", "icon", "id", "selected", "onSelect", "size"];
|
|
21
21
|
|
|
22
22
|
var TemplateButton = function TemplateButton(props) {
|
|
23
|
-
var _classnames;
|
|
24
|
-
|
|
25
23
|
var className = props.className,
|
|
26
24
|
children = props.children,
|
|
27
25
|
icon = props.icon,
|
|
@@ -37,7 +35,18 @@ var TemplateButton = function TemplateButton(props) {
|
|
|
37
35
|
};
|
|
38
36
|
|
|
39
37
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
40
|
-
className: (0,
|
|
38
|
+
className: (0, _classnames["default"])(_indexModule["default"].card, className),
|
|
39
|
+
onClick: handleClick
|
|
40
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
41
|
+
className: _indexModule["default"].iconWrapper
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], (0, _extends2["default"])({
|
|
43
|
+
className: _indexModule["default"].icon,
|
|
44
|
+
type: icon
|
|
45
|
+
}, rest))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
|
+
className: _indexModule["default"].text
|
|
47
|
+
}, children));
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
49
|
+
className: (0, _classnames["default"])(_indexModule["default"].card, className),
|
|
41
50
|
onClick: handleClick
|
|
42
51
|
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], (0, _extends2["default"])({
|
|
43
52
|
className: _indexModule["default"].icon,
|