seeder-st2110-components 1.5.6 → 1.5.8

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.js CHANGED
@@ -220,7 +220,7 @@ const getItems = details => {
220
220
  items.push(createMetricItem('NIC Temperature', 'seeder-icon-wuliwangka', details.nic_temp, '℃'));
221
221
  }
222
222
  if (details.hd_temp !== null && details.hd_temp !== undefined) {
223
- items.push(createMetricItem('HD Temperature', 'seeder-icon-yingpan', details.hd_temp, '℃'));
223
+ items.push(createMetricItem('Disk Temperature', 'seeder-icon-yingpan', details.hd_temp, '℃'));
224
224
  }
225
225
  if (details.gpu_usage !== null && details.gpu_usage !== undefined) {
226
226
  items.push(createMetricItem('GPU Usage', 'seeder-icon-gpufuwu', details.gpu_usage, '%'));
@@ -2846,6 +2846,7 @@ const RightDetailForm = /*#__PURE__*/react.memo(_ref3 => {
2846
2846
  onLoad,
2847
2847
  isLoading,
2848
2848
  isEditing,
2849
+ originalPresetData,
2849
2850
  fields = {
2850
2851
  name: {
2851
2852
  label: "Preset Name",
@@ -2895,8 +2896,9 @@ const RightDetailForm = /*#__PURE__*/react.memo(_ref3 => {
2895
2896
  const formValues = await form.validateFields();
2896
2897
  const loadData = {
2897
2898
  id: form.getFieldValue('id'),
2898
- // 只加载当前勾选的选项
2899
- category_list: formValues.category_list || []
2899
+ // 优先使用表单中的 category_list,如果没有则使用原始数据
2900
+ name: originalPresetData.name,
2901
+ category_list: hasCategoryList ? formValues.category_list || [] : (originalPresetData === null || originalPresetData === void 0 ? void 0 : originalPresetData.category_list) || []
2900
2902
  };
2901
2903
  await onLoad(loadData);
2902
2904
  } catch (error) {
@@ -2999,6 +3001,7 @@ const Preset = _ref => {
2999
3001
  title: "Preset Management",
3000
3002
  emptyText: "Select a preset from the list to view details",
3001
3003
  deleteConfirm: "Are you sure to delete preset",
3004
+ loadConfirm: "Are you sure you want to load preset",
3002
3005
  loadText: "Loading...",
3003
3006
  successText: "Success",
3004
3007
  newButton: "New Preset",
@@ -3070,7 +3073,8 @@ const Preset = _ref => {
3070
3073
  try {
3071
3074
  AntdModal.confirm({
3072
3075
  icon: /*#__PURE__*/jsxRuntime.jsx(icons.ExclamationCircleFilled, {}),
3073
- title: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
3076
+ title: 'Delete Preset',
3077
+ content: "".concat(texts.deleteConfirm, " \"").concat(presetName, "\"?"),
3074
3078
  cancelText: 'No',
3075
3079
  okText: 'Yes',
3076
3080
  onOk: async () => {
@@ -3097,46 +3101,55 @@ const Preset = _ref => {
3097
3101
  const handleLoadPreset = react.useCallback(async loadData => {
3098
3102
  if (!loadData) return;
3099
3103
 
3100
- // 显示加载模态框
3101
- const modalInstance = antd.Modal.info({
3102
- title: texts.loadText,
3103
- content: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
3104
- size: "large",
3105
- className: "block mx-auto"
3106
- }),
3107
- maskClosable: false,
3108
- okButtonProps: {
3109
- style: {
3110
- display: 'none'
3104
+ // 显示确认对话框
3105
+ AntdModal.confirm({
3106
+ title: 'Load Preset',
3107
+ content: "".concat(texts.loadConfirm, " \"").concat(loadData.name, "\"?"),
3108
+ cancelText: 'No',
3109
+ okText: 'Yes',
3110
+ onOk: async () => {
3111
+ // 显示加载模态框
3112
+ const modalInstance = antd.Modal.info({
3113
+ title: texts.loadText,
3114
+ content: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
3115
+ size: "large",
3116
+ className: "block mx-auto"
3117
+ }),
3118
+ maskClosable: false,
3119
+ okButtonProps: {
3120
+ style: {
3121
+ display: 'none'
3122
+ }
3123
+ }
3124
+ });
3125
+ try {
3126
+ await loadPreset(_objectSpread2({
3127
+ id: loadData.id
3128
+ }, loadData.category_list && {
3129
+ category_list: loadData.category_list
3130
+ }));
3131
+ // 成功时延迟关闭
3132
+ setTimeout(() => {
3133
+ modalInstance.destroy();
3134
+ AntdMessage.success(texts.successText);
3135
+
3136
+ // 加载成功的外部回调
3137
+ if (onLoadSuccess) {
3138
+ onLoadSuccess(loadData);
3139
+ }
3140
+ }, 1000);
3141
+ } catch (error) {
3142
+ console.error('Failed to load preset:', error);
3143
+ modalInstance.destroy();
3144
+
3145
+ // 加载失败的外部回调
3146
+ if (onLoadError) {
3147
+ onLoadError(error, loadData);
3148
+ }
3111
3149
  }
3112
3150
  }
3113
3151
  });
3114
- try {
3115
- await loadPreset(_objectSpread2({
3116
- id: loadData.id
3117
- }, loadData.category_list && {
3118
- category_list: loadData.category_list
3119
- }));
3120
- // 成功时延迟关闭
3121
- setTimeout(() => {
3122
- modalInstance.destroy();
3123
- AntdMessage.success(texts.successText);
3124
-
3125
- // 加载成功的外部回调
3126
- if (onLoadSuccess) {
3127
- onLoadSuccess(loadData);
3128
- }
3129
- }, 1000);
3130
- } catch (error) {
3131
- console.error('Failed to load preset:', error);
3132
- modalInstance.destroy();
3133
-
3134
- // 加载失败的外部回调
3135
- if (onLoadError) {
3136
- onLoadError(error, loadData);
3137
- }
3138
- }
3139
- }, [loadPreset, texts, AntdMessage]);
3152
+ }, [loadPreset, texts, AntdMessage, AntdModal, onLoadSuccess, onLoadError]);
3140
3153
  const handleSave = react.useCallback(async () => {
3141
3154
  setLoading(true);
3142
3155
  try {
@@ -3202,6 +3215,8 @@ const Preset = _ref => {
3202
3215
  onLoad: handleLoadPreset,
3203
3216
  isLoading: loading,
3204
3217
  isEditing: !!(selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.id),
3218
+ originalPresetData: selectedPreset // 传递原始数据
3219
+ ,
3205
3220
  fields: fields,
3206
3221
  texts: {
3207
3222
  loadButton: texts.loadButton,