@riil-frontend/component-topology 11.0.27 → 11.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +2 -1
  2. package/build/1.js +2 -2
  3. package/build/2.js +1 -1
  4. package/build/index.css +1 -1
  5. package/build/index.js +20 -20
  6. package/es/components/BatchAttrMetric/index.js +9 -19
  7. package/es/components/BatchAttrMetric/setting.js +64 -30
  8. package/es/components/BatchAttrMetric/utils.js +14 -199
  9. package/es/components/ModelAttrSelectDrawer/components/ModelAttrSelectDrawer.js +1 -1
  10. package/es/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +6 -7
  11. package/es/core/components/ResourceViewAttributeSetting/Setting.js +30 -58
  12. package/es/core/components/TopoView/topoView.js +0 -1
  13. package/es/core/components/titlebar/TitleBar.module.scss +0 -9
  14. package/es/core/components/titlebar/widgets/TitleWidget.js +2 -5
  15. package/es/core/editor/components/BottomFloatTool/HelpIcon.js +1 -4
  16. package/es/core/editor/components/BottomFloatTool/HelpIcon.module.scss +10 -8
  17. package/es/core/editor/components/Sidebar/views/BackgroundPanel/BackgroundPanel.js +1 -2
  18. package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +1 -4
  19. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +1 -4
  20. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +3 -6
  21. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +2 -5
  22. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +1 -4
  23. package/es/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +1 -4
  24. package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +1 -4
  25. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/box.js +0 -1
  26. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +2 -2
  27. package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +1 -2
  28. package/es/core/hooks/usePolling.js +8 -8
  29. package/es/core/models/TopoApp.js +1 -1
  30. package/es/core/models/topoData.js +2 -2
  31. package/es/core/store/models/topoConfig.js +3 -4
  32. package/es/core/test/Test.js +4 -5
  33. package/es/utils/topoData.js +0 -142
  34. package/lib/components/BatchAttrMetric/index.js +9 -19
  35. package/lib/components/BatchAttrMetric/setting.js +58 -24
  36. package/lib/components/BatchAttrMetric/utils.js +16 -206
  37. package/lib/components/ModelAttrSelectDrawer/components/ModelAttrSelectDrawer.js +1 -1
  38. package/lib/core/components/DisplaySettingDrawer/ResourceDisplay/BasicConfig.js +5 -6
  39. package/lib/core/components/ResourceViewAttributeSetting/Setting.js +28 -56
  40. package/lib/core/components/TopoView/topoView.js +0 -1
  41. package/lib/core/components/titlebar/TitleBar.module.scss +0 -9
  42. package/lib/core/components/titlebar/widgets/TitleWidget.js +2 -7
  43. package/lib/core/editor/components/BottomFloatTool/HelpIcon.js +1 -4
  44. package/lib/core/editor/components/BottomFloatTool/HelpIcon.module.scss +10 -8
  45. package/lib/core/editor/components/Sidebar/views/BackgroundPanel/BackgroundPanel.js +1 -2
  46. package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +1 -4
  47. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +1 -4
  48. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +3 -6
  49. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -4
  50. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +1 -4
  51. package/lib/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +1 -4
  52. package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +3 -4
  53. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/box.js +0 -1
  54. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +2 -2
  55. package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +1 -2
  56. package/lib/core/hooks/usePolling.js +8 -8
  57. package/lib/core/models/TopoApp.js +1 -1
  58. package/lib/core/models/topoData.js +2 -2
  59. package/lib/core/store/models/topoConfig.js +3 -6
  60. package/lib/core/test/Test.js +4 -5
  61. package/lib/utils/topoData.js +0 -145
  62. package/package.json +2 -2
  63. package/es/components/BatchAttrMetric2/SelectTable.js +0 -21
  64. package/es/components/BatchAttrMetric2/constant.js +0 -30
  65. package/es/components/BatchAttrMetric2/index.js +0 -68
  66. package/es/components/BatchAttrMetric2/index.module.scss +0 -76
  67. package/es/components/BatchAttrMetric2/setting.js +0 -181
  68. package/es/components/BatchAttrMetric2/utils.js +0 -42
  69. package/es/components/IndexSettingDrawer/CiList.js +0 -26
  70. package/es/components/IndexSettingDrawer/CiListItem.js +0 -37
  71. package/es/components/IndexSettingDrawer/IndexList.js +0 -62
  72. package/es/components/IndexSettingDrawer/index.js +0 -60
  73. package/es/components/IndexSettingDrawer/index.module.scss +0 -44
  74. package/es/components/ModelAttrSelectDrawer/components/ModelAttrSelect.js +0 -5
  75. package/es/core/components/TopoApp.js +0 -7
  76. package/es/core/components/TopoAppView.js +0 -24
  77. package/es/core/editor/components/Toolbar/widgets/Dropdown.js +0 -12
  78. package/es/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +0 -28
  79. package/es/networkTopo/components/Link/index copy.js +0 -213
  80. package/es/networkTopo/store/linkDynamicStyle.js +0 -259
  81. package/es/networkTopo/store/linkDynamicStyleConfig.js +0 -180
  82. package/es/networkTopo/store/linkManager.js +0 -38
  83. package/lib/components/BatchAttrMetric2/SelectTable.js +0 -26
  84. package/lib/components/BatchAttrMetric2/constant.js +0 -36
  85. package/lib/components/BatchAttrMetric2/index.js +0 -75
  86. package/lib/components/BatchAttrMetric2/index.module.scss +0 -76
  87. package/lib/components/BatchAttrMetric2/setting.js +0 -189
  88. package/lib/components/BatchAttrMetric2/utils.js +0 -48
  89. package/lib/components/IndexSettingDrawer/CiList.js +0 -32
  90. package/lib/components/IndexSettingDrawer/CiListItem.js +0 -43
  91. package/lib/components/IndexSettingDrawer/IndexList.js +0 -70
  92. package/lib/components/IndexSettingDrawer/index.js +0 -68
  93. package/lib/components/IndexSettingDrawer/index.module.scss +0 -44
  94. package/lib/components/ModelAttrSelectDrawer/components/ModelAttrSelect.js +0 -11
  95. package/lib/core/components/TopoApp.js +0 -13
  96. package/lib/core/components/TopoAppView.js +0 -32
  97. package/lib/core/editor/components/Toolbar/widgets/Dropdown.js +0 -18
  98. package/lib/core/editor/components/settings/propertyViews/view/GlobalTootipSetting.js +0 -34
  99. package/lib/networkTopo/components/Link/index copy.js +0 -220
  100. package/lib/networkTopo/store/linkDynamicStyle.js +0 -263
  101. package/lib/networkTopo/store/linkDynamicStyleConfig.js +0 -186
  102. package/lib/networkTopo/store/linkManager.js +0 -42
