From 265e3c7916a810763d2694a321306cd3963da212 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Wed, 12 Oct 2022 11:09:24 +0800 Subject: [PATCH] feat: remove id link in the name column in the role list page 1. remove id link in the name column in the role list page 2. update the bold name style check: if the name column has the withoutId attribute with the true value, the name defaults unbold Change-Id: Ia03397d064ae67193382aca483943b92805cfd7c --- src/pages/identity/containers/Role/index.jsx | 1 + src/utils/table.jsx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/identity/containers/Role/index.jsx b/src/pages/identity/containers/Role/index.jsx index 41531f12..81d716ad 100644 --- a/src/pages/identity/containers/Role/index.jsx +++ b/src/pages/identity/containers/Role/index.jsx @@ -43,6 +43,7 @@ export class Role extends Base { title: t('Role Name'), dataIndex: 'name', routeName: 'roleDetailAdmin', + withoutId: true, }, { title: t('ID'), diff --git a/src/utils/table.jsx b/src/utils/table.jsx index 9aa7a98e..3055ce89 100644 --- a/src/utils/table.jsx +++ b/src/utils/table.jsx @@ -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) => { const style = isBold ? { @@ -214,7 +222,7 @@ export const getNameRender = (render, column, rowKey) => { : linkPrefix; 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 nameRender = getNameRenderWithStyle(nameValue, isBold); const idRender = getIdRender(idValue, copyable, !!url); @@ -259,7 +267,7 @@ export const getNameRenderByRouter = (render, column, rowKey) => { } = column; return (value, record) => { 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); if (!routeName) { return nameValue;