From 008c82ba1b6d37d46dcad383b5698af60e70fd0d Mon Sep 17 00:00:00 2001 From: Nandini Singh Date: Mon, 2 Oct 2023 11:37:45 -0700 Subject: [PATCH] adding namespace to badges url Signed-off-by: Nandini Singh --- .../components/application-summary/application-summary.tsx | 5 ++++- ui/src/app/shared/components/badge-panel/badge-panel.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/src/app/applications/components/application-summary/application-summary.tsx b/ui/src/app/applications/components/application-summary/application-summary.tsx index 9072f650f5026..e2137acb52a93 100644 --- a/ui/src/app/applications/components/application-summary/application-summary.tsx +++ b/ui/src/app/applications/components/application-summary/application-summary.tsx @@ -15,7 +15,7 @@ import { RevisionHelpIcon } from '../../../shared/components'; import {BadgePanel, Spinner} from '../../../shared/components'; -import {Consumer, ContextApis} from '../../../shared/context'; +import {AuthSettingsCtx, Consumer, ContextApis} from '../../../shared/context'; import * as models from '../../../shared/models'; import {services} from '../../../shared/services'; @@ -49,6 +49,7 @@ export const ApplicationSummary = (props: ApplicationSummaryProps) => { const initialState = app.spec.destination.server === undefined ? 'NAME' : 'URL'; const [destFormat, setDestFormat] = React.useState(initialState); const [changeSync, setChangeSync] = React.useState(false); + const useAuthSettingsCtx = React.useContext(AuthSettingsCtx); const notificationSubscriptions = useEditNotificationSubscriptions(app.metadata.annotations || {}); const updateApp = notificationSubscriptions.withNotificationSubscriptions(props.updateApp); @@ -590,6 +591,8 @@ export const ApplicationSummary = (props: ApplicationSummaryProps) => { )} + + { +export const BadgePanel = ({app, project, appNamespace, nsEnabled}: {app?: string; project?: string, appNamespace?: string; nsEnabled?: boolean}) => { const [badgeType, setBadgeType] = React.useState('URL'); const context = React.useContext(Context); if (!app && !project) { @@ -20,6 +20,9 @@ export const BadgePanel = ({app, project}: {app?: string; project?: string}) => let alt = ''; if (app) { badgeURL = `${root}api/badge?name=${app}&revision=true`; + if (nsEnabled) { + badgeURL += `&namespace=${appNamespace}` + } entityURL = `${root}applications/${app}`; alt = 'App Status'; } else if (project) {