From 25019ef021ff2df128b80eea92a332cdf836e3bc Mon Sep 17 00:00:00 2001 From: tschumpr Date: Thu, 12 Sep 2024 15:15:19 +0200 Subject: [PATCH 1/2] Remove version from tab name --- CHANGELOG.md | 1 + .../components/appSettings/appSettingsContext.tsx | 14 +++----------- .../components/appSettings/appSettingsInterface.ts | 1 - src/Geopilot.Frontend/src/pages/footer/about.tsx | 6 +++++- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cda1281e..3dadf923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - The application name is always _geopilot_. With `name` the application name can be extended, e.g. to _geopilot Test_. - There is only one `logo` which is used for the header. - Optionally a separate `faviconDark` can be defined for dark mode of the browser. +- Removed API version from tab name. ## v1.0.93 - 2024-05-14 diff --git a/src/Geopilot.Frontend/src/components/appSettings/appSettingsContext.tsx b/src/Geopilot.Frontend/src/components/appSettings/appSettingsContext.tsx index fc6f54a4..b8ebb135 100644 --- a/src/Geopilot.Frontend/src/components/appSettings/appSettingsContext.tsx +++ b/src/Geopilot.Frontend/src/components/appSettings/appSettingsContext.tsx @@ -5,7 +5,6 @@ import { ContentType } from "../../api/apiInterfaces.ts"; export const AppSettingsContext = createContext({ initialized: false, - version: undefined, clientSettings: undefined, termsOfUse: undefined, }); @@ -13,18 +12,12 @@ export const AppSettingsContext = createContext({ export const AppSettingsProvider: FC = ({ children }) => { const { fetchApi } = useApi(); const [clientSettings, setClientSettings] = useState(); - const [backendVersion, setBackendVersion] = useState(); const [termsOfUse, setTermsOfUse] = useState(); useEffect(() => { fetchApi("client-settings.json") .then(setClientSettings) .catch(() => setClientSettings(null)); - fetchApi("/api/v1/version") - .then(version => { - setBackendVersion(version.split("+")[0]); - }) - .catch(() => setBackendVersion(null)); fetchApi("terms-of-use.md", { responseType: ContentType.Markdown }) .then(setTermsOfUse) .catch(() => setTermsOfUse(null)); @@ -59,14 +52,13 @@ export const AppSettingsProvider: FC = ({ children }) => { }, [clientSettings]); useEffect(() => { - document.title = "geopilot " + clientSettings?.application?.name + " " + backendVersion; - }, [backendVersion, clientSettings?.application?.name]); + document.title = "geopilot " + clientSettings?.application?.name; + }, [clientSettings?.application?.name]); return ( diff --git a/src/Geopilot.Frontend/src/components/appSettings/appSettingsInterface.ts b/src/Geopilot.Frontend/src/components/appSettings/appSettingsInterface.ts index 5ddef422..9954fa4b 100644 --- a/src/Geopilot.Frontend/src/components/appSettings/appSettingsInterface.ts +++ b/src/Geopilot.Frontend/src/components/appSettings/appSettingsInterface.ts @@ -18,7 +18,6 @@ export interface ClientSettings { export interface AppSettingsContextInterface { initialized: boolean; - version?: string | null; clientSettings?: ClientSettings | null; termsOfUse?: string | null; } diff --git a/src/Geopilot.Frontend/src/pages/footer/about.tsx b/src/Geopilot.Frontend/src/pages/footer/about.tsx index e0b43c44..d6e26226 100644 --- a/src/Geopilot.Frontend/src/pages/footer/about.tsx +++ b/src/Geopilot.Frontend/src/pages/footer/about.tsx @@ -32,14 +32,18 @@ export const About = () => { const [info, setInfo] = useState(); const [licenseInfo, setLicenseInfo] = useState(); const [licenseInfoCustom, setLicenseInfoCustom] = useState(); + const [version, setVersion] = useState(); const { fetchApi } = useApi(); - const { version, termsOfUse } = useAppSettings(); + const { termsOfUse } = useAppSettings(); const { hash } = useLocation(); useEffect(() => { fetchApi("info.md", { responseType: ContentType.Markdown }).then(setInfo); fetchApi("license.json", { responseType: ContentType.Json }).then(setLicenseInfo); fetchApi("license.custom.json", { responseType: ContentType.Json }).then(setLicenseInfoCustom); + fetchApi("/api/v1/version").then(version => { + setVersion(version.split("+")[0]); + }); }, [fetchApi]); useEffect(() => { From 4884a03b5ab26a894872b11bf36fdcca0338e560 Mon Sep 17 00:00:00 2001 From: tschumpr Date: Thu, 12 Sep 2024 15:27:23 +0200 Subject: [PATCH 2/2] Fix tests --- src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js b/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js index 1761910c..7d0ab576 100644 --- a/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js +++ b/src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js @@ -18,7 +18,7 @@ export const login = user => { () => { cy.intercept("http://localhost:4011/realms/geopilot/protocol/openid-connect/token").as("token"); cy.visit("/"); - cy.wait("@version"); + cy.wait("@termsOfUse"); cy.get('[data-cy="logIn-button"]').click(); cy.origin("http://localhost:4011", { args: { user } }, ({ user }) => { cy.get("#username").type(user);