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