WIP for not found error pages BOD-119
This commit is contained in:
@@ -7561,6 +7561,48 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>notfoundsub</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>notfoundtitle</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>rbacunauth</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -6,8 +6,6 @@ export default function Test() {
|
||||
console.log("handleQbSignIn -> result", result.data);
|
||||
// window.open(result.data, "_blank", "toolbar=0,location=0,menubar=0");
|
||||
|
||||
var win;
|
||||
var checkConnect;
|
||||
var parameters = "location=1,width=800,height=650";
|
||||
parameters +=
|
||||
",left=" +
|
||||
@@ -16,7 +14,7 @@ export default function Test() {
|
||||
(window.screen.height - 650) / 2;
|
||||
|
||||
// Launch Popup
|
||||
win = window.open(result.data, "connectPopup", parameters);
|
||||
window.open(result.data, "connectPopup", parameters);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
16
client/src/components/not-found/not-found.component.jsx
Normal file
16
client/src/components/not-found/not-found.component.jsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import React from "react";
|
||||
import { Result } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function NotFound() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div>
|
||||
<Result
|
||||
status="404"
|
||||
title={t("general.messages.notfoundtitle")}
|
||||
subTitle={t("general.messages.notfoundsub")}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import ContractDetailPageComponent from "./contract-detail.page.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -41,7 +42,11 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
: error
|
||||
? t("titles.app")
|
||||
: t("titles.contracts-detail", {
|
||||
id: (data && data.cccontracts_by_pk.agreementnumber) || "",
|
||||
id:
|
||||
(data &&
|
||||
data.cccontracts_by_pk &&
|
||||
data.cccontracts_by_pk.agreementnumber) ||
|
||||
"",
|
||||
});
|
||||
|
||||
setBreadcrumbs([
|
||||
@@ -53,12 +58,16 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
{
|
||||
link: "/manage/courtesycars/contracts/new",
|
||||
label: t("titles.bc.contracts-detail", {
|
||||
number: (data && data.cccontracts_by_pk.agreementnumber) || "",
|
||||
number:
|
||||
(data &&
|
||||
data.cccontracts_by_pk &&
|
||||
data.cccontracts_by_pk.agreementnumber) ||
|
||||
"",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
if (data)
|
||||
if (data && data.cccontracts_by_pk)
|
||||
addRecentItem(
|
||||
CreateRecentItem(
|
||||
contractId,
|
||||
@@ -88,12 +97,19 @@ export function ContractDetailPageContainer({ setBreadcrumbs, addRecentItem }) {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (data) form.resetFields();
|
||||
if (data && data.cccontracts_by_pk) form.resetFields();
|
||||
}, [data, form]);
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (loading) return <LoadingSpinner />;
|
||||
|
||||
if (!!!data.cccontracts_by_pk) return <NotFound />;
|
||||
console.log(
|
||||
"data.cccontracts_by_pk",
|
||||
!!!data.cccontracts_by_pk,
|
||||
data.cccontracts_by_pk
|
||||
);
|
||||
|
||||
return (
|
||||
<RbacWrapper action="contracts:detail">
|
||||
<div>
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import CourtesyCarDetailPageComponent from "./courtesy-car-detail.page.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -38,21 +40,29 @@ export function CourtesyCarDetailPageContainer({
|
||||
: error
|
||||
? t("titles.app")
|
||||
: t("titles.courtesycars-detail", {
|
||||
id: (data && data.courtesycars_by_pk.fleet_number) || "",
|
||||
id:
|
||||
(data &&
|
||||
data.courtesycars_by_pk &&
|
||||
data.courtesycars_by_pk.fleet_number) ||
|
||||
"",
|
||||
});
|
||||
setBreadcrumbs([
|
||||
{ link: "/manage/courtesycars", label: t("titles.bc.courtesycars") },
|
||||
{
|
||||
link: `/manage/courtesycars/${
|
||||
(data && data.courtesycars_by_pk.id) || ""
|
||||
(data && data.courtesycars_by_pk && data.courtesycars_by_pk.id) || ""
|
||||
}`,
|
||||
label: t("titles.bc.courtesycars-detail", {
|
||||
number: (data && data.courtesycars_by_pk.fleetnumber) || "",
|
||||
number:
|
||||
(data &&
|
||||
data.courtesycars_by_pk &&
|
||||
data.courtesycars_by_pk.fleetnumber) ||
|
||||
"",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
if (data)
|
||||
if (data && data.courtesycars_by_pk)
|
||||
addRecentItem(
|
||||
CreateRecentItem(
|
||||
ccId,
|
||||
@@ -84,10 +94,14 @@ export function CourtesyCarDetailPageContainer({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (data) form.resetFields();
|
||||
if (data && data.courtesycars_by_pk) form.resetFields();
|
||||
}, [data, form]);
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
if (!!!data.courtesycars_by_pk) return <NotFound />;
|
||||
|
||||
return (
|
||||
<RbacWrapper action="courtesycar:detail">
|
||||
<Form
|
||||
|
||||
@@ -3,24 +3,19 @@ import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import { QUERY_JOB_CLOSE_DETAILS } from "../../graphql/jobs.queries";
|
||||
import { setBreadcrumbs } from "../../redux/application/application.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import JobsCloseComponent from "./jobs-close.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
});
|
||||
|
||||
export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) {
|
||||
export function JobsCloseContainer({ setBreadcrumbs }) {
|
||||
const { jobId } = useParams();
|
||||
const { loading, error, data } = useQuery(QUERY_JOB_CLOSE_DETAILS, {
|
||||
variables: { id: jobId },
|
||||
@@ -28,7 +23,7 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
useEffect(() => {
|
||||
document.title = t("titles.jobs-close", {
|
||||
number: data ? data.jobs_by_pk.ro_number : null,
|
||||
number: data ? data.jobs_by_pk && data.jobs_by_pk.ro_number : null,
|
||||
});
|
||||
|
||||
setBreadcrumbs([
|
||||
@@ -39,7 +34,7 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) {
|
||||
{
|
||||
link: `/manage/jobs/${jobId}/`,
|
||||
label: t("titles.bc.jobs-detail", {
|
||||
number: data ? data.jobs_by_pk.ro_number : null,
|
||||
number: data ? data.jobs_by_pk && data.jobs_by_pk.ro_number : null,
|
||||
}),
|
||||
},
|
||||
{
|
||||
@@ -51,6 +46,7 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) {
|
||||
|
||||
if (loading) return <LoadingSpinner />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (!!!data.jobs_by_pk) return <NotFound />;
|
||||
|
||||
return (
|
||||
<RbacWrapper action="jobs:close">
|
||||
@@ -63,4 +59,4 @@ export function JobsCloseContainer({ setBreadcrumbs, bodyshop }) {
|
||||
</RbacWrapper>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsCloseContainer);
|
||||
export default connect(null, mapDispatchToProps)(JobsCloseContainer);
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import JobsDetailPage from "./jobs-detail.page.component";
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -53,9 +54,10 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
: error
|
||||
? t("titles.app")
|
||||
: t("titles.jobsdetail", {
|
||||
ro_number: data.jobs_by_pk.converted
|
||||
? data.jobs_by_pk.ro_number
|
||||
: `EST ${data.jobs_by_pk.est_number}`,
|
||||
ro_number:
|
||||
data.jobs_by_pk && data.jobs_by_pk.converted
|
||||
? data.jobs_by_pk && data.jobs_by_pk.ro_number
|
||||
: `EST ${data.jobs_by_pk && data.jobs_by_pk.est_number}`,
|
||||
});
|
||||
setBreadcrumbs([
|
||||
{ link: "/manage/jobs", label: t("titles.bc.jobs") },
|
||||
@@ -64,15 +66,16 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
label: t("titles.bc.jobs-detail", {
|
||||
number:
|
||||
(data &&
|
||||
(data.jobs_by_pk.converted
|
||||
? data && data.jobs_by_pk.ro_number
|
||||
: `EST ${data.jobs_by_pk.est_number}`)) ||
|
||||
data.jobs_by_pk &&
|
||||
(data.jobs_by_pk && data.jobs_by_pk.converted
|
||||
? data && data.jobs_by_pk && data.jobs_by_pk.ro_number
|
||||
: `EST ${data.jobs_by_pk && data.jobs_by_pk.est_number}`)) ||
|
||||
"",
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
if (data)
|
||||
if (data && data.jobs_by_pk)
|
||||
addRecentItem(
|
||||
CreateRecentItem(
|
||||
jobId,
|
||||
@@ -87,6 +90,7 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
|
||||
if (loading) return <SpinComponent />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (!!!data.jobs_by_pk) return <NotFound />;
|
||||
|
||||
return data.jobs_by_pk ? (
|
||||
<RbacWrapper action="jobs:detail">
|
||||
|
||||
@@ -64,8 +64,6 @@ export function* isUserAuthenticated() {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(yield auth.currentUser.getIdToken(true));
|
||||
|
||||
LogRocket.identify(user.email);
|
||||
yield put(
|
||||
signInSuccess({
|
||||
|
||||
@@ -486,6 +486,8 @@
|
||||
"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",
|
||||
"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...",
|
||||
"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?"
|
||||
|
||||
@@ -486,6 +486,8 @@
|
||||
"exception": "",
|
||||
"newversionmessage": "",
|
||||
"newversiontitle": "",
|
||||
"notfoundsub": "",
|
||||
"notfoundtitle": "",
|
||||
"rbacunauth": "",
|
||||
"unsavedchanges": "Usted tiene cambios no guardados.",
|
||||
"unsavedchangespopup": ""
|
||||
|
||||
@@ -486,6 +486,8 @@
|
||||
"exception": "",
|
||||
"newversionmessage": "",
|
||||
"newversiontitle": "",
|
||||
"notfoundsub": "",
|
||||
"notfoundtitle": "",
|
||||
"rbacunauth": "",
|
||||
"unsavedchanges": "Vous avez des changements non enregistrés.",
|
||||
"unsavedchangespopup": ""
|
||||
|
||||
Reference in New Issue
Block a user