Skip to content

Commit

Permalink
Remove version from tab name (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschumpr authored Sep 12, 2024
2 parents 4cbdf94 + 4884a03 commit e682632
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- The url has been removed. As an alternative the link to the organisation can be added to the public files e.g. `info.md`.
- 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

Expand Down
2 changes: 1 addition & 1 deletion src/Geopilot.Frontend/cypress/e2e/helpers/appHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,19 @@ import { ContentType } from "../../api/apiInterfaces.ts";

export const AppSettingsContext = createContext<AppSettingsContextInterface>({
initialized: false,
version: undefined,
clientSettings: undefined,
termsOfUse: undefined,
});

export const AppSettingsProvider: FC<PropsWithChildren> = ({ children }) => {
const { fetchApi } = useApi();
const [clientSettings, setClientSettings] = useState<ClientSettings | null>();
const [backendVersion, setBackendVersion] = useState<string | null>();
const [termsOfUse, setTermsOfUse] = useState<string | null>();

useEffect(() => {
fetchApi<ClientSettings>("client-settings.json")
.then(setClientSettings)
.catch(() => setClientSettings(null));
fetchApi<string>("/api/v1/version")
.then(version => {
setBackendVersion(version.split("+")[0]);
})
.catch(() => setBackendVersion(null));
fetchApi<string>("terms-of-use.md", { responseType: ContentType.Markdown })
.then(setTermsOfUse)
.catch(() => setTermsOfUse(null));
Expand Down Expand Up @@ -59,14 +52,13 @@ export const AppSettingsProvider: FC<PropsWithChildren> = ({ children }) => {
}, [clientSettings]);

useEffect(() => {
document.title = "geopilot " + clientSettings?.application?.name + " " + backendVersion;
}, [backendVersion, clientSettings?.application?.name]);
document.title = "geopilot " + clientSettings?.application?.name;
}, [clientSettings?.application?.name]);

return (
<AppSettingsContext.Provider
value={{
initialized: clientSettings !== undefined && backendVersion !== undefined && termsOfUse !== undefined,
version: backendVersion,
initialized: clientSettings !== undefined && termsOfUse !== undefined,
clientSettings: clientSettings,
termsOfUse: termsOfUse,
}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export interface ClientSettings {

export interface AppSettingsContextInterface {
initialized: boolean;
version?: string | null;
clientSettings?: ClientSettings | null;
termsOfUse?: string | null;
}
Expand Down
6 changes: 5 additions & 1 deletion src/Geopilot.Frontend/src/pages/footer/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ export const About = () => {
const [info, setInfo] = useState<string>();
const [licenseInfo, setLicenseInfo] = useState<PackageList>();
const [licenseInfoCustom, setLicenseInfoCustom] = useState<PackageList>();
const [version, setVersion] = useState<string | null>();
const { fetchApi } = useApi();
const { version, termsOfUse } = useAppSettings();
const { termsOfUse } = useAppSettings();
const { hash } = useLocation();

useEffect(() => {
fetchApi<string>("info.md", { responseType: ContentType.Markdown }).then(setInfo);
fetchApi<PackageList>("license.json", { responseType: ContentType.Json }).then(setLicenseInfo);
fetchApi<PackageList>("license.custom.json", { responseType: ContentType.Json }).then(setLicenseInfoCustom);
fetchApi<string>("/api/v1/version").then(version => {
setVersion(version.split("+")[0]);
});
}, [fetchApi]);

useEffect(() => {
Expand Down

0 comments on commit e682632

Please sign in to comment.