seeder-st2110-components 1.0.6 → 1.1.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 +32 -35
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2269,42 +2269,39 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2269
2269
|
const [submitLoading, setSubmitLoading] = useState(false);
|
|
2270
2270
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
2271
2271
|
const hasFetchedRef = useRef(false);
|
|
2272
|
-
|
|
2273
|
-
if (!open
|
|
2274
|
-
|
|
2275
|
-
hasFetchedRef.current
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
promises
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
promises.push(getSysConfig());
|
|
2282
|
-
}
|
|
2283
|
-
const results = await Promise.allSettled(promises);
|
|
2284
|
-
if (sections.includes('LAN')) {
|
|
2285
|
-
const lanResult = results[0];
|
|
2286
|
-
if (lanResult.status === 'fulfilled') {
|
|
2287
|
-
setLanConfigs(lanResult.value || []);
|
|
2272
|
+
useEffect(() => {
|
|
2273
|
+
if (!open) return;
|
|
2274
|
+
const fetchData = async () => {
|
|
2275
|
+
if (hasFetchedRef.current) return;
|
|
2276
|
+
try {
|
|
2277
|
+
hasFetchedRef.current = true;
|
|
2278
|
+
const promises = [];
|
|
2279
|
+
if (sections.includes('LAN')) {
|
|
2280
|
+
promises.push(getLanConfig());
|
|
2288
2281
|
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2282
|
+
if (sections.includes('QSFP')) {
|
|
2283
|
+
promises.push(getSysConfig());
|
|
2284
|
+
}
|
|
2285
|
+
const results = await Promise.allSettled(promises);
|
|
2286
|
+
if (sections.includes('LAN')) {
|
|
2287
|
+
const lanResult = results[0];
|
|
2288
|
+
if (lanResult.status === 'fulfilled') {
|
|
2289
|
+
setLanConfigs(lanResult.value || []);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
if (sections.includes('QSFP')) {
|
|
2293
|
+
const sysResult = sections.includes('LAN') ? results[1] : results[0];
|
|
2294
|
+
if (sysResult.status === 'fulfilled' && sysResult.value) {
|
|
2295
|
+
setSt2110Interfaces(sysResult.value.st2110_interfaces || []);
|
|
2296
|
+
}
|
|
2294
2297
|
}
|
|
2298
|
+
setIsInitialized(true);
|
|
2299
|
+
} catch (error) {
|
|
2300
|
+
console.error('Failed to fetch data:', error);
|
|
2295
2301
|
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
console.error('Failed to fetch data:', error);
|
|
2299
|
-
hasFetchedRef.current = false; // 出错时重置标志
|
|
2300
|
-
}
|
|
2302
|
+
};
|
|
2303
|
+
fetchData();
|
|
2301
2304
|
}, [open, getLanConfig, getSysConfig, sections]);
|
|
2302
|
-
useEffect(() => {
|
|
2303
|
-
if (open) {
|
|
2304
|
-
console.log(123456);
|
|
2305
|
-
fetchData();
|
|
2306
|
-
}
|
|
2307
|
-
}, [open, fetchData]);
|
|
2308
2305
|
|
|
2309
2306
|
// 当模态框关闭时重置状态
|
|
2310
2307
|
useEffect(() => {
|
|
@@ -2313,7 +2310,7 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2313
2310
|
setLanConfigs([]);
|
|
2314
2311
|
setSt2110Interfaces([]);
|
|
2315
2312
|
form.resetFields();
|
|
2316
|
-
hasFetchedRef.current = false;
|
|
2313
|
+
hasFetchedRef.current = false;
|
|
2317
2314
|
}
|
|
2318
2315
|
}, [open, form]);
|
|
2319
2316
|
|
|
@@ -2340,10 +2337,10 @@ const NetworkSettingsModal = _ref2 => {
|
|
|
2340
2337
|
|
|
2341
2338
|
// 当初始值准备好后设置表单值
|
|
2342
2339
|
useEffect(() => {
|
|
2343
|
-
if (isInitialized
|
|
2340
|
+
if (isInitialized) {
|
|
2344
2341
|
form.setFieldsValue(initialValues);
|
|
2345
2342
|
}
|
|
2346
|
-
}, [
|
|
2343
|
+
}, [isInitialized, form, initialValues]);
|
|
2347
2344
|
const handleSuccess = useCallback(async function () {
|
|
2348
2345
|
let isPopup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2349
2346
|
let messageText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Success';
|