@riil-frontend/component-topology 11.0.32 → 11.0.33
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 +8 -8
- package/es/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
- package/es/core/editor/components/settings/propertyViews/node/data/Data.js +6 -35
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/services/topo/basic.js +143 -7
- package/es/core/store/models/topoBizMod.js +0 -34
- package/es/networkTopo/services/topo/basic.js +10 -77
- package/lib/core/editor/components/Toolbar/widgets/IconSelect/index.module.scss +1 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/Data.js +6 -38
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/services/topo/basic.js +147 -8
- package/lib/core/store/models/topoBizMod.js +0 -34
- package/lib/networkTopo/services/topo/basic.js +10 -80
- package/package.json +7 -4
- package/es/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -102
- package/es/core/editor/components/settings/propertyViews/node/data/PlatformDisplay.js +0 -15
- package/lib/core/editor/components/settings/propertyViews/node/data/BindIpInput.js +0 -118
- package/lib/core/editor/components/settings/propertyViews/node/data/PlatformDisplay.js +0 -23
@@ -3,43 +3,182 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
|
-
exports["default"] = void 0;
|
6
|
+
exports["default"] = exports.TOPO_PARENT_ID = exports.TOPO_GROUP_ID = void 0;
|
7
7
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
9
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
11
11
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
|
+
|
12
14
|
var _componentTopologyUtils = require("@riil-frontend/component-topology-utils");
|
13
15
|
|
14
16
|
var _constants = require("./constants");
|
15
17
|
|
18
|
+
var API_ROOT = _constants.TOPO_API_ROOT;
|
19
|
+
/**
|
20
|
+
* 拓扑图(看做一个容器)的“父容器”ID
|
21
|
+
*/
|
22
|
+
|
23
|
+
var TOPO_PARENT_ID = -2;
|
24
|
+
/**
|
25
|
+
* 拓扑图(看做一个容器)的容器ID
|
26
|
+
*/
|
27
|
+
|
28
|
+
exports.TOPO_PARENT_ID = TOPO_PARENT_ID;
|
29
|
+
var TOPO_GROUP_ID = -1;
|
30
|
+
exports.TOPO_GROUP_ID = TOPO_GROUP_ID;
|
31
|
+
var DEFAULT_QUERY = {
|
32
|
+
current: 1,
|
33
|
+
pageSize: 200,
|
34
|
+
sortBy: 'name',
|
35
|
+
sortOrder: 'asc'
|
36
|
+
};
|
37
|
+
|
38
|
+
function prepareResourceParams(conditions, query) {
|
39
|
+
if (query === void 0) {
|
40
|
+
query = DEFAULT_QUERY;
|
41
|
+
}
|
42
|
+
|
43
|
+
var dynamicRes = conditions.dynamic,
|
44
|
+
staticRes = conditions["static"],
|
45
|
+
stateValue = conditions.stateValue;
|
46
|
+
var dynamicCondition = dynamicRes && {
|
47
|
+
stateValue: stateValue,
|
48
|
+
condition: dynamicRes
|
49
|
+
} || undefined;
|
50
|
+
|
51
|
+
if (dynamicCondition && query) {
|
52
|
+
dynamicCondition.currentPage = query.current;
|
53
|
+
dynamicCondition.pageSize = query.pageSize;
|
54
|
+
dynamicCondition.sort = query.sortBy + " " + query.sortOrder;
|
55
|
+
}
|
56
|
+
|
57
|
+
return {
|
58
|
+
dynamicCondition: dynamicCondition,
|
59
|
+
fixedConditionIdList: (staticRes || []).filter(function (ciId) {
|
60
|
+
return !ciId.startsWith('ip:');
|
61
|
+
}),
|
62
|
+
linkIps: (staticRes || []).filter(function (ciId) {
|
63
|
+
return ciId.startsWith('ip:');
|
64
|
+
}).map(function (ciId) {
|
65
|
+
return ciId.replace('ip:', '');
|
66
|
+
})
|
67
|
+
};
|
68
|
+
}
|
69
|
+
|
70
|
+
function prepareGroupParams(modifiedGroups) {
|
71
|
+
if (modifiedGroups === void 0) {
|
72
|
+
modifiedGroups = [];
|
73
|
+
}
|
74
|
+
|
75
|
+
var groups = modifiedGroups.map(function (group, index) {
|
76
|
+
var id = group.id,
|
77
|
+
layout = group.layout,
|
78
|
+
_group$parentId = group.parentId,
|
79
|
+
parentId = _group$parentId === void 0 ? TOPO_GROUP_ID : _group$parentId,
|
80
|
+
_group$name = group.name,
|
81
|
+
name = _group$name === void 0 ? '' : _group$name,
|
82
|
+
expanded = group.expanded,
|
83
|
+
_group$styles = group.styles,
|
84
|
+
styles = _group$styles === void 0 ? {} : _group$styles,
|
85
|
+
resources = group.resources,
|
86
|
+
tag = group.tag;
|
87
|
+
|
88
|
+
if (!resources) {
|
89
|
+
return null;
|
90
|
+
}
|
91
|
+
|
92
|
+
var topoGroup = {
|
93
|
+
id: id,
|
94
|
+
layout: layout,
|
95
|
+
parentId: parentId,
|
96
|
+
name: name,
|
97
|
+
styles: JSON.stringify(expanded !== undefined ? (0, _extends2["default"])({}, styles, {
|
98
|
+
showExpanded: expanded
|
99
|
+
}) : styles),
|
100
|
+
order: index,
|
101
|
+
tag: tag
|
102
|
+
};
|
103
|
+
return {
|
104
|
+
topoGroup: topoGroup,
|
105
|
+
condition: prepareResourceParams(resources)
|
106
|
+
};
|
107
|
+
}).filter(Boolean);
|
108
|
+
return {
|
109
|
+
groups: groups
|
110
|
+
};
|
111
|
+
}
|
112
|
+
|
16
113
|
var _default = {
|
17
114
|
/**
|
18
|
-
*
|
115
|
+
* 查询拓扑数据
|
19
116
|
* @param {Number} id Topo ID
|
20
|
-
* @param {
|
117
|
+
* @param {Object} resources
|
118
|
+
* @param {Array} groups
|
21
119
|
* @returns
|
22
120
|
*/
|
23
|
-
|
121
|
+
getTopoDataByResource: function getTopoDataByResource(id, resources, groups, exportLinkIdList) {
|
24
122
|
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
123
|
+
var data, obj;
|
25
124
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
26
125
|
while (1) {
|
27
126
|
switch (_context.prev = _context.next) {
|
28
127
|
case 0:
|
29
|
-
|
128
|
+
data = Array.isArray(groups) ? groups : [];
|
129
|
+
|
130
|
+
if (resources) {
|
131
|
+
data.push({
|
132
|
+
parentId: TOPO_PARENT_ID,
|
133
|
+
order: 100,
|
134
|
+
resources: resources
|
135
|
+
});
|
136
|
+
}
|
137
|
+
|
138
|
+
obj = prepareGroupParams(data);
|
139
|
+
_context.next = 5;
|
140
|
+
return _componentTopologyUtils.request.post(API_ROOT + "/structure/byCondition/" + id, (0, _extends2["default"])({}, obj, {
|
141
|
+
exportLinkIdList: exportLinkIdList
|
142
|
+
}));
|
143
|
+
|
144
|
+
case 5:
|
145
|
+
return _context.abrupt("return", _context.sent);
|
146
|
+
|
147
|
+
case 6:
|
148
|
+
case "end":
|
149
|
+
return _context.stop();
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}, _callee);
|
153
|
+
}))();
|
154
|
+
},
|
155
|
+
|
156
|
+
/**
|
157
|
+
* 保存拓扑绘制数据(第三方库内部结构,无需关心含义)
|
158
|
+
* @param {Number} id Topo ID
|
159
|
+
* @param {String} data ht拓扑序列化数据
|
160
|
+
* @returns
|
161
|
+
*/
|
162
|
+
saveSerializeData: function saveSerializeData(id, data) {
|
163
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
164
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
165
|
+
while (1) {
|
166
|
+
switch (_context2.prev = _context2.next) {
|
167
|
+
case 0:
|
168
|
+
_context2.next = 2;
|
30
169
|
return _componentTopologyUtils.request.post(_constants.TOPO_API_ROOT + "/structure/" + id, {
|
31
170
|
data: data
|
32
171
|
});
|
33
172
|
|
34
173
|
case 2:
|
35
|
-
return
|
174
|
+
return _context2.abrupt("return", _context2.sent);
|
36
175
|
|
37
176
|
case 3:
|
38
177
|
case "end":
|
39
|
-
return
|
178
|
+
return _context2.stop();
|
40
179
|
}
|
41
180
|
}
|
42
|
-
},
|
181
|
+
}, _callee2);
|
43
182
|
}))();
|
44
183
|
}
|
45
184
|
};
|
@@ -65,40 +65,6 @@ function _default(engine) {
|
|
65
65
|
}, _callee);
|
66
66
|
}))();
|
67
67
|
},
|
68
|
-
// 根据ci的id获取属性的值
|
69
|
-
getCiArrByIds: function getCiArrByIds(conditions, state) {
|
70
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
71
|
-
var resIdsList, result;
|
72
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
73
|
-
while (1) {
|
74
|
-
switch (_context2.prev = _context2.next) {
|
75
|
-
case 0:
|
76
|
-
resIdsList = state.topoBizMod.resAndMetrics.resIdsList; // rlog.debug('根据ci的id获取属性的值-getCiArrByIds', resIdsList);
|
77
|
-
// const ciIds = encodeURIComponent(resIdsList);
|
78
|
-
|
79
|
-
_context2.prev = 1;
|
80
|
-
_context2.next = 4;
|
81
|
-
return _topo["default"].getBatchCiArr({
|
82
|
-
ids: resIdsList
|
83
|
-
});
|
84
|
-
|
85
|
-
case 4:
|
86
|
-
result = _context2.sent;
|
87
|
-
return _context2.abrupt("return", result.content);
|
88
|
-
|
89
|
-
case 8:
|
90
|
-
_context2.prev = 8;
|
91
|
-
_context2.t0 = _context2["catch"](1);
|
92
|
-
return _context2.abrupt("return", null);
|
93
|
-
|
94
|
-
case 11:
|
95
|
-
case "end":
|
96
|
-
return _context2.stop();
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}, _callee2, null, [[1, 8]]);
|
100
|
-
}))();
|
101
|
-
},
|
102
68
|
|
103
69
|
/**
|
104
70
|
* 设置属性和指标
|
@@ -21,8 +21,6 @@ var _blacklist = _interopRequireDefault(require("./blacklist"));
|
|
21
21
|
|
22
22
|
var _constants = require("./constants");
|
23
23
|
|
24
|
-
var _cmdb = require("../cmdb");
|
25
|
-
|
26
24
|
var _model = require("../model");
|
27
25
|
|
28
26
|
var _exitLinkUtil = require("../../utils/exitLinkUtil");
|
@@ -48,10 +46,6 @@ var DEFAULT_QUERY = {
|
|
48
46
|
sortOrder: 'asc'
|
49
47
|
};
|
50
48
|
|
51
|
-
function isAvailableArray(arr) {
|
52
|
-
return arr && Array.isArray(arr) && arr.length > 0;
|
53
|
-
}
|
54
|
-
|
55
49
|
function prepareResourceParams(conditions, query) {
|
56
50
|
if (query === void 0) {
|
57
51
|
query = DEFAULT_QUERY;
|
@@ -59,10 +53,7 @@ function prepareResourceParams(conditions, query) {
|
|
59
53
|
|
60
54
|
var dynamicRes = conditions.dynamic,
|
61
55
|
staticRes = conditions["static"],
|
62
|
-
stateValue = conditions.stateValue;
|
63
|
-
// return null;
|
64
|
-
// }
|
65
|
-
|
56
|
+
stateValue = conditions.stateValue;
|
66
57
|
var dynamicCondition = dynamicRes && {
|
67
58
|
stateValue: stateValue,
|
68
59
|
condition: dynamicRes
|
@@ -474,7 +465,7 @@ var _default = (0, _extends2["default"])({
|
|
474
465
|
while (1) {
|
475
466
|
switch (_context13.prev = _context13.next) {
|
476
467
|
case 0:
|
477
|
-
data =
|
468
|
+
data = Array.isArray(groups) ? groups : [];
|
478
469
|
|
479
470
|
if (resources) {
|
480
471
|
data.push({
|
@@ -523,7 +514,7 @@ var _default = (0, _extends2["default"])({
|
|
523
514
|
switch (_context14.prev = _context14.next) {
|
524
515
|
case 0:
|
525
516
|
groups = config.groups, resources = config.resources, exportLinkIdList = config.exportLinkIdList, otherConfig = (0, _objectWithoutPropertiesLoose2["default"])(config, _excluded);
|
526
|
-
newGroups =
|
517
|
+
newGroups = Array.isArray(groups) ? groups : [];
|
527
518
|
|
528
519
|
if (resources) {
|
529
520
|
// 新建拓扑时
|
@@ -659,48 +650,6 @@ var _default = (0, _extends2["default"])({
|
|
659
650
|
}))();
|
660
651
|
},
|
661
652
|
|
662
|
-
/**
|
663
|
-
* 根据资源id获取属性及属性值
|
664
|
-
* @param {*} params Topo ID
|
665
|
-
*/
|
666
|
-
getAttributesByIds: function getAttributesByIds(params) {
|
667
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19() {
|
668
|
-
var _params$ids;
|
669
|
-
|
670
|
-
var param;
|
671
|
-
return _regenerator["default"].wrap(function _callee19$(_context19) {
|
672
|
-
while (1) {
|
673
|
-
switch (_context19.prev = _context19.next) {
|
674
|
-
case 0:
|
675
|
-
if (!(((_params$ids = params.ids) === null || _params$ids === void 0 ? void 0 : _params$ids.length) > 0)) {
|
676
|
-
_context19.next = 6;
|
677
|
-
break;
|
678
|
-
}
|
679
|
-
|
680
|
-
param = {
|
681
|
-
condition: "id('" + params.ids.join("','") + "')",
|
682
|
-
sort: 'index DESC',
|
683
|
-
currentPage: 1,
|
684
|
-
pageSize: params.ids.length > 10 ? params.ids.length : 10
|
685
|
-
};
|
686
|
-
|
687
|
-
_rlog["default"].debug('getAttributesByIds', param);
|
688
|
-
|
689
|
-
_context19.next = 5;
|
690
|
-
return (0, _cmdb.commonQuery)(param);
|
691
|
-
|
692
|
-
case 5:
|
693
|
-
return _context19.abrupt("return", _context19.sent);
|
694
|
-
|
695
|
-
case 6:
|
696
|
-
case "end":
|
697
|
-
return _context19.stop();
|
698
|
-
}
|
699
|
-
}
|
700
|
-
}, _callee19);
|
701
|
-
}))();
|
702
|
-
},
|
703
|
-
|
704
653
|
/**
|
705
654
|
* 批量查询ci信息接口
|
706
655
|
* @param {*} params Topo ID
|
@@ -725,47 +674,28 @@ var _default = (0, _extends2["default"])({
|
|
725
674
|
}
|
726
675
|
},
|
727
676
|
|
728
|
-
/**
|
729
|
-
* 批量查询ci属性
|
730
|
-
* @param {*} params Topo ID
|
731
|
-
*/
|
732
|
-
getBatchCiArr: function getBatchCiArr(params) {
|
733
|
-
var _params$ids2;
|
734
|
-
|
735
|
-
if (((_params$ids2 = params.ids) === null || _params$ids2 === void 0 ? void 0 : _params$ids2.length) > 0) {
|
736
|
-
var param = {
|
737
|
-
condition: "id('" + params.ids.join("','") + "')",
|
738
|
-
sort: 'name asc',
|
739
|
-
currentPage: 1,
|
740
|
-
pageSize: 999
|
741
|
-
}; // rlog.debug('getBatchCi', param);
|
742
|
-
|
743
|
-
return (0, _cmdb.commonQuery)(param);
|
744
|
-
}
|
745
|
-
},
|
746
|
-
|
747
677
|
/**
|
748
678
|
* 批量查询ci指标属性
|
749
679
|
* @param {*} params Topo ID
|
750
680
|
*/
|
751
681
|
getBatchCiPolling: function getBatchCiPolling(params) {
|
752
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
753
|
-
return _regenerator["default"].wrap(function
|
682
|
+
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19() {
|
683
|
+
return _regenerator["default"].wrap(function _callee19$(_context19) {
|
754
684
|
while (1) {
|
755
|
-
switch (
|
685
|
+
switch (_context19.prev = _context19.next) {
|
756
686
|
case 0:
|
757
|
-
|
687
|
+
_context19.next = 2;
|
758
688
|
return _componentTopologyUtils.request.post(_constants.TOPO_API_ROOT + "/attributes/polling", params);
|
759
689
|
|
760
690
|
case 2:
|
761
|
-
return
|
691
|
+
return _context19.abrupt("return", _context19.sent);
|
762
692
|
|
763
693
|
case 3:
|
764
694
|
case "end":
|
765
|
-
return
|
695
|
+
return _context19.stop();
|
766
696
|
}
|
767
697
|
}
|
768
|
-
},
|
698
|
+
}, _callee19);
|
769
699
|
}))();
|
770
700
|
}
|
771
701
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "11.0.
|
3
|
+
"version": "11.0.33",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -80,8 +80,9 @@
|
|
80
80
|
"@riil-frontend/hooks": "latest",
|
81
81
|
"@riil-frontend/next-collapse": "^1.0.1-a.0",
|
82
82
|
"@riil-frontend/utils": "^1.0.20",
|
83
|
+
"@types/jest": "^29.5.4",
|
83
84
|
"axios": "^0.21.1",
|
84
|
-
"build-plugin-component": "^1.
|
85
|
+
"build-plugin-component": "^1.12.1",
|
85
86
|
"build-plugin-fusion": "^0.1.0",
|
86
87
|
"build-plugin-moment-locales": "^0.1.0",
|
87
88
|
"build-scripts": "^1.1.1",
|
@@ -92,7 +93,9 @@
|
|
92
93
|
"enzyme-adapter-react-16": "^1.15.4",
|
93
94
|
"eslint": "^6.0.1",
|
94
95
|
"html2canvas": "^1.3.2",
|
95
|
-
"
|
96
|
+
"identity-obj-proxy": "^3.0.0",
|
97
|
+
"jest": "^24.9.0",
|
98
|
+
"jest-environment-jsdom": "^24.9.0",
|
96
99
|
"jspdf": "^2.3.1",
|
97
100
|
"lnk-cli": "^1.0.1",
|
98
101
|
"lodash": "^4.17.19",
|
@@ -118,6 +121,6 @@
|
|
118
121
|
"access": "public"
|
119
122
|
},
|
120
123
|
"license": "MIT",
|
121
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@11.0.
|
124
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@11.0.33/build/index.html",
|
122
125
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
123
126
|
}
|
@@ -1,102 +0,0 @@
|
|
1
|
-
import _Button from "@alifd/next/es/button";
|
2
|
-
import _Input from "@alifd/next/es/input";
|
3
|
-
import _Form from "@alifd/next/es/form";
|
4
|
-
import React, { useState, useEffect } from "react";
|
5
|
-
import { isUniqueIp } from "../../../../../../../networkTopo/utils/exitLinkUtil";
|
6
|
-
var FormItem = _Form.Item;
|
7
|
-
/**
|
8
|
-
* @return {React.ReactNode | null}
|
9
|
-
*/
|
10
|
-
|
11
|
-
export default function BindIpInput(props) {
|
12
|
-
var _values$attrObjectBi;
|
13
|
-
|
14
|
-
var nodeElement = props.nodeElement,
|
15
|
-
topo = props.topo,
|
16
|
-
topoEditApi = props.topoEditApi,
|
17
|
-
values = props.values,
|
18
|
-
onChange = props.onChange,
|
19
|
-
fieldItem = props.fieldItem; // const currentResId = node.tag;
|
20
|
-
// console.log(
|
21
|
-
// "nodeElement, topo, topoEditApi, node",
|
22
|
-
// nodeElement,
|
23
|
-
// topo,
|
24
|
-
// topoEditApi,
|
25
|
-
// values
|
26
|
-
// );
|
27
|
-
|
28
|
-
var _useState = useState(""),
|
29
|
-
error = _useState[0],
|
30
|
-
setError = _useState[1];
|
31
|
-
|
32
|
-
var _useState2 = useState((_values$attrObjectBi = values["attrObject.bindIp"]) !== null && _values$attrObjectBi !== void 0 ? _values$attrObjectBi : ""),
|
33
|
-
txtValue = _useState2[0],
|
34
|
-
setTxtValue = _useState2[1];
|
35
|
-
|
36
|
-
var saveIp = function saveIp(v) {
|
37
|
-
fieldItem.validate(function (errors, vals) {
|
38
|
-
if (errors) {
|
39
|
-
console.error("saveIp-error", errors, vals);
|
40
|
-
} else {
|
41
|
-
setError("");
|
42
|
-
onChange(txtValue);
|
43
|
-
topoEditApi.relateNodeIp(txtValue, nodeElement);
|
44
|
-
}
|
45
|
-
});
|
46
|
-
};
|
47
|
-
|
48
|
-
useEffect(function () {
|
49
|
-
fieldItem.reset();
|
50
|
-
setTxtValue(values["attrObject.bindIp"]);
|
51
|
-
}, [values]);
|
52
|
-
|
53
|
-
var inputChange = function inputChange(v) {
|
54
|
-
setTxtValue(v); // onChange(v);
|
55
|
-
}; // 图片节点验证ip唯一性
|
56
|
-
|
57
|
-
|
58
|
-
var checkIp = function checkIp(rule, value, callback) {
|
59
|
-
var dm = topo.getDataModel();
|
60
|
-
var isUnique = isUniqueIp(dm, value, nodeElement); // console.log("checkIp", isUnique);
|
61
|
-
|
62
|
-
if (!isUnique) {
|
63
|
-
return callback("ip不能重复");
|
64
|
-
} else {
|
65
|
-
return callback();
|
66
|
-
}
|
67
|
-
};
|
68
|
-
|
69
|
-
return /*#__PURE__*/React.createElement("div", {
|
70
|
-
style: {
|
71
|
-
display: "flex",
|
72
|
-
width: "100%"
|
73
|
-
}
|
74
|
-
}, /*#__PURE__*/React.createElement(FormItem, {
|
75
|
-
label: "\u5173\u8054IP",
|
76
|
-
pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
|
77
|
-
patternTrigger: "onBlur",
|
78
|
-
patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E",
|
79
|
-
validator: checkIp,
|
80
|
-
style: {
|
81
|
-
width: "100%"
|
82
|
-
}
|
83
|
-
}, /*#__PURE__*/React.createElement(_Input, {
|
84
|
-
placeholder: "\u8BF7\u8F93\u5165IP\u5730\u5740",
|
85
|
-
name: "attrObject.bindIp",
|
86
|
-
state: error,
|
87
|
-
value: txtValue,
|
88
|
-
maxLength: 128,
|
89
|
-
onChange: inputChange,
|
90
|
-
style: {
|
91
|
-
width: 200
|
92
|
-
}
|
93
|
-
})), /*#__PURE__*/React.createElement(_Button, {
|
94
|
-
type: "primary",
|
95
|
-
text: true,
|
96
|
-
onClick: saveIp,
|
97
|
-
style: {
|
98
|
-
marginLeft: 8,
|
99
|
-
marginTop: 27
|
100
|
-
}
|
101
|
-
}, "\u4FDD\u5B58"));
|
102
|
-
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
|
3
|
-
function PlatformDisplay(props) {
|
4
|
-
var topo = props.topo,
|
5
|
-
node = props.node;
|
6
|
-
var data = topo.dataModel.useDataById(node.getTag());
|
7
|
-
|
8
|
-
if (!data) {
|
9
|
-
return '';
|
10
|
-
}
|
11
|
-
|
12
|
-
return data.level === '0' ? data.sourceName : '本级平台';
|
13
|
-
}
|
14
|
-
|
15
|
-
export default PlatformDisplay;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
exports.__esModule = true;
|
6
|
-
exports["default"] = BindIpInput;
|
7
|
-
|
8
|
-
var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
|
9
|
-
|
10
|
-
var _input = _interopRequireDefault(require("@alifd/next/lib/input"));
|
11
|
-
|
12
|
-
var _form = _interopRequireDefault(require("@alifd/next/lib/form"));
|
13
|
-
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
15
|
-
|
16
|
-
var _exitLinkUtil = require("../../../../../../../networkTopo/utils/exitLinkUtil");
|
17
|
-
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19
|
-
|
20
|
-
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; }
|
21
|
-
|
22
|
-
var FormItem = _form["default"].Item;
|
23
|
-
/**
|
24
|
-
* @return {React.ReactNode | null}
|
25
|
-
*/
|
26
|
-
|
27
|
-
function BindIpInput(props) {
|
28
|
-
var _values$attrObjectBi;
|
29
|
-
|
30
|
-
var nodeElement = props.nodeElement,
|
31
|
-
topo = props.topo,
|
32
|
-
topoEditApi = props.topoEditApi,
|
33
|
-
values = props.values,
|
34
|
-
onChange = props.onChange,
|
35
|
-
fieldItem = props.fieldItem; // const currentResId = node.tag;
|
36
|
-
// console.log(
|
37
|
-
// "nodeElement, topo, topoEditApi, node",
|
38
|
-
// nodeElement,
|
39
|
-
// topo,
|
40
|
-
// topoEditApi,
|
41
|
-
// values
|
42
|
-
// );
|
43
|
-
|
44
|
-
var _useState = (0, _react.useState)(""),
|
45
|
-
error = _useState[0],
|
46
|
-
setError = _useState[1];
|
47
|
-
|
48
|
-
var _useState2 = (0, _react.useState)((_values$attrObjectBi = values["attrObject.bindIp"]) !== null && _values$attrObjectBi !== void 0 ? _values$attrObjectBi : ""),
|
49
|
-
txtValue = _useState2[0],
|
50
|
-
setTxtValue = _useState2[1];
|
51
|
-
|
52
|
-
var saveIp = function saveIp(v) {
|
53
|
-
fieldItem.validate(function (errors, vals) {
|
54
|
-
if (errors) {
|
55
|
-
console.error("saveIp-error", errors, vals);
|
56
|
-
} else {
|
57
|
-
setError("");
|
58
|
-
onChange(txtValue);
|
59
|
-
topoEditApi.relateNodeIp(txtValue, nodeElement);
|
60
|
-
}
|
61
|
-
});
|
62
|
-
};
|
63
|
-
|
64
|
-
(0, _react.useEffect)(function () {
|
65
|
-
fieldItem.reset();
|
66
|
-
setTxtValue(values["attrObject.bindIp"]);
|
67
|
-
}, [values]);
|
68
|
-
|
69
|
-
var inputChange = function inputChange(v) {
|
70
|
-
setTxtValue(v); // onChange(v);
|
71
|
-
}; // 图片节点验证ip唯一性
|
72
|
-
|
73
|
-
|
74
|
-
var checkIp = function checkIp(rule, value, callback) {
|
75
|
-
var dm = topo.getDataModel();
|
76
|
-
var isUnique = (0, _exitLinkUtil.isUniqueIp)(dm, value, nodeElement); // console.log("checkIp", isUnique);
|
77
|
-
|
78
|
-
if (!isUnique) {
|
79
|
-
return callback("ip不能重复");
|
80
|
-
} else {
|
81
|
-
return callback();
|
82
|
-
}
|
83
|
-
};
|
84
|
-
|
85
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
86
|
-
style: {
|
87
|
-
display: "flex",
|
88
|
-
width: "100%"
|
89
|
-
}
|
90
|
-
}, /*#__PURE__*/_react["default"].createElement(FormItem, {
|
91
|
-
label: "\u5173\u8054IP",
|
92
|
-
pattern: /^((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))$/,
|
93
|
-
patternTrigger: "onBlur",
|
94
|
-
patternMessage: "IP\u5730\u5740\u683C\u5F0F\u4E0D\u6B63\u786E",
|
95
|
-
validator: checkIp,
|
96
|
-
style: {
|
97
|
-
width: "100%"
|
98
|
-
}
|
99
|
-
}, /*#__PURE__*/_react["default"].createElement(_input["default"], {
|
100
|
-
placeholder: "\u8BF7\u8F93\u5165IP\u5730\u5740",
|
101
|
-
name: "attrObject.bindIp",
|
102
|
-
state: error,
|
103
|
-
value: txtValue,
|
104
|
-
maxLength: 128,
|
105
|
-
onChange: inputChange,
|
106
|
-
style: {
|
107
|
-
width: 200
|
108
|
-
}
|
109
|
-
})), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
110
|
-
type: "primary",
|
111
|
-
text: true,
|
112
|
-
onClick: saveIp,
|
113
|
-
style: {
|
114
|
-
marginLeft: 8,
|
115
|
-
marginTop: 27
|
116
|
-
}
|
117
|
-
}, "\u4FDD\u5B58"));
|
118
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
exports.__esModule = true;
|
6
|
-
exports["default"] = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
function PlatformDisplay(props) {
|
11
|
-
var topo = props.topo,
|
12
|
-
node = props.node;
|
13
|
-
var data = topo.dataModel.useDataById(node.getTag());
|
14
|
-
|
15
|
-
if (!data) {
|
16
|
-
return '';
|
17
|
-
}
|
18
|
-
|
19
|
-
return data.level === '0' ? data.sourceName : '本级平台';
|
20
|
-
}
|
21
|
-
|
22
|
-
var _default = PlatformDisplay;
|
23
|
-
exports["default"] = _default;
|