feat: update name column in the keypair list page

1. Update nameRender to support without id
2. Update name column in the keypair list page: only show the name with link to the detail page
3. Fix the id value in the keypair detail page

Change-Id: I8c983875425b1c9b31f8b3ea8eb80667b5cfabf6
This commit is contained in:
Jingwei.Zhang 2022-10-11 11:57:32 +08:00
parent d158a05bfb
commit 115015821f
4 changed files with 23 additions and 7 deletions

View File

@ -35,6 +35,10 @@ export class KeypairDetail extends Base {
return actionConfigs;
}
get titleValue() {
return this.detailData.origin_id;
}
get detailInfos() {
return [
// {

View File

@ -48,6 +48,7 @@ export class Keypair extends Base {
dataIndex: 'name',
idKey: 'name',
routeName: this.getRouteName('keypairDetail'),
withoutId: true,
},
{
title: t('Fingerprint'),

View File

@ -36,6 +36,7 @@ export class KeypairStore extends Base {
return (data) => {
const { keypair } = data;
const item = keypair ? { ...keypair } : data;
item.origin_id = item.id;
item.id = item.name;
return item;
};

View File

@ -255,6 +255,7 @@ export const getNameRenderByRouter = (render, column, rowKey) => {
copyable = true,
boldName,
title,
withoutId = false,
} = column;
return (value, record) => {
const nameValue = value || get(record, dataIndex) || '-';
@ -272,18 +273,27 @@ export const getNameRenderByRouter = (render, column, rowKey) => {
? routeParamsFunc(record)
: { [routeParamsKey]: idValue };
const query = routeQuery;
if (!withoutId) {
const link = getLinkRender({
key: routeName,
params,
query,
value: idRender,
});
return (
<div>
<div>{link}</div>
{!withoutName && nameRender}
</div>
);
}
const link = getLinkRender({
key: routeName,
params,
query,
value: idRender,
value: nameRender,
});
return (
<div>
<div>{link}</div>
{!withoutName && nameRender}
</div>
);
return <div>{link}</div>;
};
};