diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json
index b6b032d..7c89a2a 100644
--- a/public/locales/en/translations.json
+++ b/public/locales/en/translations.json
@@ -52,6 +52,8 @@
"Version": "Version"
},
"Server": {
+ "ApiHostName": "API host",
+ "Domain": "Domain",
"ActiveSession": "Active session",
"ActiveSessionSubtitle": "Expand to see forwards"
}
diff --git a/public/locales/ro/translations.json b/public/locales/ro/translations.json
index a8a19f7..7f46415 100644
--- a/public/locales/ro/translations.json
+++ b/public/locales/ro/translations.json
@@ -43,6 +43,8 @@
"Version": "Versiune"
},
"Server": {
+ "ApiHostName": "Gazdă API",
+ "Domain": "Domeniu",
"ActiveSession": "Sesiune activă",
"ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările"
}
diff --git a/src/features/server/actionCreators.js b/src/features/server/actionCreators.js
index 81a33a6..909f1d2 100644
--- a/src/features/server/actionCreators.js
+++ b/src/features/server/actionCreators.js
@@ -2,11 +2,11 @@ import * as types from "./actionTypes";
import api from "./api";
import { sendHttpRequest } from "../../redux/actions/httpActions";
-export function loadSystemDateTime() {
+export function loadServerData() {
return async function (dispatch) {
try {
- const data = await dispatch(sendHttpRequest(api.getSystemDateTime()));
- dispatch({ type: types.LOAD_SYSTEM_DATETIME_SUCCESS, payload: data });
+ const data = await dispatch(sendHttpRequest(api.getServerData()));
+ dispatch({ type: types.LOAD_SERVER_DATA_SUCCESS, payload: data });
} catch (error) {
throw error;
}
diff --git a/src/features/server/actionTypes.js b/src/features/server/actionTypes.js
index 0482151..0993767 100644
--- a/src/features/server/actionTypes.js
+++ b/src/features/server/actionTypes.js
@@ -1,3 +1,3 @@
-export const LOAD_SYSTEM_DATETIME_SUCCESS = "LOAD_SYSTEM_DATETIME_SUCCESS";
export const LOAD_SYSTEM_VERSION_SUCCESS = "LOAD_SYSTEM_VERSION_SUCCESS";
export const LOAD_ACTIVE_SESSION_SUCCESS = "LOAD_ACTIVE_SESSION_SUCCESS";
+export const LOAD_SERVER_DATA_SUCCESS = "LOAD_SERVER_DATA_SUCCESS";
diff --git a/src/features/server/api.js b/src/features/server/api.js
index a015b24..c4a5c5c 100644
--- a/src/features/server/api.js
+++ b/src/features/server/api.js
@@ -1,12 +1,12 @@
import { get } from "../../api/axiosApi";
const baseUrl = process.env.REVERSE_PROXY_API_URL;
-const getSystemDateTime = () => get(`${baseUrl}/system/datetime`);
+const getServerData = () => get(`${baseUrl}/server/data`);
const getSystemVersion = () => get(`${baseUrl}/system/version`);
const getActiveSession = () => get(`${baseUrl}/server/active-session`);
export default {
- getSystemDateTime,
+ getServerData,
getSystemVersion,
getActiveSession
};
diff --git a/src/features/server/components/ServerComponent.js b/src/features/server/components/ServerComponent.js
index 99dfb12..b7468f9 100644
--- a/src/features/server/components/ServerComponent.js
+++ b/src/features/server/components/ServerComponent.js
@@ -1,4 +1,5 @@
import React from "react";
+import PropTypes from "prop-types";
import { makeStyles } from "@material-ui/core/styles";
import clsx from "clsx";
import Card from "@material-ui/core/Card";
@@ -15,10 +16,11 @@ import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import MoreVertIcon from "@material-ui/icons/MoreVert";
import DnsRoundedIcon from "@material-ui/icons/DnsRounded";
import styles from "../../../components/common/styles/expandableCardStyles";
+import ServerSummary from "./ServerSummary";
const useStyles = makeStyles(styles);
-const ServerComponent = () => {
+const ServerComponent = ({ data }) => {
const classes = useStyles();
const [expanded, setExpanded] = React.useState(false);
@@ -42,13 +44,7 @@ const ServerComponent = () => {
title={Server}
subheader="Host: StaWebSrv"
/>
-
-
- This impressive paella is a perfect party dish and a fun meal to cook
- together with your guests. Add 1 cup of frozen peas along with the
- mussels, if you like.
-
-
+ {data.loaded && }
@@ -102,4 +98,8 @@ const ServerComponent = () => {
);
};
+ServerComponent.propTypes = {
+ data: PropTypes.object.isRequired
+};
+
export default ServerComponent;
diff --git a/src/features/server/components/ServerContainer.js b/src/features/server/components/ServerContainer.js
index 756a9ce..9e9dba1 100644
--- a/src/features/server/components/ServerContainer.js
+++ b/src/features/server/components/ServerContainer.js
@@ -2,35 +2,32 @@ import React, { useEffect } from "react";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import PropTypes from "prop-types";
-import { loadSystemDateTime, loadSystemVersion } from "../actionCreators";
+import { loadServerData, loadSystemVersion } from "../actionCreators";
import ServerComponent from "./ServerComponent";
-const ServerContainer = ({ actions }) => {
+const ServerContainer = ({ actions, data }) => {
useEffect(() => {
- actions.loadSystemDateTime();
+ actions.loadServerData();
actions.loadSystemVersion();
}, []);
- return ;
+ return ;
};
ServerContainer.propTypes = {
actions: PropTypes.object.isRequired,
- server: PropTypes.object.isRequired
+ data: PropTypes.object.isRequired
};
function mapStateToProps(state) {
return {
- server: state.server
+ data: state.server.data
};
}
function mapDispatchToProps(dispatch) {
return {
- actions: bindActionCreators(
- { loadSystemDateTime, loadSystemVersion },
- dispatch
- )
+ actions: bindActionCreators({ loadServerData, loadSystemVersion }, dispatch)
};
}
diff --git a/src/features/server/components/ServerSummary.js b/src/features/server/components/ServerSummary.js
new file mode 100644
index 0000000..d41fca4
--- /dev/null
+++ b/src/features/server/components/ServerSummary.js
@@ -0,0 +1,33 @@
+import React from "react";
+import PropTypes from "prop-types";
+import { Grid } from "@material-ui/core";
+import { makeStyles } from "@material-ui/core/styles";
+import { useTranslation } from "react-i18next";
+import styles from "../../../components/common/styles/gridStyles";
+
+const useStyles = makeStyles(styles);
+
+const ServerSummary = ({ data }) => {
+ const classes = useStyles();
+ const { t } = useTranslation();
+
+ return (
+
+
+ {`${t("Server.ApiHostName")}: `}
+ {data.hosts.api}
+
+
+
+ {`${t("Server.Domain")}: `}
+ {data.domain}
+
+
+ );
+};
+
+ServerSummary.propTypes = {
+ data: PropTypes.object.isRequired
+};
+
+export default ServerSummary;
diff --git a/src/features/server/reducer.js b/src/features/server/reducer.js
index 89538ce..b769c68 100644
--- a/src/features/server/reducer.js
+++ b/src/features/server/reducer.js
@@ -3,10 +3,10 @@ import initialState from "../../redux/reducers/initialState";
export default function serverReducer(state = initialState.server, action) {
switch (action.type) {
- case types.LOAD_SYSTEM_DATETIME_SUCCESS:
+ case types.LOAD_SERVER_DATA_SUCCESS:
return {
...state,
- datetime: action.payload
+ data: { ...action.payload, loading: false, loaded: true }
};
case types.LOAD_SYSTEM_VERSION_SUCCESS:
diff --git a/src/redux/reducers/initialState.js b/src/redux/reducers/initialState.js
index 8430c70..37e728f 100644
--- a/src/redux/reducers/initialState.js
+++ b/src/redux/reducers/initialState.js
@@ -1,5 +1,6 @@
export default {
server: {
+ data: { loading: false, loaded: false },
activeSession: { loading: false, loaded: false }
},
sessions: Object.assign([], { loading: false, loaded: false }),