"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/grafana-data/src/utils/location.ts" between
grafana-8.0.0.tar.gz and grafana-8.0.1.tar.gz

About: Grafana is a visualization tool for monitoring, metric analytics and dashboards for Graphite, InfluxDB, Prometheus and many more.

location.ts  (grafana-8.0.0):location.ts  (grafana-8.0.1)
skipping to change at line 20 skipping to change at line 20
* *
* @param url * @param url
* @internal * @internal
*/ */
const stripBaseFromUrl = (url: string): string => { const stripBaseFromUrl = (url: string): string => {
const appSubUrl = grafanaConfig.appSubUrl ?? ''; const appSubUrl = grafanaConfig.appSubUrl ?? '';
const stripExtraChars = appSubUrl.endsWith('/') ? 1 : 0; const stripExtraChars = appSubUrl.endsWith('/') ? 1 : 0;
const isAbsoluteUrl = url.startsWith('http'); const isAbsoluteUrl = url.startsWith('http');
let segmentToStrip = appSubUrl; let segmentToStrip = appSubUrl;
if (isAbsoluteUrl || !url.startsWith('/')) { if (!url.startsWith('/')) {
segmentToStrip = `${window.location.origin}${appSubUrl}`; segmentToStrip = `${window.location.origin}${appSubUrl}`;
} }
return url.length > 0 && url.indexOf(segmentToStrip) !== -1 if (isAbsoluteUrl) {
? url.slice(segmentToStrip.length - stripExtraChars) segmentToStrip = url.startsWith(`${window.location.origin}${appSubUrl}`)
: url; ? `${window.location.origin}${appSubUrl}`
: `${window.location.origin}`;
}
return url.length > 0 && url.indexOf(segmentToStrip) === 0 ? url.slice(segment
ToStrip.length - stripExtraChars) : url;
}; };
/** /**
* *
* @param url * @param url
* @internal * @internal
*/ */
const assureBaseUrl = (url: string): string => { const assureBaseUrl = (url: string): string => {
if (url.startsWith('/')) { if (url.startsWith('/')) {
return `${grafanaConfig.appSubUrl}${stripBaseFromUrl(url)}`; return `${grafanaConfig.appSubUrl}${stripBaseFromUrl(url)}`;
 End of changes. 2 change blocks. 
4 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)