Browse Source

fix: sync config is not enabled #820

Jacky 3 months ago
parent
commit
6957e4fb8e

+ 0 - 6
app/src/components/StdDesign/StdDataDisplay/StdTable.vue

@@ -493,10 +493,6 @@ const paginationSize = computed(() => {
             >
               {{ $gettext('View') }}
             </AButton>
-            <ADivider
-              v-if="!props.disableModify"
-              type="vertical"
-            />
           </template>
 
           <template v-if="!props.disableModify && !inTrash">
@@ -507,7 +503,6 @@ const paginationSize = computed(() => {
             >
               {{ $gettext('Modify') }}
             </AButton>
-            <ADivider type="vertical" />
           </template>
 
           <slot
@@ -544,7 +539,6 @@ const paginationSize = computed(() => {
                 {{ $gettext('Recover') }}
               </AButton>
             </APopconfirm>
-            <ADivider type="vertical" />
             <APopconfirm
               v-if="inTrash"
               :cancel-text="$gettext('No')"

+ 0 - 1
app/src/views/config/ConfigList.vue

@@ -157,7 +157,6 @@ const refRename = useTemplateRef('refRename')
         >
           {{ $gettext('Modify') }}
         </AButton>
-        <ADivider type="vertical" />
         <AButton
           type="link"
           size="small"

+ 0 - 2
app/src/views/site/site_list/SiteList.vue

@@ -135,7 +135,6 @@ function handleBatchUpdated() {
         >
           {{ $gettext('Enable') }}
         </AButton>
-        <ADivider type="vertical" />
         <AButton
           type="link"
           size="small"
@@ -143,7 +142,6 @@ function handleBatchUpdated() {
         >
           {{ $gettext('Duplicate') }}
         </AButton>
-        <ADivider type="vertical" />
         <APopconfirm
           :cancel-text="$gettext('No')"
           :ok-text="$gettext('OK')"

+ 0 - 2
app/src/views/stream/StreamList.vue

@@ -151,7 +151,6 @@ function handleAddStream() {
         >
           {{ $gettext('Enable') }}
         </AButton>
-        <ADivider type="vertical" />
         <AButton
           type="link"
           size="small"
@@ -159,7 +158,6 @@ function handleAddStream() {
         >
           {{ $gettext('Duplicate') }}
         </AButton>
-        <ADivider type="vertical" />
         <APopconfirm
           :cancel-text="$gettext('No')"
           :ok-text="$gettext('OK')"

+ 14 - 8
internal/site/save.go

@@ -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
 	}
@@ -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())
@@ -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)
+			}
 		}()
 	}