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