Skip to content

Commit 86e7716

Browse files
committed
fix: 解决计划任务列表不显示备份账号的问题
1 parent 31e0daf commit 86e7716

File tree

7 files changed

+37
-47
lines changed

7 files changed

+37
-47
lines changed

core/app/dto/setting.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type SettingUpdate struct {
5252
type SSLUpdate struct {
5353
SSLType string `json:"sslType" validate:"required,oneof=self select import import-paste import-local"`
5454
Domain string `json:"domain"`
55-
SSL string `json:"ssl" validate:"required,oneof=enable disable"`
55+
SSL string `json:"ssl" validate:"required,oneof=Enable Disable"`
5656
Cert string `json:"cert"`
5757
Key string `json:"key"`
5858
SSLID uint `json:"sslID"`
@@ -143,7 +143,7 @@ type SyncTime struct {
143143
}
144144

145145
type BindInfo struct {
146-
Ipv6 string `json:"ipv6" validate:"required,oneof=enable disable"`
146+
Ipv6 string `json:"ipv6" validate:"required,oneof=Enable Disable"`
147147
BindAddress string `json:"bindAddress" validate:"required"`
148148
}
149149

core/middleware/operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func newDB(pathItem string) (*gorm.DB, error) {
211211
case strings.HasPrefix(pathItem, "/core"):
212212
dbFile = path.Join(global.CONF.System.BaseDir, "1panel/db/core.db")
213213
case strings.HasPrefix(pathItem, "/xpack"):
214-
dbFile = path.Join(global.CONF.System.BaseDir, "1panel/db/xpack/xpack.db")
214+
dbFile = path.Join(global.CONF.System.BaseDir, "1panel/db/xpack.db")
215215
default:
216216
dbFile = path.Join(global.CONF.System.BaseDir, "1panel/db/agent.db")
217217
}

frontend/src/api/interface/cronjob.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ export namespace Cronjob {
2929
files: Array<Item>;
3030
sourceDir: string;
3131

32-
sourceAccountIDs: string;
33-
downloadAccountID: number;
34-
sourceAccounts: Array<number>;
32+
sourceAccounts: Array<string>;
33+
downloadAccount: string;
3534
retainCopies: number;
3635
status: string;
3736
secret: string;

frontend/src/api/interface/setting.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ export namespace Setting {
146146
export interface SnapshotInfo {
147147
id: number;
148148
name: string;
149-
from: string;
150-
defaultDownload: string;
149+
sourceAccounts: Array<string>;
150+
downloadAccount: string;
151151
description: string;
152152
status: string;
153153
message: string;

frontend/src/layout/components/Sidebar/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const loadNodes = async () => {
170170
nodes.value = [];
171171
return;
172172
}
173-
nodes.value = res.data;
173+
nodes.value = res.data || [];
174174
if (nodes.value.length === 0) {
175175
globalStore.currentNode = 'local';
176176
}

frontend/src/views/cronjob/index.vue

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,33 +99,34 @@
9999
{{ row.lastRecordTime }}
100100
</template>
101101
</el-table-column>
102-
<el-table-column :min-width="80" :label="$t('setting.backupAccount')" prop="defaultDownload">
102+
<el-table-column :min-width="80" :label="$t('setting.backupAccount')">
103103
<template #default="{ row }">
104104
<span v-if="!hasBackup(row.type)">-</span>
105105
<div v-else>
106-
<div v-for="(item, index) of row.backupAccounts?.split(',')" :key="index">
106+
<div v-for="(item, index) of row.sourceAccounts" :key="index">
107107
<div v-if="row.accountExpand || (!row.accountExpand && index < 3)">
108-
<span v-if="row.backupAccounts">
109-
<span>
110-
{{ $t('setting.' + item) }}
108+
<div v-if="row.expand || (!row.expand && index < 3)">
109+
<span type="info">
110+
<span>
111+
{{ loadName(item) }}
112+
</span>
113+
<el-icon
114+
v-if="item === row.downloadAccount"
115+
size="12"
116+
class="relative top-px left-1"
117+
>
118+
<Star />
119+
</el-icon>
111120
</span>
112-
<el-icon
113-
size="12"
114-
v-if="item === row.defaultDownload"
115-
class="relative top-px left-1"
116-
>
117-
<Star />
118-
</el-icon>
119-
</span>
120-
<span v-else>-</span>
121+
</div>
121122
</div>
122123
</div>
123-
<div v-if="!row.accountExpand && row.backupAccounts?.split(',').length > 3">
124+
<div v-if="!row.accountExpand && row.sourceAccounts?.length > 3">
124125
<el-button type="primary" link @click="row.accountExpand = true">
125126
{{ $t('commons.button.expand') }}...
126127
</el-button>
127128
</div>
128-
<div v-if="row.accountExpand && row.backupAccounts?.split(',').length > 3">
129+
<div v-if="row.accountExpand && row.sourceAccounts?.length > 3">
129130
<el-button type="primary" link @click="row.accountExpand = false">
130131
{{ $t('commons.button.collapse') }}
131132
</el-button>
@@ -209,18 +210,6 @@ const search = async (column?: any) => {
209210
.then((res) => {
210211
loading.value = false;
211212
data.value = res.data.items || [];
212-
for (const item of data.value) {
213-
let itemAccounts = item.backupAccounts.split(',') || [];
214-
let accounts = [];
215-
for (const account of itemAccounts) {
216-
if (account == item.defaultDownload) {
217-
accounts.unshift(account);
218-
} else {
219-
accounts.push(account);
220-
}
221-
}
222-
item.itemAccounts = accounts.join(',');
223-
}
224213
paginationConfig.total = res.data.total;
225214
})
226215
.catch(() => {
@@ -364,6 +353,11 @@ const loadDetail = (row: any) => {
364353
dialogRecordRef.value!.acceptParams(params);
365354
};
366355
356+
const loadName = (from: any) => {
357+
let items = from.split(' - ');
358+
return i18n.global.t('setting.' + items[0]) + ' ' + items[1];
359+
};
360+
367361
const buttons = [
368362
{
369363
label: i18n.global.t('commons.button.handle'),

frontend/src/views/setting/snapshot/index.vue

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,29 @@
4141
<el-table-column prop="version" :label="$t('app.version')" />
4242
<el-table-column :label="$t('setting.backupAccount')" min-width="80" prop="from">
4343
<template #default="{ row }">
44-
<div v-if="row.hasLoad">
45-
<div v-for="(item, index) of row.from.split(',')" :key="index" class="mt-1">
44+
<div>
45+
<div v-for="(item, index) of row.sourceAccounts" :key="index" class="mt-1">
4646
<div v-if="row.expand || (!row.expand && index < 3)">
47-
<span v-if="row.from" type="info">
47+
<span type="info">
4848
<span>
4949
{{ loadName(item) }}
5050
</span>
5151
<el-icon
52-
v-if="item === row.defaultDownload"
52+
v-if="item === row.downloadAccount"
5353
size="12"
5454
class="relative top-px left-1"
5555
>
5656
<Star />
5757
</el-icon>
5858
</span>
59-
<span v-else>-</span>
6059
</div>
6160
</div>
62-
<div v-if="!row.expand && row.from.split(',').length > 3">
61+
<div v-if="!row.expand && row.sourceAccounts.length > 3">
6362
<el-button type="primary" link @click="row.expand = true">
6463
{{ $t('commons.button.expand') }}...
6564
</el-button>
6665
</div>
67-
<div v-if="row.expand && row.from.split(',').length > 3">
66+
<div v-if="row.expand && row.sourceAccounts.length > 3">
6867
<el-button type="primary" link @click="row.expand = false">
6968
{{ $t('commons.button.collapse') }}
7069
</el-button>
@@ -296,7 +295,7 @@ const onChange = async (info: any) => {
296295
};
297296
298297
const onRecover = async (row: any) => {
299-
if (row.defaultDownload.indexOf('ALIYUN') !== -1 && row.size > 100 * 1024 * 1024) {
298+
if (row.downloadAccount.indexOf('ALIYUN') !== -1 && row.size > 100 * 1024 * 1024) {
300299
MsgError(i18n.global.t('setting.ALIYUNRecover'));
301300
return;
302301
}
@@ -422,8 +421,6 @@ const loadSize = async () => {
422421
for (const item of stats) {
423422
if (snap.id === item.id) {
424423
snap.hasLoad = true;
425-
snap.from = item.from;
426-
snap.defaultDownload = item.defaultDownload;
427424
snap.size = item.size;
428425
break;
429426
}

0 commit comments

Comments
 (0)