Logs
@@ -184,6 +244,7 @@ export default {
const proxies = ref([]);
const logs = ref([]);
const showEditConfigModal = ref(false);
+ const showAddProxyModal = ref(false);
const loading = ref(false);
const formData = ref({
name: '',
@@ -277,10 +338,18 @@ export default {
showEditConfigModal.value = true;
};
+ const addProxy = () => {
+ showAddProxyModal.value = true;
+ }
+
const closeEditConfigModal = () => {
showEditConfigModal.value = false;
};
+ const closeAddProxyModal = () => {
+ showAddProxyModal.value = false;
+ };
+
const handleEditConfiguration = async () => {
loading.value = true;
try {
@@ -321,6 +390,7 @@ export default {
showNotification('Configuration saved successfully', 'success');
closeEditConfigModal();
+ closeAddProxyModal();
// 重新加载配置
instanceName.value = formData.value.name;
await loadInstanceConfig();
@@ -331,6 +401,29 @@ export default {
}
};
+ const handleSubmit = async () => {
+ loading.value = true;
+ try {
+ const proxyInfo = {
+ name: formData.value.name,
+ type: formData.value.type,
+ localIP: formData.value.localIP,
+ localPort: formData.value.localPort.toString(),
+ remotePort: formData.value.remotePort.toString()
+ };
+
+ await instanceApi.createProxy(instanceID.value, proxyInfo);
+
+ showNotification('Proxy created successfully', 'success');
+ closeAddProxyModal();
+ await loadProxies();
+ } catch (error) {
+ showNotification(error.message || 'Create proxy failed', 'error');
+ } finally {
+ loading.value = false;
+ }
+ };
+
onMounted(() => {
loadInstanceConfig();
loadProxies();
@@ -343,12 +436,16 @@ export default {
proxies,
logs,
showEditConfigModal,
+ showAddProxyModal,
loading,
formData,
goBack,
editConfig,
closeEditConfigModal,
- handleEditConfiguration
+ addProxy,
+ closeAddProxyModal,
+ handleEditConfiguration,
+ handleSubmit
};
}
};
@@ -483,4 +580,11 @@ export default {
background: var(--disabled-bg);
cursor: not-allowed;
}
+
+.section h3 {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 16px;
+}