mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 10:17:17 +08:00
fix: 重复的SSH设置
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { http } from '@/utils'
|
||||
|
||||
export default {
|
||||
ssh: (): any => http.Get('/safe/ssh'),
|
||||
updateSsh: (status: boolean, port: number): any => http.Post('/safe/ssh', { status, port }),
|
||||
pingStatus: (): any => http.Get('/safe/ping'),
|
||||
updatePingStatus: (status: boolean): any => http.Post('/safe/ping', { status })
|
||||
}
|
||||
|
||||
@@ -6,18 +6,12 @@ import { useGettext } from 'vue3-gettext'
|
||||
const { $gettext } = useGettext()
|
||||
const model = ref({
|
||||
firewallStatus: false,
|
||||
sshStatus: false,
|
||||
pingStatus: false,
|
||||
sshPort: 22
|
||||
pingStatus: false
|
||||
})
|
||||
|
||||
useRequest(firewall.status).onSuccess(({ data }) => {
|
||||
model.value.firewallStatus = data
|
||||
})
|
||||
useRequest(safe.ssh).onSuccess(({ data }) => {
|
||||
model.value.sshStatus = data.status
|
||||
model.value.sshPort = data.port
|
||||
})
|
||||
useRequest(safe.pingStatus).onSuccess(({ data }) => {
|
||||
model.value.pingStatus = data
|
||||
})
|
||||
@@ -28,12 +22,6 @@ const handleFirewallStatus = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleSsh = () => {
|
||||
useRequest(safe.updateSsh(model.value.sshStatus, model.value.sshPort)).onSuccess(() => {
|
||||
window.$message.success($gettext('Settings saved successfully'))
|
||||
})
|
||||
}
|
||||
|
||||
const handlePingStatus = () => {
|
||||
useRequest(safe.updatePingStatus(model.value.pingStatus)).onSuccess(() => {
|
||||
window.$message.success($gettext('Settings saved successfully'))
|
||||
@@ -46,15 +34,9 @@ const handlePingStatus = () => {
|
||||
<n-form-item path="firewall" :label="$gettext('System Firewall')">
|
||||
<n-switch v-model:value="model.firewallStatus" @update:value="handleFirewallStatus" />
|
||||
</n-form-item>
|
||||
<n-form-item path="ssh" :label="$gettext('SSH Switch')">
|
||||
<n-switch v-model:value="model.sshStatus" @update:value="handleSsh" />
|
||||
</n-form-item>
|
||||
<n-form-item path="ping" :label="$gettext('Allow Ping')">
|
||||
<n-switch v-model:value="model.pingStatus" @update:value="handlePingStatus" />
|
||||
</n-form-item>
|
||||
<n-form-item path="sshPort" :label="$gettext('SSH Port')">
|
||||
<n-input-number v-model:value="model.sshPort" @blur="handleSsh" />
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user