1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

feat: 下载离线包改为从OSS下载

This commit is contained in:
zhengkunwang223 2023-02-17 15:13:55 +08:00 committed by ssongliu
parent 974dc56a16
commit 795e64151a
19 changed files with 75 additions and 84 deletions

View File

@ -745,10 +745,12 @@ export default {
thirdParty: 'Third-party account', thirdParty: 'Third-party account',
createBackupAccount: 'Create {0} backup account', createBackupAccount: 'Create {0} backup account',
noTypeForCreate: 'No backup type is currently created', noTypeForCreate: 'No backup type is currently created',
serverDisk: 'Server disks', LOCAL: 'Server disks',
currentPath: 'Current path', currentPath: 'Current path',
OSS: 'Ali OSS', OSS: 'Ali OSS',
S3: 'Amazon S3', S3: 'Amazon S3',
MINIO: 'MINIO',
SFTP: 'SFTP',
backupAccount: 'Backup account', backupAccount: 'Backup account',
loadBucket: 'Get bucket', loadBucket: 'Get bucket',
accountName: 'Account name', accountName: 'Account name',
@ -759,7 +761,7 @@ export default {
password: 'Password', password: 'Password',
path: 'Path', path: 'Path',
safe: 'Safe', safe: 'Security',
safeEntrance: 'Security entrance', safeEntrance: 'Security entrance',
safeEntranceHelper: safeEntranceHelper:
'Panel management portal. You can log in to the panel only through a specified security portal, for example: onepanel', 'Panel management portal. You can log in to the panel only through a specified security portal, for example: onepanel',

View File

@ -751,10 +751,12 @@ export default {
thirdParty: '第三方账号', thirdParty: '第三方账号',
createBackupAccount: '添加 {0} 备份账号', createBackupAccount: '添加 {0} 备份账号',
noTypeForCreate: '当前无可创建备份类型', noTypeForCreate: '当前无可创建备份类型',
serverDisk: '服务器磁盘', LOCAL: '服务器磁盘',
currentPath: '当前路径', currentPath: '当前路径',
OSS: '阿里云 OSS', OSS: '阿里云 OSS',
S3: '亚马逊 S3 云存储', S3: '亚马逊 S3 云存储',
MINIO: 'MINIO',
SFTP: 'SFTP',
backupAccount: '备份账号', backupAccount: '备份账号',
loadBucket: '获取桶', loadBucket: '获取桶',
accountName: '账户名称', accountName: '账户名称',
@ -816,7 +818,7 @@ export default {
monitor: '监控', monitor: '监控',
enableMonitor: '监控状态', enableMonitor: '监控状态',
storeDays: '过期时间 ()', storeDays: 'Retention days (days)',
cleanMonitor: '清空监控记录', cleanMonitor: '清空监控记录',
message: '通知', message: '通知',

View File

@ -12,7 +12,7 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('container.from')"> <el-form-item :label="$t('container.from')">
<el-radio-group v-model="form.from"> <el-radio-group v-model="form.from">
<el-radio label="edit">{{ $t('container.edit') }}</el-radio> <el-radio label="edit">{{ $t('commons.button.edit') }}</el-radio>
<el-radio label="path">{{ $t('container.pathSelect') }}</el-radio> <el-radio label="path">{{ $t('container.pathSelect') }}</el-radio>
<el-radio label="template">{{ $t('container.composeTemplate') }}</el-radio> <el-radio label="template">{{ $t('container.composeTemplate') }}</el-radio>
</el-radio-group> </el-radio-group>

View File

@ -3,35 +3,31 @@
<div class="app-content" style="margin-top: 20px"> <div class="app-content" style="margin-top: 20px">
<el-card class="app-card"> <el-card class="app-card">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :lg="3" :xl="2"> <div>
<div> <el-tag effect="dark" type="success">{{ composeName }}</el-tag>
<el-tag effect="dark" type="success">{{ composeName }}</el-tag> </div>
</div> <div v-if="createdBy === '1Panel'">
</el-col> <el-button link type="primary" @click="onComposeOperate('start')">
<el-col :lg="8" :xl="12"> {{ $t('container.start') }}
<div v-if="createdBy === '1Panel'"> </el-button>
<el-button link type="primary" @click="onComposeOperate('start')"> <el-divider direction="vertical" />
{{ $t('container.start') }} <el-button link type="primary" @click="onComposeOperate('stop')">
</el-button> {{ $t('container.stop') }}
<el-divider direction="vertical" /> </el-button>
<el-button link type="primary" @click="onComposeOperate('stop')"> <el-divider direction="vertical" />
{{ $t('container.stop') }} <el-button link type="primary" @click="onComposeOperate('down')">
</el-button> {{ $t('container.remove') }}
<el-divider direction="vertical" /> </el-button>
<el-button link type="primary" @click="onComposeOperate('down')"> </div>
{{ $t('container.remove') }} <div v-else>
</el-button> <el-alert
</div> style="margin-top: -5px; margin-left: 50px"
<div v-else> :closable="false"
<el-alert show-icon
style="margin-top: -5px" :title="$t('container.composeDetailHelper')"
:closable="false" type="info"
show-icon />
:title="$t('container.composeDetailHelper')" </div>
type="info"
/>
</div>
</el-col>
</el-row> </el-row>
</el-card> </el-card>
</div> </div>

View File

@ -195,6 +195,9 @@ const buttons = [
click: (row: Container.ComposeInfo) => { click: (row: Container.ComposeInfo) => {
onEdit(row); onEdit(row);
}, },
disabled: (row: any) => {
return row.createdBy !== '1Panel';
},
}, },
{ {
label: i18n.global.t('commons.button.delete'), label: i18n.global.t('commons.button.delete'),

View File

@ -4,7 +4,7 @@
<DrawerHeader :header="$t('commons.button.log')" :back="handleClose" /> <DrawerHeader :header="$t('commons.button.log')" :back="handleClose" />
</template> </template>
<div> <div>
<el-select @change="searchLogs" style="width: 10%; float: left" v-model="logSearch.mode"> <el-select @change="searchLogs" style="width: 30%; float: left" v-model="logSearch.mode">
<el-option v-for="item in timeOptions" :key="item.label" :value="item.value" :label="item.label" /> <el-option v-for="item in timeOptions" :key="item.label" :value="item.value" :label="item.label" />
</el-select> </el-select>
<div style="margin-left: 20px; float: left"> <div style="margin-left: 20px; float: left">

View File

@ -104,7 +104,7 @@
</el-table-column> </el-table-column>
<el-table-column :min-width="80" :label="$t('cronjob.target')" prop="targetDir"> <el-table-column :min-width="80" :label="$t('cronjob.target')" prop="targetDir">
<template #default="{ row }"> <template #default="{ row }">
{{ loadBackupName(row.targetDir) }} {{ row.targetDir }}
</template> </template>
</el-table-column> </el-table-column>
<fu-table-operations <fu-table-operations
@ -133,7 +133,6 @@ import { loadZero } from '@/utils/util';
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import RouterButton from '@/components/router-button/index.vue'; import RouterButton from '@/components/router-button/index.vue';
import { deleteCronjob, getCronjobPage, handleOnce, updateStatus } from '@/api/modules/cronjob'; import { deleteCronjob, getCronjobPage, handleOnce, updateStatus } from '@/api/modules/cronjob';
import { loadBackupName } from '@/views/setting/helper';
import i18n from '@/lang'; import i18n from '@/lang';
import { Cronjob } from '@/api/interface/cronjob'; import { Cronjob } from '@/api/interface/cronjob';
import { useDeleteData } from '@/hooks/use-delete-data'; import { useDeleteData } from '@/hooks/use-delete-data';
@ -175,7 +174,7 @@ const search = async () => {
data.value = res.data.items || []; data.value = res.data.items || [];
for (const item of data.value) { for (const item of data.value) {
if (item.targetDir !== '-') { if (item.targetDir !== '-') {
item.targetDir = loadBackupName(item.targetDir); item.targetDir = i18n.global.t('setting.' + item.targetDir);
} }
} }
paginationConfig.total = res.data.total; paginationConfig.total = res.data.total;

View File

@ -160,7 +160,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { Rules } from '@/global/form-rules'; import { Rules } from '@/global/form-rules';
import { loadBackupName } from '@/views/setting/helper';
import FileList from '@/components/file-list/index.vue'; import FileList from '@/components/file-list/index.vue';
import { getBackupList } from '@/api/modules/setting'; import { getBackupList } from '@/api/modules/setting';
import i18n from '@/lang'; import i18n from '@/lang';
@ -324,7 +323,7 @@ const loadBackups = async () => {
dialogData.value.rowData!.targetDirID = item.id; dialogData.value.rowData!.targetDirID = item.id;
} }
} }
backupOptions.value.push({ label: loadBackupName(item.type), value: item.id }); backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.id });
} }
}; };

