seeder-st2110-components 1.5.9 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.esm.js +1954 -1796
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1953 -1794
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/index.less +65 -16
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo, useState, useCallback, useMemo, useEffect, useRef } from 'react';
|
|
2
|
-
import { Tooltip,
|
|
2
|
+
import { Tooltip, App, Modal, Form, Input, Alert, message, Dropdown, Spin, Divider, Typography, InputNumber, ConfigProvider, Badge, Switch, Select, List, Empty, Button, Space, Flex, Checkbox, Row, Col } from 'antd';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useWebSocket, useInterval } from 'ahooks';
|
|
5
5
|
import { LoadingOutlined, ExclamationCircleFilled, PlusOutlined } from '@ant-design/icons';
|
|
@@ -94,12 +94,12 @@ const UsageItem = /*#__PURE__*/memo(_ref => {
|
|
|
94
94
|
})]
|
|
95
95
|
}),
|
|
96
96
|
destroyOnHidden: false,
|
|
97
|
-
children: /*#__PURE__*/jsxs(
|
|
98
|
-
|
|
97
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
98
|
+
className: "usage-item",
|
|
99
99
|
children: [/*#__PURE__*/jsx("i", {
|
|
100
100
|
className: "seeder-iconfont ".concat(iconClass, " text-xl")
|
|
101
101
|
}), /*#__PURE__*/jsx("span", {
|
|
102
|
-
className: "
|
|
102
|
+
className: "usage-value",
|
|
103
103
|
children: children
|
|
104
104
|
})]
|
|
105
105
|
})
|
|
@@ -236,17 +236,15 @@ const useHardwareUsage = socketUrl => {
|
|
|
236
236
|
if (!ps_status || typeof ps_status !== 'object') return null;
|
|
237
237
|
const statusItems = getItems(getDetail(ps_status));
|
|
238
238
|
return /*#__PURE__*/jsx("div", {
|
|
239
|
-
className: "
|
|
240
|
-
children: statusItems.map((item, index) => /*#__PURE__*/
|
|
241
|
-
|
|
242
|
-
children:
|
|
239
|
+
className: "usage-container",
|
|
240
|
+
children: statusItems.map((item, index) => /*#__PURE__*/jsx("div", {
|
|
241
|
+
className: "usage-item-wrapper",
|
|
242
|
+
children: /*#__PURE__*/jsx(UsageItem$1, {
|
|
243
243
|
title: item.title,
|
|
244
244
|
iconClass: item.iconClass,
|
|
245
245
|
memTotal: item.memTotal,
|
|
246
246
|
children: item.valueString
|
|
247
|
-
})
|
|
248
|
-
type: "vertical"
|
|
249
|
-
})]
|
|
247
|
+
})
|
|
250
248
|
}, item.title))
|
|
251
249
|
});
|
|
252
250
|
}, [ps_status]);
|
|
@@ -710,7 +708,7 @@ const useUpgrade = _ref => {
|
|
|
710
708
|
children: /*#__PURE__*/jsx("a", {
|
|
711
709
|
onClick: e => e.preventDefault(),
|
|
712
710
|
children: /*#__PURE__*/jsx("i", {
|
|
713
|
-
className: "seeder-iconfont seeder-icon-liebiao2 text-
|
|
711
|
+
className: "seeder-iconfont seeder-icon-liebiao2 text-xl text-neutral-400"
|
|
714
712
|
})
|
|
715
713
|
})
|
|
716
714
|
}), /*#__PURE__*/jsx("input", {
|
|
@@ -792,185 +790,1308 @@ const useSystemOperations = function () {
|
|
|
792
790
|
};
|
|
793
791
|
var useSystemOperations$1 = useSystemOperations;
|
|
794
792
|
|
|
795
|
-
const
|
|
796
|
-
|
|
793
|
+
const NetworkFieldGroup = _ref => {
|
|
794
|
+
var _fieldConfig$netmask$, _fieldConfig$netmask;
|
|
797
795
|
let {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
796
|
+
prefix,
|
|
797
|
+
interfaces,
|
|
798
|
+
fieldConfig = {}
|
|
799
|
+
} = _ref;
|
|
800
|
+
// 默认字段配置
|
|
801
|
+
const defaultFieldConfig = {
|
|
802
|
+
name: {
|
|
803
|
+
label: "Name",
|
|
804
|
+
enabled: true
|
|
805
|
+
},
|
|
806
|
+
ip: {
|
|
807
|
+
label: "IP Address",
|
|
808
|
+
enabled: true
|
|
809
|
+
},
|
|
810
|
+
netmask: {
|
|
811
|
+
label: "Netmask",
|
|
812
|
+
enabled: true
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
const mergedFieldConfig = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultFieldConfig), fieldConfig), {}, {
|
|
816
|
+
netmask: {
|
|
817
|
+
label: "Netmask",
|
|
818
|
+
enabled: (_fieldConfig$netmask$ = (_fieldConfig$netmask = fieldConfig.netmask) === null || _fieldConfig$netmask === void 0 ? void 0 : _fieldConfig$netmask.enabled) !== null && _fieldConfig$netmask$ !== void 0 ? _fieldConfig$netmask$ : defaultFieldConfig.netmask.enabled // 合并 enabled
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
822
|
+
children: [/*#__PURE__*/jsx(Typography.Title, {
|
|
823
|
+
level: 5,
|
|
824
|
+
style: {
|
|
825
|
+
display: 'flex',
|
|
826
|
+
justifyContent: 'space-between',
|
|
827
|
+
alignItems: 'center',
|
|
828
|
+
marginBottom: 16
|
|
829
|
+
},
|
|
830
|
+
children: prefix
|
|
831
|
+
}), interfaces.map((iface, index) => /*#__PURE__*/jsxs("div", {
|
|
832
|
+
children: [mergedFieldConfig.name.enabled && /*#__PURE__*/jsx(Form.Item, {
|
|
833
|
+
label: mergedFieldConfig.name.label,
|
|
834
|
+
name: [prefix, index, "display_name"],
|
|
835
|
+
children: /*#__PURE__*/jsx(Input, {
|
|
836
|
+
disabled: true
|
|
837
|
+
})
|
|
838
|
+
}), mergedFieldConfig.ip.enabled && /*#__PURE__*/jsx(Form.Item, {
|
|
839
|
+
label: mergedFieldConfig.ip.label,
|
|
840
|
+
name: [prefix, index, "ip_address"],
|
|
841
|
+
children: /*#__PURE__*/jsx(Input, {})
|
|
842
|
+
}), mergedFieldConfig.netmask.enabled && /*#__PURE__*/jsx(Form.Item, {
|
|
843
|
+
label: mergedFieldConfig.netmask.label,
|
|
844
|
+
name: [prefix, index, "netmask"],
|
|
845
|
+
children: /*#__PURE__*/jsx(Input, {})
|
|
846
|
+
}), index < interfaces.length - 1 && /*#__PURE__*/jsx(Divider, {
|
|
847
|
+
style: {
|
|
848
|
+
marginBlock: 16
|
|
849
|
+
}
|
|
850
|
+
})]
|
|
851
|
+
}, iface.id || index))]
|
|
818
852
|
});
|
|
819
|
-
if (children) {
|
|
820
|
-
// 提取Dropdown组件和其menu属性
|
|
821
|
-
const dropdownElement = upgradeElement.props.children[0];
|
|
822
|
-
const otherElements = upgradeElement.props.children.slice(1);
|
|
823
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
824
|
-
children: [/*#__PURE__*/jsx(Dropdown, _objectSpread2(_objectSpread2(_objectSpread2({}, dropdownProps), dropdownElement.props), {}, {
|
|
825
|
-
children: children
|
|
826
|
-
})), otherElements]
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
// 如果没有children,直接返回完整的升级元素
|
|
831
|
-
return upgradeElement;
|
|
832
|
-
};
|
|
833
|
-
UpgradeManager.defaultProps = {
|
|
834
|
-
trigger: ["hover"],
|
|
835
|
-
placement: "bottomRight"
|
|
836
853
|
};
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
854
|
+
const NetworkSettingsModal = _ref2 => {
|
|
855
|
+
let {
|
|
856
|
+
open,
|
|
857
|
+
onClose,
|
|
858
|
+
getLanConfig,
|
|
859
|
+
// 可选 - 单独获取LAN配置的函数
|
|
860
|
+
getSysConfig,
|
|
861
|
+
// 可选 - 单独获取QSFP配置的函数
|
|
862
|
+
getConfig,
|
|
863
|
+
// 可选 - 统一获取配置的函数
|
|
864
|
+
updateLanConfig,
|
|
865
|
+
updateSysConfig,
|
|
866
|
+
restart,
|
|
867
|
+
modalProps = {},
|
|
868
|
+
formProps = {},
|
|
869
|
+
fieldConfig = {},
|
|
870
|
+
sections = ['LAN', 'QSFP'],
|
|
871
|
+
showNetmask = {
|
|
872
|
+
LAN: true,
|
|
873
|
+
QSFP: false
|
|
874
|
+
},
|
|
875
|
+
restartRemark
|
|
876
|
+
} = _ref2;
|
|
877
|
+
const {
|
|
878
|
+
message,
|
|
879
|
+
modal
|
|
880
|
+
} = App.useApp();
|
|
881
|
+
const [form] = Form.useForm();
|
|
882
|
+
const [st2110Interfaces, setSt2110Interfaces] = useState([]);
|
|
883
|
+
const [lanConfigs, setLanConfigs] = useState([]);
|
|
884
|
+
const [submitLoading, setSubmitLoading] = useState(false);
|
|
885
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
886
|
+
const initializationStatus = useRef({
|
|
887
|
+
hasFetched: false,
|
|
888
|
+
hasInitialized: false
|
|
889
|
+
});
|
|
890
|
+
const preparedFieldConfig = useMemo(() => {
|
|
891
|
+
const config = _objectSpread2({}, fieldConfig);
|
|
846
892
|
|
|
847
|
-
|
|
893
|
+
// 确保LAN和QSFP的配置存在
|
|
894
|
+
config.LAN = config.LAN || {};
|
|
895
|
+
config.QSFP = config.QSFP || {};
|
|
896
|
+
if (sections.includes('LAN')) {
|
|
897
|
+
config.LAN.netmask = _objectSpread2(_objectSpread2({}, config.LAN.netmask || {}), {}, {
|
|
898
|
+
enabled: showNetmask.LAN
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
if (sections.includes('QSFP')) {
|
|
902
|
+
config.QSFP.netmask = _objectSpread2(_objectSpread2({}, config.QSFP.netmask || {}), {}, {
|
|
903
|
+
enabled: showNetmask.QSFP
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
return config;
|
|
907
|
+
}, [fieldConfig, showNetmask, sections]);
|
|
908
|
+
useEffect(() => {
|
|
909
|
+
if (!open) return;
|
|
910
|
+
const fetchData = async () => {
|
|
911
|
+
if (initializationStatus.current.hasFetched) return;
|
|
912
|
+
try {
|
|
913
|
+
initializationStatus.current.hasFetched = true;
|
|
914
|
+
if (getConfig) {
|
|
915
|
+
// 使用统一接口获取数据
|
|
916
|
+
const config = await getConfig();
|
|
917
|
+
if (sections.includes('LAN') && config.lan_interfaces) {
|
|
918
|
+
setLanConfigs(config.lan_interfaces);
|
|
919
|
+
}
|
|
920
|
+
if (sections.includes('QSFP') && config.interfaces) {
|
|
921
|
+
setSt2110Interfaces(config.interfaces);
|
|
922
|
+
}
|
|
923
|
+
} else {
|
|
924
|
+
const promises = [];
|
|
925
|
+
if (sections.includes('LAN')) {
|
|
926
|
+
promises.push(getLanConfig());
|
|
927
|
+
}
|
|
928
|
+
if (sections.includes('QSFP')) {
|
|
929
|
+
promises.push(getSysConfig());
|
|
930
|
+
}
|
|
931
|
+
const results = await Promise.allSettled(promises);
|
|
932
|
+
if (sections.includes('LAN') && getLanConfig) {
|
|
933
|
+
const lanResult = results[0];
|
|
934
|
+
if (lanResult.status === 'fulfilled') {
|
|
935
|
+
setLanConfigs(lanResult.value || []);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
if (sections.includes('QSFP') && getSysConfig) {
|
|
939
|
+
const sysResult = sections.includes('LAN') ? results[1] : results[0];
|
|
940
|
+
if (sysResult.status === 'fulfilled' && sysResult.value) {
|
|
941
|
+
setSt2110Interfaces(sysResult.value.st2110_interfaces || []);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
setIsInitialized(true);
|
|
946
|
+
} catch (error) {
|
|
947
|
+
console.error('Failed to fetch data:', error);
|
|
948
|
+
initializationStatus.current.hasFetched = false; // 出错时重置
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
fetchData();
|
|
952
|
+
}, [open, getLanConfig, getSysConfig, sections]);
|
|
848
953
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
954
|
+
// 当模态框关闭时重置状态
|
|
955
|
+
useEffect(() => {
|
|
956
|
+
if (!open) {
|
|
957
|
+
setIsInitialized(false);
|
|
958
|
+
setLanConfigs([]);
|
|
959
|
+
setSt2110Interfaces([]);
|
|
960
|
+
form.resetFields();
|
|
961
|
+
initializationStatus.current = {
|
|
962
|
+
hasFetched: false,
|
|
963
|
+
hasInitialized: false
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
}, [open, form]);
|
|
857
967
|
|
|
858
|
-
|
|
968
|
+
// 动态初始值配置
|
|
969
|
+
const initialValues = useMemo(() => {
|
|
970
|
+
const values = {};
|
|
971
|
+
if (sections.includes('LAN') && lanConfigs.length > 0) {
|
|
972
|
+
values.LAN = lanConfigs.map(config => _objectSpread2({
|
|
973
|
+
connection_id: config.connection_id,
|
|
974
|
+
display_name: config.display_name,
|
|
975
|
+
ip_address: config.ip_address
|
|
976
|
+
}, showNetmask.LAN ? {
|
|
977
|
+
netmask: config.netmask
|
|
978
|
+
} : {}));
|
|
979
|
+
}
|
|
980
|
+
if (sections.includes('QSFP') && st2110Interfaces.length > 0) {
|
|
981
|
+
values.QSFP = st2110Interfaces.map(iface => _objectSpread2(_objectSpread2({}, iface.id !== undefined && {
|
|
982
|
+
id: iface.id
|
|
983
|
+
}), {}, {
|
|
984
|
+
display_name: iface.display_name,
|
|
985
|
+
ip_address: iface.ip_address || iface.ip
|
|
986
|
+
}, showNetmask.QSFP ? {
|
|
987
|
+
netmask: iface.netmask
|
|
988
|
+
} : {}));
|
|
989
|
+
}
|
|
990
|
+
return values;
|
|
991
|
+
}, [lanConfigs, st2110Interfaces, sections, showNetmask]);
|
|
859
992
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
hasRequiredReactIs_development = 1;
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
if (process.env.NODE_ENV !== "production") {
|
|
892
|
-
(function() {
|
|
893
|
-
|
|
894
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
895
|
-
// nor polyfill, then a plain number is used for performance.
|
|
896
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
897
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
898
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
899
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
900
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
901
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
902
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
903
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
904
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
905
|
-
|
|
906
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
907
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
908
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
909
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
910
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
911
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
912
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
913
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
914
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
915
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
916
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
917
|
-
|
|
918
|
-
function isValidElementType(type) {
|
|
919
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
920
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
function typeOf(object) {
|
|
924
|
-
if (typeof object === 'object' && object !== null) {
|
|
925
|
-
var $$typeof = object.$$typeof;
|
|
926
|
-
|
|
927
|
-
switch ($$typeof) {
|
|
928
|
-
case REACT_ELEMENT_TYPE:
|
|
929
|
-
var type = object.type;
|
|
993
|
+
// 当初始值准备好后设置表单值
|
|
994
|
+
useEffect(() => {
|
|
995
|
+
if (isInitialized && !initializationStatus.current.hasInitialized) {
|
|
996
|
+
form.setFieldsValue(initialValues);
|
|
997
|
+
initializationStatus.current.hasInitialized = true;
|
|
998
|
+
}
|
|
999
|
+
}, [isInitialized, form, initialValues]);
|
|
1000
|
+
const handleSuccess = useCallback(async function () {
|
|
1001
|
+
let {
|
|
1002
|
+
messageText = 'Success',
|
|
1003
|
+
isPopup = !!restart,
|
|
1004
|
+
refresh = !restart
|
|
1005
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1006
|
+
message.success(messageText);
|
|
1007
|
+
if (refresh && getConfig) {
|
|
1008
|
+
try {
|
|
1009
|
+
const newConfig = await getConfig();
|
|
1010
|
+
if (sections.includes('LAN') && newConfig.lan_interfaces) {
|
|
1011
|
+
setLanConfigs(newConfig.lan_interfaces);
|
|
1012
|
+
}
|
|
1013
|
+
if (sections.includes('QSFP') && newConfig.interfaces) {
|
|
1014
|
+
setSt2110Interfaces(newConfig.interfaces);
|
|
1015
|
+
}
|
|
1016
|
+
} catch (error) {
|
|
1017
|
+
console.error('Failed to refresh config:', error);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
930
1020
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1021
|
+
// 如果有restart函数,则显示重启确认框
|
|
1022
|
+
if (isPopup && restart) {
|
|
1023
|
+
try {
|
|
1024
|
+
const updatedConfig = await getSysConfig();
|
|
1025
|
+
if (updatedConfig && updatedConfig.is_restart_required) {
|
|
1026
|
+
modal.confirm({
|
|
1027
|
+
icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
|
|
1028
|
+
title: "Configuration modified. Restart to apply changes?",
|
|
1029
|
+
cancelText: "No",
|
|
1030
|
+
okText: "Yes",
|
|
1031
|
+
onOk: () => restart()
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
} catch (error) {
|
|
1035
|
+
console.error('Failed to check restart status:', error);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
onClose();
|
|
1039
|
+
}, [message, modal, getSysConfig, restart, getConfig, sections, onClose]);
|
|
1040
|
+
const handleSubmit = useCallback(async () => {
|
|
1041
|
+
setSubmitLoading(true);
|
|
1042
|
+
try {
|
|
1043
|
+
const values = await form.validateFields();
|
|
1044
|
+
// console.log("Direct form values:", values);
|
|
939
1045
|
|
|
940
|
-
|
|
941
|
-
var $$typeofType = type && type.$$typeof;
|
|
1046
|
+
const updatePromises = [];
|
|
942
1047
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1048
|
+
// 更新LAN配置
|
|
1049
|
+
if (sections.includes('LAN') && values.LAN) {
|
|
1050
|
+
const lanData = values.LAN.map((item, index) => {
|
|
1051
|
+
var _lanConfigs$index;
|
|
1052
|
+
return _objectSpread2({
|
|
1053
|
+
connection_id: (_lanConfigs$index = lanConfigs[index]) === null || _lanConfigs$index === void 0 ? void 0 : _lanConfigs$index.connection_id,
|
|
1054
|
+
ip_address: item.ip_address
|
|
1055
|
+
}, showNetmask.LAN ? {
|
|
1056
|
+
netmask: item.netmask
|
|
1057
|
+
} : {});
|
|
1058
|
+
});
|
|
1059
|
+
updatePromises.push(updateLanConfig(lanData));
|
|
1060
|
+
}
|
|
950
1061
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1062
|
+
// 更新QSFP配置
|
|
1063
|
+
if (sections.includes('QSFP') && values.QSFP) {
|
|
1064
|
+
const interfacesData = values.QSFP.map((item, index) => {
|
|
1065
|
+
var _st2110Interfaces$ind, _st2110Interfaces$ind2, _st2110Interfaces$ind3;
|
|
1066
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind = st2110Interfaces[index]) === null || _st2110Interfaces$ind === void 0 ? void 0 : _st2110Interfaces$ind.id) !== undefined && {
|
|
1067
|
+
id: st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind2 = st2110Interfaces[index]) === null || _st2110Interfaces$ind2 === void 0 ? void 0 : _st2110Interfaces$ind2.id
|
|
1068
|
+
}), (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind3 = st2110Interfaces[index]) === null || _st2110Interfaces$ind3 === void 0 ? void 0 : _st2110Interfaces$ind3.ip) !== undefined ? {
|
|
1069
|
+
ip: item.ip_address
|
|
1070
|
+
} : {
|
|
1071
|
+
ip_address: item.ip_address
|
|
1072
|
+
}), showNetmask.QSFP ? {
|
|
1073
|
+
netmask: item.netmask
|
|
1074
|
+
} : {});
|
|
1075
|
+
});
|
|
1076
|
+
const st2110Data = st2110Interfaces.some(iface => 'id' in iface) ? {
|
|
1077
|
+
st2110_interfaces: interfacesData
|
|
1078
|
+
} : {
|
|
1079
|
+
interfaces: interfacesData
|
|
1080
|
+
};
|
|
1081
|
+
updatePromises.push(updateSysConfig(st2110Data));
|
|
1082
|
+
}
|
|
1083
|
+
const results = await Promise.allSettled(updatePromises);
|
|
954
1084
|
|
|
955
|
-
|
|
1085
|
+
// 检查所有更新是否成功
|
|
1086
|
+
const allSucceeded = results.every(result => result.status === 'fulfilled');
|
|
1087
|
+
if (allSucceeded) {
|
|
1088
|
+
handleSuccess();
|
|
1089
|
+
} else {
|
|
1090
|
+
message.error('Some configurations failed to update');
|
|
1091
|
+
}
|
|
1092
|
+
} catch (error) {
|
|
1093
|
+
console.error('Failed to update configurations: ', error);
|
|
1094
|
+
message.error('Failed to update configurations');
|
|
1095
|
+
} finally {
|
|
1096
|
+
setSubmitLoading(false);
|
|
1097
|
+
}
|
|
1098
|
+
}, [form, sections, lanConfigs, st2110Interfaces, updateLanConfig, updateSysConfig, handleSuccess, message]);
|
|
956
1099
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1100
|
+
// 合并默认模态框属性和传入的属性
|
|
1101
|
+
const mergedModalProps = _objectSpread2({
|
|
1102
|
+
title: "Network Settings",
|
|
1103
|
+
width: 650,
|
|
1104
|
+
open,
|
|
1105
|
+
confirmLoading: submitLoading,
|
|
1106
|
+
onOk: handleSubmit,
|
|
1107
|
+
onCancel: onClose,
|
|
1108
|
+
okText: "Apply",
|
|
1109
|
+
cancelText: "Close",
|
|
1110
|
+
centered: true,
|
|
1111
|
+
destroyOnHidden: true,
|
|
1112
|
+
forceRender: true,
|
|
1113
|
+
styles: _objectSpread2({
|
|
1114
|
+
body: {
|
|
1115
|
+
padding: "16px 24px 8px 24px"
|
|
1116
|
+
}
|
|
1117
|
+
}, restartRemark !== null && {
|
|
1118
|
+
footer: {
|
|
1119
|
+
paddingBottom: 28
|
|
1120
|
+
}
|
|
1121
|
+
})
|
|
1122
|
+
}, modalProps);
|
|
961
1123
|
|
|
962
|
-
|
|
963
|
-
|
|
1124
|
+
// 合并默认表单属性和传入的属性
|
|
1125
|
+
const mergedFormProps = _objectSpread2({
|
|
1126
|
+
form: form,
|
|
1127
|
+
labelCol: {
|
|
1128
|
+
span: 6
|
|
1129
|
+
},
|
|
1130
|
+
wrapperCol: {
|
|
1131
|
+
span: 18
|
|
1132
|
+
},
|
|
1133
|
+
autoComplete: "off"
|
|
1134
|
+
}, formProps);
|
|
1135
|
+
return /*#__PURE__*/jsxs(Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
|
|
1136
|
+
children: [/*#__PURE__*/jsxs(Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
|
|
1137
|
+
children: [sections.includes('LAN') && lanConfigs.length > 0 && /*#__PURE__*/jsxs(Fragment, {
|
|
1138
|
+
children: [/*#__PURE__*/jsx(NetworkFieldGroup, {
|
|
1139
|
+
prefix: "LAN",
|
|
1140
|
+
interfaces: lanConfigs,
|
|
1141
|
+
fieldConfig: preparedFieldConfig.LAN
|
|
1142
|
+
}), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsx(Divider, {})]
|
|
1143
|
+
}), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsx(NetworkFieldGroup, {
|
|
1144
|
+
prefix: "QSFP",
|
|
1145
|
+
interfaces: st2110Interfaces,
|
|
1146
|
+
fieldConfig: preparedFieldConfig.QSFP
|
|
1147
|
+
})]
|
|
1148
|
+
})), restartRemark]
|
|
1149
|
+
}));
|
|
1150
|
+
};
|
|
1151
|
+
var NetworkSettingsModal$1 = /*#__PURE__*/memo(NetworkSettingsModal);
|
|
964
1152
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1153
|
+
const defaultFieldConfigs = {
|
|
1154
|
+
clock_class: {
|
|
1155
|
+
label: 'Clock Class',
|
|
1156
|
+
formType: 'select',
|
|
1157
|
+
options: [{
|
|
1158
|
+
value: 6,
|
|
1159
|
+
label: 'Atomic Clock (6)'
|
|
1160
|
+
}, {
|
|
1161
|
+
value: 7,
|
|
1162
|
+
label: 'GPS (7)'
|
|
1163
|
+
}, {
|
|
1164
|
+
value: 248,
|
|
1165
|
+
label: 'Slave-Only (248)'
|
|
1166
|
+
}],
|
|
1167
|
+
readOnly: true
|
|
1168
|
+
},
|
|
1169
|
+
clock_accuracy: {
|
|
1170
|
+
label: 'Clock Accuracy',
|
|
1171
|
+
formType: 'number',
|
|
1172
|
+
readOnly: true
|
|
1173
|
+
},
|
|
1174
|
+
offset_scaled_log_variance: {
|
|
1175
|
+
label: 'Offset Scaled Log Variance',
|
|
1176
|
+
formType: 'number',
|
|
1177
|
+
readOnly: true
|
|
1178
|
+
},
|
|
1179
|
+
grandmaster_priority1: {
|
|
1180
|
+
label: 'Priority 1',
|
|
1181
|
+
formType: 'number',
|
|
1182
|
+
readOnly: true
|
|
1183
|
+
},
|
|
1184
|
+
grandmaster_priority2: {
|
|
1185
|
+
label: 'Priority 2',
|
|
1186
|
+
formType: 'number',
|
|
1187
|
+
readOnly: true
|
|
1188
|
+
},
|
|
1189
|
+
grandmaster_identity: {
|
|
1190
|
+
label: 'Grandmaster Identity',
|
|
1191
|
+
formType: 'text',
|
|
1192
|
+
readOnly: true
|
|
1193
|
+
},
|
|
1194
|
+
master_port_id: {
|
|
1195
|
+
label: 'Port Identity',
|
|
1196
|
+
formType: 'text',
|
|
1197
|
+
readOnly: true
|
|
1198
|
+
},
|
|
1199
|
+
t1_domain_number: {
|
|
1200
|
+
label: 'Domain',
|
|
1201
|
+
formType: 'number',
|
|
1202
|
+
min: 0,
|
|
1203
|
+
max: 127,
|
|
1204
|
+
readOnly: false
|
|
1205
|
+
},
|
|
1206
|
+
master_utc_offset: {
|
|
1207
|
+
label: 'UTC Offset',
|
|
1208
|
+
formType: 'number',
|
|
1209
|
+
readOnly: true
|
|
1210
|
+
},
|
|
1211
|
+
is_connected: {
|
|
1212
|
+
label: 'Connected Status',
|
|
1213
|
+
formType: 'badge',
|
|
1214
|
+
statusMap: {
|
|
1215
|
+
0: {
|
|
1216
|
+
text: 'Disconnected',
|
|
1217
|
+
color: 'red'
|
|
1218
|
+
},
|
|
1219
|
+
1: {
|
|
1220
|
+
text: 'Connected',
|
|
1221
|
+
color: 'green'
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
is_locked: {
|
|
1226
|
+
label: 'Locked Status',
|
|
1227
|
+
formType: 'badge',
|
|
1228
|
+
statusMap: {
|
|
1229
|
+
0: {
|
|
1230
|
+
text: 'Unlocked',
|
|
1231
|
+
color: 'red'
|
|
1232
|
+
},
|
|
1233
|
+
1: {
|
|
1234
|
+
text: 'Locked',
|
|
1235
|
+
color: 'green'
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
// 默认字段顺序
|
|
1242
|
+
const defaultFieldOrder = ['t1_domain_number', 'grandmaster_priority1', 'grandmaster_priority2', 'grandmaster_identity', 'master_port_id', 'clock_class', 'clock_accuracy', 'offset_scaled_log_variance', 'master_utc_offset', 'is_connected', 'is_locked'];
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* 转换PTP状态为表单字段数组
|
|
1246
|
+
* @param {Object} ptpStatus PTP状态对象
|
|
1247
|
+
* @param {Object} fieldConfigs 字段配置
|
|
1248
|
+
* @param {Array} fieldOrder 字段顺序
|
|
1249
|
+
* @returns {Array} 表单字段数组
|
|
1250
|
+
*/
|
|
1251
|
+
function convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder) {
|
|
1252
|
+
return fieldOrder.filter(key => key in ptpStatus).map(key => {
|
|
1253
|
+
const config = fieldConfigs[key] || {
|
|
1254
|
+
label: key,
|
|
1255
|
+
formType: 'text'
|
|
1256
|
+
};
|
|
1257
|
+
const value = ptpStatus[key];
|
|
1258
|
+
return _objectSpread2(_objectSpread2({
|
|
1259
|
+
key,
|
|
1260
|
+
value
|
|
1261
|
+
}, config), {}, {
|
|
1262
|
+
rawData: ptpStatus
|
|
1263
|
+
});
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
const PtpModal = _ref => {
|
|
1267
|
+
let {
|
|
1268
|
+
open,
|
|
1269
|
+
onClose,
|
|
1270
|
+
getPtpInfo,
|
|
1271
|
+
updatePtpInfo,
|
|
1272
|
+
fieldConfigs = defaultFieldConfigs,
|
|
1273
|
+
fieldOrder = defaultFieldOrder,
|
|
1274
|
+
modalProps = {},
|
|
1275
|
+
formProps = {}
|
|
1276
|
+
} = _ref;
|
|
1277
|
+
const [ptpStatus, setPtpStatus] = useState(null);
|
|
1278
|
+
const [form] = Form.useForm();
|
|
1279
|
+
const {
|
|
1280
|
+
message
|
|
1281
|
+
} = App.useApp();
|
|
1282
|
+
useEffect(() => {
|
|
1283
|
+
if (open) {
|
|
1284
|
+
getPtpInfo().then(data => {
|
|
1285
|
+
if (data !== null && data !== void 0 && data[0]) {
|
|
1286
|
+
setPtpStatus(data[0]);
|
|
1287
|
+
form.setFieldsValue(data[0]);
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
}, [open, form, getPtpInfo]);
|
|
1292
|
+
const ptpStatusArray = useMemo(() => {
|
|
1293
|
+
if (!ptpStatus) return [];
|
|
1294
|
+
return convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder);
|
|
1295
|
+
}, [ptpStatus]);
|
|
1296
|
+
const handleValueChange = changedValues => {
|
|
1297
|
+
if ('t1_domain_number' in changedValues) {
|
|
1298
|
+
setPtpStatus(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
1299
|
+
t1_domain_number: changedValues.t1_domain_number
|
|
1300
|
+
}));
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
const handleSubmit = async () => {
|
|
1304
|
+
try {
|
|
1305
|
+
const values = await form.validateFields();
|
|
1306
|
+
const response = await updatePtpInfo(values);
|
|
1307
|
+
if (response) {
|
|
1308
|
+
message.success('Success');
|
|
1309
|
+
setTimeout(() => {
|
|
1310
|
+
onClose();
|
|
1311
|
+
}, 1500);
|
|
1312
|
+
}
|
|
1313
|
+
} catch (error) {
|
|
1314
|
+
console.error('Update failed:', error);
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
const renderFormItem = item => {
|
|
1318
|
+
var _item$statusMap, _item$min, _item$max;
|
|
1319
|
+
switch (item.formType) {
|
|
1320
|
+
case 'select':
|
|
1321
|
+
return /*#__PURE__*/jsx(Select, {
|
|
1322
|
+
options: item.options,
|
|
1323
|
+
disabled: item.readOnly
|
|
1324
|
+
});
|
|
1325
|
+
case 'switch':
|
|
1326
|
+
return /*#__PURE__*/jsx(Switch, {});
|
|
1327
|
+
case 'badge':
|
|
1328
|
+
const normalizedValue = typeof item.value === 'boolean' ? item.value ? 1 : 0 : item.value;
|
|
1329
|
+
const status = ((_item$statusMap = item.statusMap) === null || _item$statusMap === void 0 ? void 0 : _item$statusMap[normalizedValue]) || {
|
|
1330
|
+
text: 'Unknown',
|
|
1331
|
+
color: 'gray'
|
|
1332
|
+
};
|
|
1333
|
+
return /*#__PURE__*/jsx(ConfigProvider, {
|
|
1334
|
+
theme: {
|
|
1335
|
+
components: {
|
|
1336
|
+
Badge: {
|
|
1337
|
+
statusSize: 10
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
children: /*#__PURE__*/jsx(Badge, {
|
|
1342
|
+
color: status.color,
|
|
1343
|
+
text: status.text
|
|
1344
|
+
})
|
|
1345
|
+
});
|
|
1346
|
+
case 'number':
|
|
1347
|
+
return /*#__PURE__*/jsx(InputNumber, {
|
|
1348
|
+
disabled: item.readOnly,
|
|
1349
|
+
controls: false,
|
|
1350
|
+
keyboard: false,
|
|
1351
|
+
min: (_item$min = item.min) !== null && _item$min !== void 0 ? _item$min : Number.MIN_SAFE_INTEGER,
|
|
1352
|
+
max: (_item$max = item.max) !== null && _item$max !== void 0 ? _item$max : Number.MAX_SAFE_INTEGER
|
|
1353
|
+
});
|
|
1354
|
+
default:
|
|
1355
|
+
return /*#__PURE__*/jsx(Input, {
|
|
1356
|
+
disabled: item.readOnly
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
if (!open || !ptpStatus) return null;
|
|
1361
|
+
|
|
1362
|
+
// 合并默认模态框属性和传入的属性
|
|
1363
|
+
const mergedModalProps = _objectSpread2({
|
|
1364
|
+
title: "PTP",
|
|
1365
|
+
width: 650,
|
|
1366
|
+
open,
|
|
1367
|
+
okText: "Apply",
|
|
1368
|
+
cancelText: "Close",
|
|
1369
|
+
onCancel: onClose,
|
|
1370
|
+
onOk: handleSubmit
|
|
1371
|
+
}, modalProps);
|
|
1372
|
+
|
|
1373
|
+
// 合并默认表单属性和传入的属性
|
|
1374
|
+
const mergedFormProps = _objectSpread2({
|
|
1375
|
+
form: form,
|
|
1376
|
+
name: "ptpForm",
|
|
1377
|
+
labelCol: {
|
|
1378
|
+
span: 8
|
|
1379
|
+
},
|
|
1380
|
+
wrapperCol: {
|
|
1381
|
+
span: 16
|
|
1382
|
+
},
|
|
1383
|
+
autoComplete: "off",
|
|
1384
|
+
onValuesChange: handleValueChange
|
|
1385
|
+
}, formProps);
|
|
1386
|
+
return /*#__PURE__*/jsx(Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
|
|
1387
|
+
children: /*#__PURE__*/jsx(Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
|
|
1388
|
+
children: ptpStatusArray.map(item => /*#__PURE__*/jsx(Form.Item, {
|
|
1389
|
+
label: item.label,
|
|
1390
|
+
name: item.key,
|
|
1391
|
+
initialValue: item.value,
|
|
1392
|
+
children: renderFormItem(item)
|
|
1393
|
+
}, item.key))
|
|
1394
|
+
}))
|
|
1395
|
+
}));
|
|
1396
|
+
};
|
|
1397
|
+
var PtpModal$1 = /*#__PURE__*/memo(PtpModal);
|
|
1398
|
+
|
|
1399
|
+
const LeftList = /*#__PURE__*/memo(_ref => {
|
|
1400
|
+
let {
|
|
1401
|
+
dataSource,
|
|
1402
|
+
selectedPresetId,
|
|
1403
|
+
onSelectPreset,
|
|
1404
|
+
onAddNew,
|
|
1405
|
+
onRemove,
|
|
1406
|
+
hasPresets = dataSource.length > 0,
|
|
1407
|
+
showDescription = false,
|
|
1408
|
+
texts = {
|
|
1409
|
+
newButton: "New Preset",
|
|
1410
|
+
removeButton: "Remove"
|
|
1411
|
+
}
|
|
1412
|
+
} = _ref;
|
|
1413
|
+
// 动态计算列布局
|
|
1414
|
+
const gridColumns = showDescription ? "grid-cols-3" : "grid-cols-2";
|
|
1415
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1416
|
+
className: "h-full left-list-wrapper",
|
|
1417
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
1418
|
+
className: "list-container",
|
|
1419
|
+
children: /*#__PURE__*/jsx(List, {
|
|
1420
|
+
header: /*#__PURE__*/jsxs("div", {
|
|
1421
|
+
className: "grid ".concat(gridColumns, " w-full list-header"),
|
|
1422
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
1423
|
+
children: "Name"
|
|
1424
|
+
}), /*#__PURE__*/jsx("div", {
|
|
1425
|
+
children: "Create Time"
|
|
1426
|
+
}), showDescription && /*#__PURE__*/jsx("div", {
|
|
1427
|
+
children: "Description"
|
|
1428
|
+
})]
|
|
1429
|
+
}),
|
|
1430
|
+
dataSource: dataSource,
|
|
1431
|
+
rowKey: "id",
|
|
1432
|
+
renderItem: item => /*#__PURE__*/jsx(List.Item, {
|
|
1433
|
+
className: "list-item ".concat(selectedPresetId === item.id ? 'selected' : ''),
|
|
1434
|
+
style: {
|
|
1435
|
+
padding: "9px 24px"
|
|
1436
|
+
},
|
|
1437
|
+
onClick: () => onSelectPreset(item),
|
|
1438
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1439
|
+
className: "grid ".concat(gridColumns, " w-full text-text-normal"),
|
|
1440
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
1441
|
+
title: item.name,
|
|
1442
|
+
children: item.name || "Untitled Preset"
|
|
1443
|
+
}), /*#__PURE__*/jsx("div", {
|
|
1444
|
+
children: item.create_time
|
|
1445
|
+
}), showDescription && /*#__PURE__*/jsx("div", {
|
|
1446
|
+
children: item.description
|
|
1447
|
+
})]
|
|
1448
|
+
})
|
|
1449
|
+
}),
|
|
1450
|
+
locale: {
|
|
1451
|
+
emptyText: /*#__PURE__*/jsx("div", {
|
|
1452
|
+
className: "p-8",
|
|
1453
|
+
children: /*#__PURE__*/jsx(Empty, {
|
|
1454
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
1455
|
+
description: /*#__PURE__*/jsx("span", {
|
|
1456
|
+
className: "text-gray-400",
|
|
1457
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
1458
|
+
type: "link",
|
|
1459
|
+
onClick: onAddNew,
|
|
1460
|
+
className: "p-0 h-auto",
|
|
1461
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
1462
|
+
children: "Create new preset"
|
|
1463
|
+
})
|
|
1464
|
+
})
|
|
1465
|
+
})
|
|
1466
|
+
})
|
|
1467
|
+
}
|
|
1468
|
+
})
|
|
1469
|
+
}), hasPresets && /*#__PURE__*/jsx("div", {
|
|
1470
|
+
className: "p-4",
|
|
1471
|
+
style: {
|
|
1472
|
+
paddingInline: 24
|
|
1473
|
+
},
|
|
1474
|
+
children: /*#__PURE__*/jsxs(Space, {
|
|
1475
|
+
size: "middle",
|
|
1476
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
1477
|
+
type: "default",
|
|
1478
|
+
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
1479
|
+
style: {
|
|
1480
|
+
padding: "20px 12px"
|
|
1481
|
+
},
|
|
1482
|
+
className: "btn-gray",
|
|
1483
|
+
onClick: onAddNew,
|
|
1484
|
+
children: texts.newButton
|
|
1485
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
1486
|
+
type: "default",
|
|
1487
|
+
style: {
|
|
1488
|
+
padding: "20px 12px"
|
|
1489
|
+
},
|
|
1490
|
+
className: "btn-gray",
|
|
1491
|
+
onClick: onRemove,
|
|
1492
|
+
children: texts.removeButton
|
|
1493
|
+
})]
|
|
1494
|
+
})
|
|
1495
|
+
})]
|
|
1496
|
+
});
|
|
1497
|
+
});
|
|
1498
|
+
const SubmitButton = _ref2 => {
|
|
1499
|
+
let {
|
|
1500
|
+
loading,
|
|
1501
|
+
action,
|
|
1502
|
+
children,
|
|
1503
|
+
disabled = false
|
|
1504
|
+
} = _ref2;
|
|
1505
|
+
return /*#__PURE__*/jsx("div", {
|
|
1506
|
+
className: "submit-btn-wrapper",
|
|
1507
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
1508
|
+
className: "btn-gray",
|
|
1509
|
+
loading: loading,
|
|
1510
|
+
onClick: action,
|
|
1511
|
+
disabled: disabled,
|
|
1512
|
+
children: children
|
|
1513
|
+
})
|
|
1514
|
+
});
|
|
1515
|
+
};
|
|
1516
|
+
const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
|
|
1517
|
+
let {
|
|
1518
|
+
form,
|
|
1519
|
+
onSave,
|
|
1520
|
+
onLoad,
|
|
1521
|
+
isLoading,
|
|
1522
|
+
isEditing,
|
|
1523
|
+
originalPresetData,
|
|
1524
|
+
fields = {
|
|
1525
|
+
name: {
|
|
1526
|
+
label: "Preset Name",
|
|
1527
|
+
placeholder: "Enter preset name",
|
|
1528
|
+
required: true
|
|
1529
|
+
}
|
|
1530
|
+
},
|
|
1531
|
+
texts = {
|
|
1532
|
+
loadButton: "Load",
|
|
1533
|
+
saveButton: "Save"
|
|
1534
|
+
},
|
|
1535
|
+
presetChanged
|
|
1536
|
+
} = _ref3;
|
|
1537
|
+
const [initialSelected, setInitialSelected] = useState([]);
|
|
1538
|
+
const currentSelected = Form.useWatch('category_list', form) || [];
|
|
1539
|
+
|
|
1540
|
+
// 检查是否包含category_list字段
|
|
1541
|
+
const hasCategoryList = fields.category_list !== null && fields.category_list !== undefined;
|
|
1542
|
+
|
|
1543
|
+
// 初始化 category_list 的选择状态
|
|
1544
|
+
useEffect(() => {
|
|
1545
|
+
if (hasCategoryList) {
|
|
1546
|
+
const currentValue = form.getFieldValue('category_list') || [];
|
|
1547
|
+
setInitialSelected(currentValue);
|
|
1548
|
+
}
|
|
1549
|
+
}, [presetChanged, form, hasCategoryList]); // 当presetChanged变化时更新
|
|
1550
|
+
|
|
1551
|
+
// 动态生成 checkbox 选项
|
|
1552
|
+
const checkboxOptions = useMemo(() => {
|
|
1553
|
+
if (!hasCategoryList) return [];
|
|
1554
|
+
return fields.category_list.options.map(category => {
|
|
1555
|
+
const isInitiallySelected = initialSelected.includes(category.name);
|
|
1556
|
+
const shouldDisable = isEditing ? !isInitiallySelected : false;
|
|
1557
|
+
return _objectSpread2(_objectSpread2({}, category), {}, {
|
|
1558
|
+
disabled: shouldDisable,
|
|
1559
|
+
initiallySelected: isInitiallySelected
|
|
1560
|
+
});
|
|
1561
|
+
});
|
|
1562
|
+
}, [initialSelected, isEditing, hasCategoryList, fields.category_list]);
|
|
1563
|
+
const handleCheckboxChange = checkedValues => {
|
|
1564
|
+
form.setFieldsValue({
|
|
1565
|
+
category_list: checkedValues
|
|
1566
|
+
});
|
|
1567
|
+
};
|
|
1568
|
+
const handleLoad = async () => {
|
|
1569
|
+
try {
|
|
1570
|
+
const formValues = await form.validateFields();
|
|
1571
|
+
const loadData = {
|
|
1572
|
+
id: form.getFieldValue('id'),
|
|
1573
|
+
// 优先使用表单中的 category_list,如果没有则使用原始数据
|
|
1574
|
+
name: originalPresetData.name,
|
|
1575
|
+
category_list: hasCategoryList ? formValues.category_list || [] : (originalPresetData === null || originalPresetData === void 0 ? void 0 : originalPresetData.category_list) || []
|
|
1576
|
+
};
|
|
1577
|
+
await onLoad(loadData);
|
|
1578
|
+
} catch (error) {
|
|
1579
|
+
console.error('表单验证失败:', error);
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
return /*#__PURE__*/jsxs(Flex, {
|
|
1583
|
+
vertical: true,
|
|
1584
|
+
className: "h-full",
|
|
1585
|
+
children: [/*#__PURE__*/jsxs(Form, {
|
|
1586
|
+
form: form,
|
|
1587
|
+
layout: "vertical",
|
|
1588
|
+
autoComplete: "off",
|
|
1589
|
+
style: {
|
|
1590
|
+
flex: 1,
|
|
1591
|
+
overflowY: 'auto'
|
|
1592
|
+
},
|
|
1593
|
+
children: [/*#__PURE__*/jsx(Form.Item, {
|
|
1594
|
+
name: "name",
|
|
1595
|
+
label: fields.name.label,
|
|
1596
|
+
rules: [{
|
|
1597
|
+
required: fields.name.required,
|
|
1598
|
+
validator: async (_, value) => {
|
|
1599
|
+
if (!value || value.trim() === '') {
|
|
1600
|
+
return Promise.reject(new Error('Preset name cannot be empty or spaces only'));
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}],
|
|
1604
|
+
children: /*#__PURE__*/jsx(Input, {
|
|
1605
|
+
placeholder: fields.name.placeholder,
|
|
1606
|
+
disabled: isEditing
|
|
1607
|
+
})
|
|
1608
|
+
}), hasCategoryList && /*#__PURE__*/jsx(Form.Item, {
|
|
1609
|
+
name: "category_list",
|
|
1610
|
+
label: fields.category_list.label,
|
|
1611
|
+
rules: [{
|
|
1612
|
+
required: fields.category_list.required,
|
|
1613
|
+
message: 'Please select at least one category',
|
|
1614
|
+
validator: (_, value) => {
|
|
1615
|
+
if (value && value.length > 0) {
|
|
1616
|
+
return Promise.resolve();
|
|
1617
|
+
}
|
|
1618
|
+
return Promise.reject(new Error('Please select at least one category'));
|
|
1619
|
+
}
|
|
1620
|
+
}],
|
|
1621
|
+
children: /*#__PURE__*/jsx(Checkbox.Group, {
|
|
1622
|
+
className: "grid grid-cols-2 gap-2",
|
|
1623
|
+
onChange: handleCheckboxChange,
|
|
1624
|
+
children: checkboxOptions.map(category => /*#__PURE__*/jsx(Checkbox, {
|
|
1625
|
+
value: category.name,
|
|
1626
|
+
disabled: category.disabled,
|
|
1627
|
+
children: category.label
|
|
1628
|
+
}, category.name))
|
|
1629
|
+
})
|
|
1630
|
+
}), fields.description && /*#__PURE__*/jsx(Form.Item, {
|
|
1631
|
+
name: "description",
|
|
1632
|
+
label: fields.description.label,
|
|
1633
|
+
children: /*#__PURE__*/jsx(Input.TextArea, {
|
|
1634
|
+
rows: 4,
|
|
1635
|
+
placeholder: fields.description.placeholder,
|
|
1636
|
+
disabled: isEditing
|
|
1637
|
+
})
|
|
1638
|
+
})]
|
|
1639
|
+
}), isEditing ? /*#__PURE__*/jsx(SubmitButton, _objectSpread2(_objectSpread2({
|
|
1640
|
+
action: handleLoad
|
|
1641
|
+
}, hasCategoryList && {
|
|
1642
|
+
disabled: !currentSelected.length
|
|
1643
|
+
}), {}, {
|
|
1644
|
+
children: texts.loadButton
|
|
1645
|
+
})) : /*#__PURE__*/jsx(SubmitButton, {
|
|
1646
|
+
action: onSave,
|
|
1647
|
+
loading: isLoading,
|
|
1648
|
+
children: texts.saveButton
|
|
1649
|
+
})]
|
|
1650
|
+
});
|
|
1651
|
+
});
|
|
1652
|
+
|
|
1653
|
+
const Preset = _ref => {
|
|
1654
|
+
let {
|
|
1655
|
+
open,
|
|
1656
|
+
onClose,
|
|
1657
|
+
// API 方法通过 props 传入
|
|
1658
|
+
getPresetList,
|
|
1659
|
+
savePreset,
|
|
1660
|
+
removePreset,
|
|
1661
|
+
loadPreset,
|
|
1662
|
+
onLoadSuccess,
|
|
1663
|
+
// 加载成功后的回调
|
|
1664
|
+
onLoadError,
|
|
1665
|
+
// 加载失败后的回调
|
|
1666
|
+
// 字段配置
|
|
1667
|
+
fields = {
|
|
1668
|
+
name: {
|
|
1669
|
+
label: "Preset Name",
|
|
1670
|
+
placeholder: "Enter preset name",
|
|
1671
|
+
required: true
|
|
1672
|
+
}
|
|
1673
|
+
},
|
|
1674
|
+
texts = {
|
|
1675
|
+
title: "Preset Management",
|
|
1676
|
+
emptyText: "Select a preset from the list to view details",
|
|
1677
|
+
deleteConfirm: "Are you sure to delete preset",
|
|
1678
|
+
loadConfirm: "Are you sure you want to load preset",
|
|
1679
|
+
loadText: "Loading...",
|
|
1680
|
+
successText: "Success",
|
|
1681
|
+
newButton: "New Preset",
|
|
1682
|
+
removeButton: "Remove",
|
|
1683
|
+
loadButton: "Load",
|
|
1684
|
+
saveButton: "Save"
|
|
1685
|
+
},
|
|
1686
|
+
// 样式定制
|
|
1687
|
+
width = 1000,
|
|
1688
|
+
height = 680,
|
|
1689
|
+
className = ""
|
|
1690
|
+
} = _ref;
|
|
1691
|
+
const {
|
|
1692
|
+
message: AntdMessage,
|
|
1693
|
+
modal: AntdModal
|
|
1694
|
+
} = App.useApp();
|
|
1695
|
+
const [presetList, setPresetList] = useState([]);
|
|
1696
|
+
const [selectedPreset, setSelectedPreset] = useState(null);
|
|
1697
|
+
const [loading, setLoading] = useState(false);
|
|
1698
|
+
const [presetChanged, setPresetChanged] = useState(0);
|
|
1699
|
+
const [form] = Form.useForm();
|
|
1700
|
+
|
|
1701
|
+
// 获取预设列表
|
|
1702
|
+
useEffect(() => {
|
|
1703
|
+
fetchPresetList();
|
|
1704
|
+
}, []);
|
|
1705
|
+
const fetchPresetList = useCallback(async () => {
|
|
1706
|
+
try {
|
|
1707
|
+
const data = await getPresetList();
|
|
1708
|
+
const presets = (data === null || data === void 0 ? void 0 : data.preset_list) || data || [];
|
|
1709
|
+
setPresetList(presets);
|
|
1710
|
+
} catch (error) {
|
|
1711
|
+
console.error('Failed to fetch preset list:', error);
|
|
1712
|
+
}
|
|
1713
|
+
}, [getPresetList]);
|
|
1714
|
+
const handleSelectPreset = useCallback(preset => {
|
|
1715
|
+
setSelectedPreset(preset);
|
|
1716
|
+
form.setFieldsValue(preset);
|
|
1717
|
+
setPresetChanged(prev => prev + 1); // 触发react更新
|
|
1718
|
+
}, [form]);
|
|
1719
|
+
const handleAddNew = useCallback(() => {
|
|
1720
|
+
var _fields$category_list;
|
|
1721
|
+
const unsavedPreset = presetList.find(item => !item.id);
|
|
1722
|
+
if (unsavedPreset) {
|
|
1723
|
+
AntdMessage.warning('Existing unsaved preset detected.');
|
|
1724
|
+
return;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
// 创建新的数据,包含所有配置的字段
|
|
1728
|
+
const newPreset = Object.keys(fields).reduce((acc, fieldName) => {
|
|
1729
|
+
acc[fieldName] = '';
|
|
1730
|
+
return acc;
|
|
1731
|
+
}, {});
|
|
1732
|
+
|
|
1733
|
+
// 特殊处理 category_list
|
|
1734
|
+
if ((_fields$category_list = fields.category_list) !== null && _fields$category_list !== void 0 && _fields$category_list.options) {
|
|
1735
|
+
newPreset.category_list = fields.category_list.options.map(item => item.name);
|
|
1736
|
+
}
|
|
1737
|
+
setPresetList([...presetList, newPreset]);
|
|
1738
|
+
setSelectedPreset(newPreset);
|
|
1739
|
+
form.setFieldsValue(newPreset);
|
|
1740
|
+
}, [form, presetList, AntdMessage]);
|
|
1741
|
+
const handleRemove = useCallback(async () => {
|
|
1742
|
+
if (!selectedPreset) return;
|
|
1743
|
+
|
|
1744
|
+
// 检查是否为新建的未保存数据(无id)
|
|
1745
|
+
const isUnsavedPreset = !selectedPreset.id;
|
|
1746
|
+
const presetName = selectedPreset.name || 'Untitled Preset';
|
|
1747
|
+
try {
|
|
1748
|
+
AntdModal.confirm({
|
|
1749
|
+
icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
|
|
1750
|
+
title: 'Delete Preset',
|
|
1751
|
+
content: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
|
|
1752
|
+
cancelText: 'No',
|
|
1753
|
+
okText: 'Yes',
|
|
1754
|
+
onOk: async () => {
|
|
1755
|
+
if (!isUnsavedPreset) {
|
|
1756
|
+
await removePreset({
|
|
1757
|
+
id: selectedPreset.id
|
|
1758
|
+
});
|
|
1759
|
+
AntdMessage.success(texts.successText);
|
|
1760
|
+
// 刷新列表
|
|
1761
|
+
await fetchPresetList();
|
|
1762
|
+
} else {
|
|
1763
|
+
setPresetList(prev => prev.filter(item => !!item.id));
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// 重置表单和选择状态
|
|
1767
|
+
setSelectedPreset(null);
|
|
1768
|
+
form.resetFields();
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
} catch (error) {
|
|
1772
|
+
console.error('Failed to delete preset:', error);
|
|
1773
|
+
}
|
|
1774
|
+
}, [selectedPreset, form, AntdModal, AntdMessage, fetchPresetList, texts]);
|
|
1775
|
+
const handleLoadPreset = useCallback(async loadData => {
|
|
1776
|
+
if (!loadData) return;
|
|
1777
|
+
|
|
1778
|
+
// 显示确认对话框
|
|
1779
|
+
AntdModal.confirm({
|
|
1780
|
+
title: 'Load Preset',
|
|
1781
|
+
content: "".concat(texts.loadConfirm, " \"").concat(loadData.name, "\"?"),
|
|
1782
|
+
cancelText: 'No',
|
|
1783
|
+
okText: 'Yes',
|
|
1784
|
+
onOk: async () => {
|
|
1785
|
+
// 显示加载模态框
|
|
1786
|
+
const modalInstance = Modal.info({
|
|
1787
|
+
title: texts.loadText,
|
|
1788
|
+
content: /*#__PURE__*/jsx(Spin, {
|
|
1789
|
+
size: "large",
|
|
1790
|
+
className: "block mx-auto"
|
|
1791
|
+
}),
|
|
1792
|
+
maskClosable: false,
|
|
1793
|
+
okButtonProps: {
|
|
1794
|
+
style: {
|
|
1795
|
+
display: 'none'
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
});
|
|
1799
|
+
try {
|
|
1800
|
+
await loadPreset(_objectSpread2({
|
|
1801
|
+
id: loadData.id
|
|
1802
|
+
}, loadData.category_list && {
|
|
1803
|
+
category_list: loadData.category_list
|
|
1804
|
+
}));
|
|
1805
|
+
// 成功时延迟关闭
|
|
1806
|
+
setTimeout(() => {
|
|
1807
|
+
modalInstance.destroy();
|
|
1808
|
+
AntdMessage.success(texts.successText);
|
|
1809
|
+
|
|
1810
|
+
// 加载成功的外部回调
|
|
1811
|
+
if (onLoadSuccess) {
|
|
1812
|
+
onLoadSuccess(loadData);
|
|
1813
|
+
}
|
|
1814
|
+
}, 1000);
|
|
1815
|
+
} catch (error) {
|
|
1816
|
+
console.error('Failed to load preset:', error);
|
|
1817
|
+
modalInstance.destroy();
|
|
1818
|
+
|
|
1819
|
+
// 加载失败的外部回调
|
|
1820
|
+
if (onLoadError) {
|
|
1821
|
+
onLoadError(error, loadData);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
}, [loadPreset, texts, AntdMessage, AntdModal, onLoadSuccess, onLoadError]);
|
|
1827
|
+
const handleSave = useCallback(async () => {
|
|
1828
|
+
setLoading(true);
|
|
1829
|
+
try {
|
|
1830
|
+
const values = await form.validateFields();
|
|
1831
|
+
console.log('Form values:', values);
|
|
1832
|
+
await savePreset(values);
|
|
1833
|
+
AntdMessage.success(texts.successText);
|
|
1834
|
+
// 刷新列表
|
|
1835
|
+
await fetchPresetList();
|
|
1836
|
+
|
|
1837
|
+
// 重置表单和选择状态
|
|
1838
|
+
setSelectedPreset(null);
|
|
1839
|
+
form.resetFields();
|
|
1840
|
+
} catch (error) {
|
|
1841
|
+
if (error.errorFields) {
|
|
1842
|
+
// 表单验证错误
|
|
1843
|
+
console.error('Form validation failed:', error.errorFields);
|
|
1844
|
+
} else {
|
|
1845
|
+
console.error('Failed to save preset:', error);
|
|
1846
|
+
}
|
|
1847
|
+
} finally {
|
|
1848
|
+
setLoading(false);
|
|
1849
|
+
}
|
|
1850
|
+
}, [form, AntdMessage, fetchPresetList, savePreset, texts]);
|
|
1851
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
1852
|
+
title: texts.title,
|
|
1853
|
+
width: width,
|
|
1854
|
+
open: open,
|
|
1855
|
+
wrapClassName: "preset-management ".concat(className),
|
|
1856
|
+
footer: null,
|
|
1857
|
+
onCancel: onClose,
|
|
1858
|
+
centered: true,
|
|
1859
|
+
styles: {
|
|
1860
|
+
body: {
|
|
1861
|
+
height: "".concat(height, "px")
|
|
1862
|
+
}
|
|
1863
|
+
},
|
|
1864
|
+
children: /*#__PURE__*/jsxs(Row, {
|
|
1865
|
+
gutter: 0,
|
|
1866
|
+
className: "h-full w-full",
|
|
1867
|
+
children: [/*#__PURE__*/jsx(Col, {
|
|
1868
|
+
span: 14,
|
|
1869
|
+
className: "h-full",
|
|
1870
|
+
children: /*#__PURE__*/jsx(LeftList, {
|
|
1871
|
+
dataSource: presetList,
|
|
1872
|
+
selectedPresetId: selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.id,
|
|
1873
|
+
onSelectPreset: handleSelectPreset,
|
|
1874
|
+
onAddNew: handleAddNew,
|
|
1875
|
+
onRemove: handleRemove,
|
|
1876
|
+
showDescription: !!fields.description // 根据 fields 判断是否显示 description
|
|
1877
|
+
,
|
|
1878
|
+
texts: {
|
|
1879
|
+
newButton: texts.newButton,
|
|
1880
|
+
removeButton: texts.removeButton
|
|
1881
|
+
}
|
|
1882
|
+
})
|
|
1883
|
+
}), /*#__PURE__*/jsx(Col, {
|
|
1884
|
+
span: 10,
|
|
1885
|
+
className: "h-full p-6",
|
|
1886
|
+
children: selectedPreset ? /*#__PURE__*/jsx(RightDetailForm, {
|
|
1887
|
+
form: form,
|
|
1888
|
+
onSave: handleSave,
|
|
1889
|
+
onLoad: handleLoadPreset,
|
|
1890
|
+
isLoading: loading,
|
|
1891
|
+
isEditing: !!(selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.id),
|
|
1892
|
+
originalPresetData: selectedPreset // 传递原始数据
|
|
1893
|
+
,
|
|
1894
|
+
fields: fields,
|
|
1895
|
+
texts: {
|
|
1896
|
+
loadButton: texts.loadButton,
|
|
1897
|
+
saveButton: texts.saveButton
|
|
1898
|
+
},
|
|
1899
|
+
presetChanged: presetChanged
|
|
1900
|
+
}) : /*#__PURE__*/jsx(Flex, {
|
|
1901
|
+
vertical: true,
|
|
1902
|
+
justify: "center",
|
|
1903
|
+
align: "center",
|
|
1904
|
+
className: "h-full text-gray-400",
|
|
1905
|
+
children: /*#__PURE__*/jsx(Empty, {
|
|
1906
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
1907
|
+
description: texts.emptyText
|
|
1908
|
+
})
|
|
1909
|
+
})
|
|
1910
|
+
})]
|
|
1911
|
+
})
|
|
1912
|
+
});
|
|
1913
|
+
};
|
|
1914
|
+
var PresetModal = /*#__PURE__*/memo(Preset);
|
|
1915
|
+
|
|
1916
|
+
const _excluded = ["menuItems", "onMenuClick", "downloadFiles", "upgradeExecute", "upgradeStatus", "acceptFileTypes", "uploadCompleteDelay", "statusPollingInterval", "children"];
|
|
1917
|
+
const UpgradeManager = _ref => {
|
|
1918
|
+
let {
|
|
1919
|
+
menuItems = [],
|
|
1920
|
+
onMenuClick,
|
|
1921
|
+
downloadFiles,
|
|
1922
|
+
upgradeExecute,
|
|
1923
|
+
upgradeStatus,
|
|
1924
|
+
acceptFileTypes = "application/octet-stream",
|
|
1925
|
+
uploadCompleteDelay = 3000,
|
|
1926
|
+
statusPollingInterval = 1000,
|
|
1927
|
+
children
|
|
1928
|
+
} = _ref,
|
|
1929
|
+
dropdownProps = _objectWithoutProperties(_ref, _excluded);
|
|
1930
|
+
const [upgradeElement] = useUpgrade$1({
|
|
1931
|
+
menuItems,
|
|
1932
|
+
onMenuClick,
|
|
1933
|
+
downloadFiles,
|
|
1934
|
+
upgradeExecute,
|
|
1935
|
+
upgradeStatus,
|
|
1936
|
+
acceptFileTypes,
|
|
1937
|
+
uploadCompleteDelay,
|
|
1938
|
+
statusPollingInterval
|
|
1939
|
+
});
|
|
1940
|
+
if (children) {
|
|
1941
|
+
// 提取Dropdown组件和其menu属性
|
|
1942
|
+
const dropdownElement = upgradeElement.props.children[0];
|
|
1943
|
+
const otherElements = upgradeElement.props.children.slice(1);
|
|
1944
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
1945
|
+
children: [/*#__PURE__*/jsx(Dropdown, _objectSpread2(_objectSpread2(_objectSpread2({}, dropdownProps), dropdownElement.props), {}, {
|
|
1946
|
+
children: children
|
|
1947
|
+
})), otherElements]
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
// 如果没有children,直接返回完整的升级元素
|
|
1952
|
+
return upgradeElement;
|
|
1953
|
+
};
|
|
1954
|
+
UpgradeManager.defaultProps = {
|
|
1955
|
+
trigger: ["hover"],
|
|
1956
|
+
placement: "bottomRight"
|
|
1957
|
+
};
|
|
1958
|
+
var UpgradeManager$1 = UpgradeManager;
|
|
1959
|
+
|
|
1960
|
+
function getDefaultExportFromCjs (x) {
|
|
1961
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
var propTypes = {exports: {}};
|
|
1965
|
+
|
|
1966
|
+
var reactIs = {exports: {}};
|
|
1967
|
+
|
|
1968
|
+
var reactIs_production_min = {};
|
|
1969
|
+
|
|
1970
|
+
/** @license React v16.13.1
|
|
1971
|
+
* react-is.production.min.js
|
|
1972
|
+
*
|
|
1973
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1974
|
+
*
|
|
1975
|
+
* This source code is licensed under the MIT license found in the
|
|
1976
|
+
* LICENSE file in the root directory of this source tree.
|
|
1977
|
+
*/
|
|
1978
|
+
|
|
1979
|
+
var hasRequiredReactIs_production_min;
|
|
1980
|
+
|
|
1981
|
+
function requireReactIs_production_min () {
|
|
1982
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
1983
|
+
hasRequiredReactIs_production_min = 1;
|
|
1984
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
1985
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
1986
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
1987
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
1988
|
+
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
1989
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
1990
|
+
return reactIs_production_min;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
var reactIs_development = {};
|
|
1994
|
+
|
|
1995
|
+
/** @license React v16.13.1
|
|
1996
|
+
* react-is.development.js
|
|
1997
|
+
*
|
|
1998
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1999
|
+
*
|
|
2000
|
+
* This source code is licensed under the MIT license found in the
|
|
2001
|
+
* LICENSE file in the root directory of this source tree.
|
|
2002
|
+
*/
|
|
2003
|
+
|
|
2004
|
+
var hasRequiredReactIs_development;
|
|
2005
|
+
|
|
2006
|
+
function requireReactIs_development () {
|
|
2007
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
2008
|
+
hasRequiredReactIs_development = 1;
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2013
|
+
(function() {
|
|
2014
|
+
|
|
2015
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
2016
|
+
// nor polyfill, then a plain number is used for performance.
|
|
2017
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
2018
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
2019
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
2020
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
2021
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
2022
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
2023
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
2024
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
2025
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
2026
|
+
|
|
2027
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
2028
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
2029
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
2030
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
2031
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
2032
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
2033
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
2034
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
2035
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
2036
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
2037
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
2038
|
+
|
|
2039
|
+
function isValidElementType(type) {
|
|
2040
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
2041
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
function typeOf(object) {
|
|
2045
|
+
if (typeof object === 'object' && object !== null) {
|
|
2046
|
+
var $$typeof = object.$$typeof;
|
|
2047
|
+
|
|
2048
|
+
switch ($$typeof) {
|
|
2049
|
+
case REACT_ELEMENT_TYPE:
|
|
2050
|
+
var type = object.type;
|
|
2051
|
+
|
|
2052
|
+
switch (type) {
|
|
2053
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
2054
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
2055
|
+
case REACT_FRAGMENT_TYPE:
|
|
2056
|
+
case REACT_PROFILER_TYPE:
|
|
2057
|
+
case REACT_STRICT_MODE_TYPE:
|
|
2058
|
+
case REACT_SUSPENSE_TYPE:
|
|
2059
|
+
return type;
|
|
2060
|
+
|
|
2061
|
+
default:
|
|
2062
|
+
var $$typeofType = type && type.$$typeof;
|
|
2063
|
+
|
|
2064
|
+
switch ($$typeofType) {
|
|
2065
|
+
case REACT_CONTEXT_TYPE:
|
|
2066
|
+
case REACT_FORWARD_REF_TYPE:
|
|
2067
|
+
case REACT_LAZY_TYPE:
|
|
2068
|
+
case REACT_MEMO_TYPE:
|
|
2069
|
+
case REACT_PROVIDER_TYPE:
|
|
2070
|
+
return $$typeofType;
|
|
2071
|
+
|
|
2072
|
+
default:
|
|
2073
|
+
return $$typeof;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
case REACT_PORTAL_TYPE:
|
|
2079
|
+
return $$typeof;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
return undefined;
|
|
2084
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
2085
|
+
|
|
2086
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
2087
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
2088
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
2089
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
2090
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
2091
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2092
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
2093
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
2094
|
+
var Memo = REACT_MEMO_TYPE;
|
|
974
2095
|
var Portal = REACT_PORTAL_TYPE;
|
|
975
2096
|
var Profiler = REACT_PROFILER_TYPE;
|
|
976
2097
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
@@ -1528,227 +2649,59 @@ function requireFactoryWithTypeCheckers () {
|
|
|
1528
2649
|
if (props[propName] == null) {
|
|
1529
2650
|
if (isRequired) {
|
|
1530
2651
|
if (props[propName] === null) {
|
|
1531
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
1532
|
-
}
|
|
1533
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
1534
|
-
}
|
|
1535
|
-
return null;
|
|
1536
|
-
} else {
|
|
1537
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
1542
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
1543
|
-
|
|
1544
|
-
return chainedCheckType;
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
1548
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
1549
|
-
var propValue = props[propName];
|
|
1550
|
-
var propType = getPropType(propValue);
|
|
1551
|
-
if (propType !== expectedType) {
|
|
1552
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
1553
|
-
// check, but we can offer a more precise error message here rather than
|
|
1554
|
-
// 'of type `object`'.
|
|
1555
|
-
var preciseType = getPreciseType(propValue);
|
|
1556
|
-
|
|
1557
|
-
return new PropTypeError(
|
|
1558
|
-
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
1559
|
-
{expectedType: expectedType}
|
|
1560
|
-
);
|
|
1561
|
-
}
|
|
1562
|
-
return null;
|
|
1563
|
-
}
|
|
1564
|
-
return createChainableTypeChecker(validate);
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
function createAnyTypeChecker() {
|
|
1568
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
1572
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1573
|
-
if (typeof typeChecker !== 'function') {
|
|
1574
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
1575
|
-
}
|
|
1576
|
-
var propValue = props[propName];
|
|
1577
|
-
if (!Array.isArray(propValue)) {
|
|
1578
|
-
var propType = getPropType(propValue);
|
|
1579
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
1580
|
-
}
|
|
1581
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
1582
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
1583
|
-
if (error instanceof Error) {
|
|
1584
|
-
return error;
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
return null;
|
|
1588
|
-
}
|
|
1589
|
-
return createChainableTypeChecker(validate);
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
function createElementTypeChecker() {
|
|
1593
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1594
|
-
var propValue = props[propName];
|
|
1595
|
-
if (!isValidElement(propValue)) {
|
|
1596
|
-
var propType = getPropType(propValue);
|
|
1597
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
1598
|
-
}
|
|
1599
|
-
return null;
|
|
1600
|
-
}
|
|
1601
|
-
return createChainableTypeChecker(validate);
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
function createElementTypeTypeChecker() {
|
|
1605
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1606
|
-
var propValue = props[propName];
|
|
1607
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
1608
|
-
var propType = getPropType(propValue);
|
|
1609
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
1610
|
-
}
|
|
1611
|
-
return null;
|
|
1612
|
-
}
|
|
1613
|
-
return createChainableTypeChecker(validate);
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
1617
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1618
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
1619
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
1620
|
-
var actualClassName = getClassName(props[propName]);
|
|
1621
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
1622
|
-
}
|
|
1623
|
-
return null;
|
|
1624
|
-
}
|
|
1625
|
-
return createChainableTypeChecker(validate);
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
function createEnumTypeChecker(expectedValues) {
|
|
1629
|
-
if (!Array.isArray(expectedValues)) {
|
|
1630
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1631
|
-
if (arguments.length > 1) {
|
|
1632
|
-
printWarning(
|
|
1633
|
-
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
1634
|
-
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
1635
|
-
);
|
|
1636
|
-
} else {
|
|
1637
|
-
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
2652
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
2653
|
+
}
|
|
2654
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
1638
2655
|
}
|
|
2656
|
+
return null;
|
|
2657
|
+
} else {
|
|
2658
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
1639
2659
|
}
|
|
1640
|
-
return emptyFunctionThatReturnsNull;
|
|
1641
2660
|
}
|
|
1642
2661
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
1646
|
-
if (is(propValue, expectedValues[i])) {
|
|
1647
|
-
return null;
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
2662
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
2663
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
1650
2664
|
|
|
1651
|
-
|
|
1652
|
-
var type = getPreciseType(value);
|
|
1653
|
-
if (type === 'symbol') {
|
|
1654
|
-
return String(value);
|
|
1655
|
-
}
|
|
1656
|
-
return value;
|
|
1657
|
-
});
|
|
1658
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
1659
|
-
}
|
|
1660
|
-
return createChainableTypeChecker(validate);
|
|
2665
|
+
return chainedCheckType;
|
|
1661
2666
|
}
|
|
1662
2667
|
|
|
1663
|
-
function
|
|
1664
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1665
|
-
if (typeof typeChecker !== 'function') {
|
|
1666
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
1667
|
-
}
|
|
2668
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
2669
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
1668
2670
|
var propValue = props[propName];
|
|
1669
2671
|
var propType = getPropType(propValue);
|
|
1670
|
-
if (propType !==
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1676
|
-
if (error instanceof Error) {
|
|
1677
|
-
return error;
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
return null;
|
|
1682
|
-
}
|
|
1683
|
-
return createChainableTypeChecker(validate);
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
1687
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
1688
|
-
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1689
|
-
return emptyFunctionThatReturnsNull;
|
|
1690
|
-
}
|
|
2672
|
+
if (propType !== expectedType) {
|
|
2673
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
2674
|
+
// check, but we can offer a more precise error message here rather than
|
|
2675
|
+
// 'of type `object`'.
|
|
2676
|
+
var preciseType = getPreciseType(propValue);
|
|
1691
2677
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
printWarning(
|
|
1696
|
-
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
1697
|
-
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
2678
|
+
return new PropTypeError(
|
|
2679
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
2680
|
+
{expectedType: expectedType}
|
|
1698
2681
|
);
|
|
1699
|
-
return emptyFunctionThatReturnsNull;
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1704
|
-
var expectedTypes = [];
|
|
1705
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1706
|
-
var checker = arrayOfTypeCheckers[i];
|
|
1707
|
-
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
1708
|
-
if (checkerResult == null) {
|
|
1709
|
-
return null;
|
|
1710
|
-
}
|
|
1711
|
-
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1712
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
1716
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1717
|
-
}
|
|
1718
|
-
return createChainableTypeChecker(validate);
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
function createNodeChecker() {
|
|
1722
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1723
|
-
if (!isNode(props[propName])) {
|
|
1724
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
1725
2682
|
}
|
|
1726
2683
|
return null;
|
|
1727
2684
|
}
|
|
1728
2685
|
return createChainableTypeChecker(validate);
|
|
1729
2686
|
}
|
|
1730
2687
|
|
|
1731
|
-
function
|
|
1732
|
-
return
|
|
1733
|
-
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
1734
|
-
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
1735
|
-
);
|
|
2688
|
+
function createAnyTypeChecker() {
|
|
2689
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
1736
2690
|
}
|
|
1737
2691
|
|
|
1738
|
-
function
|
|
2692
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
1739
2693
|
function validate(props, propName, componentName, location, propFullName) {
|
|
2694
|
+
if (typeof typeChecker !== 'function') {
|
|
2695
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
2696
|
+
}
|
|
1740
2697
|
var propValue = props[propName];
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '`
|
|
2698
|
+
if (!Array.isArray(propValue)) {
|
|
2699
|
+
var propType = getPropType(propValue);
|
|
2700
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
1744
2701
|
}
|
|
1745
|
-
for (var
|
|
1746
|
-
var
|
|
1747
|
-
if (
|
|
1748
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1749
|
-
}
|
|
1750
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1751
|
-
if (error) {
|
|
2702
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
2703
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
2704
|
+
if (error instanceof Error) {
|
|
1752
2705
|
return error;
|
|
1753
2706
|
}
|
|
1754
2707
|
}
|
|
@@ -1757,1485 +2710,690 @@ function requireFactoryWithTypeCheckers () {
|
|
|
1757
2710
|
return createChainableTypeChecker(validate);
|
|
1758
2711
|
}
|
|
1759
2712
|
|
|
1760
|
-
function
|
|
2713
|
+
function createElementTypeChecker() {
|
|
1761
2714
|
function validate(props, propName, componentName, location, propFullName) {
|
|
1762
2715
|
var propValue = props[propName];
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '`
|
|
1766
|
-
}
|
|
1767
|
-
// We need to check all keys in case some are required but missing from props.
|
|
1768
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1769
|
-
for (var key in allKeys) {
|
|
1770
|
-
var checker = shapeTypes[key];
|
|
1771
|
-
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1772
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1773
|
-
}
|
|
1774
|
-
if (!checker) {
|
|
1775
|
-
return new PropTypeError(
|
|
1776
|
-
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1777
|
-
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1778
|
-
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1779
|
-
);
|
|
1780
|
-
}
|
|
1781
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1782
|
-
if (error) {
|
|
1783
|
-
return error;
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
return null;
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
return createChainableTypeChecker(validate);
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
function isNode(propValue) {
|
|
1793
|
-
switch (typeof propValue) {
|
|
1794
|
-
case 'number':
|
|
1795
|
-
case 'string':
|
|
1796
|
-
case 'undefined':
|
|
1797
|
-
return true;
|
|
1798
|
-
case 'boolean':
|
|
1799
|
-
return !propValue;
|
|
1800
|
-
case 'object':
|
|
1801
|
-
if (Array.isArray(propValue)) {
|
|
1802
|
-
return propValue.every(isNode);
|
|
1803
|
-
}
|
|
1804
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
1805
|
-
return true;
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
1809
|
-
if (iteratorFn) {
|
|
1810
|
-
var iterator = iteratorFn.call(propValue);
|
|
1811
|
-
var step;
|
|
1812
|
-
if (iteratorFn !== propValue.entries) {
|
|
1813
|
-
while (!(step = iterator.next()).done) {
|
|
1814
|
-
if (!isNode(step.value)) {
|
|
1815
|
-
return false;
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
} else {
|
|
1819
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1820
|
-
while (!(step = iterator.next()).done) {
|
|
1821
|
-
var entry = step.value;
|
|
1822
|
-
if (entry) {
|
|
1823
|
-
if (!isNode(entry[1])) {
|
|
1824
|
-
return false;
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
} else {
|
|
1830
|
-
return false;
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
return true;
|
|
1834
|
-
default:
|
|
1835
|
-
return false;
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
function isSymbol(propType, propValue) {
|
|
1840
|
-
// Native Symbol.
|
|
1841
|
-
if (propType === 'symbol') {
|
|
1842
|
-
return true;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
// falsy value can't be a Symbol
|
|
1846
|
-
if (!propValue) {
|
|
1847
|
-
return false;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1851
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1852
|
-
return true;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1856
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1857
|
-
return true;
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
return false;
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1864
|
-
function getPropType(propValue) {
|
|
1865
|
-
var propType = typeof propValue;
|
|
1866
|
-
if (Array.isArray(propValue)) {
|
|
1867
|
-
return 'array';
|
|
1868
|
-
}
|
|
1869
|
-
if (propValue instanceof RegExp) {
|
|
1870
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1871
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1872
|
-
// passes PropTypes.object.
|
|
1873
|
-
return 'object';
|
|
1874
|
-
}
|
|
1875
|
-
if (isSymbol(propType, propValue)) {
|
|
1876
|
-
return 'symbol';
|
|
1877
|
-
}
|
|
1878
|
-
return propType;
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
1882
|
-
// See `createPrimitiveTypeChecker`.
|
|
1883
|
-
function getPreciseType(propValue) {
|
|
1884
|
-
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1885
|
-
return '' + propValue;
|
|
1886
|
-
}
|
|
1887
|
-
var propType = getPropType(propValue);
|
|
1888
|
-
if (propType === 'object') {
|
|
1889
|
-
if (propValue instanceof Date) {
|
|
1890
|
-
return 'date';
|
|
1891
|
-
} else if (propValue instanceof RegExp) {
|
|
1892
|
-
return 'regexp';
|
|
2716
|
+
if (!isValidElement(propValue)) {
|
|
2717
|
+
var propType = getPropType(propValue);
|
|
2718
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
1893
2719
|
}
|
|
2720
|
+
return null;
|
|
1894
2721
|
}
|
|
1895
|
-
return
|
|
2722
|
+
return createChainableTypeChecker(validate);
|
|
1896
2723
|
}
|
|
1897
2724
|
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
case 'boolean':
|
|
1907
|
-
case 'date':
|
|
1908
|
-
case 'regexp':
|
|
1909
|
-
return 'a ' + type;
|
|
1910
|
-
default:
|
|
1911
|
-
return type;
|
|
2725
|
+
function createElementTypeTypeChecker() {
|
|
2726
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2727
|
+
var propValue = props[propName];
|
|
2728
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
2729
|
+
var propType = getPropType(propValue);
|
|
2730
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
2731
|
+
}
|
|
2732
|
+
return null;
|
|
1912
2733
|
}
|
|
2734
|
+
return createChainableTypeChecker(validate);
|
|
1913
2735
|
}
|
|
1914
2736
|
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
2737
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
2738
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2739
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
2740
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
2741
|
+
var actualClassName = getClassName(props[propName]);
|
|
2742
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
2743
|
+
}
|
|
2744
|
+
return null;
|
|
1919
2745
|
}
|
|
1920
|
-
return
|
|
2746
|
+
return createChainableTypeChecker(validate);
|
|
1921
2747
|
}
|
|
1922
2748
|
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
* LICENSE file in the root directory of this source tree.
|
|
1937
|
-
*/
|
|
1938
|
-
|
|
1939
|
-
var factoryWithThrowingShims;
|
|
1940
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
1941
|
-
|
|
1942
|
-
function requireFactoryWithThrowingShims () {
|
|
1943
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1944
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
1945
|
-
|
|
1946
|
-
var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
|
|
1947
|
-
|
|
1948
|
-
function emptyFunction() {}
|
|
1949
|
-
function emptyFunctionWithReset() {}
|
|
1950
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1951
|
-
|
|
1952
|
-
factoryWithThrowingShims = function() {
|
|
1953
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1954
|
-
if (secret === ReactPropTypesSecret) {
|
|
1955
|
-
// It is still safe when called from React.
|
|
1956
|
-
return;
|
|
2749
|
+
function createEnumTypeChecker(expectedValues) {
|
|
2750
|
+
if (!Array.isArray(expectedValues)) {
|
|
2751
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2752
|
+
if (arguments.length > 1) {
|
|
2753
|
+
printWarning(
|
|
2754
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
2755
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
2756
|
+
);
|
|
2757
|
+
} else {
|
|
2758
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
return emptyFunctionThatReturnsNull;
|
|
1957
2762
|
}
|
|
1958
|
-
var err = new Error(
|
|
1959
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1960
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1961
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
1962
|
-
);
|
|
1963
|
-
err.name = 'Invariant Violation';
|
|
1964
|
-
throw err;
|
|
1965
|
-
} shim.isRequired = shim;
|
|
1966
|
-
function getShim() {
|
|
1967
|
-
return shim;
|
|
1968
|
-
} // Important!
|
|
1969
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1970
|
-
var ReactPropTypes = {
|
|
1971
|
-
array: shim,
|
|
1972
|
-
bigint: shim,
|
|
1973
|
-
bool: shim,
|
|
1974
|
-
func: shim,
|
|
1975
|
-
number: shim,
|
|
1976
|
-
object: shim,
|
|
1977
|
-
string: shim,
|
|
1978
|
-
symbol: shim,
|
|
1979
|
-
|
|
1980
|
-
any: shim,
|
|
1981
|
-
arrayOf: getShim,
|
|
1982
|
-
element: shim,
|
|
1983
|
-
elementType: shim,
|
|
1984
|
-
instanceOf: getShim,
|
|
1985
|
-
node: shim,
|
|
1986
|
-
objectOf: getShim,
|
|
1987
|
-
oneOf: getShim,
|
|
1988
|
-
oneOfType: getShim,
|
|
1989
|
-
shape: getShim,
|
|
1990
|
-
exact: getShim,
|
|
1991
|
-
|
|
1992
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
1993
|
-
resetWarningCache: emptyFunction
|
|
1994
|
-
};
|
|
1995
|
-
|
|
1996
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1997
2763
|
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
*
|
|
2006
|
-
* This source code is licensed under the MIT license found in the
|
|
2007
|
-
* LICENSE file in the root directory of this source tree.
|
|
2008
|
-
*/
|
|
2009
|
-
|
|
2010
|
-
var hasRequiredPropTypes;
|
|
2011
|
-
|
|
2012
|
-
function requirePropTypes () {
|
|
2013
|
-
if (hasRequiredPropTypes) return propTypes.exports;
|
|
2014
|
-
hasRequiredPropTypes = 1;
|
|
2015
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2016
|
-
var ReactIs = requireReactIs();
|
|
2017
|
-
|
|
2018
|
-
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
2019
|
-
// http://fb.me/prop-types-in-prod
|
|
2020
|
-
var throwOnDirectAccess = true;
|
|
2021
|
-
propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
2022
|
-
} else {
|
|
2023
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
2024
|
-
// http://fb.me/prop-types-in-prod
|
|
2025
|
-
propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
|
|
2026
|
-
}
|
|
2027
|
-
return propTypes.exports;
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
var propTypesExports = /*@__PURE__*/ requirePropTypes();
|
|
2031
|
-
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
2032
|
-
|
|
2033
|
-
const SystemOperations = _ref => {
|
|
2034
|
-
let {
|
|
2035
|
-
onPowerOff,
|
|
2036
|
-
onRestart,
|
|
2037
|
-
powerOffLabel = "Power Off",
|
|
2038
|
-
restartLabel = "Restart",
|
|
2039
|
-
iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
|
|
2040
|
-
confirmTitle = "Confirm",
|
|
2041
|
-
cancelText = "No",
|
|
2042
|
-
okText = "Yes",
|
|
2043
|
-
run
|
|
2044
|
-
} = _ref;
|
|
2045
|
-
const {
|
|
2046
|
-
modal: AntdModal
|
|
2047
|
-
} = App.useApp();
|
|
2048
|
-
const menuItems = [{
|
|
2049
|
-
key: "poweroff",
|
|
2050
|
-
label: powerOffLabel
|
|
2051
|
-
},
|
|
2052
|
-
// {
|
|
2053
|
-
// key: "reboot",
|
|
2054
|
-
// label: rebootLabel, // 硬重启 物理重启
|
|
2055
|
-
// },
|
|
2056
|
-
{
|
|
2057
|
-
key: "restart",
|
|
2058
|
-
label: restartLabel // 软重启 服务重启
|
|
2059
|
-
}];
|
|
2060
|
-
const doAction = action => {
|
|
2061
|
-
try {
|
|
2062
|
-
AntdModal.confirm({
|
|
2063
|
-
icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
|
|
2064
|
-
title: "".concat(confirmTitle, " ").concat(action, "?"),
|
|
2065
|
-
cancelText,
|
|
2066
|
-
okText,
|
|
2067
|
-
onOk: () => {
|
|
2068
|
-
if (action === 'poweroff' && onPowerOff) {
|
|
2069
|
-
onPowerOff();
|
|
2070
|
-
} else if (action === 'restart' && onRestart) {
|
|
2071
|
-
onRestart();
|
|
2072
|
-
}
|
|
2764
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2765
|
+
var propValue = props[propName];
|
|
2766
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
2767
|
+
if (is(propValue, expectedValues[i])) {
|
|
2768
|
+
return null;
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2073
2771
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
let {
|
|
2086
|
-
key
|
|
2087
|
-
} = _ref2;
|
|
2088
|
-
doAction(key);
|
|
2089
|
-
};
|
|
2090
|
-
return /*#__PURE__*/jsx(Dropdown, {
|
|
2091
|
-
menu: {
|
|
2092
|
-
items: menuItems,
|
|
2093
|
-
onClick: handleMenuClick
|
|
2094
|
-
},
|
|
2095
|
-
trigger: ["hover"],
|
|
2096
|
-
children: /*#__PURE__*/jsx("a", {
|
|
2097
|
-
onClick: e => e.preventDefault(),
|
|
2098
|
-
children: /*#__PURE__*/jsx("i", {
|
|
2099
|
-
className: iconClassName
|
|
2100
|
-
})
|
|
2101
|
-
})
|
|
2102
|
-
});
|
|
2103
|
-
};
|
|
2104
|
-
SystemOperations.propTypes = {
|
|
2105
|
-
onPowerOff: PropTypes.func,
|
|
2106
|
-
onRestart: PropTypes.func,
|
|
2107
|
-
powerOffLabel: PropTypes.string,
|
|
2108
|
-
restartLabel: PropTypes.string,
|
|
2109
|
-
iconClassName: PropTypes.string,
|
|
2110
|
-
confirmTitle: PropTypes.string,
|
|
2111
|
-
cancelText: PropTypes.string,
|
|
2112
|
-
okText: PropTypes.string,
|
|
2113
|
-
run: PropTypes.func
|
|
2114
|
-
};
|
|
2115
|
-
var SystemOperations$1 = SystemOperations;
|
|
2772
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
2773
|
+
var type = getPreciseType(value);
|
|
2774
|
+
if (type === 'symbol') {
|
|
2775
|
+
return String(value);
|
|
2776
|
+
}
|
|
2777
|
+
return value;
|
|
2778
|
+
});
|
|
2779
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
2780
|
+
}
|
|
2781
|
+
return createChainableTypeChecker(validate);
|
|
2782
|
+
}
|
|
2116
2783
|
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
label: 'Offset Scaled Log Variance',
|
|
2140
|
-
formType: 'number',
|
|
2141
|
-
readOnly: true
|
|
2142
|
-
},
|
|
2143
|
-
grandmaster_priority1: {
|
|
2144
|
-
label: 'Priority 1',
|
|
2145
|
-
formType: 'number',
|
|
2146
|
-
readOnly: true
|
|
2147
|
-
},
|
|
2148
|
-
grandmaster_priority2: {
|
|
2149
|
-
label: 'Priority 2',
|
|
2150
|
-
formType: 'number',
|
|
2151
|
-
readOnly: true
|
|
2152
|
-
},
|
|
2153
|
-
grandmaster_identity: {
|
|
2154
|
-
label: 'Grandmaster Identity',
|
|
2155
|
-
formType: 'text',
|
|
2156
|
-
readOnly: true
|
|
2157
|
-
},
|
|
2158
|
-
master_port_id: {
|
|
2159
|
-
label: 'Port Identity',
|
|
2160
|
-
formType: 'text',
|
|
2161
|
-
readOnly: true
|
|
2162
|
-
},
|
|
2163
|
-
t1_domain_number: {
|
|
2164
|
-
label: 'Domain',
|
|
2165
|
-
formType: 'number',
|
|
2166
|
-
min: 0,
|
|
2167
|
-
max: 127,
|
|
2168
|
-
readOnly: false
|
|
2169
|
-
},
|
|
2170
|
-
master_utc_offset: {
|
|
2171
|
-
label: 'UTC Offset',
|
|
2172
|
-
formType: 'number',
|
|
2173
|
-
readOnly: true
|
|
2174
|
-
},
|
|
2175
|
-
is_connected: {
|
|
2176
|
-
label: 'Connected Status',
|
|
2177
|
-
formType: 'badge',
|
|
2178
|
-
statusMap: {
|
|
2179
|
-
0: {
|
|
2180
|
-
text: 'Disconnected',
|
|
2181
|
-
color: 'red'
|
|
2182
|
-
},
|
|
2183
|
-
1: {
|
|
2184
|
-
text: 'Connected',
|
|
2185
|
-
color: 'green'
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
},
|
|
2189
|
-
is_locked: {
|
|
2190
|
-
label: 'Locked Status',
|
|
2191
|
-
formType: 'badge',
|
|
2192
|
-
statusMap: {
|
|
2193
|
-
0: {
|
|
2194
|
-
text: 'Unlocked',
|
|
2195
|
-
color: 'red'
|
|
2196
|
-
},
|
|
2197
|
-
1: {
|
|
2198
|
-
text: 'Locked',
|
|
2199
|
-
color: 'green'
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
};
|
|
2784
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
2785
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2786
|
+
if (typeof typeChecker !== 'function') {
|
|
2787
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
2788
|
+
}
|
|
2789
|
+
var propValue = props[propName];
|
|
2790
|
+
var propType = getPropType(propValue);
|
|
2791
|
+
if (propType !== 'object') {
|
|
2792
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
2793
|
+
}
|
|
2794
|
+
for (var key in propValue) {
|
|
2795
|
+
if (has(propValue, key)) {
|
|
2796
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
2797
|
+
if (error instanceof Error) {
|
|
2798
|
+
return error;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
return null;
|
|
2803
|
+
}
|
|
2804
|
+
return createChainableTypeChecker(validate);
|
|
2805
|
+
}
|
|
2204
2806
|
|
|
2205
|
-
|
|
2206
|
-
|
|
2807
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
2808
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
2809
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
2810
|
+
return emptyFunctionThatReturnsNull;
|
|
2811
|
+
}
|
|
2207
2812
|
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
fieldConfigs = defaultFieldConfigs,
|
|
2237
|
-
fieldOrder = defaultFieldOrder,
|
|
2238
|
-
modalProps = {},
|
|
2239
|
-
formProps = {}
|
|
2240
|
-
} = _ref;
|
|
2241
|
-
const [ptpStatus, setPtpStatus] = useState(null);
|
|
2242
|
-
const [form] = Form.useForm();
|
|
2243
|
-
const {
|
|
2244
|
-
message
|
|
2245
|
-
} = App.useApp();
|
|
2246
|
-
useEffect(() => {
|
|
2247
|
-
if (open) {
|
|
2248
|
-
getPtpInfo().then(data => {
|
|
2249
|
-
if (data !== null && data !== void 0 && data[0]) {
|
|
2250
|
-
setPtpStatus(data[0]);
|
|
2251
|
-
form.setFieldsValue(data[0]);
|
|
2252
|
-
}
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
}, [open, form, getPtpInfo]);
|
|
2256
|
-
const ptpStatusArray = useMemo(() => {
|
|
2257
|
-
if (!ptpStatus) return [];
|
|
2258
|
-
return convertPtpStatusToArray(ptpStatus, fieldConfigs, fieldOrder);
|
|
2259
|
-
}, [ptpStatus]);
|
|
2260
|
-
const handleValueChange = changedValues => {
|
|
2261
|
-
if ('t1_domain_number' in changedValues) {
|
|
2262
|
-
setPtpStatus(prev => _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
2263
|
-
t1_domain_number: changedValues.t1_domain_number
|
|
2264
|
-
}));
|
|
2265
|
-
}
|
|
2266
|
-
};
|
|
2267
|
-
const handleSubmit = async () => {
|
|
2268
|
-
try {
|
|
2269
|
-
const values = await form.validateFields();
|
|
2270
|
-
const response = await updatePtpInfo(values);
|
|
2271
|
-
if (response) {
|
|
2272
|
-
message.success('Success');
|
|
2273
|
-
setTimeout(() => {
|
|
2274
|
-
onClose();
|
|
2275
|
-
}, 1500);
|
|
2276
|
-
}
|
|
2277
|
-
} catch (error) {
|
|
2278
|
-
console.error('Update failed:', error);
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2281
|
-
const renderFormItem = item => {
|
|
2282
|
-
var _item$statusMap, _item$min, _item$max;
|
|
2283
|
-
switch (item.formType) {
|
|
2284
|
-
case 'select':
|
|
2285
|
-
return /*#__PURE__*/jsx(Select, {
|
|
2286
|
-
options: item.options,
|
|
2287
|
-
disabled: item.readOnly
|
|
2288
|
-
});
|
|
2289
|
-
case 'switch':
|
|
2290
|
-
return /*#__PURE__*/jsx(Switch, {});
|
|
2291
|
-
case 'badge':
|
|
2292
|
-
const normalizedValue = typeof item.value === 'boolean' ? item.value ? 1 : 0 : item.value;
|
|
2293
|
-
const status = ((_item$statusMap = item.statusMap) === null || _item$statusMap === void 0 ? void 0 : _item$statusMap[normalizedValue]) || {
|
|
2294
|
-
text: 'Unknown',
|
|
2295
|
-
color: 'gray'
|
|
2296
|
-
};
|
|
2297
|
-
return /*#__PURE__*/jsx(ConfigProvider, {
|
|
2298
|
-
theme: {
|
|
2299
|
-
components: {
|
|
2300
|
-
Badge: {
|
|
2301
|
-
statusSize: 10
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
},
|
|
2305
|
-
children: /*#__PURE__*/jsx(Badge, {
|
|
2306
|
-
color: status.color,
|
|
2307
|
-
text: status.text
|
|
2308
|
-
})
|
|
2309
|
-
});
|
|
2310
|
-
case 'number':
|
|
2311
|
-
return /*#__PURE__*/jsx(InputNumber, {
|
|
2312
|
-
disabled: item.readOnly,
|
|
2313
|
-
controls: false,
|
|
2314
|
-
keyboard: false,
|
|
2315
|
-
min: (_item$min = item.min) !== null && _item$min !== void 0 ? _item$min : Number.MIN_SAFE_INTEGER,
|
|
2316
|
-
max: (_item$max = item.max) !== null && _item$max !== void 0 ? _item$max : Number.MAX_SAFE_INTEGER
|
|
2317
|
-
});
|
|
2318
|
-
default:
|
|
2319
|
-
return /*#__PURE__*/jsx(Input, {
|
|
2320
|
-
disabled: item.readOnly
|
|
2321
|
-
});
|
|
2322
|
-
}
|
|
2323
|
-
};
|
|
2324
|
-
if (!open || !ptpStatus) return null;
|
|
2813
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
2814
|
+
var checker = arrayOfTypeCheckers[i];
|
|
2815
|
+
if (typeof checker !== 'function') {
|
|
2816
|
+
printWarning(
|
|
2817
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
2818
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
2819
|
+
);
|
|
2820
|
+
return emptyFunctionThatReturnsNull;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2825
|
+
var expectedTypes = [];
|
|
2826
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
2827
|
+
var checker = arrayOfTypeCheckers[i];
|
|
2828
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
2829
|
+
if (checkerResult == null) {
|
|
2830
|
+
return null;
|
|
2831
|
+
}
|
|
2832
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
2833
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
2837
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
2838
|
+
}
|
|
2839
|
+
return createChainableTypeChecker(validate);
|
|
2840
|
+
}
|
|
2325
2841
|
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
}, modalProps);
|
|
2842
|
+
function createNodeChecker() {
|
|
2843
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2844
|
+
if (!isNode(props[propName])) {
|
|
2845
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
2846
|
+
}
|
|
2847
|
+
return null;
|
|
2848
|
+
}
|
|
2849
|
+
return createChainableTypeChecker(validate);
|
|
2850
|
+
}
|
|
2336
2851
|
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
},
|
|
2344
|
-
wrapperCol: {
|
|
2345
|
-
span: 16
|
|
2346
|
-
},
|
|
2347
|
-
autoComplete: "off",
|
|
2348
|
-
onValuesChange: handleValueChange
|
|
2349
|
-
}, formProps);
|
|
2350
|
-
return /*#__PURE__*/jsx(Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
|
|
2351
|
-
children: /*#__PURE__*/jsx(Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
|
|
2352
|
-
children: ptpStatusArray.map(item => /*#__PURE__*/jsx(Form.Item, {
|
|
2353
|
-
label: item.label,
|
|
2354
|
-
name: item.key,
|
|
2355
|
-
initialValue: item.value,
|
|
2356
|
-
children: renderFormItem(item)
|
|
2357
|
-
}, item.key))
|
|
2358
|
-
}))
|
|
2359
|
-
}));
|
|
2360
|
-
};
|
|
2361
|
-
var PtpModal$1 = /*#__PURE__*/memo(PtpModal);
|
|
2852
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
2853
|
+
return new PropTypeError(
|
|
2854
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
2855
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
2856
|
+
);
|
|
2857
|
+
}
|
|
2362
2858
|
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2859
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
2860
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2861
|
+
var propValue = props[propName];
|
|
2862
|
+
var propType = getPropType(propValue);
|
|
2863
|
+
if (propType !== 'object') {
|
|
2864
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
2865
|
+
}
|
|
2866
|
+
for (var key in shapeTypes) {
|
|
2867
|
+
var checker = shapeTypes[key];
|
|
2868
|
+
if (typeof checker !== 'function') {
|
|
2869
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
2870
|
+
}
|
|
2871
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
2872
|
+
if (error) {
|
|
2873
|
+
return error;
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
return null;
|
|
2877
|
+
}
|
|
2878
|
+
return createChainableTypeChecker(validate);
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
2882
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
2883
|
+
var propValue = props[propName];
|
|
2884
|
+
var propType = getPropType(propValue);
|
|
2885
|
+
if (propType !== 'object') {
|
|
2886
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
2887
|
+
}
|
|
2888
|
+
// We need to check all keys in case some are required but missing from props.
|
|
2889
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
2890
|
+
for (var key in allKeys) {
|
|
2891
|
+
var checker = shapeTypes[key];
|
|
2892
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
2893
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
2894
|
+
}
|
|
2895
|
+
if (!checker) {
|
|
2896
|
+
return new PropTypeError(
|
|
2897
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
2898
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
2899
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
2903
|
+
if (error) {
|
|
2904
|
+
return error;
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
return null;
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
return createChainableTypeChecker(validate);
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
function isNode(propValue) {
|
|
2914
|
+
switch (typeof propValue) {
|
|
2915
|
+
case 'number':
|
|
2916
|
+
case 'string':
|
|
2917
|
+
case 'undefined':
|
|
2918
|
+
return true;
|
|
2919
|
+
case 'boolean':
|
|
2920
|
+
return !propValue;
|
|
2921
|
+
case 'object':
|
|
2922
|
+
if (Array.isArray(propValue)) {
|
|
2923
|
+
return propValue.every(isNode);
|
|
2924
|
+
}
|
|
2925
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
2926
|
+
return true;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
2930
|
+
if (iteratorFn) {
|
|
2931
|
+
var iterator = iteratorFn.call(propValue);
|
|
2932
|
+
var step;
|
|
2933
|
+
if (iteratorFn !== propValue.entries) {
|
|
2934
|
+
while (!(step = iterator.next()).done) {
|
|
2935
|
+
if (!isNode(step.value)) {
|
|
2936
|
+
return false;
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
} else {
|
|
2940
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
2941
|
+
while (!(step = iterator.next()).done) {
|
|
2942
|
+
var entry = step.value;
|
|
2943
|
+
if (entry) {
|
|
2944
|
+
if (!isNode(entry[1])) {
|
|
2945
|
+
return false;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
} else {
|
|
2951
|
+
return false;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
return true;
|
|
2955
|
+
default:
|
|
2956
|
+
return false;
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2462
2959
|
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
enabled: showNetmask.LAN
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
if (sections.includes('QSFP')) {
|
|
2472
|
-
config.QSFP.netmask = _objectSpread2(_objectSpread2({}, config.QSFP.netmask || {}), {}, {
|
|
2473
|
-
enabled: showNetmask.QSFP
|
|
2474
|
-
});
|
|
2475
|
-
}
|
|
2476
|
-
return config;
|
|
2477
|
-
}, [fieldConfig, showNetmask, sections]);
|
|
2478
|
-
useEffect(() => {
|
|
2479
|
-
if (!open) return;
|
|
2480
|
-
const fetchData = async () => {
|
|
2481
|
-
if (initializationStatus.current.hasFetched) return;
|
|
2482
|
-
try {
|
|
2483
|
-
initializationStatus.current.hasFetched = true;
|
|
2484
|
-
if (getConfig) {
|
|
2485
|
-
// 使用统一接口获取数据
|
|
2486
|
-
const config = await getConfig();
|
|
2487
|
-
if (sections.includes('LAN') && config.lan_interfaces) {
|
|
2488
|
-
setLanConfigs(config.lan_interfaces);
|
|
2489
|
-
}
|
|
2490
|
-
if (sections.includes('QSFP') && config.interfaces) {
|
|
2491
|
-
setSt2110Interfaces(config.interfaces);
|
|
2492
|
-
}
|
|
2493
|
-
} else {
|
|
2494
|
-
const promises = [];
|
|
2495
|
-
if (sections.includes('LAN')) {
|
|
2496
|
-
promises.push(getLanConfig());
|
|
2497
|
-
}
|
|
2498
|
-
if (sections.includes('QSFP')) {
|
|
2499
|
-
promises.push(getSysConfig());
|
|
2500
|
-
}
|
|
2501
|
-
const results = await Promise.allSettled(promises);
|
|
2502
|
-
if (sections.includes('LAN') && getLanConfig) {
|
|
2503
|
-
const lanResult = results[0];
|
|
2504
|
-
if (lanResult.status === 'fulfilled') {
|
|
2505
|
-
setLanConfigs(lanResult.value || []);
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
if (sections.includes('QSFP') && getSysConfig) {
|
|
2509
|
-
const sysResult = sections.includes('LAN') ? results[1] : results[0];
|
|
2510
|
-
if (sysResult.status === 'fulfilled' && sysResult.value) {
|
|
2511
|
-
setSt2110Interfaces(sysResult.value.st2110_interfaces || []);
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
setIsInitialized(true);
|
|
2516
|
-
} catch (error) {
|
|
2517
|
-
console.error('Failed to fetch data:', error);
|
|
2518
|
-
initializationStatus.current.hasFetched = false; // 出错时重置
|
|
2519
|
-
}
|
|
2520
|
-
};
|
|
2521
|
-
fetchData();
|
|
2522
|
-
}, [open, getLanConfig, getSysConfig, sections]);
|
|
2960
|
+
function isSymbol(propType, propValue) {
|
|
2961
|
+
// Native Symbol.
|
|
2962
|
+
if (propType === 'symbol') {
|
|
2963
|
+
return true;
|
|
2964
|
+
}
|
|
2523
2965
|
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
setLanConfigs([]);
|
|
2529
|
-
setSt2110Interfaces([]);
|
|
2530
|
-
form.resetFields();
|
|
2531
|
-
initializationStatus.current = {
|
|
2532
|
-
hasFetched: false,
|
|
2533
|
-
hasInitialized: false
|
|
2534
|
-
};
|
|
2535
|
-
}
|
|
2536
|
-
}, [open, form]);
|
|
2966
|
+
// falsy value can't be a Symbol
|
|
2967
|
+
if (!propValue) {
|
|
2968
|
+
return false;
|
|
2969
|
+
}
|
|
2537
2970
|
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
values.LAN = lanConfigs.map(config => _objectSpread2({
|
|
2543
|
-
connection_id: config.connection_id,
|
|
2544
|
-
display_name: config.display_name,
|
|
2545
|
-
ip_address: config.ip_address
|
|
2546
|
-
}, showNetmask.LAN ? {
|
|
2547
|
-
netmask: config.netmask
|
|
2548
|
-
} : {}));
|
|
2549
|
-
}
|
|
2550
|
-
if (sections.includes('QSFP') && st2110Interfaces.length > 0) {
|
|
2551
|
-
values.QSFP = st2110Interfaces.map(iface => _objectSpread2(_objectSpread2({}, iface.id !== undefined && {
|
|
2552
|
-
id: iface.id
|
|
2553
|
-
}), {}, {
|
|
2554
|
-
display_name: iface.display_name,
|
|
2555
|
-
ip_address: iface.ip_address || iface.ip
|
|
2556
|
-
}, showNetmask.QSFP ? {
|
|
2557
|
-
netmask: iface.netmask
|
|
2558
|
-
} : {}));
|
|
2559
|
-
}
|
|
2560
|
-
return values;
|
|
2561
|
-
}, [lanConfigs, st2110Interfaces, sections, showNetmask]);
|
|
2971
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
2972
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
2973
|
+
return true;
|
|
2974
|
+
}
|
|
2562
2975
|
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
initializationStatus.current.hasInitialized = true;
|
|
2568
|
-
}
|
|
2569
|
-
}, [isInitialized, form, initialValues]);
|
|
2570
|
-
const handleSuccess = useCallback(async function () {
|
|
2571
|
-
let {
|
|
2572
|
-
messageText = 'Success',
|
|
2573
|
-
isPopup = !!restart,
|
|
2574
|
-
refresh = !restart
|
|
2575
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2576
|
-
message.success(messageText);
|
|
2577
|
-
if (refresh && getConfig) {
|
|
2578
|
-
try {
|
|
2579
|
-
const newConfig = await getConfig();
|
|
2580
|
-
if (sections.includes('LAN') && newConfig.lan_interfaces) {
|
|
2581
|
-
setLanConfigs(newConfig.lan_interfaces);
|
|
2582
|
-
}
|
|
2583
|
-
if (sections.includes('QSFP') && newConfig.interfaces) {
|
|
2584
|
-
setSt2110Interfaces(newConfig.interfaces);
|
|
2585
|
-
}
|
|
2586
|
-
} catch (error) {
|
|
2587
|
-
console.error('Failed to refresh config:', error);
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2976
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
2977
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
2978
|
+
return true;
|
|
2979
|
+
}
|
|
2590
2980
|
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
try {
|
|
2594
|
-
const updatedConfig = await getSysConfig();
|
|
2595
|
-
if (updatedConfig && updatedConfig.is_restart_required) {
|
|
2596
|
-
modal.confirm({
|
|
2597
|
-
icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
|
|
2598
|
-
title: "Configuration modified. Restart to apply changes?",
|
|
2599
|
-
cancelText: "No",
|
|
2600
|
-
okText: "Yes",
|
|
2601
|
-
onOk: () => restart()
|
|
2602
|
-
});
|
|
2603
|
-
}
|
|
2604
|
-
} catch (error) {
|
|
2605
|
-
console.error('Failed to check restart status:', error);
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
onClose();
|
|
2609
|
-
}, [message, modal, getSysConfig, restart, getConfig, sections, onClose]);
|
|
2610
|
-
const handleSubmit = useCallback(async () => {
|
|
2611
|
-
setSubmitLoading(true);
|
|
2612
|
-
try {
|
|
2613
|
-
const values = await form.validateFields();
|
|
2614
|
-
// console.log("Direct form values:", values);
|
|
2981
|
+
return false;
|
|
2982
|
+
}
|
|
2615
2983
|
|
|
2616
|
-
|
|
2984
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
2985
|
+
function getPropType(propValue) {
|
|
2986
|
+
var propType = typeof propValue;
|
|
2987
|
+
if (Array.isArray(propValue)) {
|
|
2988
|
+
return 'array';
|
|
2989
|
+
}
|
|
2990
|
+
if (propValue instanceof RegExp) {
|
|
2991
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
2992
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
2993
|
+
// passes PropTypes.object.
|
|
2994
|
+
return 'object';
|
|
2995
|
+
}
|
|
2996
|
+
if (isSymbol(propType, propValue)) {
|
|
2997
|
+
return 'symbol';
|
|
2998
|
+
}
|
|
2999
|
+
return propType;
|
|
3000
|
+
}
|
|
2617
3001
|
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
3002
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
3003
|
+
// See `createPrimitiveTypeChecker`.
|
|
3004
|
+
function getPreciseType(propValue) {
|
|
3005
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
3006
|
+
return '' + propValue;
|
|
3007
|
+
}
|
|
3008
|
+
var propType = getPropType(propValue);
|
|
3009
|
+
if (propType === 'object') {
|
|
3010
|
+
if (propValue instanceof Date) {
|
|
3011
|
+
return 'date';
|
|
3012
|
+
} else if (propValue instanceof RegExp) {
|
|
3013
|
+
return 'regexp';
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
return propType;
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
3020
|
+
// For example, "undefined" or "of type array"
|
|
3021
|
+
function getPostfixForTypeWarning(value) {
|
|
3022
|
+
var type = getPreciseType(value);
|
|
3023
|
+
switch (type) {
|
|
3024
|
+
case 'array':
|
|
3025
|
+
case 'object':
|
|
3026
|
+
return 'an ' + type;
|
|
3027
|
+
case 'boolean':
|
|
3028
|
+
case 'date':
|
|
3029
|
+
case 'regexp':
|
|
3030
|
+
return 'a ' + type;
|
|
3031
|
+
default:
|
|
3032
|
+
return type;
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
// Returns class name of the object, if any.
|
|
3037
|
+
function getClassName(propValue) {
|
|
3038
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
3039
|
+
return ANONYMOUS;
|
|
3040
|
+
}
|
|
3041
|
+
return propValue.constructor.name;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
3045
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
3046
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
3047
|
+
|
|
3048
|
+
return ReactPropTypes;
|
|
3049
|
+
};
|
|
3050
|
+
return factoryWithTypeCheckers;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
/**
|
|
3054
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3055
|
+
*
|
|
3056
|
+
* This source code is licensed under the MIT license found in the
|
|
3057
|
+
* LICENSE file in the root directory of this source tree.
|
|
3058
|
+
*/
|
|
2631
3059
|
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
const interfacesData = values.QSFP.map((item, index) => {
|
|
2635
|
-
var _st2110Interfaces$ind, _st2110Interfaces$ind2, _st2110Interfaces$ind3;
|
|
2636
|
-
return _objectSpread2(_objectSpread2(_objectSpread2({}, (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind = st2110Interfaces[index]) === null || _st2110Interfaces$ind === void 0 ? void 0 : _st2110Interfaces$ind.id) !== undefined && {
|
|
2637
|
-
id: st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind2 = st2110Interfaces[index]) === null || _st2110Interfaces$ind2 === void 0 ? void 0 : _st2110Interfaces$ind2.id
|
|
2638
|
-
}), (st2110Interfaces === null || st2110Interfaces === void 0 || (_st2110Interfaces$ind3 = st2110Interfaces[index]) === null || _st2110Interfaces$ind3 === void 0 ? void 0 : _st2110Interfaces$ind3.ip) !== undefined ? {
|
|
2639
|
-
ip: item.ip_address
|
|
2640
|
-
} : {
|
|
2641
|
-
ip_address: item.ip_address
|
|
2642
|
-
}), showNetmask.QSFP ? {
|
|
2643
|
-
netmask: item.netmask
|
|
2644
|
-
} : {});
|
|
2645
|
-
});
|
|
2646
|
-
const st2110Data = st2110Interfaces.some(iface => 'id' in iface) ? {
|
|
2647
|
-
st2110_interfaces: interfacesData
|
|
2648
|
-
} : {
|
|
2649
|
-
interfaces: interfacesData
|
|
2650
|
-
};
|
|
2651
|
-
updatePromises.push(updateSysConfig(st2110Data));
|
|
2652
|
-
}
|
|
2653
|
-
const results = await Promise.allSettled(updatePromises);
|
|
3060
|
+
var factoryWithThrowingShims;
|
|
3061
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
2654
3062
|
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
handleSuccess();
|
|
2659
|
-
} else {
|
|
2660
|
-
message.error('Some configurations failed to update');
|
|
2661
|
-
}
|
|
2662
|
-
} catch (error) {
|
|
2663
|
-
console.error('Failed to update configurations: ', error);
|
|
2664
|
-
message.error('Failed to update configurations');
|
|
2665
|
-
} finally {
|
|
2666
|
-
setSubmitLoading(false);
|
|
2667
|
-
}
|
|
2668
|
-
}, [form, sections, lanConfigs, st2110Interfaces, updateLanConfig, updateSysConfig, handleSuccess, message]);
|
|
3063
|
+
function requireFactoryWithThrowingShims () {
|
|
3064
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
3065
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
2669
3066
|
|
|
2670
|
-
|
|
2671
|
-
const mergedModalProps = _objectSpread2({
|
|
2672
|
-
title: "Network Settings",
|
|
2673
|
-
width: 650,
|
|
2674
|
-
open,
|
|
2675
|
-
confirmLoading: submitLoading,
|
|
2676
|
-
onOk: handleSubmit,
|
|
2677
|
-
onCancel: onClose,
|
|
2678
|
-
okText: "Apply",
|
|
2679
|
-
cancelText: "Close",
|
|
2680
|
-
centered: true,
|
|
2681
|
-
destroyOnHidden: true,
|
|
2682
|
-
forceRender: true,
|
|
2683
|
-
styles: _objectSpread2({
|
|
2684
|
-
body: {
|
|
2685
|
-
padding: "16px 24px 8px 24px"
|
|
2686
|
-
}
|
|
2687
|
-
}, restartRemark !== null && {
|
|
2688
|
-
footer: {
|
|
2689
|
-
paddingBottom: 28
|
|
2690
|
-
}
|
|
2691
|
-
})
|
|
2692
|
-
}, modalProps);
|
|
3067
|
+
var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
|
|
2693
3068
|
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
labelCol: {
|
|
2698
|
-
span: 6
|
|
2699
|
-
},
|
|
2700
|
-
wrapperCol: {
|
|
2701
|
-
span: 18
|
|
2702
|
-
},
|
|
2703
|
-
autoComplete: "off"
|
|
2704
|
-
}, formProps);
|
|
2705
|
-
return /*#__PURE__*/jsxs(Modal, _objectSpread2(_objectSpread2({}, mergedModalProps), {}, {
|
|
2706
|
-
children: [/*#__PURE__*/jsxs(Form, _objectSpread2(_objectSpread2({}, mergedFormProps), {}, {
|
|
2707
|
-
children: [sections.includes('LAN') && lanConfigs.length > 0 && /*#__PURE__*/jsxs(Fragment, {
|
|
2708
|
-
children: [/*#__PURE__*/jsx(NetworkFieldGroup, {
|
|
2709
|
-
prefix: "LAN",
|
|
2710
|
-
interfaces: lanConfigs,
|
|
2711
|
-
fieldConfig: preparedFieldConfig.LAN
|
|
2712
|
-
}), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsx(Divider, {})]
|
|
2713
|
-
}), sections.includes('QSFP') && st2110Interfaces.length > 0 && /*#__PURE__*/jsx(NetworkFieldGroup, {
|
|
2714
|
-
prefix: "QSFP",
|
|
2715
|
-
interfaces: st2110Interfaces,
|
|
2716
|
-
fieldConfig: preparedFieldConfig.QSFP
|
|
2717
|
-
})]
|
|
2718
|
-
})), restartRemark]
|
|
2719
|
-
}));
|
|
2720
|
-
};
|
|
2721
|
-
var NetworkSettingsModal$1 = /*#__PURE__*/memo(NetworkSettingsModal);
|
|
3069
|
+
function emptyFunction() {}
|
|
3070
|
+
function emptyFunctionWithReset() {}
|
|
3071
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2722
3072
|
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
}), showDescription && /*#__PURE__*/jsx("div", {
|
|
2751
|
-
children: "Description"
|
|
2752
|
-
})]
|
|
2753
|
-
}),
|
|
2754
|
-
dataSource: dataSource,
|
|
2755
|
-
rowKey: "id",
|
|
2756
|
-
renderItem: item => /*#__PURE__*/jsx(List.Item, {
|
|
2757
|
-
className: "list-item ".concat(selectedPresetId === item.id ? 'selected' : ''),
|
|
2758
|
-
style: {
|
|
2759
|
-
padding: "9px 24px"
|
|
2760
|
-
},
|
|
2761
|
-
onClick: () => onSelectPreset(item),
|
|
2762
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
2763
|
-
className: "grid ".concat(gridColumns, " w-full text-text-normal"),
|
|
2764
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
2765
|
-
title: item.name,
|
|
2766
|
-
children: item.name || "Untitled Preset"
|
|
2767
|
-
}), /*#__PURE__*/jsx("div", {
|
|
2768
|
-
children: item.create_time
|
|
2769
|
-
}), showDescription && /*#__PURE__*/jsx("div", {
|
|
2770
|
-
children: item.description
|
|
2771
|
-
})]
|
|
2772
|
-
})
|
|
2773
|
-
}),
|
|
2774
|
-
locale: {
|
|
2775
|
-
emptyText: /*#__PURE__*/jsx("div", {
|
|
2776
|
-
className: "p-8",
|
|
2777
|
-
children: /*#__PURE__*/jsx(Empty, {
|
|
2778
|
-
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
2779
|
-
description: /*#__PURE__*/jsx("span", {
|
|
2780
|
-
className: "text-gray-400",
|
|
2781
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
2782
|
-
type: "link",
|
|
2783
|
-
onClick: onAddNew,
|
|
2784
|
-
className: "p-0 h-auto",
|
|
2785
|
-
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
2786
|
-
children: "Create new preset"
|
|
2787
|
-
})
|
|
2788
|
-
})
|
|
2789
|
-
})
|
|
2790
|
-
})
|
|
2791
|
-
}
|
|
2792
|
-
})
|
|
2793
|
-
}), hasPresets && /*#__PURE__*/jsx("div", {
|
|
2794
|
-
className: "p-4",
|
|
2795
|
-
style: {
|
|
2796
|
-
paddingInline: 24
|
|
2797
|
-
},
|
|
2798
|
-
children: /*#__PURE__*/jsxs(Space, {
|
|
2799
|
-
size: "middle",
|
|
2800
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
2801
|
-
type: "default",
|
|
2802
|
-
icon: /*#__PURE__*/jsx(PlusOutlined, {}),
|
|
2803
|
-
style: {
|
|
2804
|
-
padding: "20px 12px"
|
|
2805
|
-
},
|
|
2806
|
-
className: "btn-gray",
|
|
2807
|
-
onClick: onAddNew,
|
|
2808
|
-
children: texts.newButton
|
|
2809
|
-
}), /*#__PURE__*/jsx(Button, {
|
|
2810
|
-
type: "default",
|
|
2811
|
-
style: {
|
|
2812
|
-
padding: "20px 12px"
|
|
2813
|
-
},
|
|
2814
|
-
className: "btn-gray",
|
|
2815
|
-
onClick: onRemove,
|
|
2816
|
-
children: texts.removeButton
|
|
2817
|
-
})]
|
|
2818
|
-
})
|
|
2819
|
-
})]
|
|
2820
|
-
});
|
|
2821
|
-
});
|
|
2822
|
-
const SubmitButton = _ref2 => {
|
|
2823
|
-
let {
|
|
2824
|
-
loading,
|
|
2825
|
-
action,
|
|
2826
|
-
children,
|
|
2827
|
-
disabled = false
|
|
2828
|
-
} = _ref2;
|
|
2829
|
-
return /*#__PURE__*/jsx("div", {
|
|
2830
|
-
className: "submit-btn-wrapper",
|
|
2831
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
2832
|
-
className: "btn-gray",
|
|
2833
|
-
loading: loading,
|
|
2834
|
-
onClick: action,
|
|
2835
|
-
disabled: disabled,
|
|
2836
|
-
children: children
|
|
2837
|
-
})
|
|
2838
|
-
});
|
|
2839
|
-
};
|
|
2840
|
-
const RightDetailForm = /*#__PURE__*/memo(_ref3 => {
|
|
2841
|
-
let {
|
|
2842
|
-
form,
|
|
2843
|
-
onSave,
|
|
2844
|
-
onLoad,
|
|
2845
|
-
isLoading,
|
|
2846
|
-
isEditing,
|
|
2847
|
-
originalPresetData,
|
|
2848
|
-
fields = {
|
|
2849
|
-
name: {
|
|
2850
|
-
label: "Preset Name",
|
|
2851
|
-
placeholder: "Enter preset name",
|
|
2852
|
-
required: true
|
|
2853
|
-
}
|
|
2854
|
-
},
|
|
2855
|
-
texts = {
|
|
2856
|
-
loadButton: "Load",
|
|
2857
|
-
saveButton: "Save"
|
|
2858
|
-
},
|
|
2859
|
-
presetChanged
|
|
2860
|
-
} = _ref3;
|
|
2861
|
-
const [initialSelected, setInitialSelected] = useState([]);
|
|
2862
|
-
const currentSelected = Form.useWatch('category_list', form) || [];
|
|
3073
|
+
factoryWithThrowingShims = function() {
|
|
3074
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
3075
|
+
if (secret === ReactPropTypesSecret) {
|
|
3076
|
+
// It is still safe when called from React.
|
|
3077
|
+
return;
|
|
3078
|
+
}
|
|
3079
|
+
var err = new Error(
|
|
3080
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
3081
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
3082
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
3083
|
+
);
|
|
3084
|
+
err.name = 'Invariant Violation';
|
|
3085
|
+
throw err;
|
|
3086
|
+
} shim.isRequired = shim;
|
|
3087
|
+
function getShim() {
|
|
3088
|
+
return shim;
|
|
3089
|
+
} // Important!
|
|
3090
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
3091
|
+
var ReactPropTypes = {
|
|
3092
|
+
array: shim,
|
|
3093
|
+
bigint: shim,
|
|
3094
|
+
bool: shim,
|
|
3095
|
+
func: shim,
|
|
3096
|
+
number: shim,
|
|
3097
|
+
object: shim,
|
|
3098
|
+
string: shim,
|
|
3099
|
+
symbol: shim,
|
|
2863
3100
|
|
|
2864
|
-
|
|
2865
|
-
|
|
3101
|
+
any: shim,
|
|
3102
|
+
arrayOf: getShim,
|
|
3103
|
+
element: shim,
|
|
3104
|
+
elementType: shim,
|
|
3105
|
+
instanceOf: getShim,
|
|
3106
|
+
node: shim,
|
|
3107
|
+
objectOf: getShim,
|
|
3108
|
+
oneOf: getShim,
|
|
3109
|
+
oneOfType: getShim,
|
|
3110
|
+
shape: getShim,
|
|
3111
|
+
exact: getShim,
|
|
2866
3112
|
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
const currentValue = form.getFieldValue('category_list') || [];
|
|
2871
|
-
setInitialSelected(currentValue);
|
|
2872
|
-
}
|
|
2873
|
-
}, [presetChanged, form, hasCategoryList]); // 当presetChanged变化时更新
|
|
3113
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
3114
|
+
resetWarningCache: emptyFunction
|
|
3115
|
+
};
|
|
2874
3116
|
|
|
2875
|
-
|
|
2876
|
-
const checkboxOptions = useMemo(() => {
|
|
2877
|
-
if (!hasCategoryList) return [];
|
|
2878
|
-
return fields.category_list.options.map(category => {
|
|
2879
|
-
const isInitiallySelected = initialSelected.includes(category.name);
|
|
2880
|
-
const shouldDisable = isEditing ? !isInitiallySelected : false;
|
|
2881
|
-
return _objectSpread2(_objectSpread2({}, category), {}, {
|
|
2882
|
-
disabled: shouldDisable,
|
|
2883
|
-
initiallySelected: isInitiallySelected
|
|
2884
|
-
});
|
|
2885
|
-
});
|
|
2886
|
-
}, [initialSelected, isEditing, hasCategoryList, fields.category_list]);
|
|
2887
|
-
const handleCheckboxChange = checkedValues => {
|
|
2888
|
-
form.setFieldsValue({
|
|
2889
|
-
category_list: checkedValues
|
|
2890
|
-
});
|
|
2891
|
-
};
|
|
2892
|
-
const handleLoad = async () => {
|
|
2893
|
-
try {
|
|
2894
|
-
const formValues = await form.validateFields();
|
|
2895
|
-
const loadData = {
|
|
2896
|
-
id: form.getFieldValue('id'),
|
|
2897
|
-
// 优先使用表单中的 category_list,如果没有则使用原始数据
|
|
2898
|
-
name: originalPresetData.name,
|
|
2899
|
-
category_list: hasCategoryList ? formValues.category_list || [] : (originalPresetData === null || originalPresetData === void 0 ? void 0 : originalPresetData.category_list) || []
|
|
2900
|
-
};
|
|
2901
|
-
await onLoad(loadData);
|
|
2902
|
-
} catch (error) {
|
|
2903
|
-
console.error('表单验证失败:', error);
|
|
2904
|
-
}
|
|
2905
|
-
};
|
|
2906
|
-
return /*#__PURE__*/jsxs(Flex, {
|
|
2907
|
-
vertical: true,
|
|
2908
|
-
className: "h-full",
|
|
2909
|
-
children: [/*#__PURE__*/jsxs(Form, {
|
|
2910
|
-
form: form,
|
|
2911
|
-
layout: "vertical",
|
|
2912
|
-
autoComplete: "off",
|
|
2913
|
-
style: {
|
|
2914
|
-
flex: 1,
|
|
2915
|
-
overflowY: 'auto'
|
|
2916
|
-
},
|
|
2917
|
-
children: [/*#__PURE__*/jsx(Form.Item, {
|
|
2918
|
-
name: "name",
|
|
2919
|
-
label: fields.name.label,
|
|
2920
|
-
rules: [{
|
|
2921
|
-
required: fields.name.required,
|
|
2922
|
-
validator: async (_, value) => {
|
|
2923
|
-
if (!value || value.trim() === '') {
|
|
2924
|
-
return Promise.reject(new Error('Preset name cannot be empty or spaces only'));
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
}],
|
|
2928
|
-
children: /*#__PURE__*/jsx(Input, {
|
|
2929
|
-
placeholder: fields.name.placeholder,
|
|
2930
|
-
disabled: isEditing
|
|
2931
|
-
})
|
|
2932
|
-
}), hasCategoryList && /*#__PURE__*/jsx(Form.Item, {
|
|
2933
|
-
name: "category_list",
|
|
2934
|
-
label: fields.category_list.label,
|
|
2935
|
-
rules: [{
|
|
2936
|
-
required: fields.category_list.required,
|
|
2937
|
-
message: 'Please select at least one category',
|
|
2938
|
-
validator: (_, value) => {
|
|
2939
|
-
if (value && value.length > 0) {
|
|
2940
|
-
return Promise.resolve();
|
|
2941
|
-
}
|
|
2942
|
-
return Promise.reject(new Error('Please select at least one category'));
|
|
2943
|
-
}
|
|
2944
|
-
}],
|
|
2945
|
-
children: /*#__PURE__*/jsx(Checkbox.Group, {
|
|
2946
|
-
className: "grid grid-cols-2 gap-2",
|
|
2947
|
-
onChange: handleCheckboxChange,
|
|
2948
|
-
children: checkboxOptions.map(category => /*#__PURE__*/jsx(Checkbox, {
|
|
2949
|
-
value: category.name,
|
|
2950
|
-
disabled: category.disabled,
|
|
2951
|
-
children: category.label
|
|
2952
|
-
}, category.name))
|
|
2953
|
-
})
|
|
2954
|
-
}), fields.description && /*#__PURE__*/jsx(Form.Item, {
|
|
2955
|
-
name: "description",
|
|
2956
|
-
label: fields.description.label,
|
|
2957
|
-
children: /*#__PURE__*/jsx(Input.TextArea, {
|
|
2958
|
-
rows: 4,
|
|
2959
|
-
placeholder: fields.description.placeholder,
|
|
2960
|
-
disabled: isEditing
|
|
2961
|
-
})
|
|
2962
|
-
})]
|
|
2963
|
-
}), isEditing ? /*#__PURE__*/jsx(SubmitButton, _objectSpread2(_objectSpread2({
|
|
2964
|
-
action: handleLoad
|
|
2965
|
-
}, hasCategoryList && {
|
|
2966
|
-
disabled: !currentSelected.length
|
|
2967
|
-
}), {}, {
|
|
2968
|
-
children: texts.loadButton
|
|
2969
|
-
})) : /*#__PURE__*/jsx(SubmitButton, {
|
|
2970
|
-
action: onSave,
|
|
2971
|
-
loading: isLoading,
|
|
2972
|
-
children: texts.saveButton
|
|
2973
|
-
})]
|
|
2974
|
-
});
|
|
2975
|
-
});
|
|
3117
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2976
3118
|
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
// API 方法通过 props 传入
|
|
2982
|
-
getPresetList,
|
|
2983
|
-
savePreset,
|
|
2984
|
-
removePreset,
|
|
2985
|
-
loadPreset,
|
|
2986
|
-
onLoadSuccess,
|
|
2987
|
-
// 加载成功后的回调
|
|
2988
|
-
onLoadError,
|
|
2989
|
-
// 加载失败后的回调
|
|
2990
|
-
// 字段配置
|
|
2991
|
-
fields = {
|
|
2992
|
-
name: {
|
|
2993
|
-
label: "Preset Name",
|
|
2994
|
-
placeholder: "Enter preset name",
|
|
2995
|
-
required: true
|
|
2996
|
-
}
|
|
2997
|
-
},
|
|
2998
|
-
texts = {
|
|
2999
|
-
title: "Preset Management",
|
|
3000
|
-
emptyText: "Select a preset from the list to view details",
|
|
3001
|
-
deleteConfirm: "Are you sure to delete preset",
|
|
3002
|
-
loadConfirm: "Are you sure you want to load preset",
|
|
3003
|
-
loadText: "Loading...",
|
|
3004
|
-
successText: "Success",
|
|
3005
|
-
newButton: "New Preset",
|
|
3006
|
-
removeButton: "Remove",
|
|
3007
|
-
loadButton: "Load",
|
|
3008
|
-
saveButton: "Save"
|
|
3009
|
-
},
|
|
3010
|
-
// 样式定制
|
|
3011
|
-
width = 1000,
|
|
3012
|
-
height = 680,
|
|
3013
|
-
className = ""
|
|
3014
|
-
} = _ref;
|
|
3015
|
-
const {
|
|
3016
|
-
message: AntdMessage,
|
|
3017
|
-
modal: AntdModal
|
|
3018
|
-
} = App.useApp();
|
|
3019
|
-
const [presetList, setPresetList] = useState([]);
|
|
3020
|
-
const [selectedPreset, setSelectedPreset] = useState(null);
|
|
3021
|
-
const [loading, setLoading] = useState(false);
|
|
3022
|
-
const [presetChanged, setPresetChanged] = useState(0);
|
|
3023
|
-
const [form] = Form.useForm();
|
|
3119
|
+
return ReactPropTypes;
|
|
3120
|
+
};
|
|
3121
|
+
return factoryWithThrowingShims;
|
|
3122
|
+
}
|
|
3024
3123
|
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
const data = await getPresetList();
|
|
3032
|
-
const presets = (data === null || data === void 0 ? void 0 : data.preset_list) || data || [];
|
|
3033
|
-
setPresetList(presets);
|
|
3034
|
-
} catch (error) {
|
|
3035
|
-
console.error('Failed to fetch preset list:', error);
|
|
3036
|
-
}
|
|
3037
|
-
}, [getPresetList]);
|
|
3038
|
-
const handleSelectPreset = useCallback(preset => {
|
|
3039
|
-
setSelectedPreset(preset);
|
|
3040
|
-
form.setFieldsValue(preset);
|
|
3041
|
-
setPresetChanged(prev => prev + 1); // 触发react更新
|
|
3042
|
-
}, [form]);
|
|
3043
|
-
const handleAddNew = useCallback(() => {
|
|
3044
|
-
var _fields$category_list;
|
|
3045
|
-
const unsavedPreset = presetList.find(item => !item.id);
|
|
3046
|
-
if (unsavedPreset) {
|
|
3047
|
-
AntdMessage.warning('Existing unsaved preset detected.');
|
|
3048
|
-
return;
|
|
3049
|
-
}
|
|
3124
|
+
/**
|
|
3125
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3126
|
+
*
|
|
3127
|
+
* This source code is licensed under the MIT license found in the
|
|
3128
|
+
* LICENSE file in the root directory of this source tree.
|
|
3129
|
+
*/
|
|
3050
3130
|
|
|
3051
|
-
|
|
3052
|
-
const newPreset = Object.keys(fields).reduce((acc, fieldName) => {
|
|
3053
|
-
acc[fieldName] = '';
|
|
3054
|
-
return acc;
|
|
3055
|
-
}, {});
|
|
3131
|
+
var hasRequiredPropTypes;
|
|
3056
3132
|
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
setSelectedPreset(newPreset);
|
|
3063
|
-
form.setFieldsValue(newPreset);
|
|
3064
|
-
}, [form, presetList, AntdMessage]);
|
|
3065
|
-
const handleRemove = useCallback(async () => {
|
|
3066
|
-
if (!selectedPreset) return;
|
|
3133
|
+
function requirePropTypes () {
|
|
3134
|
+
if (hasRequiredPropTypes) return propTypes.exports;
|
|
3135
|
+
hasRequiredPropTypes = 1;
|
|
3136
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3137
|
+
var ReactIs = requireReactIs();
|
|
3067
3138
|
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3139
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
3140
|
+
// http://fb.me/prop-types-in-prod
|
|
3141
|
+
var throwOnDirectAccess = true;
|
|
3142
|
+
propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
3143
|
+
} else {
|
|
3144
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
3145
|
+
// http://fb.me/prop-types-in-prod
|
|
3146
|
+
propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
|
|
3147
|
+
}
|
|
3148
|
+
return propTypes.exports;
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
var propTypesExports = /*@__PURE__*/ requirePropTypes();
|
|
3152
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
3153
|
+
|
|
3154
|
+
const SystemOperations = _ref => {
|
|
3155
|
+
let {
|
|
3156
|
+
onPowerOff,
|
|
3157
|
+
onRestart,
|
|
3158
|
+
powerOffLabel = "Power Off",
|
|
3159
|
+
restartLabel = "Restart",
|
|
3160
|
+
iconClassName = "seeder-iconfont seeder-icon-guanji1 text-xl text-neutral-400",
|
|
3161
|
+
confirmTitle = "Confirm",
|
|
3162
|
+
cancelText = "No",
|
|
3163
|
+
okText = "Yes",
|
|
3164
|
+
run
|
|
3165
|
+
} = _ref;
|
|
3166
|
+
const {
|
|
3167
|
+
modal: AntdModal
|
|
3168
|
+
} = App.useApp();
|
|
3169
|
+
const menuItems = [{
|
|
3170
|
+
key: "poweroff",
|
|
3171
|
+
label: powerOffLabel
|
|
3172
|
+
},
|
|
3173
|
+
// {
|
|
3174
|
+
// key: "reboot",
|
|
3175
|
+
// label: rebootLabel, // 硬重启 物理重启
|
|
3176
|
+
// },
|
|
3177
|
+
{
|
|
3178
|
+
key: "restart",
|
|
3179
|
+
label: restartLabel // 软重启 服务重启
|
|
3180
|
+
}];
|
|
3181
|
+
const doAction = action => {
|
|
3071
3182
|
try {
|
|
3072
3183
|
AntdModal.confirm({
|
|
3073
3184
|
icon: /*#__PURE__*/jsx(ExclamationCircleFilled, {}),
|
|
3074
|
-
title:
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
});
|
|
3083
|
-
AntdMessage.success(texts.successText);
|
|
3084
|
-
// 刷新列表
|
|
3085
|
-
await fetchPresetList();
|
|
3086
|
-
} else {
|
|
3087
|
-
setPresetList(prev => prev.filter(item => !!item.id));
|
|
3185
|
+
title: "".concat(confirmTitle, " ").concat(action, "?"),
|
|
3186
|
+
cancelText,
|
|
3187
|
+
okText,
|
|
3188
|
+
onOk: () => {
|
|
3189
|
+
if (action === 'poweroff' && onPowerOff) {
|
|
3190
|
+
onPowerOff();
|
|
3191
|
+
} else if (action === 'restart' && onRestart) {
|
|
3192
|
+
onRestart();
|
|
3088
3193
|
}
|
|
3089
3194
|
|
|
3090
|
-
//
|
|
3091
|
-
|
|
3092
|
-
|
|
3195
|
+
// Call the run callback after successful operation
|
|
3196
|
+
if (typeof run === 'function') {
|
|
3197
|
+
run();
|
|
3198
|
+
}
|
|
3093
3199
|
}
|
|
3094
3200
|
});
|
|
3095
3201
|
} catch (error) {
|
|
3096
|
-
console.error(
|
|
3202
|
+
console.error("".concat(action.toUpperCase(), " ERROR: "), error);
|
|
3097
3203
|
}
|
|
3098
|
-
}
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
modalInstance.destroy();
|
|
3132
|
-
AntdMessage.success(texts.successText);
|
|
3204
|
+
};
|
|
3205
|
+
const handleMenuClick = _ref2 => {
|
|
3206
|
+
let {
|
|
3207
|
+
key
|
|
3208
|
+
} = _ref2;
|
|
3209
|
+
doAction(key);
|
|
3210
|
+
};
|
|
3211
|
+
return /*#__PURE__*/jsx(Dropdown, {
|
|
3212
|
+
menu: {
|
|
3213
|
+
items: menuItems,
|
|
3214
|
+
onClick: handleMenuClick
|
|
3215
|
+
},
|
|
3216
|
+
trigger: ["hover"],
|
|
3217
|
+
children: /*#__PURE__*/jsx("a", {
|
|
3218
|
+
onClick: e => e.preventDefault(),
|
|
3219
|
+
children: /*#__PURE__*/jsx("i", {
|
|
3220
|
+
className: iconClassName
|
|
3221
|
+
})
|
|
3222
|
+
})
|
|
3223
|
+
});
|
|
3224
|
+
};
|
|
3225
|
+
SystemOperations.propTypes = {
|
|
3226
|
+
onPowerOff: PropTypes.func,
|
|
3227
|
+
onRestart: PropTypes.func,
|
|
3228
|
+
powerOffLabel: PropTypes.string,
|
|
3229
|
+
restartLabel: PropTypes.string,
|
|
3230
|
+
iconClassName: PropTypes.string,
|
|
3231
|
+
confirmTitle: PropTypes.string,
|
|
3232
|
+
cancelText: PropTypes.string,
|
|
3233
|
+
okText: PropTypes.string,
|
|
3234
|
+
run: PropTypes.func
|
|
3235
|
+
};
|
|
3236
|
+
var SystemOperations$1 = SystemOperations;
|
|
3133
3237
|
|
|
3134
|
-
// 加载成功的外部回调
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3238
|
+
const logoBase64 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLAAAAGaCAYAAAAfLro4AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAGj2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDg4LCAyMDIwLzA3LzEwLTIyOjA2OjUzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0i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kSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLRLLAkSZIkSZJUNAssSZIkSZIkFc0CS5IkSZIkSUWzwJIkSZIkSVLR/h+CVP12K0zZoAAAAABJRU5ErkJggg==';
|
|
3239
|
+
const defaultResetRoute = () => {
|
|
3240
|
+
window.location.href = window.location.origin;
|
|
3241
|
+
};
|
|
3242
|
+
const useSpaLogo = function () {
|
|
3243
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3244
|
+
const {
|
|
3245
|
+
logoUrl = logoBase64,
|
|
3246
|
+
// 使用者传入 logo URL
|
|
3247
|
+
logoWidth = 100,
|
|
3248
|
+
logoAlt = 'logo',
|
|
3249
|
+
onClick = defaultResetRoute,
|
|
3250
|
+
buttonStyle = {
|
|
3251
|
+
padding: 0,
|
|
3252
|
+
lineHeight: 1,
|
|
3253
|
+
height: 'auto',
|
|
3254
|
+
borderStyle: 'none',
|
|
3255
|
+
display: 'inline-block'
|
|
3256
|
+
}
|
|
3257
|
+
} = props;
|
|
3142
3258
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3259
|
+
// 如果没有提供 logoUrl,返回空
|
|
3260
|
+
if (!logoUrl) {
|
|
3261
|
+
return [null];
|
|
3262
|
+
}
|
|
3263
|
+
return [/*#__PURE__*/jsx(Button, {
|
|
3264
|
+
type: "link",
|
|
3265
|
+
style: buttonStyle,
|
|
3266
|
+
onClick: onClick,
|
|
3267
|
+
children: /*#__PURE__*/jsx("img", {
|
|
3268
|
+
alt: logoAlt,
|
|
3269
|
+
src: logoUrl,
|
|
3270
|
+
style: {
|
|
3271
|
+
width: logoWidth
|
|
3148
3272
|
}
|
|
3149
|
-
})
|
|
3150
|
-
},
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
await fetchPresetList();
|
|
3273
|
+
})
|
|
3274
|
+
}, "logo")];
|
|
3275
|
+
};
|
|
3276
|
+
useSpaLogo.propTypes = {
|
|
3277
|
+
logoUrl: PropTypes.string,
|
|
3278
|
+
logoWidth: PropTypes.number,
|
|
3279
|
+
logoAlt: PropTypes.string,
|
|
3280
|
+
onClick: PropTypes.func
|
|
3281
|
+
};
|
|
3282
|
+
var useSpaLogo$1 = useSpaLogo;
|
|
3160
3283
|
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
saveButton: texts.saveButton
|
|
3284
|
+
const defaultGetSocketUrl = url => {
|
|
3285
|
+
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
|
|
3286
|
+
return "ws://127.0.0.1:".concat(window.location.port).concat(url);
|
|
3287
|
+
}
|
|
3288
|
+
return "ws://".concat(window.location.host).concat(url);
|
|
3289
|
+
};
|
|
3290
|
+
|
|
3291
|
+
/**
|
|
3292
|
+
* 通用 Header 组件
|
|
3293
|
+
* @param {Object} props
|
|
3294
|
+
* @param {React.ReactNode} props.menuElement - 菜单元素
|
|
3295
|
+
* @param {Object} props.productInfo - 产品信息 { productName, version }
|
|
3296
|
+
* @param {boolean} props.showLogo - 是否显示Logo
|
|
3297
|
+
* @param {boolean} props.showProductInfo - 是否显示产品信息
|
|
3298
|
+
* @param {boolean} props.showHardwareUsage - 是否显示硬件使用情况
|
|
3299
|
+
* @param {boolean} props.showSystemOperations - 是否显示系统操作
|
|
3300
|
+
* @param {Function} props.onPowerOff - 关机函数
|
|
3301
|
+
* @param {Function} props.onRestart - 重启函数
|
|
3302
|
+
* @param {Function} props.onRun - 运行函数(用于SystemOperations)
|
|
3303
|
+
* @param {string} props.hardwareMonitorUrl - 硬件监控WebSocket地址
|
|
3304
|
+
* @param {Function} props.getSocketUrl - 获取WebSocket URL的函数
|
|
3305
|
+
* @param {Object} props.logoProps - Logo组件属性
|
|
3306
|
+
* @param {string} props.className - 自定义类名
|
|
3307
|
+
* @param {Object} props.style - 自定义样式
|
|
3308
|
+
*/
|
|
3309
|
+
const CommonHeader = _ref => {
|
|
3310
|
+
let {
|
|
3311
|
+
menuElement,
|
|
3312
|
+
productInfo = {},
|
|
3313
|
+
showLogo = true,
|
|
3314
|
+
showProductInfo = true,
|
|
3315
|
+
showHardwareUsage = true,
|
|
3316
|
+
showSystemOperations = true,
|
|
3317
|
+
onPowerOff,
|
|
3318
|
+
onRestart,
|
|
3319
|
+
onRun,
|
|
3320
|
+
hardwareMonitorUrl = '/ws/psmonitor/status_update',
|
|
3321
|
+
getSocketUrl = defaultGetSocketUrl,
|
|
3322
|
+
logoProps = {},
|
|
3323
|
+
className = '',
|
|
3324
|
+
style = {}
|
|
3325
|
+
} = _ref;
|
|
3326
|
+
const [logo] = useSpaLogo$1(logoProps);
|
|
3327
|
+
|
|
3328
|
+
// 系统资源使用情况
|
|
3329
|
+
const usageElement = useHardwareUsage$1(getSocketUrl(hardwareMonitorUrl));
|
|
3330
|
+
return /*#__PURE__*/jsxs(Flex, {
|
|
3331
|
+
justify: "space-between",
|
|
3332
|
+
align: "center",
|
|
3333
|
+
className: "common-header ".concat(className),
|
|
3334
|
+
style: style,
|
|
3335
|
+
children: [/*#__PURE__*/jsxs(Space, {
|
|
3336
|
+
size: 12,
|
|
3337
|
+
children: [showLogo && logo, showProductInfo && /*#__PURE__*/jsxs(Flex, {
|
|
3338
|
+
align: "center",
|
|
3339
|
+
gap: 8,
|
|
3340
|
+
children: [productInfo.productName && /*#__PURE__*/jsx(Typography.Title, {
|
|
3341
|
+
level: 4,
|
|
3342
|
+
style: {
|
|
3343
|
+
marginBottom: 0
|
|
3222
3344
|
},
|
|
3223
|
-
|
|
3224
|
-
})
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3345
|
+
children: productInfo.productName
|
|
3346
|
+
}), productInfo.version && /*#__PURE__*/jsx(Typography.Text, {
|
|
3347
|
+
style: {
|
|
3348
|
+
position: 'relative',
|
|
3349
|
+
top: 6,
|
|
3350
|
+
left: -6
|
|
3351
|
+
},
|
|
3352
|
+
children: productInfo.version
|
|
3353
|
+
})]
|
|
3354
|
+
})]
|
|
3355
|
+
}), /*#__PURE__*/jsxs(Flex, {
|
|
3356
|
+
align: "center",
|
|
3357
|
+
gap: 10,
|
|
3358
|
+
children: [showHardwareUsage && usageElement, /*#__PURE__*/jsxs("div", {
|
|
3359
|
+
className: "header-controls",
|
|
3360
|
+
children: [menuElement && /*#__PURE__*/jsx("div", {
|
|
3361
|
+
className: "control-icon",
|
|
3362
|
+
children: menuElement
|
|
3363
|
+
}), showSystemOperations && /*#__PURE__*/jsx("div", {
|
|
3364
|
+
className: "control-icon",
|
|
3365
|
+
children: /*#__PURE__*/jsx(SystemOperations$1, {
|
|
3366
|
+
onPowerOff: onPowerOff,
|
|
3367
|
+
onRestart: onRestart,
|
|
3368
|
+
run: onRun
|
|
3232
3369
|
})
|
|
3233
|
-
})
|
|
3370
|
+
})]
|
|
3234
3371
|
})]
|
|
3235
|
-
})
|
|
3372
|
+
})]
|
|
3236
3373
|
});
|
|
3237
3374
|
};
|
|
3238
|
-
var PresetModal = /*#__PURE__*/memo(Preset);
|
|
3239
3375
|
|
|
3240
|
-
|
|
3376
|
+
// PropTypes 类型检查
|
|
3377
|
+
CommonHeader.propTypes = {
|
|
3378
|
+
menuElement: PropTypes.node,
|
|
3379
|
+
productInfo: PropTypes.shape({
|
|
3380
|
+
productName: PropTypes.string,
|
|
3381
|
+
version: PropTypes.string
|
|
3382
|
+
}),
|
|
3383
|
+
showLogo: PropTypes.bool,
|
|
3384
|
+
showProductInfo: PropTypes.bool,
|
|
3385
|
+
showHardwareUsage: PropTypes.bool,
|
|
3386
|
+
showSystemOperations: PropTypes.bool,
|
|
3387
|
+
onPowerOff: PropTypes.func,
|
|
3388
|
+
onRestart: PropTypes.func,
|
|
3389
|
+
onRun: PropTypes.func,
|
|
3390
|
+
hardwareMonitorUrl: PropTypes.string,
|
|
3391
|
+
getSocketUrl: PropTypes.func,
|
|
3392
|
+
logoProps: PropTypes.object,
|
|
3393
|
+
className: PropTypes.string,
|
|
3394
|
+
style: PropTypes.object
|
|
3395
|
+
};
|
|
3396
|
+
var CommonHeader$1 = CommonHeader;
|
|
3397
|
+
|
|
3398
|
+
export { AuthorizationModal$1 as AuthorizationModal, CommonHeader$1 as CommonHeader, NetworkSettingsModal$1 as NetworkSettingsModal, PresetModal, PtpModal$1 as PtpModal, SystemOperations$1 as SystemOperations, UpgradeManager$1 as UpgradeManager, useAuth, useHardwareUsage$1 as useHardwareUsage, useSystemOperations$1 as useSystemOperations, useUpgrade$1 as useUpgrade };
|
|
3241
3399
|
//# sourceMappingURL=index.esm.js.map
|