mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations panel: Remove subpath from dashboard links (#34134)
* fix(annolistpanel): strip base from url to prevent subpath duplication * fix(centrifuge): allow connections when served from subpath
This commit is contained in:
@@ -55,7 +55,7 @@ export class CentrifugeSrv implements GrafanaLiveSrv {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const baseURL = window.location.origin.replace('http', 'ws');
|
const baseURL = window.location.origin.replace('http', 'ws');
|
||||||
const liveUrl = `${baseURL}/${config.appSubUrl}api/live/ws`;
|
const liveUrl = `${baseURL}${config.appSubUrl}/api/live/ws`;
|
||||||
this.orgId = (window as any).grafanaBootData.user.orgId;
|
this.orgId = (window as any).grafanaBootData.user.orgId;
|
||||||
this.centrifuge = new Centrifuge(liveUrl, {
|
this.centrifuge = new Centrifuge(liveUrl, {
|
||||||
debug: true,
|
debug: true,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
// Types
|
// Types
|
||||||
import { AnnoOptions } from './types';
|
import { AnnoOptions } from './types';
|
||||||
import { AnnotationEvent, AppEvents, dateTime, DurationUnit, PanelProps } from '@grafana/data';
|
import { AnnotationEvent, AppEvents, dateTime, DurationUnit, locationUtil, PanelProps } from '@grafana/data';
|
||||||
import { getBackendSrv, getLocationSrv } from '@grafana/runtime';
|
import { getBackendSrv, locationService } from '@grafana/runtime';
|
||||||
import { AbstractList } from '@grafana/ui/src/components/List/AbstractList';
|
import { AbstractList } from '@grafana/ui/src/components/List/AbstractList';
|
||||||
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
@@ -121,10 +121,7 @@ export class AnnoListPanel extends PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current?.id === anno.dashboardId) {
|
if (current?.id === anno.dashboardId) {
|
||||||
getLocationSrv().update({
|
locationService.partial(params);
|
||||||
query: params,
|
|
||||||
partial: true,
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,10 +130,8 @@ export class AnnoListPanel extends PureComponent<Props, State> {
|
|||||||
.then((res: any[]) => {
|
.then((res: any[]) => {
|
||||||
if (res && res.length && res[0].id === anno.dashboardId) {
|
if (res && res.length && res[0].id === anno.dashboardId) {
|
||||||
const dash = res[0];
|
const dash = res[0];
|
||||||
getLocationSrv().update({
|
const newUrl = locationUtil.stripBaseFromUrl(dash.url);
|
||||||
query: params,
|
locationService.push(newUrl);
|
||||||
path: dash.url,
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appEvents.emit(AppEvents.alertWarning, ['Unknown Dashboard: ' + anno.dashboardId]);
|
appEvents.emit(AppEvents.alertWarning, ['Unknown Dashboard: ' + anno.dashboardId]);
|
||||||
|
|||||||
Reference in New Issue
Block a user