View File

@ -162,7 +162,7 @@
</el-col> </el-col>
<el-col :span="8" v-if="isBackup()"> <el-col :span="8" v-if="isBackup()">
<el-form-item :label="$t('cronjob.target')"> <el-form-item :label="$t('cronjob.target')">
{{ loadBackupName(dialogData.rowData!.targetDir) }} {{ dialogData.rowData!.targetDir }}
<el-button <el-button
v-if="currentRecord?.status! !== 'Failed'" v-if="currentRecord?.status! !== 'Failed'"
type="primary" type="primary"
@ -273,7 +273,6 @@
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { Cronjob } from '@/api/interface/cronjob'; import { Cronjob } from '@/api/interface/cronjob';
import { loadZero } from '@/utils/util'; import { loadZero } from '@/utils/util';
import { loadBackupName } from '@/views/setting/helper';
import { searchRecords, download, handleOnce, updateStatus } from '@/api/modules/cronjob'; import { searchRecords, download, handleOnce, updateStatus } from '@/api/modules/cronjob';
import { dateFormat, dateFormatForName } from '@/utils/util'; import { dateFormat, dateFormatForName } from '@/utils/util';
import i18n from '@/lang'; import i18n from '@/lang';

View File

@ -75,9 +75,9 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<Status v-if="activeName === 'status'" ref="statusRef" /> <Status v-show="activeName === 'status'" ref="statusRef" />
<Variables v-if="activeName === 'tuning'" ref="variablesRef" /> <Variables v-show="activeName === 'tuning'" ref="variablesRef" />
<div v-if="activeName === 'port'"> <div v-show="activeName === 'port'">
<el-form :model="baseInfo" ref="panelFormRef" label-width="120px"> <el-form :model="baseInfo" ref="panelFormRef" label-width="120px">
<el-row> <el-row>
<el-col :span="1"><br /></el-col> <el-col :span="1"><br /></el-col>
@ -95,8 +95,8 @@
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<ContainerLog v-if="activeName === 'log'" ref="dialogContainerLogRef" /> <ContainerLog v-show="activeName === 'log'" ref="dialogContainerLogRef" />
<SlowLog v-if="activeName === 'slowLog'" ref="slowLogRef" /> <SlowLog v-show="activeName === 'slowLog'" ref="slowLogRef" />
</template> </template>
</LayoutContent> </LayoutContent>

