@ -5,6 +5,7 @@ import coreModule from 'app/core/core_module';
import { appendQueryToUrl , toUrlParams } from 'app/core/utils/url' ;
import { appendQueryToUrl , toUrlParams } from 'app/core/utils/url' ;
import { sanitizeUrl } from 'app/core/utils/text' ;
import { sanitizeUrl } from 'app/core/utils/text' ;
import { getConfig } from 'app/core/config' ;
import { getConfig } from 'app/core/config' ;
import locationUtil from 'app/core/utils/location_util' ;
import { VariableSuggestion , VariableOrigin , DataLinkBuiltInVars } from '@grafana/ui' ;
import { VariableSuggestion , VariableOrigin , DataLinkBuiltInVars } from '@grafana/ui' ;
import {
import {
DataLink ,
DataLink ,
@ -216,7 +217,7 @@ export class LinkSrv implements LinkService {
constructor ( private templateSrv : TemplateSrv , private timeSrv : TimeSrv ) { }
constructor ( private templateSrv : TemplateSrv , private timeSrv : TimeSrv ) { }
getLinkUrl ( link : any ) {
getLinkUrl ( link : any ) {
const url = this . templateSrv . replace ( link . url || '' ) ;
let url = locationUtil . assureBaseUrl ( this . templateSrv . replace ( link . url || '' ) ) ;
const params : { [ key : string ] : any } = { } ;
const params : { [ key : string ] : any } = { } ;
if ( link . keepTime ) {
if ( link . keepTime ) {
@ -229,7 +230,8 @@ export class LinkSrv implements LinkService {
this . templateSrv . fillVariableValuesForUrl ( params ) ;
this . templateSrv . fillVariableValuesForUrl ( params ) ;
}
}
return appendQueryToUrl ( url , toUrlParams ( params ) ) ;
url = appendQueryToUrl ( url , toUrlParams ( params ) ) ;
return getConfig ( ) . disableSanitizeHtml ? url : sanitizeUrl ( url ) ;
}
}
getAnchorInfo ( link : any ) {
getAnchorInfo ( link : any ) {
@ -266,7 +268,7 @@ export class LinkSrv implements LinkService {
}
}
const info : LinkModel < T > = {
const info : LinkModel < T > = {
href : href.replace ( /\s|\n/g , '' ) ,
href : locationUtil.assureBaseUrl ( href . replace ( /\s|\n/g , '' ) ) ,
title : this.templateSrv.replace ( link . title || '' , scopedVars ) ,
title : this.templateSrv.replace ( link . title || '' , scopedVars ) ,
target : link.targetBlank ? '_blank' : '_self' ,
target : link.targetBlank ? '_blank' : '_self' ,
origin ,
origin ,