From ca8b727ff520fb0641c1a532dedcf3506e26ebdc Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 6 May 2021 14:47:56 +0200 Subject: [PATCH] Make console.log optional and accessible via a button Signed-off-by: Erik Engervall --- .../src/features/Stats/DialogBody.tsx | 19 +----- .../src/features/Stats/Warn.tsx | 63 ++++++++++++------- 2 files changed, 44 insertions(+), 38 deletions(-) diff --git a/plugins/git-release-manager/src/features/Stats/DialogBody.tsx b/plugins/git-release-manager/src/features/Stats/DialogBody.tsx index 04c64b7b07..219bc2a146 100644 --- a/plugins/git-release-manager/src/features/Stats/DialogBody.tsx +++ b/plugins/git-release-manager/src/features/Stats/DialogBody.tsx @@ -17,7 +17,6 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; import { - Box, makeStyles, Table, TableBody, @@ -70,20 +69,6 @@ export function DialogBody() { project, }); - const shouldWarn = - releaseStats.unmappableTags.length > 0 || - releaseStats.unmatchedTags.length > 0 || - releaseStats.unmatchedReleases.length > 0; - - if (shouldWarn) { - // eslint-disable-next-line no-console - console.log("⚠️ Here's a summary of unmapped/unmatched tags/releases", { - unmatchedReleases: releaseStats.unmatchedReleases, - unmatchedTags: releaseStats.unmatchedTags, - unmappableTags: releaseStats.unmappableTags, - }); - } - return ( @@ -115,7 +100,9 @@ export function DialogBody() { - {shouldWarn && } + {(releaseStats.unmappableTags.length > 0 || + releaseStats.unmatchedTags.length > 0 || + releaseStats.unmatchedReleases.length > 0) && } ); diff --git a/plugins/git-release-manager/src/features/Stats/Warn.tsx b/plugins/git-release-manager/src/features/Stats/Warn.tsx index 93c2cc4154..24997cc9b3 100644 --- a/plugins/git-release-manager/src/features/Stats/Warn.tsx +++ b/plugins/git-release-manager/src/features/Stats/Warn.tsx @@ -16,6 +16,7 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; +import { Box, Button } from '@material-ui/core'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useReleaseStatsContext } from './contexts/ReleaseStatsContext'; @@ -25,30 +26,48 @@ export const Warn = () => { const { project } = useProjectContext(); return ( - - {releaseStats.unmappableTags.length > 0 && ( -
- Failed to map {releaseStats.unmappableTags.length}{' '} - tags to releases -
- )} + + + {releaseStats.unmappableTags.length > 0 && ( +
+ Failed to map {releaseStats.unmappableTags.length}{' '} + tags to releases +
+ )} - {releaseStats.unmatchedTags.length > 0 && ( -
- Failed to match {releaseStats.unmatchedTags.length}{' '} - tags to {project.versioningStrategy} -
- )} + {releaseStats.unmatchedTags.length > 0 && ( +
+ Failed to match {releaseStats.unmatchedTags.length}{' '} + tags to {project.versioningStrategy} +
+ )} - {releaseStats.unmatchedReleases.length > 0 && ( -
- Failed to match{' '} - {releaseStats.unmatchedReleases.length} releases to{' '} - {project.versioningStrategy} -
- )} + {releaseStats.unmatchedReleases.length > 0 && ( +
+ Failed to match{' '} + {releaseStats.unmatchedReleases.length} releases to{' '} + {project.versioningStrategy} +
+ )} -
See full output in the console
-
+ + + +
+ ); };