From 471ccfd50fec4a4d8b122160902d3985d907cc5e Mon Sep 17 00:00:00 2001 From: Zoe Steinkamp Date: Fri, 31 Jul 2020 15:59:46 -0600 Subject: [PATCH] feat: Community template polishing (#19171) * feat: Community template polishing --- .../templates/components/CommunityTemplateName.tsx | 12 +++++++++++- .../components/CommunityTemplatesInstalledList.tsx | 12 +++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ui/src/templates/components/CommunityTemplateName.tsx b/ui/src/templates/components/CommunityTemplateName.tsx index 597b799534..80f035f3d0 100644 --- a/ui/src/templates/components/CommunityTemplateName.tsx +++ b/ui/src/templates/components/CommunityTemplateName.tsx @@ -23,12 +23,19 @@ interface Props { onClickInstall?: () => void } +import {} from 'react' + const CommunityTemplateName: FC = ({ templateName, resourceCount, onClickInstall, }) => { let installButton + let resourcePlural = 'resources' + + if (resourceCount === 1) { + resourcePlural = 'resource' + } if (onClickInstall && resourceCount > 0) { installButton = ( @@ -63,7 +70,10 @@ const CommunityTemplateName: FC = ({

Installing this template will create{' '} - {resourceCount} resources in your system + + {resourceCount} {resourcePlural} + {' '} + in your system

{installButton} diff --git a/ui/src/templates/components/CommunityTemplatesInstalledList.tsx b/ui/src/templates/components/CommunityTemplatesInstalledList.tsx index f79b4cb7c7..8b94d301f3 100644 --- a/ui/src/templates/components/CommunityTemplatesInstalledList.tsx +++ b/ui/src/templates/components/CommunityTemplatesInstalledList.tsx @@ -199,12 +199,15 @@ class CommunityTemplatesInstalledListUnconnected extends PureComponent { }) } - private generateDeleteHandlerForStack = (stackID: string) => { + private generateDeleteHandlerForStack = ( + stackID: string, + stackName: string + ) => { return async () => { try { await deleteStack(stackID, this.props.orgID) - this.props.notify(communityTemplateDeleteSucceeded(stackID)) + this.props.notify(communityTemplateDeleteSucceeded(stackName)) } catch (err) { this.props.notify(communityTemplateDeleteFailed(err.message)) reportError(err, {name: 'The community template delete failed'}) @@ -253,7 +256,10 @@ class CommunityTemplatesInstalledListUnconnected extends PureComponent { confirmationLabel="Really Delete All Resources?" popoverColor={ComponentColor.Default} popoverAppearance={Appearance.Solid} - onConfirm={this.generateDeleteHandlerForStack(stack.id)} + onConfirm={this.generateDeleteHandlerForStack( + stack.id, + stack.name + )} icon={IconFont.Trash} color={ComponentColor.Danger} size={ComponentSize.Small}