Skip to content

Commit

Permalink
fix:deploy menuData helpDocs (#4437)
Browse files Browse the repository at this point in the history
* fix:deploy menuData helpDocs

Signed-off-by: jingyang <3161362058@qq.com>

* feat:db BACKUP_ENABLED

Signed-off-by: jingyang <3161362058@qq.com>

---------

Signed-off-by: jingyang <3161362058@qq.com>
  • Loading branch information
zjy365 committed Dec 21, 2023
1 parent 937d829 commit 18aff5d
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 31 deletions.
Expand Up @@ -9,7 +9,6 @@ spec:
url: "https://adminer.{{ .cloudDomain }}"
icon: "https://adminer.{{ .cloudDomain }}/logo.svg"
menuData:
helpDocs: https://www.sealos.io/docs/cloud/apps/adminer/
helpDropDown: false
nameColor: text-black
name: Adminer
Expand Down
Expand Up @@ -14,7 +14,6 @@ spec:
zh-Hans:
name: 费用中心
menuData:
helpDocs: https://www.sealos.io/docs/cloud/apps/costcenter/
helpDropDown: false
nameColor: text-black
name: Cost Center
Expand Down
1 change: 1 addition & 0 deletions frontend/providers/dbprovider/deploy/Kubefile
Expand Up @@ -15,5 +15,6 @@ ENV minioSecretKey=""
ENV minioPort=""
ENV migrateFileImage=""
ENV minioBucketName=""
ENV BACKUP_ENABLED="false"

CMD ["kubectl apply -f manifests"]
Expand Up @@ -14,6 +14,7 @@ spec:
zh-Hans:
name: 数据库
menuData:
helpDocs: https://sealos.run/docs/guides/dbprovider/config-docs/
helpDropDown: false
nameColor: text-black
name: Database
Expand Down
6 changes: 3 additions & 3 deletions frontend/providers/dbprovider/public/locales/en/common.json
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
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
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'
}
});
}
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
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
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
Expand Up @@ -7,10 +7,6 @@ import type { NextApiRequest, NextApiResponse } from 'next';

export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
try {
const { namespace } = await getK8s({
kubeconfig: await authSession(req)
});

const defaultKc = K8sApiDefault();

const result = await defaultKc.makeApiClient(k8s.CoreV1Api).readNamespace('kube-system');
Expand Down
Expand Up @@ -14,7 +14,6 @@ spec:
zh-Hans:
name: 对象存储
menuData:
helpDocs: https://www.sealos.io/docs/cloud/apps/objectstorage/
helpDropDown: false
nameColor: text-black
name: Object Storage
Expand Down
Expand Up @@ -14,7 +14,6 @@ spec:
zh-Hans:
name: 终端
menuData:
helpDocs: https://www.sealos.io/docs/cloud/apps/terminal/
helpDropDown: false
nameColor: text-black
name: Terminal
Expand Down

0 comments on commit 18aff5d

Please sign in to comment.