From 115015821f7054778aaf5a82cc36102c98227fa4 Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Tue, 11 Oct 2022 11:57:32 +0800 Subject: [PATCH] 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 --- .../containers/Keypair/Detail/index.jsx | 4 ++++ .../compute/containers/Keypair/index.jsx | 1 + src/stores/nova/keypair.js | 1 + src/utils/table.jsx | 24 +++++++++++++------ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/pages/compute/containers/Keypair/Detail/index.jsx b/src/pages/compute/containers/Keypair/Detail/index.jsx index 5a8ada73..29237481 100644 --- a/src/pages/compute/containers/Keypair/Detail/index.jsx +++ b/src/pages/compute/containers/Keypair/Detail/index.jsx @@ -35,6 +35,10 @@ export class KeypairDetail extends Base { return actionConfigs; } + get titleValue() { + return this.detailData.origin_id; + } + get detailInfos() { return [ // { diff --git a/src/pages/compute/containers/Keypair/index.jsx b/src/pages/compute/containers/Keypair/index.jsx index 9e9499fe..e85ddf4b 100644 --- a/src/pages/compute/containers/Keypair/index.jsx +++ b/src/pages/compute/containers/Keypair/index.jsx @@ -48,6 +48,7 @@ export class Keypair extends Base { dataIndex: 'name', idKey: 'name', routeName: this.getRouteName('keypairDetail'), + withoutId: true, }, { title: t('Fingerprint'), diff --git a/src/stores/nova/keypair.js b/src/stores/nova/keypair.js index 4c6b5688..4b25294c 100644 --- a/src/stores/nova/keypair.js +++ b/src/stores/nova/keypair.js @@ -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; }; diff --git a/src/utils/table.jsx b/src/utils/table.jsx index e4e32cba..f1122eff 100644 --- a/src/utils/table.jsx +++ b/src/utils/table.jsx @@ -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 ( +
+
{link}
+ {!withoutName && nameRender} +
+ ); + } const link = getLinkRender({ key: routeName, params, query, - value: idRender, + value: nameRender, }); - return ( -
-
{link}
- {!withoutName && nameRender} -
- ); + return
{link}
; }; };