Scopes: Redirect to redirectUrl on selection (#112721)
* Add redirectUrl frontend functionality * Add test * Add e2e test suite * Fix linting
This commit is contained in:
@@ -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,
|
||||
}),
|
||||
},
|
||||
})),
|
||||
}),
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user