mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ShareModal: delete shareView query param from url (#92243)
This commit is contained in:
parent
733ae1f099
commit
2ad9d8cafe
@ -28,7 +28,16 @@ describe('dashboard utils', () => {
|
|||||||
expect(url).toBe('/d/dash-1/dash-1-slug/panel-edit/2?orgId=1&filter=A');
|
expect(url).toBe('/d/dash-1/dash-1-slug/panel-edit/2?orgId=1&filter=A');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can getUrl with params removed and addded', () => {
|
it('Can getURL without shareView param', async () => {
|
||||||
|
const url = getDashboardUrl({
|
||||||
|
uid: 'dash-1',
|
||||||
|
currentQueryParams: '?orgId=1&filter=A&shareView=link',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(url).toBe('/d/dash-1?orgId=1&filter=A');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Can getUrl with params removed and added', () => {
|
||||||
const url = getDashboardUrl({
|
const url = getDashboardUrl({
|
||||||
uid: 'dash-1',
|
uid: 'dash-1',
|
||||||
currentQueryParams: '?orgId=1&filter=A',
|
currentQueryParams: '?orgId=1&filter=A',
|
||||||
|
@ -62,6 +62,8 @@ export function getDashboardUrl(options: DashboardUrlOptions) {
|
|||||||
|
|
||||||
const params = options.currentQueryParams ? locationSearchToObject(options.currentQueryParams) : {};
|
const params = options.currentQueryParams ? locationSearchToObject(options.currentQueryParams) : {};
|
||||||
|
|
||||||
|
delete params['shareView'];
|
||||||
|
|
||||||
if (options.updateQuery) {
|
if (options.updateQuery) {
|
||||||
for (const key in options.updateQuery) {
|
for (const key in options.updateQuery) {
|
||||||
// removing params with null | undefined
|
// removing params with null | undefined
|
||||||
|
Loading…
Reference in New Issue
Block a user