fix(site-add): failed to add location #637

This commit is contained in:
Jacky 2024-10-23 20:20:14 +08:00
parent 4747c6916e
commit 0378ff4438
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
4 changed files with 15 additions and 12 deletions

View file

@ -105,7 +105,10 @@ provide('ngx_config', ngx_config)
<DirectiveEditor /> <DirectiveEditor />
<br> <br>
<LocationEditor :locations="ngx_config.servers[0].locations" /> <LocationEditor
:locations="ngx_config.servers[0].locations"
:current-server-index="0"
/>
<br> <br>
<AAlert <AAlert
v-if="!has_server_name" v-if="!has_server_name"

View file

@ -44,7 +44,7 @@ const data = ref({})
init() init()
const advance_mode = computed({ const advanceMode = computed({
get() { get() {
return advance_mode_ref.value || parse_error_status.value return advance_mode_ref.value || parse_error_status.value
}, },
@ -57,10 +57,10 @@ const history_chatgpt_record = ref([]) as Ref<ChatComplicationMessage[]>
function handle_response(r: Site) { function handle_response(r: Site) {
if (r.advanced) if (r.advanced)
advance_mode.value = true advanceMode.value = true
if (r.advanced) if (r.advanced)
advance_mode.value = true advanceMode.value = true
parse_error_status.value = false parse_error_status.value = false
parse_error_message.value = '' parse_error_message.value = ''
@ -97,7 +97,7 @@ function handle_parse_error(e: { error?: string; message: string }) {
function on_mode_change(advanced: CheckedType) { function on_mode_change(advanced: CheckedType) {
domain.advance_mode(name.value, { advanced: advanced as boolean }).then(() => { domain.advance_mode(name.value, { advanced: advanced as boolean }).then(() => {
advance_mode.value = advanced as boolean advanceMode.value = advanced as boolean
if (advanced) { if (advanced) {
build_config() build_config()
} }
@ -118,7 +118,7 @@ async function build_config() {
const save = async () => { const save = async () => {
saving.value = true saving.value = true
if (!advance_mode.value) { if (!advanceMode.value) {
try { try {
await build_config() await build_config()
} }
@ -187,11 +187,11 @@ provide('data', data)
<ASwitch <ASwitch
size="small" size="small"
:disabled="parse_error_status" :disabled="parse_error_status"
:checked="advance_mode" :checked="advanceMode"
@change="on_mode_change" @change="on_mode_change"
/> />
</div> </div>
<template v-if="advance_mode"> <template v-if="advanceMode">
<div>{{ $gettext('Advance Mode') }}</div> <div>{{ $gettext('Advance Mode') }}</div>
</template> </template>
<template v-else> <template v-else>
@ -202,7 +202,7 @@ provide('data', data)
<Transition name="slide-fade"> <Transition name="slide-fade">
<div <div
v-if="advance_mode" v-if="advanceMode"
key="advance" key="advance"
> >
<div <div

View file

@ -48,7 +48,7 @@ function duplicate(index: number) {
<template> <template>
<h3>{{ $gettext('Locations') }}</h3> <h3>{{ $gettext('Locations') }}</h3>
<AEmpty v-if="!locations" /> <AEmpty v-if="locations && locations?.length === 0" />
<Draggable <Draggable
v-else v-else
:list="locations" :list="locations"

View file

@ -213,9 +213,9 @@ const activeKey = ref(['3'])
> >
<NgxServer <NgxServer
v-model:auto-cert="autoCertRef" v-model:auto-cert="autoCertRef"
:enabled="enabled" :enabled
:cert-info="certInfo" :cert-info="certInfo"
:context="context" :context
/> />
</ACollapsePanel> </ACollapsePanel>
</ACollapse> </ACollapse>