Merge "feat: remove id link in the name column in the role list page"

This commit is contained in:
Zuul 2022-10-12 06:31:33 +00:00 committed by Gerrit Code Review
commit 1506dd9353
2 changed files with 11 additions and 2 deletions

View File

@ -43,6 +43,7 @@ export class Role extends Base {
title: t('Role Name'), title: t('Role Name'),
dataIndex: 'name', dataIndex: 'name',
routeName: 'roleDetailAdmin', routeName: 'roleDetailAdmin',
withoutId: true,
}, },
{ {
title: t('ID'), title: t('ID'),

View File

@ -179,6 +179,14 @@ export const getIdRender = (value, copyable = true, isLink = true) => {
); );
}; };
const isNameBold = (dataIndex, title, boldName, withoutId) => {
return boldName === undefined
? withoutId
? false
: title === t('ID/Name') || dataIndex === 'name'
: boldName;
};
export const getNameRenderWithStyle = (name, isBold) => { export const getNameRenderWithStyle = (name, isBold) => {
const style = isBold const style = isBold
? { ? {
@ -214,7 +222,7 @@ export const getNameRender = (render, column, rowKey) => {
: linkPrefix; : linkPrefix;
url = getLinkUrl(linkValue, idValue); url = getLinkUrl(linkValue, idValue);
} }
const isBold = boldName || title === t('ID/Name') || dataIndex === 'name'; const isBold = isNameBold(dataIndex, title, boldName, false);
const nameValue = value || get(record, dataIndex) || '-'; const nameValue = value || get(record, dataIndex) || '-';
const nameRender = getNameRenderWithStyle(nameValue, isBold); const nameRender = getNameRenderWithStyle(nameValue, isBold);
const idRender = getIdRender(idValue, copyable, !!url); const idRender = getIdRender(idValue, copyable, !!url);
@ -259,7 +267,7 @@ export const getNameRenderByRouter = (render, column, rowKey) => {
} = column; } = column;
return (value, record) => { return (value, record) => {
const nameValue = value || get(record, dataIndex) || '-'; const nameValue = value || get(record, dataIndex) || '-';
const isBold = boldName || title === t('ID/Name') || dataIndex === 'name'; const isBold = isNameBold(dataIndex, title, boldName, withoutId);
const nameRender = getNameRenderWithStyle(nameValue, isBold); const nameRender = getNameRenderWithStyle(nameValue, isBold);
if (!routeName) { if (!routeName) {
return nameValue; return nameValue;