View File

@ -1,14 +1,16 @@
<template> <template>
<el-dialog v-model="dialogVisiable" :destroy-on-close="true" :close-on-click-modal="false" width="30%"> <el-drawer v-model="dialogVisiable" :destroy-on-close="true" :close-on-click-modal="false" size="30%">
<template #header> <template #header>
<div class="card-header"> <DrawerHeader :header="$t('database.requirepass')" :back="handleClose" />
<span>{{ $t('database.requirepass') }}</span>
</div>
</template> </template>
<el-form v-loading="loading" ref="formRef" :model="form" label-width="80px"> <el-form v-loading="loading" ref="formRef" :model="form" label-width="80px">
<el-form-item :label="$t('database.requirepass')" :rules="Rules.requiredInput" prop="password"> <el-row type="flex" justify="center">
<el-input type="password" show-password clearable v-model="form.password" /> <el-col :span="22">
</el-form-item> <el-form-item :label="$t('database.requirepass')" :rules="Rules.requiredInput" prop="password">
<el-input type="password" show-password clearable v-model="form.password" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<ConfirmDialog ref="confirmDialogRef" @confirm="onSubmit"></ConfirmDialog> <ConfirmDialog ref="confirmDialogRef" @confirm="onSubmit"></ConfirmDialog>
@ -23,7 +25,7 @@
</el-button> </el-button>
</span> </span>
</template> </template>
</el-dialog> </el-drawer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -35,6 +37,7 @@ import { changeRedisPassword } from '@/api/modules/database';
import ConfirmDialog from '@/components/confirm-dialog/index.vue'; import ConfirmDialog from '@/components/confirm-dialog/index.vue';
import { GetAppPassword } from '@/api/modules/app'; import { GetAppPassword } from '@/api/modules/app';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import DrawerHeader from '@/components/drawer-header/index.vue';
const loading = ref(false); const loading = ref(false);
@ -55,6 +58,9 @@ const acceptParams = (): void => {
loadPassword(); loadPassword();
dialogVisiable.value = true; dialogVisiable.value = true;
}; };
const handleClose = () => {
dialogVisiable.value = false;
};
const loadPassword = async () => { const loadPassword = async () => {
const res = await GetAppPassword('redis'); const res = await GetAppPassword('redis');

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-show="settingShow"> <div v-show="settingShow">
<LayoutContent :title="'Redis' + $t('database.setting')" :reload="true"> <LayoutContent :title="'Redis ' + $t('database.setting')" :reload="true">
<template #buttons> <template #buttons>
<el-button type="primary" :plain="activeName !== 'conf'" @click="changeTab('conf')"> <el-button type="primary" :plain="activeName !== 'conf'" @click="changeTab('conf')">
{{ $t('database.confChange') }} {{ $t('database.confChange') }}

View File

@ -5,7 +5,7 @@
:destroy-on-close="true" :destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleClose" :before-close="handleClose"
size="30%" size="40%"
> >
<template #header> <template #header>
<DrawerHeader :header="$t('file.download')" :back="handleClose" /> <DrawerHeader :header="$t('file.download')" :back="handleClose" />

View File

@ -4,7 +4,7 @@
:destroy-on-close="true" :destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleClose" :before-close="handleClose"
size="30%" size="40%"
> >
<template #header> <template #header>
<DrawerHeader :header="title" :back="handleClose" /> <DrawerHeader :header="title" :back="handleClose" />

View File

@ -9,7 +9,7 @@
<template #header> <template #header>
<svg-icon style="font-size: 7px" iconName="p-file-folder"></svg-icon> <svg-icon style="font-size: 7px" iconName="p-file-folder"></svg-icon>
<span style="font-size: 16px; font-weight: 500"> <span style="font-size: 16px; font-weight: 500">
&nbsp;{{ $t('setting.serverDisk') }} &nbsp;{{ $t('setting.LOCAL') }}
</span> </span>
<div style="float: right"> <div style="float: right">
<el-button round @click="onOpenDialog('edit', 'local', localData)"> <el-button round @click="onOpenDialog('edit', 'local', localData)">
@ -86,7 +86,7 @@
<el-card style="height: 265px"> <el-card style="height: 265px">
<template #header> <template #header>
<svg-icon style="font-size: 7px" iconName="p-oss"></svg-icon> <svg-icon style="font-size: 7px" iconName="p-oss"></svg-icon>
<span style="font-size: 16px; font-weight: 500">&nbsp;OSS</span> <span style="font-size: 16px; font-weight: 500">&nbsp;{{ $t('setting.OSS') }}</span>
<div style="float: right"> <div style="float: right">
<el-button round :disabled="ossData.id === 0" @click="onBatchDelete(ossData)"> <el-button round :disabled="ossData.id === 0" @click="onBatchDelete(ossData)">
{{ $t('commons.button.delete') }} {{ $t('commons.button.delete') }}
@ -135,7 +135,7 @@
<el-card style="height: 265px"> <el-card style="height: 265px">
<template #header> <template #header>
<svg-icon style="font-size: 7px" iconName="p-minio"></svg-icon> <svg-icon style="font-size: 7px" iconName="p-minio"></svg-icon>
<span style="font-size: 16px; font-weight: 500">&nbsp;MIMIO</span> <span style="font-size: 16px; font-weight: 500">&nbsp;MINIO</span>
<div style="float: right"> <div style="float: right">
<el-button :disabled="minioData.id === 0" round @click="onBatchDelete(minioData)"> <el-button :disabled="minioData.id === 0" round @click="onBatchDelete(minioData)">
{{ $t('commons.button.delete') }} {{ $t('commons.button.delete') }}

View File

@ -7,7 +7,7 @@
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="22"> <el-col :span="22">
<el-form-item :label="$t('commons.table.type')" prop="type" :rules="Rules.requiredSelect"> <el-form-item :label="$t('commons.table.type')" prop="type" :rules="Rules.requiredSelect">
<el-tag>{{ dialogData.rowData!.type }}</el-tag> <el-tag>{{ $t('setting.' + dialogData.rowData!.type) }}</el-tag>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="dialogData.rowData!.type === 'LOCAL'" v-if="dialogData.rowData!.type === 'LOCAL'"

View File

@ -1,17 +0,0 @@
import i18n from '@/lang';
export const loadBackupName = (type: string) => {
switch (type) {
case 'OSS':
return i18n.global.t('setting.OSS');
break;
case 'S3':
return i18n.global.t('setting.S3');
break;
case 'LOCAL':
return i18n.global.t('setting.serverDisk');
break;
default:
return type;
}
};

View File

@ -49,7 +49,6 @@ import i18n from '@/lang';
import DrawerHeader from '@/components/drawer-header/index.vue'; import DrawerHeader from '@/components/drawer-header/index.vue';
import { snapshotImport } from '@/api/modules/setting'; import { snapshotImport } from '@/api/modules/setting';
import { getBackupList, getFilesFromBackup } from '@/api/modules/setting'; import { getBackupList, getFilesFromBackup } from '@/api/modules/setting';
import { loadBackupName } from '../../helper';
import { Rules } from '@/global/form-rules'; import { Rules } from '@/global/form-rules';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
@ -106,7 +105,7 @@ const loadBackups = async () => {
backupOptions.value = []; backupOptions.value = [];
for (const item of res.data) { for (const item of res.data) {
if (item.type !== 'LOCAL' && item.id !== 0) { if (item.type !== 'LOCAL' && item.id !== 0) {
backupOptions.value.push({ label: loadBackupName(item.type), value: item.type }); backupOptions.value.push({ label: i18n.global.t('setting' + item.type), value: item.type });
} }
} }
}; };

View File

@ -47,7 +47,11 @@
fix fix
/> />
<el-table-column prop="version" :label="$t('app.version')" /> <el-table-column prop="version" :label="$t('app.version')" />
<el-table-column :label="$t('setting.backupAccount')" min-width="80" prop="from" /> <el-table-column :label="$t('setting.backupAccount')" min-width="80" prop="from">
<template #default="{ row }">
{{ $t('setting.' + row.from) }}
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.status')" min-width="80" prop="status"> <el-table-column :label="$t('commons.table.status')" min-width="80" prop="status">
<template #default="{ row }"> <template #default="{ row }">
<el-tag v-if="row.status === 'Success'" type="success"> <el-tag v-if="row.status === 'Success'" type="success">
@ -158,7 +162,6 @@ import LayoutContent from '@/layout/layout-content.vue';
import RecoverStatus from '@/views/setting/snapshot/status/index.vue'; import RecoverStatus from '@/views/setting/snapshot/status/index.vue';
import SnapshotImport from '@/views/setting/snapshot/import/index.vue'; import SnapshotImport from '@/views/setting/snapshot/import/index.vue';
import { getBackupList } from '@/api/modules/setting'; import { getBackupList } from '@/api/modules/setting';
import { loadBackupName } from '../helper';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
const loading = ref(false); const loading = ref(false);
@ -231,7 +234,7 @@ const loadBackups = async () => {
backupOptions.value = []; backupOptions.value = [];
for (const item of res.data) { for (const item of res.data) {
if (item.type !== 'LOCAL' && item.id !== 0) { if (item.type !== 'LOCAL' && item.id !== 0) {
backupOptions.value.push({ label: loadBackupName(item.type), value: item.type }); backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type });
} }
} }
}; };