diff --git a/internal/lookout/configuration/types.go b/internal/lookout/configuration/types.go index 8e8028c19e8..f617b71e2f6 100644 --- a/internal/lookout/configuration/types.go +++ b/internal/lookout/configuration/types.go @@ -8,6 +8,8 @@ import ( ) type LookoutUIConfig struct { + CustomTitle string + ArmadaApiBaseUrl string UserAnnotationPrefix string BinocularsEnabled bool diff --git a/internal/lookout/ui/src/App.tsx b/internal/lookout/ui/src/App.tsx index 6e603fed9b7..5b71cb2263b 100644 --- a/internal/lookout/ui/src/App.tsx +++ b/internal/lookout/ui/src/App.tsx @@ -1,4 +1,4 @@ -import React from "react" +import React, { useEffect } from "react" import { ThemeProvider as ThemeProviderV4, createTheme as createThemeV4, StylesProvider } from "@material-ui/core" import { createGenerateClassName } from "@material-ui/core/styles" @@ -61,6 +61,7 @@ const themeV4 = createThemeV4(theme) const themeV5 = createThemeV5(theme) type AppProps = { + customTitle: string jobService: JobService v2GetJobsService: IGetJobsService v2GroupJobsService: IGroupJobsService @@ -76,6 +77,11 @@ type AppProps = { } export function App(props: AppProps) { + useEffect(() => { + if (props.customTitle) { + document.title = `${props.customTitle} - Armada Lookout` + } + }, [props.customTitle]) return ( @@ -87,7 +93,7 @@ export function App(props: AppProps) { >
- +
} /> diff --git a/internal/lookout/ui/src/components/NavBar.tsx b/internal/lookout/ui/src/components/NavBar.tsx index b0f85884a59..1c0eb79a9b1 100644 --- a/internal/lookout/ui/src/components/NavBar.tsx +++ b/internal/lookout/ui/src/components/NavBar.tsx @@ -3,7 +3,7 @@ import React from "react" import { AppBar, Tab, Tabs, Toolbar, Typography } from "@material-ui/core" import { Link } from "react-router-dom" -import { PropsWithRouter, withRouter } from "../utils" +import { PropsWithRouter, Router, withRouter } from "../utils" import "./NavBar.css" @@ -49,7 +49,12 @@ function locationFromIndex(pages: Page[], index: number): string { return "/" } -function NavBar({ router }: PropsWithRouter) { +interface NavBarProps { + customTitle: string + router: Router +} + +function NavBar({ customTitle, router }: NavBarProps) { const currentLocation = router.location.pathname const currentValue = locationMap.has(currentLocation) ? locationMap.get(currentLocation) : 0 return ( @@ -60,6 +65,11 @@ function NavBar({ router }: PropsWithRouter) { Lookout + {customTitle && ( + + {customTitle} + + )}
{ debugEnabled: queryParams.has("debug"), fakeDataEnabled: queryParams.has("fakeData"), lookoutV2ApiBaseUrl: "", + customTitle: "", } try { @@ -51,6 +53,7 @@ export async function getUIConfig(): Promise { if (json.JobSetsAutoRefreshMs) config.jobSetsAutoRefreshMs = json.JobSetsAutoRefreshMs if (json.JobsAutoRefreshMs) config.jobsAutoRefreshMs = json.JobsAutoRefreshMs if (json.LookoutV2ApiBaseUrl) config.lookoutV2ApiBaseUrl = json.LookoutV2ApiBaseUrl + if (json.CustomTitle) config.customTitle = json.CustomTitle } catch (e) { console.error(e) }