refactor: update columns function for image

update getColumns function for image, then other class can better update the columns by inheritance class

Change-Id: I8c5387b4e03edfb5f94764a7bb7c60759962871e
This commit is contained in:
Jingwei.Zhang 2023-10-12 11:31:26 +08:00
parent c2a80fda7a
commit d56f8ea6ce

View File

@ -117,75 +117,77 @@ export class Image extends Base {
return 'owner'; return 'owner';
} }
getColumns = () => [ getColumns() {
{ return [
title: t('ID/Name'), {
dataIndex: 'name', title: t('ID/Name'),
routeName: this.getRouteName('imageDetail'), dataIndex: 'name',
}, routeName: this.getRouteName('imageDetail'),
{ },
title: t('Project ID/Name'), {
dataIndex: 'project_name', title: t('Project ID/Name'),
hidden: !this.isAdminPage && this.tab !== 'all', dataIndex: 'project_name',
sorter: false, hidden: !this.isAdminPage && this.tab !== 'all',
}, sorter: false,
{ },
title: t('Description'), {
dataIndex: 'description', title: t('Description'),
isHideable: true, dataIndex: 'description',
sorter: false, isHideable: true,
}, sorter: false,
{ },
title: t('Use Type'), {
dataIndex: 'usage_type', title: t('Use Type'),
isHideable: true, dataIndex: 'usage_type',
valueMap: imageUsage, isHideable: true,
sorter: false, valueMap: imageUsage,
}, sorter: false,
{ },
title: t('Container Format'), {
dataIndex: 'container_format', title: t('Container Format'),
valueMap: imageContainerFormats, dataIndex: 'container_format',
isHideable: true, valueMap: imageContainerFormats,
}, isHideable: true,
{ },
title: t('Type'), {
dataIndex: 'os_distro', title: t('Type'),
isHideable: true, dataIndex: 'os_distro',
render: (value) => <ImageType type={value} title={value} />, isHideable: true,
width: 80, render: (value) => <ImageType type={value} title={value} />,
sorter: false, width: 80,
}, sorter: false,
{ },
title: t('Status'), {
dataIndex: 'status', title: t('Status'),
valueMap: imageStatus, dataIndex: 'status',
}, valueMap: imageStatus,
{ },
title: t('Visibility'), {
dataIndex: 'visibility', title: t('Visibility'),
valueMap: imageVisibility, dataIndex: 'visibility',
sorter: false, valueMap: imageVisibility,
}, sorter: false,
{ },
title: t('Disk Format'), {
dataIndex: 'disk_format', title: t('Disk Format'),
isHideable: true, dataIndex: 'disk_format',
valueMap: imageFormats, isHideable: true,
}, valueMap: imageFormats,
{ },
title: t('Size'), {
dataIndex: 'size', title: t('Size'),
isHideable: true, dataIndex: 'size',
valueRender: 'formatSize', isHideable: true,
}, valueRender: 'formatSize',
{ },
title: t('Created At'), {
dataIndex: 'created_at', title: t('Created At'),
isHideable: true, dataIndex: 'created_at',
valueRender: 'sinceTime', isHideable: true,
}, valueRender: 'sinceTime',
]; },
];
}
get searchFilters() { get searchFilters() {
const filters = [ const filters = [