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 />
<br>
<LocationEditor :locations="ngx_config.servers[0].locations" />
<LocationEditor
:locations="ngx_config.servers[0].locations"
:current-server-index="0"
/>
<br>
<AAlert
v-if="!has_server_name"

View file

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

View file

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

View file

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