server summary update

master
Tudor Stanciu 2020-05-19 11:49:32 +03:00
parent 1d3f69d32e
commit 1a39d64b85
5 changed files with 27 additions and 13 deletions

View File

@ -53,7 +53,7 @@
}, },
"Server": { "Server": {
"Title": "Server", "Title": "Server",
"Host": "Host", "Subtitle": "Expand to see details",
"ServerHostName": "Server host", "ServerHostName": "Server host",
"ApiHostName": "API host", "ApiHostName": "API host",
"Domain": "Domain", "Domain": "Domain",

View File

@ -44,7 +44,7 @@
}, },
"Server": { "Server": {
"Title": "Server", "Title": "Server",
"Host": "Gazdă", "Subtitle": "Extindeţi pentru a vedea detalii",
"ServerHostName": "Gazdă server", "ServerHostName": "Gazdă server",
"ApiHostName": "Gazdă API", "ApiHostName": "Gazdă API",
"Domain": "Domeniu", "Domain": "Domeniu",

View File

@ -23,7 +23,7 @@ import { useTranslation } from "react-i18next";
const useStyles = makeStyles(styles); const useStyles = makeStyles(styles);
const ServerComponent = ({ data, openAbout }) => { const ServerComponent = ({ data, serverHost, openAbout }) => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
@ -47,12 +47,16 @@ const ServerComponent = ({ data, openAbout }) => {
</IconButton> </IconButton>
} }
title={<strong>{t("Server.Title")}</strong>} title={<strong>{t("Server.Title")}</strong>}
subheader={`${t("Server.Host")}: ${ subheader={t("Server.Subtitle")}
data.hosts ? data.hosts.server : ""
}`}
/> />
<CardContent> <CardContent>
{data.loaded && <ServerSummary data={data} openAbout={openAbout} />} {data.loaded && (
<ServerSummary
data={data}
serverHost={serverHost}
openAbout={openAbout}
/>
)}
</CardContent> </CardContent>
<CardActions disableSpacing> <CardActions disableSpacing>
<IconButton aria-label="add to favorites"> <IconButton aria-label="add to favorites">
@ -109,6 +113,7 @@ const ServerComponent = ({ data, openAbout }) => {
ServerComponent.propTypes = { ServerComponent.propTypes = {
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
serverHost: PropTypes.string,
openAbout: PropTypes.func.isRequired openAbout: PropTypes.func.isRequired
}; };

View File

@ -6,7 +6,7 @@ import { loadServerData, loadSystemVersion } from "../actionCreators";
import ServerComponent from "./ServerComponent"; import ServerComponent from "./ServerComponent";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
const ServerContainer = ({ actions, data, history }) => { const ServerContainer = ({ actions, data, serverHost, history }) => {
useEffect(() => { useEffect(() => {
actions.loadServerData(); actions.loadServerData();
actions.loadSystemVersion(); actions.loadSystemVersion();
@ -17,18 +17,26 @@ const ServerContainer = ({ actions, data, history }) => {
event.preventDefault(); event.preventDefault();
}; };
return <ServerComponent data={data} openAbout={openAbout} />; return (
<ServerComponent
data={data}
serverHost={serverHost}
openAbout={openAbout}
/>
);
}; };
ServerContainer.propTypes = { ServerContainer.propTypes = {
actions: PropTypes.object.isRequired, actions: PropTypes.object.isRequired,
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
history: PropTypes.object.isRequired history: PropTypes.object.isRequired,
serverHost: PropTypes.string
}; };
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
data: state.server.data data: state.server.data,
serverHost: state.server.activeSession.hostName
}; };
} }

View File

@ -7,7 +7,7 @@ import styles from "../../../components/common/styles/gridStyles";
const useStyles = makeStyles(styles); const useStyles = makeStyles(styles);
const ServerSummary = ({ data, openAbout }) => { const ServerSummary = ({ data, serverHost, openAbout }) => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
@ -20,7 +20,7 @@ const ServerSummary = ({ data, openAbout }) => {
<Grid item xs={6} sm={4} md={4}> <Grid item xs={6} sm={4} md={4}>
{`${t("Server.ServerHostName")}: `} {`${t("Server.ServerHostName")}: `}
<span className={classes.value}>{data.hosts.server}</span> <span className={classes.value}>{serverHost || ""}</span>
</Grid> </Grid>
<Grid item xs={6} sm={4} md={4}> <Grid item xs={6} sm={4} md={4}>
@ -46,6 +46,7 @@ const ServerSummary = ({ data, openAbout }) => {
ServerSummary.propTypes = { ServerSummary.propTypes = {
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
serverHost: PropTypes.string,
openAbout: PropTypes.func.isRequired openAbout: PropTypes.func.isRequired
}; };