mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
bug fix for LocationEditor
fix a problem that unable to add location when locations slice is empty.
This commit is contained in:
parent
1dc5f71688
commit
2d4c15e7f9
2 changed files with 25 additions and 22 deletions
|
@ -40,6 +40,20 @@ function remove(index: number) {
|
||||||
<a-empty v-if="!locations"/>
|
<a-empty v-if="!locations"/>
|
||||||
<a-card v-for="(v,k) in locations" :key="k"
|
<a-card v-for="(v,k) in locations" :key="k"
|
||||||
:title="$gettext('Location')" size="small">
|
:title="$gettext('Location')" size="small">
|
||||||
|
|
||||||
|
<template #extra>
|
||||||
|
<a-popconfirm @confirm="remove(k)"
|
||||||
|
:title="$gettext('Are you sure you want to remove this location?')"
|
||||||
|
:ok-text="$gettext('Yes')"
|
||||||
|
:cancel-text="$gettext('No')">
|
||||||
|
<a-button type="text">
|
||||||
|
<template #icon>
|
||||||
|
<DeleteOutlined style="font-size: 14px;"/>
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
|
|
||||||
<a-form layout="vertical">
|
<a-form layout="vertical">
|
||||||
<a-form-item :label="$gettext('Comments')">
|
<a-form-item :label="$gettext('Comments')">
|
||||||
<a-textarea v-model:value="v.comments" :bordered="false"/>
|
<a-textarea v-model:value="v.comments" :bordered="false"/>
|
||||||
|
@ -48,19 +62,7 @@ function remove(index: number) {
|
||||||
<a-input addon-before="location" v-model:value="v.path"/>
|
<a-input addon-before="location" v-model:value="v.path"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :label="$gettext('Content')">
|
<a-form-item :label="$gettext('Content')">
|
||||||
<div class="input-wrapper">
|
<code-editor v-model:content="v.content" default-height="200px" style="width: 100%;"/>
|
||||||
<code-editor v-model:content="v.content" default-height="200px" style="width: 100%;"/>
|
|
||||||
<a-popconfirm @confirm="remove(k)"
|
|
||||||
:title="$gettext('Are you sure you want to remove this location?')"
|
|
||||||
:ok-text="$gettext('Yes')"
|
|
||||||
:cancel-text="$gettext('No')">
|
|
||||||
<a-button>
|
|
||||||
<template #icon>
|
|
||||||
<DeleteOutlined style="font-size: 14px;"/>
|
|
||||||
</template>
|
|
||||||
</a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
</div>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
@ -88,12 +90,5 @@ function remove(index: number) {
|
||||||
.ant-card {
|
.ant-card {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
box-shadow: unset;
|
box-shadow: unset;
|
||||||
|
|
||||||
.input-wrapper {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -64,9 +64,17 @@ func (d *NgxDirective) TrimParams() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNgxServer() *NgxServer {
|
func NewNgxServer() *NgxServer {
|
||||||
return &NgxServer{commentQueue: &CommentQueue{linkedlistqueue.New()}}
|
return &NgxServer{
|
||||||
|
Locations: make([]*NgxLocation, 0),
|
||||||
|
Directives: make([]*NgxDirective, 0),
|
||||||
|
commentQueue: &CommentQueue{linkedlistqueue.New()},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNgxConfig(filename string) *NgxConfig {
|
func NewNgxConfig(filename string) *NgxConfig {
|
||||||
return &NgxConfig{FileName: filename, commentQueue: &CommentQueue{linkedlistqueue.New()}}
|
return &NgxConfig{
|
||||||
|
FileName: filename,
|
||||||
|
commentQueue: &CommentQueue{linkedlistqueue.New()},
|
||||||
|
Upstreams: make([]*NgxUpstream, 0),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue