mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove endpoints that contain the slug field (#35104)
* Chore: Remove endpoints that contain the slug field * More cleanups * Lint fixes * Remove unnecessary funcs * Cleanup frontend code * Remove deprecated endpoints from docs * Revert change according to reviewer's comments
This commit is contained in:
committed by
GitHub
parent
aa4c5bbfe4
commit
1c49986b2f
@@ -34,23 +34,6 @@ export interface InitDashboardArgs {
|
||||
fixUrl: boolean;
|
||||
}
|
||||
|
||||
async function redirectToNewUrl(slug: string) {
|
||||
const res = await backendSrv.getDashboardBySlug(slug);
|
||||
|
||||
if (res) {
|
||||
const location = locationService.getLocation();
|
||||
let newUrl = res.meta.url;
|
||||
|
||||
// fix solo route urls
|
||||
if (location.pathname.indexOf('dashboard-solo') !== -1) {
|
||||
newUrl = newUrl.replace('/d/', '/d-solo/');
|
||||
}
|
||||
|
||||
const url = locationUtil.stripBaseFromUrl(newUrl);
|
||||
locationService.replace(url);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchDashboard(
|
||||
args: InitDashboardArgs,
|
||||
dispatch: ThunkDispatch,
|
||||
@@ -76,12 +59,6 @@ async function fetchDashboard(
|
||||
return dashDTO;
|
||||
}
|
||||
case DashboardRoutes.Normal: {
|
||||
// for old db routes we redirect
|
||||
if (args.urlType === 'db') {
|
||||
redirectToNewUrl(args.urlSlug!);
|
||||
return null;
|
||||
}
|
||||
|
||||
const dashDTO: DashboardDTO = await dashboardLoaderSrv.loadDashboard(args.urlType, args.urlSlug, args.urlUid);
|
||||
|
||||
if (args.fixUrl && dashDTO.meta.url) {
|
||||
|
||||
Reference in New Issue
Block a user