From d78742783cd93d442da9215060f837b8c3ffe40d Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Mon, 30 Aug 2021 11:45:15 +0200 Subject: [PATCH] add keys to custom features list Signed-off-by: Erik Engervall --- .../src/features/Features.test.tsx | 4 ++++ .../src/features/Features.tsx | 22 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/git-release-manager/src/features/Features.test.tsx b/plugins/git-release-manager/src/features/Features.test.tsx index cdef4f0d43..28bd9b6310 100644 --- a/plugins/git-release-manager/src/features/Features.test.tsx +++ b/plugins/git-release-manager/src/features/Features.test.tsx @@ -41,6 +41,10 @@ describe('Features', () => { createRc: { omit: true }, promoteRc: { omit: true }, patch: { omit: true }, + custom: { + // shouldn't trigger "missing key" warning in console + factory: () => [
Custom 1
,
Custom 2
], + }, }} />, ); diff --git a/plugins/git-release-manager/src/features/Features.tsx b/plugins/git-release-manager/src/features/Features.tsx index b8386c41cc..0fa5ded36d 100644 --- a/plugins/git-release-manager/src/features/Features.tsx +++ b/plugins/git-release-manager/src/features/Features.tsx @@ -29,6 +29,7 @@ import { useProjectContext } from '../contexts/ProjectContext'; import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStrategyMatchesRepoTags'; import { validateTagName } from '../helpers/tagParts/validateTagName'; +import { Box } from '@material-ui/core'; import { ErrorBoundary, Progress } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; @@ -89,6 +90,19 @@ export function Features({ ); } + let CustomFeatures = + features?.custom?.factory({ + latestRelease: gitBatchInfo.value.latestRelease, + project, + releaseBranch: gitBatchInfo.value.releaseBranch, + repository: gitBatchInfo.value.repository, + }) ?? null; + if (Array.isArray(CustomFeatures)) { + CustomFeatures = CustomFeatures.map((CustomFeature, index) => ( + {CustomFeature} + )); + } + return ( @@ -143,13 +157,7 @@ export function Features({ /> )} - {features?.custom?.factory && - features.custom.factory({ - latestRelease: gitBatchInfo.value.latestRelease, - project, - releaseBranch: gitBatchInfo.value.releaseBranch, - repository: gitBatchInfo.value.repository, - })} + {CustomFeatures} );