From ba2de1b298f419c38957b1230f4b16230999fddc Mon Sep 17 00:00:00 2001 From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com> Date: Mon, 1 Jun 2020 18:42:48 +0200 Subject: [PATCH] feat: redirect to right konnector discover screen --- .../Konnector/KonnectorNotFound.tsx | 19 +++++++++---------- .../KonnectorViewer/KonnectorViewerCard.tsx | 4 +++- src/locales/en.json | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/ContentComponents/Konnector/KonnectorNotFound.tsx b/src/components/ContentComponents/Konnector/KonnectorNotFound.tsx index a3a27c229..6432b778a 100644 --- a/src/components/ContentComponents/Konnector/KonnectorNotFound.tsx +++ b/src/components/ContentComponents/Konnector/KonnectorNotFound.tsx @@ -9,8 +9,16 @@ interface KonnectorNotFoundProps { } const KonnectorNotFound: React.FC<KonnectorNotFoundProps> = ({ + konnectorSlug, t, }: KonnectorNotFoundProps) => { + const openKonnectorURL = () => { + console.log(window.location) + const hostname = window.location.origin.replace('ecolyo', 'store') + const url = hostname + '/#/discover/' + konnectorSlug + window.open(url, '_blank') + } + return ( <div className="knotfound"> <div className="knotfound-text"> @@ -18,16 +26,7 @@ const KonnectorNotFound: React.FC<KonnectorNotFoundProps> = ({ {t('KONNECTORCONFIG.NOT_INSTALLED')} </div> <div className="knotfound-button"> - <StyledButton - type="button" - color="primary" - onClick={() => - window.open( - 'https://store.yoan.cozy.wf.alpha.grandlyon.com/#/discover/boulanger', - '_blank' - ) - } - > + <StyledButton type="button" color="primary" onClick={openKonnectorURL}> {t('KONNECTORCONFIG.BTN_INSTALL')} </StyledButton> </div> diff --git a/src/components/ContentComponents/KonnectorViewer/KonnectorViewerCard.tsx b/src/components/ContentComponents/KonnectorViewer/KonnectorViewerCard.tsx index 37e3b72c2..6239cc01d 100644 --- a/src/components/ContentComponents/KonnectorViewer/KonnectorViewerCard.tsx +++ b/src/components/ContentComponents/KonnectorViewer/KonnectorViewerCard.tsx @@ -297,7 +297,9 @@ const KonnectorViewerCard: React.FC<KonnectorViewerCardProps> = ({ className={`accordion-content ${setActive}`} > {!konnector ? ( - <KonnectorNotFound /> + <KonnectorNotFound + konnectorSlug={fluidConfig.konnectorConfig.slug} + /> ) : !isKonnectorAcc ? ( !fluidConfig.konnectorConfig.oauth ? ( <KonnectorForm diff --git a/src/locales/en.json b/src/locales/en.json index 27b218e15..003f6eebb 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -122,7 +122,7 @@ "BTN_DELETE": "Supprimer", "LOADING_DATA": "Vos premières données seront disponibles dans quelques minutes et les prochaines données seront chargées automatiquement.", "PLZ_WAIT": "Veuillez patienter...", - "NOT_INSTALLED": "Le connecteur n'est pas installer. Veuillez l'installer en cliquant sur le bouton ci-dessous." + "NOT_INSTALLED": "Le connecteur n'est pas installé. Veuillez l'installer en cliquant sur le bouton ci-dessous." }, "INDICATOR": { "DISPLAY_OTHER_FLUID": "Voir", -- GitLab