Added basic RBAC component BOD-232

This commit is contained in:
Patrick Fic
2020-08-10 16:07:30 -07:00
parent 0df61a2701
commit 83c83ac06e
52 changed files with 670 additions and 288 deletions

View File

@@ -10,6 +10,8 @@ import LoadingSpinner from "../../components/loading-spinner/loading-spinner.com
import { QUERY_INTAKE_CHECKLIST } from "../../graphql/bodyshop.queries";
import { setBreadcrumbs } from "../../redux/application/application.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -42,19 +44,21 @@ export function JobsIntakeContainer({ bodyshop, setBreadcrumbs }) {
}, [t, setBreadcrumbs, jobId]);
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type='error' />;
if (error) return <AlertComponent message={error.message} type="error" />;
if (data && !!!data.bodyshops_by_pk.intakechecklist)
return (
<AlertComponent message={t("intake.errors.nochecklist")} type='error' />
<AlertComponent message={t("intake.errors.nochecklist")} type="error" />
);
return (
<div>
<JobIntakeComponent
intakeChecklistConfig={
(data && data.bodyshops_by_pk.intakechecklist) || {}
}
/>
</div>
<RbacWrapper action="jobs:intake">
<div>
<JobIntakeComponent
intakeChecklistConfig={
(data && data.bodyshops_by_pk.intakechecklist) || {}
}
/>
</div>
</RbacWrapper>
);
}