diff --git a/src/pages/ServersPage.vue b/src/pages/ServersPage.vue
index 4a95931..c826e2b 100644
--- a/src/pages/ServersPage.vue
+++ b/src/pages/ServersPage.vue
@@ -181,8 +181,6 @@
-
-
@@ -318,11 +316,7 @@
-
-
-
取消
@@ -336,8 +330,6 @@
-
-
{{ row.is_active ? '是' : '否'
}}
@@ -351,17 +343,18 @@
+
+ 关闭
+
+
-
+
-
-
- 关闭
+ 取消
{{ editingSoftwareId ? '更新软件' : '新增软件'
}}
@@ -390,6 +383,7 @@ const passwordDialogVisible = ref(false)
const boundPasswordDialogVisible = ref(false)
const protocolDialogVisible = ref(false)
const softwareDialogVisible = ref(false)
+const softwareFormDialogVisible = ref(false)
const savingPermissions = ref(false)
const usingResource = ref(false)
const copyingTempPassword = ref(false)
@@ -421,12 +415,12 @@ const opsSavedSelections = reactive>({})
const typeOptions = [{ label: '服务器', value: 'server' }, { label: '资源', value: 'resource' }]
const form = reactive({ type: 'server', name: '', display_name: '', parent_id: null, internal_ip: '', user_api_base_url: '', user_api_token: '', asset_id: null, account_id: null, protocol: '', allow_copy_temp_password: false, description: '', is_active: true })
-const systemUserForm = reactive({ username: '', password: '', groups: [], shell: '/bin/bash', home_dir: '', groupname: '' })
+const systemUserForm = reactive({ username: '', password: '', groups: [], groupname: '' })
const useForm = reactive({ protocol: 'SSH', account_name: '', password: '', remember: false, last_temp_password: '' })
const passwordForm = reactive({ password: '' })
const boundPasswordForm = reactive({ password: '' })
-const protocolForm = reactive({ name: '', bastion_protocol_id: 2, description: '', sort: 0, is_active: true })
-const softwareForm = reactive({ name: '', client_path: '', sort: 0, is_active: true })
+const protocolForm = reactive({ name: '', description: '' })
+const softwareForm = reactive({ name: '', is_active: true })
const opsSelections = reactive>({})
const systemUserGroupSelections = reactive>({})
const systemUsers = ref([])
@@ -775,13 +769,13 @@ function bindingLabel(username: string): string {
function openCreateSystemUser(): void {
systemUserFormMode.value = 'user'
- Object.assign(systemUserForm, { username: '', password: '', groups: [], shell: '/bin/bash', home_dir: '', groupname: '' })
+ Object.assign(systemUserForm, { username: '', password: '', groups: [], groupname: '' })
systemUserFormVisible.value = true
}
function openCreateSystemGroup(): void {
systemUserFormMode.value = 'group'
- Object.assign(systemUserForm, { username: '', password: '', groups: [], shell: '/bin/bash', home_dir: '', groupname: '' })
+ Object.assign(systemUserForm, { username: '', password: '', groups: [], groupname: '' })
systemUserFormVisible.value = true
}
@@ -799,8 +793,6 @@ async function submitSystemUserForm(): Promise {
username: systemUserForm.username,
password: systemUserForm.password,
groups: systemUserForm.groups,
- shell: systemUserForm.shell || '/bin/bash',
- home_dir: systemUserForm.home_dir || null,
})
ElMessage.success('服务器用户创建成功')
}
@@ -990,7 +982,7 @@ async function fetchOpsMeta(): Promise {
}
function resetProtocolForm(): void {
- Object.assign(protocolForm, { name: '', bastion_protocol_id: 2, description: '', sort: 0, is_active: true })
+ Object.assign(protocolForm, { name: '', description: '' })
}
function openCreateProtocol(): void {
@@ -1003,10 +995,7 @@ function openEditProtocol(row: any): void {
editingProtocolId.value = row.id
Object.assign(protocolForm, {
name: row.name,
- bastion_protocol_id: row.bastion_protocol_id || 2,
description: row.description || '',
- sort: row.sort || 0,
- is_active: Boolean(row.is_active),
})
protocolDialogVisible.value = true
}
@@ -1016,10 +1005,7 @@ async function submitProtocol(): Promise {
try {
const payload = {
name: protocolForm.name,
- bastion_protocol_id: Number(protocolForm.bastion_protocol_id || 2),
description: protocolForm.description || '',
- sort: protocolForm.sort || 0,
- is_active: Boolean(protocolForm.is_active),
}
if (editingProtocolId.value) {
await serversApi.updateOpsProtocol(editingProtocolId.value, payload)
@@ -1047,27 +1033,28 @@ async function removeProtocol(row: any): Promise {
function resetSoftwareForm(): void {
editingSoftwareId.value = null
- Object.assign(softwareForm, { name: '', client_path: '', sort: 0, is_active: true })
+ Object.assign(softwareForm, { name: '', is_active: true })
}
function openSoftwareDialog(row: any): void {
softwareProtocol.value = row
resetSoftwareForm()
+ softwareFormDialogVisible.value = false
softwareDialogVisible.value = true
}
function openCreateSoftware(): void {
resetSoftwareForm()
+ softwareFormDialogVisible.value = true
}
function openEditSoftware(row: any): void {
editingSoftwareId.value = row.id
Object.assign(softwareForm, {
name: row.name,
- client_path: row.client_path || '',
- sort: row.sort || 0,
is_active: Boolean(row.is_active),
})
+ softwareFormDialogVisible.value = true
}
async function submitSoftware(): Promise {
@@ -1079,8 +1066,6 @@ async function submitSoftware(): Promise {
try {
const payload = {
name: softwareForm.name,
- client_path: softwareForm.client_path || '',
- sort: softwareForm.sort || 0,
is_active: Boolean(softwareForm.is_active),
}
if (editingSoftwareId.value) {
@@ -1090,6 +1075,7 @@ async function submitSoftware(): Promise {
await serversApi.createOpsSoftware(softwareProtocol.value.id, payload)
ElMessage.success('软件创建成功')
}
+ softwareFormDialogVisible.value = false
resetSoftwareForm()
await fetchOpsMeta()
softwareProtocol.value = opsProtocols.value.find((item) => item.id === softwareProtocol.value?.id) || null