DDNSProvider and active session forwards number

master
Tudor Stanciu 2020-05-19 12:57:11 +03:00
parent 1a39d64b85
commit 423f79f04b
6 changed files with 43 additions and 13 deletions

View File

@ -58,6 +58,7 @@
"ApiHostName": "API host", "ApiHostName": "API host",
"Domain": "Domain", "Domain": "Domain",
"ActiveSession": "Active session", "ActiveSession": "Active session",
"ActiveSessionSubtitle": "Expand to see forwards" "ActiveSessionSubtitle": "Expand to see forwards",
"DDNSProvider": "Dynamic DNS Provider"
} }
} }

View File

@ -49,6 +49,7 @@
"ApiHostName": "Gazdă API", "ApiHostName": "Gazdă API",
"Domain": "Domeniu", "Domain": "Domeniu",
"ActiveSession": "Sesiune activă", "ActiveSession": "Sesiune activă",
"ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările" "ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările",
"DDNSProvider": "Furnizor DNS dinamic"
} }
} }

View File

@ -13,12 +13,12 @@ const ActiveSessionSummary = ({ session }) => {
return ( return (
<Grid container> <Grid container>
<Grid item xs={12} sm={4} md={4}> <Grid item xs={6} sm={3} md={3}>
{`${t("Session.RunningTime")}: `} {`${t("Session.RunningTime")}: `}
<span className={classes.value}>{session.runningTime}</span> <span className={classes.value}>{session.runningTime}</span>
</Grid> </Grid>
<Grid item xs={12} sm={4} md={4}> <Grid item xs={6} sm={3} md={3}>
{`${t("Session.StartDate")}: `} {`${t("Session.StartDate")}: `}
<span className={classes.value}> <span className={classes.value}>
{t("DATE_FORMAT", { {t("DATE_FORMAT", {
@ -27,10 +27,15 @@ const ActiveSessionSummary = ({ session }) => {
</span> </span>
</Grid> </Grid>
<Grid item xs={12} sm={4} md={4}> <Grid item xs={6} sm={3} md={3}>
{`${t("Session.Host")}: `} {`${t("Session.Host")}: `}
<span className={classes.value}>{session.hostName}</span> <span className={classes.value}>{session.hostName}</span>
</Grid> </Grid>
<Grid item xs={6} sm={3} md={3}>
{`${t("Session.Forwards.Title")}: `}
<span className={classes.value}>{session.forwardsNumber}</span>
</Grid>
</Grid> </Grid>
); );
}; };

View File

@ -23,7 +23,12 @@ import { useTranslation } from "react-i18next";
const useStyles = makeStyles(styles); const useStyles = makeStyles(styles);
const ServerComponent = ({ data, serverHost, openAbout }) => { const ServerComponent = ({
data,
serverHost,
openAbout,
handleOpenInNewTab
}) => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
@ -55,6 +60,7 @@ const ServerComponent = ({ data, serverHost, openAbout }) => {
data={data} data={data}
serverHost={serverHost} serverHost={serverHost}
openAbout={openAbout} openAbout={openAbout}
handleOpenInNewTab={handleOpenInNewTab}
/> />
)} )}
</CardContent> </CardContent>
@ -114,7 +120,8 @@ const ServerComponent = ({ data, serverHost, openAbout }) => {
ServerComponent.propTypes = { ServerComponent.propTypes = {
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
serverHost: PropTypes.string, serverHost: PropTypes.string,
openAbout: PropTypes.func.isRequired openAbout: PropTypes.func.isRequired,
handleOpenInNewTab: PropTypes.func.isRequired
}; };
export default ServerComponent; export default ServerComponent;

View File

@ -17,11 +17,17 @@ const ServerContainer = ({ actions, data, serverHost, history }) => {
event.preventDefault(); event.preventDefault();
}; };
const handleOpenInNewTab = (url) => (event) => {
window.open(url, "_blank");
event.preventDefault();
};
return ( return (
<ServerComponent <ServerComponent
data={data} data={data}
serverHost={serverHost} serverHost={serverHost}
openAbout={openAbout} openAbout={openAbout}
handleOpenInNewTab={handleOpenInNewTab}
/> />
); );
}; };

View File

@ -7,28 +7,37 @@ import styles from "../../../components/common/styles/gridStyles";
const useStyles = makeStyles(styles); const useStyles = makeStyles(styles);
const ServerSummary = ({ data, serverHost, openAbout }) => { const ServerSummary = ({ data, serverHost, openAbout, handleOpenInNewTab }) => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<Grid container> <Grid container>
<Grid item xs={6} sm={4} md={4}> <Grid item xs={6} sm={3} md={3}>
{`${t("Server.Domain")}: `} {`${t("Server.Domain")}: `}
<span className={classes.value}>{data.domain.name}</span> <span className={classes.value}>{data.domain.name}</span>
</Grid> </Grid>
<Grid item xs={6} sm={4} md={4}> <Grid item xs={6} sm={3} md={3}>
{`${t("Server.ServerHostName")}: `} {`${t("Server.ServerHostName")}: `}
<span className={classes.value}>{serverHost || ""}</span> <span className={classes.value}>{serverHost || ""}</span>
</Grid> </Grid>
<Grid item xs={6} sm={4} md={4}> <Grid item xs={6} sm={3} md={3}>
{`${t("Server.ApiHostName")}: `} {`${t("Server.ApiHostName")}: `}
<span className={classes.value}>{data.hosts.api}</span> <span className={classes.value}>{data.hosts.api}</span>
</Grid> </Grid>
<Grid item xs={6} sm={4} md={4}></Grid> <Grid item xs={6} sm={3} md={3}>
{`${t("Server.DDNSProvider")}: `}
<Link
href="#"
onClick={handleOpenInNewTab(data.domain.provider.url)}
variant="subtitle1"
>
{data.domain.provider.name}
</Link>
</Grid>
<Grid item xs={12} sm={12} md={12}> <Grid item xs={12} sm={12} md={12}>
<Typography variant="body2" gutterBottom color="textSecondary"> <Typography variant="body2" gutterBottom color="textSecondary">
@ -47,7 +56,8 @@ const ServerSummary = ({ data, serverHost, openAbout }) => {
ServerSummary.propTypes = { ServerSummary.propTypes = {
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
serverHost: PropTypes.string, serverHost: PropTypes.string,
openAbout: PropTypes.func.isRequired openAbout: PropTypes.func.isRequired,
handleOpenInNewTab: PropTypes.func.isRequired
}; };
export default ServerSummary; export default ServerSummary;