@riil-frontend/component-topology 11.0.28 → 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/index.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +3 -5
- 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/test/Test.js +4 -5
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +3 -5
- 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/test/Test.js +4 -5
- package/package.json +2 -2
- 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/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/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/networkTopo/store/linkDynamicStyle.js +0 -263
- package/lib/networkTopo/store/linkDynamicStyleConfig.js +0 -186
- package/lib/networkTopo/store/linkManager.js +0 -42
@@ -1,70 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
exports.__esModule = true;
|
5
|
-
exports["default"] = void 0;
|
6
|
-
var _table = _interopRequireDefault(require("@alifd/next/lib/table"));
|
7
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
var _NoDataPage = _interopRequireDefault(require("@riil-frontend/component-topology-common/es/components/NoDataPage"));
|
10
|
-
var _table2 = require("@riil-frontend/component-topology-common/es/utils/table");
|
11
|
-
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); }
|
12
|
-
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; }
|
13
|
-
// import styles from './index.module.scss';
|
14
|
-
|
15
|
-
var TYPES_NAME = {
|
16
|
-
attributes: '属性',
|
17
|
-
metrics: '指标'
|
18
|
-
};
|
19
|
-
var IndexList = function IndexList(props) {
|
20
|
-
var _props$data = props.data,
|
21
|
-
data = _props$data === void 0 ? [] : _props$data,
|
22
|
-
initialValue = props.initialValue,
|
23
|
-
onChange = props.onChange,
|
24
|
-
loading = props.loading;
|
25
|
-
var _useState = (0, _react.useState)(initialValue || []),
|
26
|
-
selectedRowKeys = _useState[0],
|
27
|
-
setSelectedRowKeys = _useState[1];
|
28
|
-
var onSelectionChange = function onSelectionChange(selectedRowKeys, records) {
|
29
|
-
setSelectedRowKeys(selectedRowKeys);
|
30
|
-
if (onChange) {
|
31
|
-
onChange(selectedRowKeys);
|
32
|
-
}
|
33
|
-
};
|
34
|
-
var rowSelection = {
|
35
|
-
onChange: onSelectionChange,
|
36
|
-
selectedRowKeys: selectedRowKeys
|
37
|
-
};
|
38
|
-
var columns = [{
|
39
|
-
title: '属性/指标',
|
40
|
-
dataIndex: 'name',
|
41
|
-
cell: _table2.getTitleCell
|
42
|
-
}, {
|
43
|
-
title: '类型',
|
44
|
-
dataIndex: 'type',
|
45
|
-
cell: function cell(type) {
|
46
|
-
return (0, _table2.getTitleCell)(TYPES_NAME[type]);
|
47
|
-
}
|
48
|
-
}];
|
49
|
-
return /*#__PURE__*/_react["default"].createElement(_table["default"], {
|
50
|
-
dataSource: data,
|
51
|
-
primaryKey: "code",
|
52
|
-
rowSelection: rowSelection,
|
53
|
-
size: "small",
|
54
|
-
tableLayout: "auto",
|
55
|
-
maxBodyHeight: "100vh",
|
56
|
-
tableWidth: 300,
|
57
|
-
fixedHeader: true,
|
58
|
-
hasBorder: false,
|
59
|
-
loading: loading,
|
60
|
-
emptyContent: /*#__PURE__*/_react["default"].createElement(_NoDataPage["default"], {
|
61
|
-
type: "table"
|
62
|
-
})
|
63
|
-
}, columns.map(function (column) {
|
64
|
-
return /*#__PURE__*/_react["default"].createElement(_table["default"].Column, (0, _extends2["default"])({}, column, {
|
65
|
-
key: column.dataIndex
|
66
|
-
}));
|
67
|
-
}));
|
68
|
-
};
|
69
|
-
var _default = IndexList;
|
70
|
-
exports["default"] = _default;
|
@@ -1,68 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
exports.__esModule = true;
|
5
|
-
exports["default"] = void 0;
|
6
|
-
var _divider = _interopRequireDefault(require("@alifd/next/lib/divider"));
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
8
|
-
var _TopoCenter = require("ice/TopoCenter");
|
9
|
-
var _utils = require("@riil-frontend/utils");
|
10
|
-
var _Drawer = _interopRequireDefault(require("../Drawer"));
|
11
|
-
var _CiList = _interopRequireDefault(require("./CiList"));
|
12
|
-
var _IndexList = _interopRequireDefault(require("./IndexList"));
|
13
|
-
var _indexModule = _interopRequireDefault(require("./index.module.scss"));
|
14
|
-
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); }
|
15
|
-
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; }
|
16
|
-
var IndexSettingDrawer = function IndexSettingDrawer(props) {
|
17
|
-
var visible = props.visible,
|
18
|
-
initialData = props.initialData,
|
19
|
-
onSave = props.onSave,
|
20
|
-
onClose = props.onClose;
|
21
|
-
var effectsState = _TopoCenter.store.useModelEffectsState('ciModel');
|
22
|
-
var ciLoading = effectsState.getTypeDicts.isLoading;
|
23
|
-
var metaLoading = effectsState.getCiMeta.isLoading;
|
24
|
-
var _pageStore$useModel = _TopoCenter.store.useModel('ciModel'),
|
25
|
-
pageState = _pageStore$useModel[0],
|
26
|
-
pageDispatchers = _pageStore$useModel[1];
|
27
|
-
(0, _react.useEffect)(function () {
|
28
|
-
pageDispatchers.getTypeDicts();
|
29
|
-
}, []);
|
30
|
-
var typeDicts = pageState.typeDicts,
|
31
|
-
_pageState$currentCi = pageState.currentCi,
|
32
|
-
_pageState$currentCi2 = _pageState$currentCi === void 0 ? {} : _pageState$currentCi,
|
33
|
-
code = _pageState$currentCi2.code,
|
34
|
-
_pageState$currentCi3 = _pageState$currentCi2.meta,
|
35
|
-
meta = _pageState$currentCi3 === void 0 ? [] : _pageState$currentCi3;
|
36
|
-
var onDrawerSave = function onDrawerSave() {
|
37
|
-
// onSave(data[0]);
|
38
|
-
onClose();
|
39
|
-
};
|
40
|
-
var onCiSelect = function onCiSelect(ci) {
|
41
|
-
pageDispatchers.getCiMeta(ci.value);
|
42
|
-
};
|
43
|
-
var onMetaChange = function onMetaChange(values) {
|
44
|
-
// console.log(values);
|
45
|
-
};
|
46
|
-
return /*#__PURE__*/_react["default"].createElement(_Drawer["default"], {
|
47
|
-
title: "\u9009\u62E9\u6570\u636E",
|
48
|
-
visible: visible,
|
49
|
-
onSave: onDrawerSave,
|
50
|
-
onClose: onClose
|
51
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
52
|
-
className: _indexModule["default"].container
|
53
|
-
}, /*#__PURE__*/_react["default"].createElement(_CiList["default"], {
|
54
|
-
data: typeDicts,
|
55
|
-
loading: ciLoading,
|
56
|
-
onSelect: onCiSelect,
|
57
|
-
selected: code
|
58
|
-
}), /*#__PURE__*/_react["default"].createElement(_divider["default"], {
|
59
|
-
className: _indexModule["default"].separator,
|
60
|
-
direction: "ver"
|
61
|
-
}), code && /*#__PURE__*/_react["default"].createElement(_IndexList["default"], {
|
62
|
-
data: meta,
|
63
|
-
loading: metaLoading,
|
64
|
-
onChange: onMetaChange
|
65
|
-
})));
|
66
|
-
};
|
67
|
-
var _default = IndexSettingDrawer;
|
68
|
-
exports["default"] = _default;
|
@@ -1,44 +0,0 @@
|
|
1
|
-
@import "@alifd/next/variables";
|
2
|
-
|
3
|
-
.container {
|
4
|
-
display: flex;
|
5
|
-
align-items: stretch;
|
6
|
-
align-content: stretch;
|
7
|
-
}
|
8
|
-
|
9
|
-
.cilist {
|
10
|
-
width: calc(100% - 317px);
|
11
|
-
}
|
12
|
-
|
13
|
-
.ciitem {
|
14
|
-
display: flex;
|
15
|
-
align-items: center;
|
16
|
-
cursor: pointer;
|
17
|
-
margin: 0 4px;
|
18
|
-
padding: 4px;
|
19
|
-
border-radius: 2px;
|
20
|
-
color: #333;
|
21
|
-
background-color: #FFF;
|
22
|
-
height: 20px;
|
23
|
-
line-height: 20px;
|
24
|
-
font-size: 12px;
|
25
|
-
|
26
|
-
&:hover {
|
27
|
-
background-color: #F2F3F7;
|
28
|
-
}
|
29
|
-
|
30
|
-
.icon {
|
31
|
-
width: 16px;
|
32
|
-
height: 16px;
|
33
|
-
margin-right: 8px;
|
34
|
-
}
|
35
|
-
|
36
|
-
&.selected {
|
37
|
-
background-color: #F2F3F7;
|
38
|
-
color: $color-brand1-6;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
.separator {
|
43
|
-
height: 100vh;
|
44
|
-
}
|
@@ -1,263 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
exports.__esModule = true;
|
5
|
-
exports["default"] = _default;
|
6
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
7
|
-
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
9
|
-
var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
|
10
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } /**
|
11
|
-
* 动态设置链路样式 Model。-- 功能已废弃
|
12
|
-
*/
|
13
|
-
var defaultConfig = {
|
14
|
-
networkLink: {
|
15
|
-
// 网络链路
|
16
|
-
rules: []
|
17
|
-
},
|
18
|
-
networkAggLink: {
|
19
|
-
// 聚合链路
|
20
|
-
rules: []
|
21
|
-
}
|
22
|
-
};
|
23
|
-
|
24
|
-
/**
|
25
|
-
* 计算条件。当前仅处理属性
|
26
|
-
*
|
27
|
-
* @param condition {{relation: string, children: object[]}}
|
28
|
-
* @param attributes {{code,value}[]}
|
29
|
-
* @return boolean
|
30
|
-
*/
|
31
|
-
function executeCondition(condition, attributes) {
|
32
|
-
var relation = condition.relation,
|
33
|
-
children = condition.children;
|
34
|
-
var result = true;
|
35
|
-
for (var i = 0; i < children.length; i++) {
|
36
|
-
var _$find;
|
37
|
-
var _children$i = children[i],
|
38
|
-
field = _children$i.field,
|
39
|
-
operator = _children$i.operator,
|
40
|
-
value = _children$i.value;
|
41
|
-
var fieldValue = (_$find = _lodash["default"].find(attributes, {
|
42
|
-
code: field
|
43
|
-
})) === null || _$find === void 0 ? void 0 : _$find.value;
|
44
|
-
var ruleResult = void 0;
|
45
|
-
if (fieldValue === undefined || fieldValue === null) {
|
46
|
-
ruleResult = false;
|
47
|
-
} else {
|
48
|
-
var expression = fieldValue + " " + operator + " " + value;
|
49
|
-
try {
|
50
|
-
// eslint-disable-next-line no-eval
|
51
|
-
ruleResult = eval(expression);
|
52
|
-
} catch (e) {
|
53
|
-
// 属性不存在时会执行失败
|
54
|
-
result = false;
|
55
|
-
// console.error(`执行表达式失败: ${expression}`, {rule: children[i], attributes}, e);
|
56
|
-
break;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
if (relation === 'and') {
|
60
|
-
if (!ruleResult) {
|
61
|
-
result = false;
|
62
|
-
break;
|
63
|
-
}
|
64
|
-
} else {
|
65
|
-
result = ruleResult;
|
66
|
-
if (ruleResult) {
|
67
|
-
result = true;
|
68
|
-
break;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
}
|
72
|
-
return result;
|
73
|
-
}
|
74
|
-
function _default(engine) {
|
75
|
-
return {
|
76
|
-
// 定义 model 的初始 state
|
77
|
-
state: {
|
78
|
-
/**
|
79
|
-
* 格式见 https://shimo.im/docs/VKt3HCKHYgJ9kvGP#anchor-75ld
|
80
|
-
* @type {{networkLink: {}, networkAggLink: {}}}
|
81
|
-
*/
|
82
|
-
config: null
|
83
|
-
},
|
84
|
-
// 定义改变该模型状态的纯函数
|
85
|
-
reducers: {
|
86
|
-
setConfig: function setConfig(prevState, payload) {
|
87
|
-
var config = payload || defaultConfig;
|
88
|
-
return (0, _extends3["default"])({}, prevState, {
|
89
|
-
config: config
|
90
|
-
});
|
91
|
-
},
|
92
|
-
update: function update(prevState, payload) {
|
93
|
-
return (0, _extends3["default"])({}, prevState, payload);
|
94
|
-
},
|
95
|
-
/**
|
96
|
-
* 更新链路的配置
|
97
|
-
*
|
98
|
-
* @param prevState
|
99
|
-
* @param payload {{type: string, config: object}}
|
100
|
-
*/
|
101
|
-
updateLinkConfig: function updateLinkConfig(prevState, payload) {
|
102
|
-
var _extends2;
|
103
|
-
var type = payload.type,
|
104
|
-
linkConfig = payload.config;
|
105
|
-
return (0, _extends3["default"])({}, prevState, {
|
106
|
-
config: (0, _extends3["default"])({}, prevState.config, (_extends2 = {}, _extends2[type] = linkConfig, _extends2))
|
107
|
-
});
|
108
|
-
}
|
109
|
-
},
|
110
|
-
// 定义处理该模型副作用的函数
|
111
|
-
effects: function effects(dispatch) {
|
112
|
-
return {
|
113
|
-
getConfig: function getConfig(payload, rootState) {
|
114
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
115
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
116
|
-
while (1) switch (_context.prev = _context.next) {
|
117
|
-
case 0:
|
118
|
-
return _context.abrupt("return", rootState.linkDynamicStyle.config);
|
119
|
-
case 1:
|
120
|
-
case "end":
|
121
|
-
return _context.stop();
|
122
|
-
}
|
123
|
-
}, _callee);
|
124
|
-
}))();
|
125
|
-
},
|
126
|
-
/**
|
127
|
-
* 获取链路需要查询的属性/指标
|
128
|
-
*
|
129
|
-
* @return {Promise<*>}
|
130
|
-
*/
|
131
|
-
getFields: function getFields(payload, rootState) {
|
132
|
-
var _this = this;
|
133
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
134
|
-
var config, fields;
|
135
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
136
|
-
while (1) switch (_context2.prev = _context2.next) {
|
137
|
-
case 0:
|
138
|
-
_context2.next = 2;
|
139
|
-
return _this.getConfig();
|
140
|
-
case 2:
|
141
|
-
config = _context2.sent;
|
142
|
-
fields = {
|
143
|
-
networkLink: {
|
144
|
-
attribute: [],
|
145
|
-
metric: []
|
146
|
-
},
|
147
|
-
networkAggLink: {
|
148
|
-
attribute: [],
|
149
|
-
metric: []
|
150
|
-
}
|
151
|
-
};
|
152
|
-
['networkLink', 'networkAggLink'].forEach(function (ciType) {
|
153
|
-
config[ciType].rules.forEach(function (rule) {
|
154
|
-
rule.condition[0].children.forEach(function (conditionRow) {
|
155
|
-
fields[ciType][conditionRow.type].push(conditionRow.field);
|
156
|
-
});
|
157
|
-
});
|
158
|
-
});
|
159
|
-
return _context2.abrupt("return", fields);
|
160
|
-
case 6:
|
161
|
-
case "end":
|
162
|
-
return _context2.stop();
|
163
|
-
}
|
164
|
-
}, _callee2);
|
165
|
-
}))();
|
166
|
-
},
|
167
|
-
/**
|
168
|
-
* 执行动态样式显示.
|
169
|
-
*
|
170
|
-
* 样式优先级:告警>开启自定义>动态(如果命中)>默认(未命中动态)。
|
171
|
-
* 不包含有告警的链路。
|
172
|
-
* 链路开启动态未命中规则时,使用默认样式。值为null,ht设置为默认
|
173
|
-
*
|
174
|
-
* @param payload
|
175
|
-
* @param rootState
|
176
|
-
* @returns {Promise<void>}
|
177
|
-
*/
|
178
|
-
execute: function execute(payload, rootState) {
|
179
|
-
var _this2 = this;
|
180
|
-
return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
181
|
-
var styleConfig, isEdit, links, allLinkAttributes, alarmMap, linkStyleMap;
|
182
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
183
|
-
while (1) switch (_context3.prev = _context3.next) {
|
184
|
-
case 0:
|
185
|
-
return _context3.abrupt("return");
|
186
|
-
case 3:
|
187
|
-
styleConfig = _context3.sent;
|
188
|
-
isEdit = rootState.topoMod.viewState !== 'view'; // 获取链路
|
189
|
-
links = [];
|
190
|
-
if (!(isEdit && rootState.topoConfig.topoData.links.length)) {
|
191
|
-
_context3.next = 10;
|
192
|
-
break;
|
193
|
-
}
|
194
|
-
links = rootState.topoConfig.topoData.links;
|
195
|
-
_context3.next = 13;
|
196
|
-
break;
|
197
|
-
case 10:
|
198
|
-
if (rootState.topoMod.topoData) {
|
199
|
-
_context3.next = 12;
|
200
|
-
break;
|
201
|
-
}
|
202
|
-
return _context3.abrupt("return");
|
203
|
-
case 12:
|
204
|
-
links = rootState.topoMod.topoData.links;
|
205
|
-
case 13:
|
206
|
-
// 获取属性。无权限的属性为 []
|
207
|
-
allLinkAttributes = rootState.topoBizMod.attrsAndMetrics; // 告警
|
208
|
-
alarmMap = rootState.topoAlarm.alarmDoc; // 如果是显示模式,过滤有告警的链路
|
209
|
-
if (!isEdit) {
|
210
|
-
links = links.filter(function (link) {
|
211
|
-
return !(alarmMap[link.id] || []).length;
|
212
|
-
});
|
213
|
-
}
|
214
|
-
|
215
|
-
// 遍历链路,根据规则计算样式
|
216
|
-
linkStyleMap = {};
|
217
|
-
links.forEach(function (link) {
|
218
|
-
var ciType = link.ciType;
|
219
|
-
var config = styleConfig[ciType];
|
220
|
-
if (config) {
|
221
|
-
var _$find2;
|
222
|
-
var rules = config.rules;
|
223
|
-
var attributes = ((_$find2 = _lodash["default"].find(allLinkAttributes, {
|
224
|
-
id: link.id
|
225
|
-
})) === null || _$find2 === void 0 ? void 0 : _$find2.attributes) || [];
|
226
|
-
var style = null;
|
227
|
-
for (var i = 0; i < rules.length; i++) {
|
228
|
-
var rule = rules[i];
|
229
|
-
// 如果命中规则则中止
|
230
|
-
if (executeCondition(rule.condition[0], attributes)) {
|
231
|
-
style = rule.style;
|
232
|
-
break;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
linkStyleMap[link.id] = style;
|
236
|
-
}
|
237
|
-
});
|
238
|
-
_rlog["default"].debug('链路动态样式 linkDynamicStyle.execute', {
|
239
|
-
linksStyle: linkStyleMap,
|
240
|
-
params: {
|
241
|
-
links: links,
|
242
|
-
allLinkAttributes: allLinkAttributes,
|
243
|
-
styleConfig: styleConfig,
|
244
|
-
alarmMap: alarmMap
|
245
|
-
}
|
246
|
-
});
|
247
|
-
|
248
|
-
// 通知ht更新
|
249
|
-
if (links.length) {
|
250
|
-
engine.view.topoClient.batchSetLineStyle(linkStyleMap);
|
251
|
-
}
|
252
|
-
case 20:
|
253
|
-
case "end":
|
254
|
-
return _context3.stop();
|
255
|
-
}
|
256
|
-
}, _callee3);
|
257
|
-
}))();
|
258
|
-
}
|
259
|
-
};
|
260
|
-
}
|
261
|
-
};
|
262
|
-
}
|
263
|
-
;
|