Skip to content

Commit

Permalink
fix: sync config is not enabled #820
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Jan 23, 2025
1 parent a48f714 commit 6957e4f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
6 changes: 0 additions & 6 deletions app/src/components/StdDesign/StdDataDisplay/StdTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,6 @@ const paginationSize = computed(() => {
>
{{ $gettext('View') }}
</AButton>
<ADivider
v-if="!props.disableModify"
type="vertical"
/>
</template>

<template v-if="!props.disableModify && !inTrash">
Expand All @@ -507,7 +503,6 @@ const paginationSize = computed(() => {
>
{{ $gettext('Modify') }}
</AButton>
<ADivider type="vertical" />
</template>

<slot
Expand Down Expand Up @@ -544,7 +539,6 @@ const paginationSize = computed(() => {
{{ $gettext('Recover') }}
</AButton>
</APopconfirm>
<ADivider type="vertical" />
<APopconfirm
v-if="inTrash"
:cancel-text="$gettext('No')"
Expand Down
1 change: 0 additions & 1 deletion app/src/views/config/ConfigList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ const refRename = useTemplateRef('refRename')
>
{{ $gettext('Modify') }}
</AButton>
<ADivider type="vertical" />
<AButton
type="link"
size="small"
Expand Down
2 changes: 0 additions & 2 deletions app/src/views/site/site_list/SiteList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,13 @@ function handleBatchUpdated() {
>
{{ $gettext('Enable') }}
</AButton>
<ADivider type="vertical" />
<AButton
type="link"
size="small"
@click="handle_click_duplicate(record.name)"
>
{{ $gettext('Duplicate') }}
</AButton>
<ADivider type="vertical" />
<APopconfirm
:cancel-text="$gettext('No')"
:ok-text="$gettext('OK')"
Expand Down
2 changes: 0 additions & 2 deletions app/src/views/stream/StreamList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,13 @@ function handleAddStream() {
>
{{ $gettext('Enable') }}
</AButton>
<ADivider type="vertical" />
<AButton
type="link"
size="small"
@click="handle_click_duplicate(record.name)"
>
{{ $gettext('Duplicate') }}
</AButton>
<ADivider type="vertical" />
<APopconfirm
:cancel-text="$gettext('No')"
:ok-text="$gettext('OK')"
Expand Down
22 changes: 14 additions & 8 deletions internal/site/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func Save(name string, content string, overwrite bool, siteCategoryId uint64, sy
s := query.Site
_, err = s.Where(s.Path.Eq(path)).
Select(s.SiteCategoryID, s.SyncNodeIDs).
Updates(&model.Site{
SiteCategoryID: siteCategoryId,
SyncNodeIDs: syncNodeIds,
})
Updates(&model.Site{
SiteCategoryID: siteCategoryId,
SyncNodeIDs: syncNodeIds,
})
if err != nil {
return
}
Expand Down Expand Up @@ -80,10 +80,10 @@ func syncSave(name string, content string) {
client.SetBaseURL(node.URL)
resp, err := client.R().
SetHeader("X-Node-Secret", node.Token).
SetBody(map[string]interface{}{
"content": content,
"overwrite": true,
}).
SetBody(map[string]interface{}{
"content": content,
"overwrite": true,
}).
Post(fmt.Sprintf("/api/sites/%s", name))
if err != nil {
notification.Error("Save Remote Site Error", err.Error())
Expand All @@ -94,6 +94,12 @@ func syncSave(name string, content string) {
return
}
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)
}
}()
}

Expand Down

0 comments on commit 6957e4f

Please sign in to comment.