NotAllowed component
parent
4dff02b87f
commit
2b6751335f
|
@ -10,3 +10,5 @@ Add in settings:
|
||||||
- ping interval
|
- ping interval
|
||||||
- notifications
|
- notifications
|
||||||
- test notification mechanism
|
- test notification mechanism
|
||||||
|
- permissions
|
||||||
|
- permissions hierarchy
|
|
@ -36,6 +36,12 @@
|
||||||
"Label": "Login",
|
"Label": "Login",
|
||||||
"IncorrectCredentials": "Incorrect credentials."
|
"IncorrectCredentials": "Incorrect credentials."
|
||||||
},
|
},
|
||||||
|
"Announcements": {
|
||||||
|
"NotAllowed": {
|
||||||
|
"Title": "It seems that you do not have sufficient rights to view this page.",
|
||||||
|
"Message": "For more details, please contact an administrator."
|
||||||
|
}
|
||||||
|
},
|
||||||
"Dashboard": {
|
"Dashboard": {
|
||||||
"Announcements": {
|
"Announcements": {
|
||||||
"Guest": {
|
"Guest": {
|
||||||
|
|
|
@ -27,6 +27,12 @@
|
||||||
"Label": "Autentificare",
|
"Label": "Autentificare",
|
||||||
"IncorrectCredentials": "Credențiale incorecte."
|
"IncorrectCredentials": "Credențiale incorecte."
|
||||||
},
|
},
|
||||||
|
"Announcements": {
|
||||||
|
"NotAllowed": {
|
||||||
|
"Title": "Se pare că nu aveți suficiente drepturi pentru a vizualiza această pagină.",
|
||||||
|
"Message": "Pentru mai multe detalii, vă rugăm să contactați un administrator."
|
||||||
|
}
|
||||||
|
},
|
||||||
"Dashboard": {
|
"Dashboard": {
|
||||||
"Announcements": {
|
"Announcements": {
|
||||||
"Guest": {
|
"Guest": {
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import React from "react";
|
||||||
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
|
import { Alert, AlertTitle } from "@material-ui/lab";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
const useStyles = makeStyles(theme => ({
|
||||||
|
alert: {
|
||||||
|
width: "100%",
|
||||||
|
"& > * + *": {
|
||||||
|
marginTop: theme.spacing(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
const NotAllowed = () => {
|
||||||
|
const classes = useStyles();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classes.alert}>
|
||||||
|
<Alert variant="outlined" severity="error">
|
||||||
|
<AlertTitle>{t("Announcements.NotAllowed.Title")}</AlertTitle>
|
||||||
|
{t("Announcements.NotAllowed.Message")}
|
||||||
|
</Alert>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NotAllowed;
|
|
@ -1,8 +1,14 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import MachinesContainer from "../../machines/components/MachinesContainer";
|
import MachinesContainer from "../../machines/components/MachinesContainer";
|
||||||
import NetworkStateProvider from "../state/NetworkStateProvider";
|
import NetworkStateProvider from "../state/NetworkStateProvider";
|
||||||
|
import { usePermissions } from "../../../hooks";
|
||||||
|
import NotAllowed from "../../../components/common/NotAllowed";
|
||||||
|
|
||||||
const NetworkContainer = () => {
|
const NetworkContainer = () => {
|
||||||
|
const { viewMachines } = usePermissions();
|
||||||
|
|
||||||
|
if (!viewMachines) return <NotAllowed />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NetworkStateProvider>
|
<NetworkStateProvider>
|
||||||
<MachinesContainer />
|
<MachinesContainer />
|
||||||
|
|
Loading…
Reference in New Issue