fix(vault-plugin): rework
Signed-off-by: denis.fortin <denis.fortin@adevinta.com>
This commit is contained in:
@@ -3,4 +3,4 @@
|
||||
'@backstage/plugin-vault-backend': patch
|
||||
---
|
||||
|
||||
Added a path notion in addition to secret name to allow to differentiate secrets in subpaths
|
||||
Added a path notion in addition to secret name to allow to differentiate secrets in sub-paths
|
||||
|
||||
@@ -32,13 +32,6 @@ export const vaultSecretPath = (entity: Entity) => {
|
||||
return { secretPath };
|
||||
};
|
||||
|
||||
function getSecretRelativeName(
|
||||
secretPath: string,
|
||||
secret: VaultSecret,
|
||||
): string {
|
||||
return `${secret.path.replace(`${secretPath}/`, '')}/${secret.name}`;
|
||||
}
|
||||
|
||||
export const EntityVaultTable = ({ entity }: { entity: Entity }) => {
|
||||
const vaultApi = useApi(vaultApiRef);
|
||||
const { secretPath } = vaultSecretPath(entity);
|
||||
@@ -60,12 +53,16 @@ export const EntityVaultTable = ({ entity }: { entity: Entity }) => {
|
||||
];
|
||||
|
||||
const data = (value || []).map(secret => {
|
||||
const secretName = `${secret.path.replace(`${secretPath}/`, '')}/${
|
||||
secret.name
|
||||
}`;
|
||||
|
||||
return {
|
||||
secret: getSecretRelativeName(secretPath, secret),
|
||||
secret: secretName,
|
||||
view: (
|
||||
<Link
|
||||
aria-label="View"
|
||||
title={`View ${getSecretRelativeName(secretPath, secret)}`}
|
||||
title={`View ${secretName}`}
|
||||
to={secret.showUrl}
|
||||
>
|
||||
<Visibility style={{ fontSize: 16 }} />
|
||||
@@ -74,7 +71,7 @@ export const EntityVaultTable = ({ entity }: { entity: Entity }) => {
|
||||
edit: (
|
||||
<Link
|
||||
aria-label="Edit"
|
||||
title={`Edit ${getSecretRelativeName(secretPath, secret)}`}
|
||||
title={`Edit ${secretName}`}
|
||||
to={secret.editUrl}
|
||||
>
|
||||
<Edit style={{ fontSize: 16 }} />
|
||||
|
||||
Reference in New Issue
Block a user