Skip to content

Commit b1d227b

Browse files
fix: separate path and query params
1 parent a0ab60d commit b1d227b

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

web/src/components/dashboards/legacy/legacy-dashboard-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const LegacyDashboardsPage_: FC<LegacyDashboardsPageProps> = ({ urlBoard }) => {
5858
const LegacyDashboardsPageWithFallback = withFallback(LegacyDashboardsPage_);
5959

6060
export const MpCmoLegacyDashboardsPage: FC = () => {
61-
const params = useParams<{ ns?: string; dashboardName: string }>();
61+
const params = useParams<{ dashboardName: string }>();
6262

6363
return (
6464
<MonitoringProvider monitoringContext={{ plugin: 'monitoring-plugin', prometheus: 'cmo' }}>

web/src/components/dashboards/legacy/useLegacyDashboards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const useLegacyDashboards = (namespace: string, urlBoard: string) => {
124124
const queryArguments = getAllQueryArguments();
125125
const params = new URLSearchParams(queryArguments);
126126

127-
const url = getLegacyDashboardsUrl(perspective, newBoard) + params.toString();
127+
const url = `${getLegacyDashboardsUrl(perspective, newBoard)}?${params.toString()}`;
128128

129129
if (newBoard !== urlBoard || initialLoad) {
130130
if (params.get(QueryParams.Dashboard) !== newBoard) {

web/src/components/dashboards/legacy/useOpenshiftProject.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ export const useOpenshiftProject = () => {
2727
// set the activeNamespace to match the URL parameter
2828
if (openshiftProject && openshiftProject !== activeNamespace) {
2929
setActiveNamespace(openshiftProject);
30-
if (variableNamespace !== openshiftProject) {
30+
if (variableNamespace !== openshiftProject && openshiftProject !== ALL_NAMESPACES_KEY) {
3131
dispatch(
3232
dashboardsPatchVariable('namespace', {
3333
// Dashboards space variable shouldn't use the ALL_NAMESPACES_KEY
34-
value: openshiftProject === ALL_NAMESPACES_KEY ? '' : openshiftProject,
34+
value: openshiftProject,
3535
}),
3636
);
3737
}
3838
return;
3939
}
4040
if (!openshiftProject) {
4141
setOpenshiftProject(activeNamespace);
42-
if (variableNamespace !== activeNamespace) {
42+
if (variableNamespace !== activeNamespace && openshiftProject !== ALL_NAMESPACES_KEY) {
4343
// Dashboards space variable shouldn't use the ALL_NAMESPACES_KEY
4444
dispatch(
4545
dashboardsPatchVariable('namespace', {
46-
value: activeNamespace === ALL_NAMESPACES_KEY ? '' : activeNamespace,
46+
value: activeNamespace,
4747
}),
4848
);
4949
}

0 commit comments

Comments
 (0)