From 5e0879da2bf1ad7b83ee067ba82d5ab779a4167e Mon Sep 17 00:00:00 2001 From: Bruno Fuzetti Penso Date: Fri, 10 Dec 2021 11:07:13 -0300 Subject: [PATCH] refacotr Signed-off-by: Bruno Fuzetti Penso --- .../src/components/RadarDescription/RadarDescription.tsx | 5 ++--- plugins/tech-radar/src/utils/components.tsx | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/tech-radar/src/components/RadarDescription/RadarDescription.tsx b/plugins/tech-radar/src/components/RadarDescription/RadarDescription.tsx index 36946f7875..5aebc8d8fb 100644 --- a/plugins/tech-radar/src/components/RadarDescription/RadarDescription.tsx +++ b/plugins/tech-radar/src/components/RadarDescription/RadarDescription.tsx @@ -20,6 +20,7 @@ import DialogTitle from '@material-ui/core/DialogTitle'; import { Button, DialogActions, DialogContent } from '@material-ui/core'; import LinkIcon from '@material-ui/icons/Link'; import { MarkdownContent } from '@backstage/core-components'; +import { isValidUrl } from '../../utils/components'; export type Props = { open: boolean; @@ -36,10 +37,8 @@ const RadarDescription = (props: Props): JSX.Element => { const handleClick = () => { onClose(); if (urlTarget) { - console.log('with target' + urlTarget) window.open(url, urlTarget); } else { - console.log('no target' + urlTarget) window.location.href = url; } }; @@ -52,7 +51,7 @@ const RadarDescription = (props: Props): JSX.Element => { - {(url && url !== '#') && ( + {isValidUrl(url) && (