Skip to content

Commit

Permalink
Add environment string to admin tool applications dashboard and bestb…
Browse files Browse the repository at this point in the history
…et too
  • Loading branch information
johnnadeluy committed Jul 17, 2024
1 parent b5563b0 commit be39b9b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/admin/tools/bestbet/bestbet.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html data-th-lang="no">
<head>
<meta charset="UTF-8"></meta>
<title>SSB Best bet</title>
<title data-th-utext="${title}" />
<meta http-equiv="Cache-control" content="NO-CACHE"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
<link rel="stylesheet"
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/admin/tools/bestbet/bestbet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { localize } from '/lib/xp/i18n'
import { getToolUrl } from '/lib/xp/admin'
import { render } from '/lib/thymeleaf'
import { getMainSubjects } from '/lib/ssb/utils/subjectUtils'
import { parseContributions } from '/lib/ssb/utils/utils'
import { getEnvironmentString, parseContributions } from '/lib/ssb/utils/utils'
import { type DropdownItems } from '/lib/types/components'
import { render as r4XpRender } from '/lib/enonic/react4xp'

Expand Down Expand Up @@ -114,10 +114,12 @@ function renderPart(req: XP.Request): XP.Response {
}
)

const environmentString = getEnvironmentString()
return {
body: render(view, {
...getAssets(),
pageContributions: parseContributions(bestBetComponent.pageContributions),
title: `${environmentString ? `${environmentString}: ` : ''}SSB Bestbet`,
}),
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/admin/tools/dashboard/dashboard.es6
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assetUrl, serviceUrl } from '/lib/xp/portal'
import { getUser, hasRole } from '/lib/xp/auth'
import { getToolUrl } from '/lib/xp/admin'
import { parseContributions } from '/lib/ssb/utils/utils'
import { parseContributions, getEnvironmentString } from '/lib/ssb/utils/utils'

import { render } from '/lib/thymeleaf'
import { renderError } from '/lib/ssb/error/error'
Expand Down Expand Up @@ -53,6 +53,7 @@ function renderPart(req) {
statisticRegister: userHasAdmin,
}

const environmentString = getEnvironmentString()
const dashboardDataset = new React4xp('DashboardEntry')
.setProps({
user,
Expand All @@ -63,6 +64,7 @@ function renderPart(req) {
internalStatbankUrl: `${INTERNAL_STATBANK_URL}`,
statregRapportUrl: `${STATREG_RAPPORT_URL}`,
toggleDebugging: isEnabled('dashboard-redux-logging-debugging', true, 'ssb'),
title: `${environmentString ? `${environmentString}: ` : ''}SSB Dashboard`,
})
.setId('dashboard')

Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/react4xp/_entries/DashboardEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function Dashboard(props: DashboardProps) {
internalBaseUrl={props.internalBaseUrl}
internalStatbankUrl={props.internalStatbankUrl}
statregRapportUrl={props.statregRapportUrl}
title={props.title}
/>
</HelmetProvider>
</WebsocketProvider>
Expand All @@ -58,6 +59,7 @@ interface DashboardRouterProps {
internalBaseUrl?: string
internalStatbankUrl?: string
statregRapportUrl?: string
title: string
}

function DashboardRouter(props: DashboardRouterProps) {
Expand Down Expand Up @@ -101,7 +103,7 @@ function DashboardRouter(props: DashboardRouterProps) {
requestServerTime(dispatch, io)
return (
<BrowserRouter>
<Helmet titleTemplate='SSB Dashboard' defaultTitle='SSB Dashboard'></Helmet>
<Helmet titleTemplate={props.title} defaultTitle={props.title}></Helmet>

<Switch>
<Route path='/' component={HomePage} />
Expand Down

0 comments on commit be39b9b

Please sign in to comment.