Merge pull request #12244 from leboncoin/vault-display-full-secret-name

fix(vault-plugin): display full secret name relative to the secret path
This commit is contained in:
Ben Lambert
2022-06-29 10:08:45 +02:00
committed by GitHub
10 changed files with 26 additions and 3 deletions
+1
View File
@@ -32,6 +32,7 @@ export const vaultPlugin: BackstagePlugin<{}, {}>;
// @public
export type VaultSecret = {
name: string;
path: string;
showUrl: string;
editUrl: string;
};
+2
View File
@@ -45,11 +45,13 @@ const mockedApi: VaultApi = {
return [
{
name: 'a::b',
path: '',
editUrl: 'https://example.com',
showUrl: 'https://example.com',
},
{
name: 'c::d',
path: '',
editUrl: 'https://example.com',
showUrl: 'https://example.com',
},
+2
View File
@@ -31,11 +31,13 @@ describe('api', () => {
items: [
{
name: 'secret::one',
path: 'test/success',
editUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/edit/test/success/secret::one`,
showUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/show/test/success/secret::one`,
},
{
name: 'secret::two',
path: 'test/success',
editUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/edit/test/success/secret::two`,
showUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/show/test/success/secret::two`,
},
+1
View File
@@ -29,6 +29,7 @@ export const vaultApiRef = createApiRef<VaultApi>({
*/
export type VaultSecret = {
name: string;
path: string;
showUrl: string;
editUrl: string;
};
@@ -72,11 +72,13 @@ describe('EntityVaultTable', () => {
items: [
{
name: 'secret::one',
path: 'test/success',
editUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/edit/test/success/secret::one`,
showUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/show/test/success/secret::one`,
},
{
name: 'secret::two',
path: 'test/success',
editUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/edit/test/success/secret::two`,
showUrl: `${mockBaseUrl}/ui/vault/secrets/secrets/show/test/success/secret::two`,
},
@@ -53,12 +53,16 @@ export const EntityVaultTable = ({ entity }: { entity: Entity }) => {
];
const data = (value || []).map(secret => {
const secretName = `${secret.path.replace(`${secretPath}/`, '')}/${
secret.name
}`;
return {
secret: secret.name,
secret: secretName,
view: (
<Link
aria-label="View"
title={`View ${secret.name}`}
title={`View ${secretName}`}
to={secret.showUrl}
>
<Visibility style={{ fontSize: 16 }} />
@@ -67,7 +71,7 @@ export const EntityVaultTable = ({ entity }: { entity: Entity }) => {
edit: (
<Link
aria-label="Edit"
title={`Edit ${secret.name}`}
title={`Edit ${secretName}`}
to={secret.editUrl}
>
<Edit style={{ fontSize: 16 }} />