seeder-st2110-components 1.1.7 → 1.2.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.js CHANGED
@@ -2491,7 +2491,7 @@ const NetworkSettingsModal = _ref2 => {
2491
2491
  }
2492
2492
  }
2493
2493
  onClose();
2494
- }, [message, modal, getSysConfig, restart, onClose]);
2494
+ }, [message, modal, getSysConfig, restart, getConfig, sections, onClose]);
2495
2495
  const handleSubmit = react.useCallback(async () => {
2496
2496
  setSubmitLoading(true);
2497
2497
  try {
@@ -2514,17 +2514,24 @@ const NetworkSettingsModal = _ref2 => {
2514
2514
 
2515
2515
  // 更新QSFP配置
2516
2516
  if (sections.includes('QSFP') && values.QSFP) {
2517
- const st2110Data = {
2518
- st2110_interfaces: values.QSFP.map((item, index) => ({
2519
- // 只有当原始数据中存在id时才包含id
2520
- ...(st2110Interfaces?.[index]?.id !== undefined && {
2521
- id: st2110Interfaces?.[index]?.id
2522
- }),
2523
- ip_address: item.ip_address,
2524
- ...(showNetmask.QSFP ? {
2525
- netmask: item.netmask
2526
- } : {})
2527
- }))
2517
+ const interfacesData = values.QSFP.map((item, index) => ({
2518
+ // 只有当原始数据中存在id时才包含id
2519
+ ...(st2110Interfaces?.[index]?.id !== undefined && {
2520
+ id: st2110Interfaces?.[index]?.id
2521
+ }),
2522
+ ...(st2110Interfaces?.[index]?.ip !== undefined ? {
2523
+ ip: item.ip_address
2524
+ } : {
2525
+ ip_address: item.ip_address
2526
+ }),
2527
+ ...(showNetmask.QSFP ? {
2528
+ netmask: item.netmask
2529
+ } : {})
2530
+ }));
2531
+ const st2110Data = st2110Interfaces.some(iface => 'id' in iface) ? {
2532
+ st2110_interfaces: interfacesData
2533
+ } : {
2534
+ interfaces: interfacesData
2528
2535
  };
2529
2536
  updatePromises.push(updateSysConfig(st2110Data));
2530
2537
  }