From 071958a6abc8cf7d3608180ad05d3c943d6baa62 Mon Sep 17 00:00:00 2001
From: Romain CREY <ext.sopra.rcrey@grandlyon.com>
Date: Thu, 4 Jun 2020 15:14:12 +0200
Subject: [PATCH] WIP: errors in konnector launch

---
 .../Konnector/KonnectorLaunch.tsx             | 31 +++++--------------
 .../Konnector/KonnectorResult.tsx             |  4 ++-
 src/locales/en.json                           |  5 +--
 src/styles/components/_konnector.scss         | 21 ++++++++-----
 4 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/src/components/ContentComponents/Konnector/KonnectorLaunch.tsx b/src/components/ContentComponents/Konnector/KonnectorLaunch.tsx
index 7ab7567a0..0f19c1358 100644
--- a/src/components/ContentComponents/Konnector/KonnectorLaunch.tsx
+++ b/src/components/ContentComponents/Konnector/KonnectorLaunch.tsx
@@ -85,30 +85,13 @@ const KonnectorLaunch: React.FC<KonnectorLaunchProps> = ({
         </>
       ) : (
         <>
-          <div>
-            {state === ERROR_EVENT ? (
-              <div>
-                {t('KONNECTORCONFIG.ERROR_ACCOUNT_CREATION')}
-                <StyledButton
-                  type="button"
-                  color="primary"
-                  onClick={handleClick}
-                >
-                  <div>{t('KONNECTORCONFIG.OK')}</div>
-                </StyledButton>
-              </div>
-            ) : (
-              <div>
-                {t('KONNECTORCONFIG.SUCCESS')}
-                <StyledButton
-                  type="button"
-                  color="primary"
-                  onClick={handleClick}
-                >
-                  <div>{t('KONNECTORCONFIG.OK')}</div>
-                </StyledButton>
-              </div>
-            )}
+          <div className="konnector-info-txt">
+            {state === ERROR_EVENT
+              ? t('KONNECTORCONFIG.ERROR_DATA')
+              : t('KONNECTORCONFIG.SUCCESS')}
+            <StyledButton type="button" color="primary" onClick={handleClick}>
+              <div>{t('KONNECTORCONFIG.OK')}</div>
+            </StyledButton>
           </div>
         </>
       )}
diff --git a/src/components/ContentComponents/Konnector/KonnectorResult.tsx b/src/components/ContentComponents/Konnector/KonnectorResult.tsx
index 4da3b219c..579fad83e 100644
--- a/src/components/ContentComponents/Konnector/KonnectorResult.tsx
+++ b/src/components/ContentComponents/Konnector/KonnectorResult.tsx
@@ -44,7 +44,9 @@ const KonnectorResult: React.FC<KonnectorResultProps> = ({
     if (triggerState) {
       // TODO - format date
       console.log('triggerState', triggerState)
-      setLastExecutionDate(new Date(triggerState.last_execution).toDateString())
+      setLastExecutionDate(
+        new Date(triggerState.last_execution).toLocaleString()
+      )
       setStatus(triggerState.status)
       handleJobState(triggerState.status)
       await context.refreshFluidTypes()
diff --git a/src/locales/en.json b/src/locales/en.json
index 7c4ab690a..7e7682b5f 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -124,9 +124,10 @@
     "PLZ_WAIT": "Veuillez patienter...",
     "NOT_INSTALLED": "Le connecteur n'est pas installé. Veuillez l'installer en cliquant sur le bouton ci-dessous.",
     "ERROR_NO_LOGIN_PASSWORD": "Identifiant et mot de passe requis",
-    "ERROR_ACCOUNT_CREATION": "Une erreur est survenue, veuillez essayer de nouveau",
+    "ERROR_ACCOUNT_CREATION": "Une erreur est survenue, veuillez essayer de nouveau.",
     "ERROR_LOGIN_FAILED": "Identifiants invalides",
-    "SUCCESS": "Félicitations, la connexion a été effectuée",
+    "SUCCESS": "Félicitations, la connexion a été effectuée.",
+    "ERROR_DATA": "Une erreur est survenue pendant le rapatriement des données.",
     "OK": "Ok"
   },
   "INDICATOR": {
diff --git a/src/styles/components/_konnector.scss b/src/styles/components/_konnector.scss
index 99d669c38..b306ca2e4 100644
--- a/src/styles/components/_konnector.scss
+++ b/src/styles/components/_konnector.scss
@@ -113,31 +113,31 @@
 }
 
 // KonnectorNotFound
-.knotfound{
+.knotfound {
   margin: 0 1.5rem;
   @media #{$large-phone} {
     margin: 0;
   }
-  .knotfound-text{
+  .knotfound-text {
     color: $text-bright;
     padding-top: 1rem;
   }
-  .knotfound-button{
+  .knotfound-button {
     margin-bottom: 1rem;
   }
 }
 
 // KonnectorOAuthForm
-.koauthform{
+.koauthform {
   margin: 0 1.5rem;
   @media #{$large-phone} {
     margin: 0;
   }
-  .koauthform-text{
+  .koauthform-text {
     color: $text-bright;
     padding-top: 1rem;
   }
-  .koauthform-button{
+  .koauthform-button {
     margin-bottom: 1rem;
   }
 }
@@ -157,9 +157,14 @@
   }
 }
 
+.konnector-info-txt {
+  margin-top: 1.5rem;
+}
+
 .state-icon {
   height: 22px;
   width: 22px;
-  margin-left: 32px;
-  margin-bottom: 40px;
+  position: absolute;
+  bottom: 8px;
+  left: 30px;
 }
-- 
GitLab