From cb16f9ebfc61caaa65d5c3d3f3fdfe81977c1b97 Mon Sep 17 00:00:00 2001 From: Marek Calus Date: Mon, 23 Nov 2020 19:34:15 +0100 Subject: [PATCH] Code review fixes --- packages/app/src/App.tsx | 2 +- .../src/components/ComponentConfigDisplay.tsx | 32 ++++++++++++++++--- .../src/components/ImportFinished.tsx | 7 +++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index c02d83841f..28aebeeb79 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -69,7 +69,7 @@ const AppRoutes = () => ( } /> void; + nextStep: (options?: { reset: boolean }) => void; configFile: ConfigSpec; savePRLink: (PRLink: string) => void; catalogRouteRef: RouteRef; @@ -74,6 +74,7 @@ const ComponentConfigDisplay = ({ savePRLink, catalogRouteRef, }: Props) => { + const [errorOccured, setErrorOccured] = useState(false); const [submitting, setSubmitting] = useState(false); const errorApi = useApi(errorApiRef); const { submitPrToRepo, addLocation } = useGithubRepos(); @@ -91,6 +92,7 @@ const ComponentConfigDisplay = ({ nextStep(); } } catch (e) { + setErrorOccured(true); setSubmitting(false); errorApi.post(e); } @@ -102,13 +104,25 @@ const ComponentConfigDisplay = ({ Following config object will be submitted in a pull request to the repository{' '} - {configFile.location} and - added as a new location to the backend + + {configFile.location} + {' '} + and added as a new location to the backend ) : ( Following config object will be added as a new location to the backend{' '} - {configFile.location} + + {configFile.location} + )} @@ -164,6 +178,16 @@ const ComponentConfigDisplay = ({ > Next + {errorOccured ? ( + + ) : null} diff --git a/plugins/catalog-import/src/components/ImportFinished.tsx b/plugins/catalog-import/src/components/ImportFinished.tsx index 9a06de234b..caba678999 100644 --- a/plugins/catalog-import/src/components/ImportFinished.tsx +++ b/plugins/catalog-import/src/components/ImportFinished.tsx @@ -36,7 +36,12 @@ export const ImportFinished = ({ nextStep, PRLink, type }: Props) => { {type === 'repo' ? ( - + View pull request on GitHub ) : null}