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