Skip to content

Commit

Permalink
feat:db BACKUP_ENABLED
Browse files Browse the repository at this point in the history
Signed-off-by: jingyang <3161362058@qq.com>
  • Loading branch information
zjy365 committed Dec 21, 2023
1 parent 077ecc5 commit b602635
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
1 change: 1 addition & 0 deletions frontend/providers/dbprovider/deploy/Kubefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ ENV minioSecretKey=""
ENV minioPort=""
ENV migrateFileImage=""
ENV minioBucketName=""
ENV BACKUP_ENABLED="false"

CMD ["kubectl apply -f manifests"]
6 changes: 3 additions & 3 deletions frontend/providers/dbprovider/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
"Migrate": "Migrate",
"Advanced Configuration": "Advanced Configuration",
"Option": "Option",
"Internet Migration": "Internet Migration",
"File Migration": "File Migration",
"Online Import": "Online Import",
"Import Through File": "Import Through File",
"Source Database": "Source Database",
"Database Host": "Database Host",
"DB Name": "DataBase Name",
Expand Down Expand Up @@ -259,4 +259,4 @@
"Failed to turn off automatic backup": "Failed to turn off automatic backup",
"Automatic backup is turned off": "Automatic backup is turned off",
"Are you sure you want to turn off automatic backup": "Are you sure you want to turn off automatic backup?"
}
}
6 changes: 3 additions & 3 deletions frontend/providers/dbprovider/public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
"Migrate": "迁移",
"Advanced Configuration": "高级配置",
"Option": "选填",
"Internet Migration": "公网迁移",
"File Migration": "文件迁移",
"Online Import": "在线导入",
"Import Through File": "文件导入",
"Source Database": "源数据库",
"Database Host": "数据库 Host",
"DB Name": "数据库名字",
Expand Down Expand Up @@ -261,4 +261,4 @@
"Failed to turn off automatic backup": "关闭自动备份失败",
"Automatic backup is turned off": "已关闭自动备份",
"Are you sure you want to turn off automatic backup": "确定关闭自动备份吗"
}
}
4 changes: 3 additions & 1 deletion frontend/providers/dbprovider/src/pages/api/getEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type SystemEnvResponse = {
env_storage_className: string;
migrate_file_image: string;
minio_url: string;
BACKUP_ENABLED: boolean;
};

export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
Expand All @@ -15,7 +16,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
domain: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
env_storage_className: process.env.STORAGE_CLASSNAME || 'openebs-backup',
migrate_file_image: process.env.MIGRATE_FILE_IMAGE || 'ghcr.io/wallyxjh/test:7.1',
minio_url: process.env.MINIO_URL || ''
minio_url: process.env.MINIO_URL || '',
BACKUP_ENABLED: process.env.BACKUP_ENABLED === 'true'
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ const ChartTemplate = ({
</Flex>
</Flex>
) : (
<Flex
justifyContent={'center'}
alignItems={'center'}
flexDirection={'column'}
w="100%"
h="100%"
>
<MyIcon name={'noEvents'} color={'transparent'} width={'36px'} height={'36px'} />
<Box pt={'8px'}>{t('No Data Available')}</Box>
<Flex flexDirection={'column'} h="100%">
<Box fontSize={'12px'} fontWeight={500} color={'#24282C'}>
{t(chartTitle)}
{unit ? `(${unit})` : ''}
</Box>
<Flex justifyContent={'center'} alignItems={'center'} flexDirection={'column'} flex={1}>
<MyIcon name={'noEvents'} color={'transparent'} width={'36px'} height={'36px'} />
<Box pt={'8px'}>{t('No Data Available')}</Box>
</Flex>
</Flex>
)}
</Box>
Expand Down
12 changes: 6 additions & 6 deletions frontend/providers/dbprovider/src/pages/db/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ const AppDetail = ({
const { listNav } = useMemo(() => {
const PublicNetMigration = ['postgresql', 'apecloud-mysql', 'mongodb'].includes(dbType);
const MigrateSupported = ['postgresql', 'mongodb', 'apecloud-mysql'].includes(dbType);
const BackupSupported = ['postgresql', 'mongodb', 'apecloud-mysql', 'redis'].includes(dbType);
const BackupSupported =
['postgresql', 'mongodb', 'apecloud-mysql', 'redis'].includes(dbType) &&
SystemEnv.BACKUP_ENABLED;

const listNavValue = [
{ label: 'Monitor List', value: TabEnum.monitor },
{ label: 'Replicas List', value: TabEnum.pod },
...(BackupSupported ? [{ label: 'Backup List', value: TabEnum.backup }] : []),
...(PublicNetMigration
? [{ label: 'Internet Migration', value: TabEnum.InternetMigration }]
: []),
...(PublicNetMigration ? [{ label: 'Online Import', value: TabEnum.InternetMigration }] : []),
...(PublicNetMigration && !!SystemEnv.minio_url
? [{ label: 'File Migration', value: TabEnum.DumpImport }]
? [{ label: 'Import Through File', value: TabEnum.DumpImport }]
: [])
];

Expand All @@ -64,7 +64,7 @@ const AppDetail = ({
isBackupSupported: BackupSupported,
listNav: listNavValue
};
}, [SystemEnv.minio_url, dbType]);
}, [SystemEnv, dbType]);

const theme = useTheme();
const { toast } = useToast();
Expand Down
3 changes: 2 additions & 1 deletion frontend/providers/dbprovider/src/store/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const useEnvStore = create<EnvState>()(
domain: '',
env_storage_className: '',
migrate_file_image: '',
minio_url: ''
minio_url: '',
BACKUP_ENABLED: false
},
initSystemEnv: async () => {
try {
Expand Down

0 comments on commit b602635

Please sign in to comment.