|
|
|
@ -4,6 +4,7 @@ import {
|
|
|
|
|
Card,
|
|
|
|
|
Message,
|
|
|
|
|
Popconfirm,
|
|
|
|
|
Space,
|
|
|
|
|
useAsyncRequest,
|
|
|
|
|
useTranslation,
|
|
|
|
|
} from 'tushan';
|
|
|
|
@ -14,8 +15,10 @@ import { request } from '../request';
|
|
|
|
|
*/
|
|
|
|
|
export const CacheManager: React.FC = React.memo(() => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const [, cleanCache] = useAsyncRequest(async () => {
|
|
|
|
|
const { data } = await request.post('/cache/clean');
|
|
|
|
|
const [, cleanCache] = useAsyncRequest(async (target?: string) => {
|
|
|
|
|
const { data } = await request.post('/cache/clean', {
|
|
|
|
|
target,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!data.success) {
|
|
|
|
|
Message.error(t('tushan.common.failed') + ':' + data.msg);
|
|
|
|
@ -27,15 +30,25 @@ export const CacheManager: React.FC = React.memo(() => {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Card>
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title={t('custom.cache.cleanTitle')}
|
|
|
|
|
content={t('custom.cache.cleanDesc')}
|
|
|
|
|
onOk={cleanCache}
|
|
|
|
|
>
|
|
|
|
|
<Button type="primary" status="danger">
|
|
|
|
|
{t('custom.cache.cleanBtn')}
|
|
|
|
|
</Button>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
<Space direction="vertical">
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title={t('custom.cache.cleanTitle')}
|
|
|
|
|
content={t('custom.cache.cleanDesc')}
|
|
|
|
|
onOk={() => cleanCache('config.client')}
|
|
|
|
|
>
|
|
|
|
|
<Button type="primary">{t('custom.cache.cleanConfigBtn')}</Button>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title={t('custom.cache.cleanTitle')}
|
|
|
|
|
content={t('custom.cache.cleanDesc')}
|
|
|
|
|
onOk={() => cleanCache()}
|
|
|
|
|
>
|
|
|
|
|
<Button type="primary" status="danger">
|
|
|
|
|
{t('custom.cache.cleanAllBtn')}
|
|
|
|
|
</Button>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
</Space>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|