|
|
@ -1,9 +1,28 @@
|
|
|
|
|
|
|
|
import filesize from 'filesize';
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import { createTextField, ListTable } from 'tushan';
|
|
|
|
import {
|
|
|
|
|
|
|
|
createTextField,
|
|
|
|
|
|
|
|
ListTable,
|
|
|
|
|
|
|
|
useAsync,
|
|
|
|
|
|
|
|
useTranslation,
|
|
|
|
|
|
|
|
Typography,
|
|
|
|
|
|
|
|
} from 'tushan';
|
|
|
|
import { fileFields } from '../fields';
|
|
|
|
import { fileFields } from '../fields';
|
|
|
|
|
|
|
|
import { request } from '../request';
|
|
|
|
|
|
|
|
|
|
|
|
export const FileList: React.FC = React.memo(() => {
|
|
|
|
export const FileList: React.FC = React.memo(() => {
|
|
|
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
const { value: totalSize = 0 } = useAsync(async () => {
|
|
|
|
|
|
|
|
const { data } = await request.get('/file/filesizeSum');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return data.totalSize ?? 0;
|
|
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
|
|
|
|
<>
|
|
|
|
|
|
|
|
<Typography.Paragraph style={{ textAlign: 'right' }}>
|
|
|
|
|
|
|
|
{t('custom.file.fileTotalSize')}: {filesize(totalSize)}
|
|
|
|
|
|
|
|
</Typography.Paragraph>
|
|
|
|
<ListTable
|
|
|
|
<ListTable
|
|
|
|
filter={[
|
|
|
|
filter={[
|
|
|
|
createTextField('q', {
|
|
|
|
createTextField('q', {
|
|
|
@ -13,7 +32,9 @@ export const FileList: React.FC = React.memo(() => {
|
|
|
|
fields={fileFields}
|
|
|
|
fields={fileFields}
|
|
|
|
action={{ detail: true, delete: true }}
|
|
|
|
action={{ detail: true, delete: true }}
|
|
|
|
batchAction={{ delete: true }}
|
|
|
|
batchAction={{ delete: true }}
|
|
|
|
|
|
|
|
showSizeChanger={true}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
FileList.displayName = 'FileList';
|
|
|
|
FileList.displayName = 'FileList';
|
|
|
|