From 105ebc74b28b8bb0ec02be4d51db0472bab39958 Mon Sep 17 00:00:00 2001 From: Claudemir Todo Bom Date: Fri, 16 Aug 2024 23:19:22 -0300 Subject: [PATCH] Show version of frontend and backend in the About modal --- frontend/src/components/AboutModal/index.js | 50 +++++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/AboutModal/index.js b/frontend/src/components/AboutModal/index.js index c2fd1136..8b8c4180 100644 --- a/frontend/src/components/AboutModal/index.js +++ b/frontend/src/components/AboutModal/index.js @@ -12,12 +12,14 @@ import { DialogTitle } from "@material-ui/core"; -import { getBackendURL } from "../../services/config"; - import { i18n } from "../../translate/i18n"; import useAuth from "../../hooks/useAuth.js"; import { useTheme } from "@material-ui/core/styles"; +import { loadJSON } from "../../helpers/loadJSON"; +import api from "../../services/api"; + +const frontendGitInfo = loadJSON('/gitinfo.json'); const logo = "/vector/logo.svg"; const logoDark = "/vector/logo-dark.svg"; @@ -35,7 +37,12 @@ const useStyles = makeStyles(theme => ({ logoImg: { width: "100%", margin: "0 auto", - content: "url(" + ((theme.appLogoLight || theme.appLogoDark) ? getBackendURL()+"/public/"+ (theme.mode === "light" ? theme.appLogoLight || theme.appLogoDark : theme.appLogoDark || theme.appLogoLight ) : (theme.mode === "light" ? logo : logoDark)) + ")" + content: "url(" + (theme.mode === "light" ? theme.calculatedLogoLight() : theme.calculatedLogoDark()) + ")" + }, + ticketzLogoImg: { + width: "100%", + margin: "0 auto", + content: "url(" + (theme.mode === "light" ? logo : logoDark) + ")" }, textCenter: { textAlign: "center", @@ -47,6 +54,7 @@ const AboutModal = ({ open, onClose }) => { const classes = useStyles(); const { getCurrentUserInfo } = useAuth(); const [currentUser, setCurrentUser] = useState({}); + const [backendGitInfo, setBackendGitInfo] = useState(null); const theme = useTheme(); @@ -60,6 +68,12 @@ const AboutModal = ({ open, onClose }) => { setCurrentUser(user); } ); + + api.get("/").then( + (response) => { + setBackendGitInfo(response.data); + } + ) // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -68,7 +82,7 @@ const AboutModal = ({ open, onClose }) => { @@ -78,6 +92,34 @@ const AboutModal = ({ open, onClose }) => { { currentUser?.super ? <> +
+ +
+ Frontend: + { frontendGitInfo.tagName && `Version: ${frontendGitInfo.tagName} Build info: ${frontendGitInfo.buildTimestamp}` } + { !frontendGitInfo.tagName && + <> + {frontendGitInfo.commitHash && `Commit: {frontendGitInfo.commitHash} `} + {frontendGitInfo.branchName && `Branch: {frontendGitInfo.branchName} `} + {frontendGitInfo.commitTimestamp && `Time: {frontendGitInfo.commitTimestamp} `} + + } + + {backendGitInfo && + <> +
Backend: + { backendGitInfo.tagName && `Version: ${backendGitInfo.tagName} Build info: ${backendGitInfo.buildTimestamp}` } + { !backendGitInfo.tagName && + <> + {backendGitInfo.commitHash && `Commit: {backendGitInfo.commitHash} `} + {backendGitInfo.branchName && `Branch: {backendGitInfo.branchName} `} + {backendGitInfo.commitTimestamp && `Time: {backendGitInfo.commitTimestamp} `} + + } + + + } +
{i18n.t("about.aboutdetail")} {i18n.t("about.aboutauthorsite")} {i18n.t("about.aboutwhaticketsite")}