Explorar o código

fix(auto-backup): curd default value

Jacky hai 2 meses
pai
achega
8ce80c042f

+ 2 - 2
app/src/language/zh_CN/app.po

@@ -2902,7 +2902,7 @@ msgstr "Nginx Conf 中未引用 stream-enabled"
 #: src/views/backup/AutoBackup/AutoBackup.vue:28
 #: src/views/backup/AutoBackup/AutoBackup.vue:42
 msgid "Nginx Config"
-msgstr "Nginx配置"
+msgstr "Nginx 配置"
 
 #: src/constants/errors/backup.ts:19
 msgid "Nginx config directory is not set"
@@ -3044,7 +3044,7 @@ msgstr "Nginx UI 已安装"
 #: src/views/backup/AutoBackup/AutoBackup.vue:29
 #: src/views/backup/AutoBackup/AutoBackup.vue:43
 msgid "Nginx UI Config"
-msgstr "Nginx 界面配置"
+msgstr "Nginx UI 配置"
 
 #: src/components/SystemRestore/SystemRestoreContent.vue:142
 msgid "Nginx UI configuration has been restored"

+ 1 - 1
app/src/language/zh_TW/app.po

@@ -2906,7 +2906,7 @@ msgstr "Nginx 設定檔未包含 stream-enabled"
 #: src/views/backup/AutoBackup/AutoBackup.vue:28
 #: src/views/backup/AutoBackup/AutoBackup.vue:42
 msgid "Nginx Config"
-msgstr "Nginx配置"
+msgstr "Nginx 配置"
 
 #: src/constants/errors/backup.ts:19
 msgid "Nginx config directory is not set"

+ 33 - 2
app/src/views/backup/AutoBackup/AutoBackup.vue

@@ -94,13 +94,16 @@ const columns: StdTableColumn[] = [
   },
   {
     title: () => $gettext('Storage Configuration'),
-    dataIndex: 'storage_config',
+    dataIndex: 'storage_type',
     edit: {
       type: (formData: AutoBackup) => {
+        if (!formData.storage_type) {
+          formData.storage_type = 'local'
+        }
         return (
           <div>
             <div class="font-500 mb-4">{$gettext('Storage Configuration')}</div>
-            <StorageConfigEditor v-model={formData} storageType={formData.storage_type} />
+            <StorageConfigEditor v-model={formData} />
           </div>
         )
       },
@@ -143,6 +146,9 @@ const columns: StdTableColumn[] = [
     },
     edit: {
       type: (formData: AutoBackup) => {
+        if (!formData.cron_expression) {
+          formData.cron_expression = '0 0 * * *'
+        }
         return (
           <CronEditor v-model={formData.cron_expression} />
         )
@@ -237,6 +243,31 @@ const columns: StdTableColumn[] = [
     sorter: true,
     pure: true,
   },
+  {
+    title: () => $gettext('S3 Endpoint'),
+    dataIndex: 's3_endpoint',
+    hiddenInTable: true,
+  },
+  {
+    title: () => $gettext('S3 Access Key ID'),
+    dataIndex: 's3_access_key_id',
+    hiddenInTable: true,
+  },
+  {
+    title: () => $gettext('S3 Secret Access Key'),
+    dataIndex: 's3_secret_access_key',
+    hiddenInTable: true,
+  },
+  {
+    title: () => $gettext('S3 Bucket'),
+    dataIndex: 's3_bucket',
+    hiddenInTable: true,
+  },
+  {
+    title: () => $gettext('S3 Region'),
+    dataIndex: 's3_region',
+    hiddenInTable: true,
+  },
   {
     title: () => $gettext('Actions'),
     dataIndex: 'actions',

+ 1 - 1
app/src/views/backup/AutoBackup/components/CronEditor.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-const modelValue = defineModel<string>({ default: '' })
+const modelValue = defineModel<string>({ default: '0 0 * * *' })
 
 interface CronConfig {
   type: 'daily' | 'weekly' | 'monthly' | 'custom'

+ 3 - 1
app/src/views/backup/AutoBackup/components/StorageConfigEditor.vue

@@ -5,7 +5,9 @@ import { CheckCircleOutlined, LoadingOutlined } from '@ant-design/icons-vue'
 import { message } from 'ant-design-vue'
 import { testS3Connection } from '@/api/backup'
 
-const modelValue = defineModel<AutoBackup>({ default: reactive({}) as AutoBackup })
+const modelValue = defineModel<AutoBackup>({ default: reactive({
+  storage_type: 'local',
+}) as AutoBackup })
 
 const isLocalStorage = computed(() => modelValue.value.storage_type === 'local')
 const isS3Storage = computed(() => modelValue.value.storage_type === 's3')