From 1a6e336e9a07bec9fe250bf113895c31ecd15bcc Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 22 Feb 2021 17:05:12 -0800 Subject: [PATCH] Added alert for partner in app IO-406 --- bodyshop_translations.babel | 42 +++++++++++++++++++ .../partner-ping/partner-ping.component.jsx | 34 +++++++++++++++ .../jobs-available.page.container.jsx | 3 +- .../pages/manage/manage.page.component.jsx | 2 + client/src/translations/en_us/common.json | 2 + client/src/translations/es/common.json | 2 + client/src/translations/fr/common.json | 2 + 7 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 client/src/components/partner-ping/partner-ping.component.jsx diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 7e308cdbb..2d832720b 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -11934,6 +11934,27 @@ + + noacctfilepath + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + notfoundsub false @@ -11976,6 +11997,27 @@ + + partnernotrunning + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + rbacunauth false diff --git a/client/src/components/partner-ping/partner-ping.component.jsx b/client/src/components/partner-ping/partner-ping.component.jsx new file mode 100644 index 000000000..cdb9b2874 --- /dev/null +++ b/client/src/components/partner-ping/partner-ping.component.jsx @@ -0,0 +1,34 @@ +import React, { useState, useEffect } from "react"; +import axios from "axios"; +import { message, notification } from "antd"; +import { useTranslation } from "react-i18next"; + +export default function PartnerPingComponent() { + const { t } = useTranslation(); + + useEffect(() => { + // Create an scoped async function in the hook + async function checkPartnerStatus() { + try { + const PartnerResponse = await axios.post("http://localhost:1337/ping/"); + const { appver, qbpath } = PartnerResponse.data; + if (!qbpath) { + notification["error"]({ + title: "", + message: t("general.messages.noacctfilepath"), + }); + } + } catch (error) { + notification["error"]({ + title: "", + message: t("general.messages.partnernotrunning"), + }); + } + } + // Execute the created function directly + checkPartnerStatus(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return <>; +} diff --git a/client/src/pages/jobs-available/jobs-available.page.container.jsx b/client/src/pages/jobs-available/jobs-available.page.container.jsx index afc12ad72..c60107502 100644 --- a/client/src/pages/jobs-available/jobs-available.page.container.jsx +++ b/client/src/pages/jobs-available/jobs-available.page.container.jsx @@ -7,7 +7,7 @@ import JobsAvailableTableContainer from "../../components/jobs-available-table/j import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; import { setBreadcrumbs, - setSelectedHeader, + setSelectedHeader } from "../../redux/application/application.actions"; const mapDispatchToProps = (dispatch) => ({ @@ -32,6 +32,7 @@ export function JobsAvailablePageContainer({ return (
+ diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 5b0741f9a..32929bb41 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -16,6 +16,7 @@ import FcmNotification from "../../components/fcm-notification/fcm-notification. import HeaderContainer from "../../components/header/header.container"; import JiraSupportComponent from "../../components/jira-support-widget/jira-support-widget.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; +import PartnerPingComponent from "../../components/partner-ping/partner-ping.component"; import PrintCenterModalContainer from "../../components/print-center-modal/print-center-modal.container"; import TestComponent from "../../components/_test/test.component"; import { QUERY_STRIPE_ID } from "../../graphql/bodyshop.queries"; @@ -177,6 +178,7 @@ export function Manage({ match, conflict }) { + {conflict ? ( diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index c10c18eaa..5e186ca7c 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -770,8 +770,10 @@ "exception": "$t(titles.app) has encountered an error. Please try again. If the problem persists, please submit a support ticket or contact us.", "newversionmessage": "Click refresh below to update to the latest available version of ImEX Online.", "newversiontitle": "New version of ImEX Online Available", + "noacctfilepath": "There is no accounting file path set. You will not be able to export any items.", "notfoundsub": "Please make sure that you have access to the data or that the link is correct.", "notfoundtitle": "We couldn't find what you're looking for...", + "partnernotrunning": "ImEX Online has detected that the partner is not running. Please ensure it is running to enable full functionality.", "rbacunauth": "You are not authorized to view this content. Please reach out to your shop manager to change your access level.", "unsavedchanges": "You have unsaved changes.", "unsavedchangespopup": "You have unsaved changes. Are you sure you want to leave?" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index a3a3bddd2..e7da811b1 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -770,8 +770,10 @@ "exception": "", "newversionmessage": "", "newversiontitle": "", + "noacctfilepath": "", "notfoundsub": "", "notfoundtitle": "", + "partnernotrunning": "", "rbacunauth": "", "unsavedchanges": "Usted tiene cambios no guardados.", "unsavedchangespopup": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index bb4274969..b469cbfa5 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -770,8 +770,10 @@ "exception": "", "newversionmessage": "", "newversiontitle": "", + "noacctfilepath": "", "notfoundsub": "", "notfoundtitle": "", + "partnernotrunning": "", "rbacunauth": "", "unsavedchanges": "Vous avez des changements non enregistrés.", "unsavedchangespopup": ""