Scopes: Redirect to redirectUrl on selection (#112721)

* Add redirectUrl frontend functionality

* Add test

* Add e2e test suite

* Fix linting
This commit is contained in:
Tobias Skarhed
2025-10-22 09:16:58 +02:00
committed by GitHub
parent 8ab7a20265
commit b3d9fd677b
6 changed files with 255 additions and 23 deletions
+4
View File
@@ -19,6 +19,7 @@ export type TestScope = {
type?: string;
category?: string;
addLinks?: boolean;
redirectUrl?: string;
};
type ScopeDashboardBinding = Resource<ScopeDashboardBindingSpec, ScopeDashboardBindingStatus, 'ScopeDashboardBinding'>;
@@ -55,6 +56,9 @@ export async function scopeNodeChildrenRequest(
linkType: 'scope',
linkId: `scope-${scope.name}`,
}),
...(scope.redirectUrl && {
redirectUrl: scope.redirectUrl,
}),
},
})),
}),
+21
View File
@@ -105,3 +105,24 @@ export const testScopes = (scopeBindingSetting?: { uid: string; title: string })
},
];
};
export const testScopesWithRedirect = (): TestScope[] => {
return [
{
name: 'sn-redirect-custom',
title: 'Custom Redirect',
redirectUrl: '/d/cuj-dashboard-2', // Use existing dashboard
filters: [{ key: 'namespace', operator: 'equals', value: 'custom-redirect' }],
addLinks: true,
},
{
name: 'sn-redirect-fallback',
title: 'Fallback Navigation',
// No redirectUrl - should fall back to scope navigation
filters: [{ key: 'namespace', operator: 'equals', value: 'fallback-nav' }],
dashboardUid: 'cuj-dashboard-2', // Use existing dashboard
dashboardTitle: 'CUJ Dashboard 2',
addLinks: true,
},
];
};