@@ -1,259 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _extends from "@babel/runtime/helpers/extends";
3
- 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; }
4
- /**
5
- * 动态设置链路样式 Model。-- 功能已废弃
6
- */
7
- import _ from 'lodash';
8
- import rlog from '@riil-frontend/component-topology-utils/es/rlog';
9
- var defaultConfig = {
10
- networkLink: {
11
- // 网络链路
12
- rules: []
13
- },
14
- networkAggLink: {
15
- // 聚合链路
16
- rules: []
17
- }
18
- };
19
-
20
- /**
21
- * 计算条件。当前仅处理属性
22
- *
23
- * @param condition {{relation: string, children: object[]}}
24
- * @param attributes {{code,value}[]}
25
- * @return boolean
26
- */
27
- function executeCondition(condition, attributes) {
28
- var relation = condition.relation,
29
- children = condition.children;
30
- var result = true;
31
- for (var i = 0; i < children.length; i++) {
32
- var _$find;
33
- var _children$i = children[i],
34
- field = _children$i.field,
35
- operator = _children$i.operator,
36
- value = _children$i.value;
37
- var fieldValue = (_$find = _.find(attributes, {
38
- code: field
39
- })) === null || _$find === void 0 ? void 0 : _$find.value;
40
- var ruleResult = void 0;
41
- if (fieldValue === undefined || fieldValue === null) {
42
- ruleResult = false;
43
- } else {
44
- var expression = fieldValue + " " + operator + " " + value;
45
- try {
46
- // eslint-disable-next-line no-eval
47
- ruleResult = eval(expression);
48
- } catch (e) {
49
- // 属性不存在时会执行失败
50
- result = false;
51
- // console.error(`执行表达式失败: ${expression}`, {rule: children[i], attributes}, e);
52
- break;
53
- }
54
- }
55
- if (relation === 'and') {
56
- if (!ruleResult) {
57
- result = false;
58
- break;
59
- }
60
- } else {
61
- result = ruleResult;
62
- if (ruleResult) {
63
- result = true;
64
- break;
65
- }
66
- }
67
- }
68
- return result;
69
- }
70
- export default function (engine) {
71
- return {
72
- // 定义 model 的初始 state
73
- state: {
74
- /**
75
- * 格式见 https://shimo.im/docs/VKt3HCKHYgJ9kvGP#anchor-75ld
76
- * @type {{networkLink: {}, networkAggLink: {}}}
77
- */
78
- config: null
79
- },
80
- // 定义改变该模型状态的纯函数
81
- reducers: {
82
- setConfig: function setConfig(prevState, payload) {
83
- var config = payload || defaultConfig;
84
- return _extends({}, prevState, {
85
- config: config
86
- });
87
- },
88
- update: function update(prevState, payload) {
89
- return _extends({}, prevState, payload);
90
- },
91
- /**
92
- * 更新链路的配置
93
- *
94
- * @param prevState
95
- * @param payload {{type: string, config: object}}
96
- */
97
- updateLinkConfig: function updateLinkConfig(prevState, payload) {
98
- var _extends2;
99
- var type = payload.type,
100
- linkConfig = payload.config;
101
- return _extends({}, prevState, {
102
- config: _extends({}, prevState.config, (_extends2 = {}, _extends2[type] = linkConfig, _extends2))
103
- });
104
- }
105
- },
106
- // 定义处理该模型副作用的函数
107
- effects: function effects(dispatch) {
108
- return {
109
- getConfig: function getConfig(payload, rootState) {
110
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
111
- return _regeneratorRuntime().wrap(function _callee$(_context) {
112
- while (1) switch (_context.prev = _context.next) {
113
- case 0:
114
- return _context.abrupt("return", rootState.linkDynamicStyle.config);
115
- case 1:
116
- case "end":
117
- return _context.stop();
118
- }
119
- }, _callee);
120
- }))();
121
- },
122
- /**
123
- * 获取链路需要查询的属性/指标
124
- *
125
- * @return {Promise<*>}
126
- */
127
- getFields: function getFields(payload, rootState) {
128
- var _this = this;
129
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
130
- var config, fields;
131
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
132
- while (1) switch (_context2.prev = _context2.next) {
133
- case 0:
134
- _context2.next = 2;
135
- return _this.getConfig();
136
- case 2:
137
- config = _context2.sent;
138
- fields = {
139
- networkLink: {
140
- attribute: [],
141
- metric: []
142
- },
143
- networkAggLink: {
144
- attribute: [],
145
- metric: []
146
- }
147
- };
148
- ['networkLink', 'networkAggLink'].forEach(function (ciType) {
149
- config[ciType].rules.forEach(function (rule) {
150
- rule.condition[0].children.forEach(function (conditionRow) {
151
- fields[ciType][conditionRow.type].push(conditionRow.field);
152
- });
153
- });
154
- });
155
- return _context2.abrupt("return", fields);
156
- case 6:
157
- case "end":
158
- return _context2.stop();
159
- }
160
- }, _callee2);
161
- }))();
162
- },
163
- /**
164
- * 执行动态样式显示.
165
- *
166
- * 样式优先级:告警>开启自定义>动态(如果命中)>默认(未命中动态)。
167
- * 不包含有告警的链路。
168
- * 链路开启动态未命中规则时,使用默认样式。值为null,ht设置为默认
169
- *
170
- * @param payload
171
- * @param rootState
172
- * @returns {Promise<void>}
173
- */
174
- execute: function execute(payload, rootState) {
175
- var _this2 = this;
176
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
177
- var styleConfig, isEdit, links, allLinkAttributes, alarmMap, linkStyleMap;
178
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
179
- while (1) switch (_context3.prev = _context3.next) {
180
- case 0:
181
- return _context3.abrupt("return");
182
- case 3:
183
- styleConfig = _context3.sent;
184
- isEdit = rootState.topoMod.viewState !== 'view'; // 获取链路
185
- links = [];
186
- if (!(isEdit && rootState.topoConfig.topoData.links.length)) {
187
- _context3.next = 10;
188
- break;
189
- }
190
- links = rootState.topoConfig.topoData.links;
191
- _context3.next = 13;
192
- break;
193
- case 10:
194
- if (rootState.topoMod.topoData) {
195
- _context3.next = 12;
196
- break;
197
- }
198
- return _context3.abrupt("return");
199
- case 12:
200
- links = rootState.topoMod.topoData.links;
201
- case 13:
202
- // 获取属性。无权限的属性为 []
203
- allLinkAttributes = rootState.topoBizMod.attrsAndMetrics; // 告警
204
- alarmMap = rootState.topoAlarm.alarmDoc; // 如果是显示模式,过滤有告警的链路
205
- if (!isEdit) {
206
- links = links.filter(function (link) {
207
- return !(alarmMap[link.id] || []).length;
208
- });
209
- }
210
-
211
- // 遍历链路,根据规则计算样式
212
- linkStyleMap = {};
213
- links.forEach(function (link) {
214
- var ciType = link.ciType;
215
- var config = styleConfig[ciType];
216
- if (config) {
217
- var _$find2;
218
- var rules = config.rules;
219
- var attributes = ((_$find2 = _.find(allLinkAttributes, {
220
- id: link.id
221
- })) === null || _$find2 === void 0 ? void 0 : _$find2.attributes) || [];
222
- var style = null;
223
- for (var i = 0; i < rules.length; i++) {
224
- var rule = rules[i];
225
- // 如果命中规则则中止
226
- if (executeCondition(rule.condition[0], attributes)) {
227
- style = rule.style;
228
- break;
229
- }
230
- }
231
- linkStyleMap[link.id] = style;
232
- }
233
- });
234
- rlog.debug('链路动态样式 linkDynamicStyle.execute', {
235
- linksStyle: linkStyleMap,
236
- params: {
237
- links: links,
238
- allLinkAttributes: allLinkAttributes,
239
- styleConfig: styleConfig,
240
- alarmMap: alarmMap
241
- }
242
- });
243
-
244
- // 通知ht更新
245
- if (links.length) {
246
- engine.view.topoClient.batchSetLineStyle(linkStyleMap);
247
- }
248
- case 20:
249
- case "end":
250
- return _context3.stop();
251
- }
252
- }, _callee3);
253
- }))();
254
- }
255
- };
256
- }
257
- };
258
- }
259
- ;
@@ -1,180 +0,0 @@
1
- import _Message from "@alifd/next/es/message";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _extends from "@babel/runtime/helpers/extends";
4
- 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; }
5
- import clone from 'lodash/cloneDeep';
6
- var ruleKey = 0;
7
- // -- 功能已废弃
8
- export default {
9
- // 定义 model 的初始 state
10
- state: {
11
- drawerVisible: false,
12
- currentLinkType: null,
13
- currentLinkConfig: null
14
- },
15
- // 定义改变该模型状态的纯函数
16
- reducers: {
17
- update: function update(prevState, payload) {
18
- return _extends({}, prevState, payload);
19
- },
20
- addRule: function addRule(prevState, payload) {
21
- var newRule = payload || {
22
- key: ruleKey++,
23
- condition: [{
24
- relation: 'and',
25
- children: [{
26
- key: '1',
27
- ciType: prevState.currentLinkType,
28
- type: 'attribute',
29
- // 类型:属性 attribute、指标 metric
30
- field: undefined,
31
- // 属性
32
- dataType: 'int',
33
- // 数据类型
34
- operator: undefined,
35
- //
36
- value: undefined // 值
37
- }]
38
- }],
39
-
40
- style: {
41
- lineType: 'solid',
42
- // 线型实线、虚线 'solid' / 'dash'
43
- color: '#09D90E',
44
- // 线的颜色
45
- direction: 'none',
46
- // 线的方向(箭头方向),none/right/left/both
47
- lineWidth: 1 // 线宽
48
- }
49
- };
50
-
51
- var currentLinkConfig = {
52
- rules: [].concat(prevState.currentLinkConfig.rules, [newRule])
53
- };
54
- return _extends({}, prevState, {
55
- currentLinkConfig: currentLinkConfig
56
- });
57
- },
58
- deleteRule: function deleteRule(prevState, index) {
59
- var rules = [].concat(prevState.currentLinkConfig.rules);
60
- rules.splice(index, 1);
61
- // console.info({
62
- // prev:prevState.currentLinkConfig.rules,
63
- // rules
64
- // });
65
- return _extends({}, prevState, {
66
- currentLinkConfig: {
67
- rules: rules
68
- }
69
- });
70
- },
71
- updateRuleByIndex: function updateRuleByIndex(prevState, _ref) {
72
- var index = _ref.index,
73
- rule = _ref.rule;
74
- var rules = [].concat(prevState.currentLinkConfig.rules);
75
- rules[index] = rule;
76
- return _extends({}, prevState, {
77
- currentLinkConfig: {
78
- rules: rules
79
- }
80
- });
81
- },
82
- updateRules: function updateRules(prevState, rules) {
83
- return _extends({}, prevState, {
84
- currentLinkConfig: {
85
- rules: rules
86
- }
87
- });
88
- }
89
- },
90
- // 定义处理该模型副作用的函数
91
- effects: function effects(dispatch) {
92
- return {
93
- /**
94
- * 打开配置
95
- *
96
- * @param payload {type}
97
- * @param rootState
98
- */
99
- open: function open(payload, rootState) {
100
- var type = payload.type;
101
- var config = clone(rootState.linkDynamicStyle.config[type]);
102
-
103
- // 更新id,解决增删规则UI刷新问题
104
- config.rules.forEach(function (rule) {
105
- if (rule.key === undefined) {
106
- // eslint-disable-next-line no-param-reassign
107
- rule.key = ruleKey++;
108
- }
109
- if (rule.key > ruleKey) {
110
- ruleKey = rule.key;
111
- }
112
- });
113
- this.update({
114
- drawerVisible: true,
115
- currentLinkType: type,
116
- currentLinkConfig: config
117
- });
118
- },
119
- close: function close() {
120
- this.update({
121
- drawerVisible: false,
122
- currentLinkType: null,
123
- currentLinkConfig: null
124
- });
125
- },
126
- saveLinkConfig: function saveLinkConfig(payload, rootState) {
127
- var _this = this;
128
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
129
- var type, config, valid, error;
130
- return _regeneratorRuntime().wrap(function _callee$(_context) {
131
- while (1) switch (_context.prev = _context.next) {
132
- case 0:
133
- type = payload.type, config = payload.config; // 验证数据
134
- valid = true;
135
- error = null;
136
- config.rules.forEach(function (rule, ruleIndex) {
137
- rule.condition[0].children.forEach(function (_ref2) {
138
- var field = _ref2.field,
139
- operator = _ref2.operator,
140
- value = _ref2.value;
141
- if (!field || !operator || value === null || value === undefined) {
142
- valid = false;
143
- error = error || "\u8BF7\u586B\u5199\u6761\u4EF6\u7EC4\u4EF6" + (ruleIndex + 1) + "\u7684\u6761\u4EF6";
144
- }
145
- });
146
- if (valid) {
147
- if (!rule.style.lineWidth) {
148
- valid = false;
149
- error = error || "\u8BF7\u586B\u5199\u6761\u4EF6\u7EC4\u4EF6" + (ruleIndex + 1) + "\u7684\u7EBF\u5BBD";
150
- }
151
- }
152
- });
153
- if (valid) {
154
- _context.next = 7;
155
- break;
156
- }
157
- _Message.show({
158
- type: 'error',
159
- title: error
160
- });
161
- return _context.abrupt("return");
162
- case 7:
163
- _context.next = 9;
164
- return dispatch.linkDynamicStyle.updateLinkConfig({
165
- type: type,
166
- config: config
167
- });
168
- case 9:
169
- _this.close();
170
- dispatch.linkDynamicStyle.execute();
171
- case 11:
172
- case "end":
173
- return _context.stop();
174
- }
175
- }, _callee);
176
- }))();
177
- }
178
- };
179
- }
180
- };
@@ -1,38 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _extends from "@babel/runtime/helpers/extends";
3
- 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; }
4
- /**
5
- * 链路新增、编辑 Model
6
- */
7
- import rlog from '@riil-frontend/component-topology-utils/es/rlog';
8
- export default function (topoApp) {
9
- return {
10
- // 定义 model 的初始 state
11
- state: {
12
- drawerVisible: false
13
- },
14
- // 定义改变该模型状态的纯函数
15
- reducers: {
16
- update: function update(prevState, payload) {
17
- return _extends({}, prevState, payload);
18
- }
19
- },
20
- // 定义处理该模型副作用的函数
21
- effects: function effects(dispatch) {
22
- return {
23
- show: function show(payload, rootState) {
24
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
25
- return _regeneratorRuntime().wrap(function _callee$(_context) {
26
- while (1) switch (_context.prev = _context.next) {
27
- case 0:
28
- case "end":
29
- return _context.stop();
30
- }
31
- }, _callee);
32
- }))();
33
- }
34
- };
35
- }
36
- };
37
- }
38
- ;
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- exports.__esModule = true;
5
- exports["default"] = SelectTable;
6
- var _react = _interopRequireDefault(require("react"));
7
- function SelectTable(props) {
8
- return /*#__PURE__*/_react["default"].createElement(Table, {
9
- fixedHeader: true,
10
- hasBorder: false,
11
- dataSource: tableData,
12
- emptyContent: /*#__PURE__*/_react["default"].createElement(NoDataPage, {
13
- type: "table"
14
- }),
15
- rowSelection: {
16
- selectedRowKeys: selectedRowKeys,
17
- onChange: onTableSelect,
18
- getProps: function getProps(_ref) {
19
- var id = _ref.id;
20
- return {
21
- disabled: !selectedRowKeys.includes(id) && selectedRowKeys.length >= limit
22
- };
23
- }
24
- }
25
- }, columnNodes);
26
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.SELECT_TYPE = exports.DATA_TYPE = void 0;
5
- // 选择类型
6
- var SELECT_TYPE = {
7
- single: {
8
- showTree: false,
9
- showCiNum: false,
10
- drawerWidth: "calc(" + 5 + "/24 * 100%)"
11
- },
12
- batch: {
13
- showTree: true,
14
- showCiNum: true,
15
- drawerWidth: "calc(" + 10 + "/24 * 100%)"
16
- }
17
- };
18
- // 数据类型
19
- exports.SELECT_TYPE = SELECT_TYPE;
20
- var DATA_TYPE = {
21
- tag: {
22
- drawerTitle: '选择图数据',
23
- maxSelect: 4,
24
- label: '图',
25
- poslabel: '拓扑图上',
26
- message: "\u56FE\u6570\u636E\uFF1A\u9009\u62E9\u7684\u6307\u6807\u548C\u5C5E\u6027\u5C06\u4F1A\u663E\u793A\u5728\u62D3\u6251\u56FE\u4E0A\uFF0C\u6700\u591A\u652F\u6301\u52FE\u9009 4 \u9879\u3002"
27
- },
28
- tip: {
29
- drawerTitle: '选择Tooltips显示数据',
30
- maxSelect: 10,
31
- label: 'Tootip',
32
- poslabel: 'Tooltip中',
33
- message: "Tootip\u6570\u636E\uFF1A\u9009\u62E9\u7684\u6307\u6807\u548C\u5C5E\u6027\u5C06\u4F1A\u663E\u793A\u5728Tooltip\u4E2D\uFF0C\u6700\u591A\u652F\u6301\u52FE\u9009 10 \u9879\u3002"
34
- }
35
- };
36
- exports.DATA_TYPE = DATA_TYPE;
@@ -1,75 +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 _drawer = _interopRequireDefault(require("@alifd/next/lib/drawer"));
7
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _ahooks = require("ahooks");
11
- var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _indexModule = _interopRequireDefault(require("./index.module.scss"));
13
- var _setting = _interopRequireDefault(require("./setting"));
14
- var _constant = require("./constant");
15
- var _excluded = ["saveCb", "showType"],
16
- _excluded2 = ["drawerTitle", "drawerWidth"];
17
- 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); }
18
- 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; }
19
- /**
20
- * 属性指标配置抽屉
21
- */
22
- var BatchAttrMetricDrawer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
23
- var _saveCb = props.saveCb,
24
- showType = props.showType,
25
- settingProps = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
26
- var _useBoolean = (0, _ahooks.useBoolean)(false),
27
- visible = _useBoolean[0],
28
- _useBoolean$ = _useBoolean[1],
29
- setTrue = _useBoolean$.setTrue,
30
- setFalse = _useBoolean$.setFalse;
31
- var selectType = 'batch';
32
- (0, _react.useImperativeHandle)(ref, function () {
33
- return {
34
- /**
35
- * 展开抽屉
36
- */
37
- show: function show(entryConfig) {
38
- if (entryConfig === void 0) {
39
- entryConfig = {};
40
- }
41
- setTrue();
42
- }
43
- };
44
- });
45
- var config = (0, _extends2["default"])({}, _constant.SELECT_TYPE[selectType], _constant.DATA_TYPE[showType]);
46
- var drawerTitle = config.drawerTitle,
47
- drawerWidth = config.drawerWidth,
48
- pageConfig = (0, _objectWithoutPropertiesLoose2["default"])(config, _excluded2);
49
- return /*#__PURE__*/_react["default"].createElement(_drawer["default"], {
50
- closeMode: ['close', 'esc'],
51
- visible: visible,
52
- onClose: setFalse,
53
- title: drawerTitle,
54
- className: _indexModule["default"].drawer,
55
- width: drawerWidth
56
- }, visible && /*#__PURE__*/_react["default"].createElement(_setting["default"], (0, _extends2["default"])({}, pageConfig, settingProps, {
57
- cancelCb: setFalse,
58
- saveCb: function saveCb(values) {
59
- setFalse();
60
- _saveCb(showType, values);
61
- }
62
- })));
63
- });
64
- BatchAttrMetricDrawer.displayName = 'BatchAttrMetricDrawer';
65
- BatchAttrMetricDrawer.propTypes = {
66
- // 数据项
67
- dataSource: _propTypes["default"].array.isRequired,
68
- // 保存回调
69
- saveCb: _propTypes["default"].func
70
- };
71
- BatchAttrMetricDrawer.defaultProps = {
72
- saveCb: function saveCb() {}
73
- };
74
- var _default = BatchAttrMetricDrawer;
75
- exports["default"] = _default;