mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix: sync config is not enabled #820
This commit is contained in:
parent
a48f7145d7
commit
6957e4fb8e
5 changed files with 14 additions and 19 deletions
|
@ -493,10 +493,6 @@ const paginationSize = computed(() => {
|
||||||
>
|
>
|
||||||
{{ $gettext('View') }}
|
{{ $gettext('View') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider
|
|
||||||
v-if="!props.disableModify"
|
|
||||||
type="vertical"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="!props.disableModify && !inTrash">
|
<template v-if="!props.disableModify && !inTrash">
|
||||||
|
@ -507,7 +503,6 @@ const paginationSize = computed(() => {
|
||||||
>
|
>
|
||||||
{{ $gettext('Modify') }}
|
{{ $gettext('Modify') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider type="vertical" />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<slot
|
<slot
|
||||||
|
@ -544,7 +539,6 @@ const paginationSize = computed(() => {
|
||||||
{{ $gettext('Recover') }}
|
{{ $gettext('Recover') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
</APopconfirm>
|
</APopconfirm>
|
||||||
<ADivider type="vertical" />
|
|
||||||
<APopconfirm
|
<APopconfirm
|
||||||
v-if="inTrash"
|
v-if="inTrash"
|
||||||
:cancel-text="$gettext('No')"
|
:cancel-text="$gettext('No')"
|
||||||
|
|
|
@ -157,7 +157,6 @@ const refRename = useTemplateRef('refRename')
|
||||||
>
|
>
|
||||||
{{ $gettext('Modify') }}
|
{{ $gettext('Modify') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider type="vertical" />
|
|
||||||
<AButton
|
<AButton
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
|
|
@ -135,7 +135,6 @@ function handleBatchUpdated() {
|
||||||
>
|
>
|
||||||
{{ $gettext('Enable') }}
|
{{ $gettext('Enable') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider type="vertical" />
|
|
||||||
<AButton
|
<AButton
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -143,7 +142,6 @@ function handleBatchUpdated() {
|
||||||
>
|
>
|
||||||
{{ $gettext('Duplicate') }}
|
{{ $gettext('Duplicate') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider type="vertical" />
|
|
||||||
<APopconfirm
|
<APopconfirm
|
||||||
:cancel-text="$gettext('No')"
|
:cancel-text="$gettext('No')"
|
||||||
:ok-text="$gettext('OK')"
|
:ok-text="$gettext('OK')"
|
||||||
|
|
|
@ -151,7 +151,6 @@ function handleAddStream() {
|
||||||
>
|
>
|
||||||
{{ $gettext('Enable') }}
|
{{ $gettext('Enable') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider type="vertical" />
|
|
||||||
<AButton
|
<AButton
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -159,7 +158,6 @@ function handleAddStream() {
|
||||||
>
|
>
|
||||||
{{ $gettext('Duplicate') }}
|
{{ $gettext('Duplicate') }}
|
||||||
</AButton>
|
</AButton>
|
||||||
<ADivider type="vertical" />
|
|
||||||
<APopconfirm
|
<APopconfirm
|
||||||
:cancel-text="$gettext('No')"
|
:cancel-text="$gettext('No')"
|
||||||
:ok-text="$gettext('OK')"
|
:ok-text="$gettext('OK')"
|
||||||
|
|
|
@ -46,10 +46,10 @@ func Save(name string, content string, overwrite bool, siteCategoryId uint64, sy
|
||||||
s := query.Site
|
s := query.Site
|
||||||
_, err = s.Where(s.Path.Eq(path)).
|
_, err = s.Where(s.Path.Eq(path)).
|
||||||
Select(s.SiteCategoryID, s.SyncNodeIDs).
|
Select(s.SiteCategoryID, s.SyncNodeIDs).
|
||||||
Updates(&model.Site{
|
Updates(&model.Site{
|
||||||
SiteCategoryID: siteCategoryId,
|
SiteCategoryID: siteCategoryId,
|
||||||
SyncNodeIDs: syncNodeIds,
|
SyncNodeIDs: syncNodeIds,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -80,10 +80,10 @@ func syncSave(name string, content string) {
|
||||||
client.SetBaseURL(node.URL)
|
client.SetBaseURL(node.URL)
|
||||||
resp, err := client.R().
|
resp, err := client.R().
|
||||||
SetHeader("X-Node-Secret", node.Token).
|
SetHeader("X-Node-Secret", node.Token).
|
||||||
SetBody(map[string]interface{}{
|
SetBody(map[string]interface{}{
|
||||||
"content": content,
|
"content": content,
|
||||||
"overwrite": true,
|
"overwrite": true,
|
||||||
}).
|
}).
|
||||||
Post(fmt.Sprintf("/api/sites/%s", name))
|
Post(fmt.Sprintf("/api/sites/%s", name))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
notification.Error("Save Remote Site Error", err.Error())
|
notification.Error("Save Remote Site Error", err.Error())
|
||||||
|
@ -94,6 +94,12 @@ func syncSave(name string, content string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
notification.Success("Save Remote Site Success", NewSyncResult(node.Name, name, resp).String())
|
notification.Success("Save Remote Site Success", NewSyncResult(node.Name, name, resp).String())
|
||||||
|
|
||||||
|
// Check if the site is enabled, if so then enable it on the remote node
|
||||||
|
enabledConfigFilePath := nginx.GetConfPath("sites-enabled", name)
|
||||||
|
if helper.FileExists(enabledConfigFilePath) {
|
||||||
|
syncEnable(name)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue