mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Panel: will fix so the correct links is generated to the panel view. (#24301)
* fixed a couple of bad links. * adjusted so we use the correct type of links. * cleaning up links regarding edit/viewing panels. * fixing edit link. * reverted back to panelId for the image urls. * reverted back. * remvoed the editPanel: null since it is obsolete.
This commit is contained in:
parent
2284f46edb
commit
67b4c84399
@ -67,7 +67,7 @@ class DashNav extends PureComponent<Props> {
|
||||
|
||||
onClose = () => {
|
||||
this.props.updateLocation({
|
||||
query: { edit: null, viewPanel: null },
|
||||
query: { viewPanel: null },
|
||||
partial: true,
|
||||
});
|
||||
};
|
||||
|
@ -95,7 +95,7 @@ describe('ShareModal', () => {
|
||||
|
||||
it('should generate share url absolute time', () => {
|
||||
const state = ctx.wrapper?.state();
|
||||
expect(state?.shareUrl).toBe('http://server/#!/test?from=1000&to=2000&orgId=1&panelId=22&fullscreen');
|
||||
expect(state?.shareUrl).toBe('http://server/#!/test?from=1000&to=2000&orgId=1&viewPanel=22');
|
||||
});
|
||||
|
||||
it('should generate render url', () => {
|
||||
@ -139,25 +139,14 @@ describe('ShareModal', () => {
|
||||
expect(state?.shareUrl).toBe('http://server/#!/test?from=1000&to=2000&orgId=1&theme=light');
|
||||
});
|
||||
|
||||
it('should remove fullscreen from image url when is first param in querystring and modeSharePanel is true', () => {
|
||||
mockLocationHref('http://server/#!/test?fullscreen&edit');
|
||||
it('should remove editPanel from image url when is first param in querystring', () => {
|
||||
mockLocationHref('http://server/#!/test?editPanel=1');
|
||||
ctx.mount({
|
||||
panel: { id: 1, options: {}, fieldConfig: { defaults: {}, overrides: [] } },
|
||||
});
|
||||
|
||||
const state = ctx.wrapper?.state();
|
||||
expect(state?.shareUrl).toContain('?fullscreen&edit&from=1000&to=2000&orgId=1&panelId=1');
|
||||
expect(state?.imageUrl).toContain('?from=1000&to=2000&orgId=1&panelId=1&width=1000&height=500&tz=UTC');
|
||||
});
|
||||
|
||||
it('should remove edit from image url when is first param in querystring and modeSharePanel is true', () => {
|
||||
mockLocationHref('http://server/#!/test?edit&fullscreen');
|
||||
ctx.mount({
|
||||
panel: { id: 1, options: {}, fieldConfig: { defaults: {}, overrides: [] } },
|
||||
});
|
||||
|
||||
const state = ctx.wrapper?.state();
|
||||
expect(state?.shareUrl).toContain('?edit&fullscreen&from=1000&to=2000&orgId=1&panelId=1');
|
||||
expect(state?.shareUrl).toContain('?editPanel=1&from=1000&to=2000&orgId=1');
|
||||
expect(state?.imageUrl).toContain('?from=1000&to=2000&orgId=1&panelId=1&width=1000&height=500&tz=UTC');
|
||||
});
|
||||
|
||||
|
@ -29,12 +29,10 @@ export function buildParams(
|
||||
params.theme = selectedTheme;
|
||||
}
|
||||
|
||||
if (panel) {
|
||||
params.panelId = panel.id;
|
||||
params.fullscreen = true;
|
||||
if (panel && !params.editPanel) {
|
||||
params.viewPanel = panel.id;
|
||||
} else {
|
||||
delete params.panelId;
|
||||
delete params.fullscreen;
|
||||
delete params.viewPanel;
|
||||
}
|
||||
|
||||
return params;
|
||||
@ -74,8 +72,11 @@ export function buildSoloUrl(
|
||||
|
||||
let soloUrl = baseUrl.replace(config.appSubUrl + '/dashboard/', config.appSubUrl + '/dashboard-solo/');
|
||||
soloUrl = soloUrl.replace(config.appSubUrl + '/d/', config.appSubUrl + '/d-solo/');
|
||||
delete params.fullscreen;
|
||||
delete params.edit;
|
||||
|
||||
params.panelId = params.editPanel ?? params.viewPanel;
|
||||
delete params.editPanel;
|
||||
delete params.viewPanel;
|
||||
|
||||
return urlUtil.appendQueryToUrl(soloUrl, urlUtil.toUrlParams(params));
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,8 @@ export class DashboardPage extends PureComponent<Props, State> {
|
||||
// Clear url state
|
||||
this.props.updateLocation({
|
||||
query: {
|
||||
edit: null,
|
||||
fullscreen: null,
|
||||
panelId: null,
|
||||
editPanel: null,
|
||||
viewPanel: null,
|
||||
},
|
||||
partial: true,
|
||||
});
|
||||
|
@ -177,7 +177,7 @@ export class DashboardQueryEditor extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
// Same as current URL, but different panelId
|
||||
const editURL = `d/${dashboard.uid}/${dashboard.title}?&fullscreen&edit&panelId=${query.panelId}`;
|
||||
const editURL = `d/${dashboard.uid}/${dashboard.title}?&editPanel=${query.panelId}`;
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<div class="alert-rule-item__body">
|
||||
<div class="alert-rule-item__header">
|
||||
<p class="alert-rule-item__name">
|
||||
<a href="{{alert.url}}?panelId={{alert.panelId}}&fullscreen&edit&tab=alert">
|
||||
<a href="{{alert.url}}?editPanel={{alert.panelId}}&tab=alert">
|
||||
{{alert.name}}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -118,8 +118,7 @@ export class AnnoListPanel extends PureComponent<Props, State> {
|
||||
};
|
||||
|
||||
if (options.navigateToPanel) {
|
||||
params.panelId = anno.panelId;
|
||||
params.fullscreen = true;
|
||||
params.viewPanel = anno.panelId;
|
||||
}
|
||||
|
||||
if (current.id === anno.dashboardId) {
|
||||
|
Loading…
Reference in New Issue
Block a user