refactor(InstanceDetail): simplify editConfig function by removing async call

The editConfig function was refactored to use existing local data instead of making an API call. This simplifies the logic while maintaining the same functionality.
This commit is contained in:
2026-04-07 22:54:08 +08:00
parent d0654d9ee0
commit 3859a4170c

View File

@@ -493,7 +493,6 @@ export default {
level: log.level, level: log.level,
message: log.content message: log.content
})) : []; })) : [];
showNotification(result.message || 'Logs loaded successfully', 'success');
} catch (error) { } catch (error) {
showNotification(error.message || 'Load logs failed', 'error'); showNotification(error.message || 'Load logs failed', 'error');
} }
@@ -504,28 +503,20 @@ export default {
router.push('/instances'); router.push('/instances');
}; };
const editConfig = async () => { const editConfig = () => {
try {
const result = await instanceApi.getInstanceInfo(instanceID.value);
instanceName.value = result.data.name;
formData.value = { formData.value = {
name: result.data.name, name: instanceName.value,
auth_method: result.data.auth_method || 'token', auth_method: instanceConfig.value['Auth Method'] === 'token' ? 'token' : 'oidc',
serverAddr: result.data.serverAddr || '', serverAddr: instanceConfig.value['Server Address'] || '',
serverPort: result.data.serverPort || '', serverPort: instanceConfig.value['Server Port'] || '',
token: '', token: '',
clientId: '', clientId: '',
clientSecret: '', clientSecret: '',
audience: '', audience: '',
tokenEndpoint: '', tokenEndpoint: '',
bootAtStart: result.data.bootAtStart || false, bootAtStart: instanceConfig.value['Boot At Start'] === 'Yes',
runUser: result.data.runUser || 'root' runUser: instanceConfig.value['Run User'] || 'root'
}; };
showNotification(result.message || 'Instance data loaded successfully', 'success');
} catch (error) {
showNotification(error.message || 'Load instance data failed', 'error');
return;
}
showEditConfigModal.value = true; showEditConfigModal.value = true;
}; };