Skip to content

Commit

Permalink
perf: improve file table display in file table
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Oct 5, 2024
1 parent 4a4adb1 commit ab78309
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/admin/src/client/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,16 @@ export const groupFields = [
];

export const fileFields = [
createTextField('objectName'),
createTextField('objectName', {
list: {
width: 320,
},
}),
createImageUrlField('url', {
preRenderTransform: parseUrlStr,
list: {
width: 140,
},
}),
createFileSizeField('size', {
list: {
Expand Down
7 changes: 7 additions & 0 deletions server/admin/src/client/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.arco-table-th {
white-space: nowrap;
}
.arco-table-td {
/* white-space: nowrap; */
overflow: hidden;
}
1 change: 1 addition & 0 deletions server/admin/src/client/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './global.css';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<App />
Expand Down
6 changes: 6 additions & 0 deletions server/admin/src/client/resources/file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ export const FileList: React.FC = React.memo(() => {
{t('custom.file.fileTotalSize')}: {filesize(totalSize)}
</Typography.Paragraph>
</Row>

<ListTable
filter={[
createTextField('q', {
label: 'Search',
}),
]}
tableProps={{
scroll: {
x: 1200,
},
}}
fields={fileFields}
action={{ detail: true, delete: true }}
batchAction={{ delete: true }}
Expand Down

0 comments on commit ab78309

Please sign in to comment.