mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #15455 from grafana/fixed-handling-of-alert-urls
Fixed handling of alert urls with true flags
This commit is contained in:
commit
1adc1a6097
@ -104,7 +104,7 @@ func (c *EvalContext) GetDashboardUID() (*m.DashboardRef, error) {
|
||||
return c.dashboardRef, nil
|
||||
}
|
||||
|
||||
const urlFormat = "%s?fullscreen=true&edit=true&tab=alert&panelId=%d&orgId=%d"
|
||||
const urlFormat = "%s?fullscreen&edit&tab=alert&panelId=%d&orgId=%d"
|
||||
|
||||
func (c *EvalContext) GetRuleUrl() (string, error) {
|
||||
if c.IsTestRun {
|
||||
|
@ -29,7 +29,7 @@ class AlertRuleItem extends PureComponent<Props> {
|
||||
'fa-pause': rule.state !== 'paused',
|
||||
});
|
||||
|
||||
const ruleUrl = `${rule.url}?panelId=${rule.panelId}&fullscreen=true&edit=true&tab=alert`;
|
||||
const ruleUrl = `${rule.url}?panelId=${rule.panelId}&fullscreen&edit&tab=alert`;
|
||||
|
||||
return (
|
||||
<li className="alert-rule-item">
|
||||
|
@ -21,7 +21,7 @@ exports[`Render should render component 1`] = `
|
||||
className="alert-rule-item__name"
|
||||
>
|
||||
<a
|
||||
href="https://something.something.darkside?panelId=1&fullscreen=true&edit=true&tab=alert"
|
||||
href="https://something.something.darkside?panelId=1&fullscreen&edit&tab=alert"
|
||||
>
|
||||
<Highlighter
|
||||
highlightClassName="highlight-search-match"
|
||||
@ -73,7 +73,7 @@ exports[`Render should render component 1`] = `
|
||||
</button>
|
||||
<a
|
||||
className="btn btn-small btn-inverse alert-list__btn width-2"
|
||||
href="https://something.something.darkside?panelId=1&fullscreen=true&edit=true&tab=alert"
|
||||
href="https://something.something.darkside?panelId=1&fullscreen&edit&tab=alert"
|
||||
title="Edit alert rule"
|
||||
>
|
||||
<i
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { DashboardPage, Props, State } from './DashboardPage';
|
||||
import { DashboardPage, Props, State, mapStateToProps } from './DashboardPage';
|
||||
import { DashboardModel } from '../state';
|
||||
import { cleanUpDashboard } from '../state/actions';
|
||||
import { getNoPayloadActionCreatorMock, NoPayloadActionCreatorMock } from 'app/core/redux';
|
||||
@ -250,4 +250,36 @@ describe('DashboardPage', () => {
|
||||
expect(ctx.cleanUpDashboardMock.calls).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('mapStateToProps with bool fullscreen', () => {
|
||||
const props = mapStateToProps({
|
||||
location: {
|
||||
routeParams: {},
|
||||
query: {
|
||||
fullscreen: true,
|
||||
edit: false,
|
||||
},
|
||||
},
|
||||
dashboard: {},
|
||||
} as any);
|
||||
|
||||
expect(props.urlFullscreen).toBe(true);
|
||||
expect(props.urlEdit).toBe(false);
|
||||
});
|
||||
|
||||
describe('mapStateToProps with string edit true', () => {
|
||||
const props = mapStateToProps({
|
||||
location: {
|
||||
routeParams: {},
|
||||
query: {
|
||||
fullscreen: false,
|
||||
edit: 'true',
|
||||
},
|
||||
},
|
||||
dashboard: {},
|
||||
} as any);
|
||||
|
||||
expect(props.urlFullscreen).toBe(false);
|
||||
expect(props.urlEdit).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -284,15 +284,15 @@ export class DashboardPage extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: StoreState) => ({
|
||||
export const mapStateToProps = (state: StoreState) => ({
|
||||
urlUid: state.location.routeParams.uid,
|
||||
urlSlug: state.location.routeParams.slug,
|
||||
urlType: state.location.routeParams.type,
|
||||
editview: state.location.query.editview,
|
||||
urlPanelId: state.location.query.panelId,
|
||||
urlFolderId: state.location.query.folderId,
|
||||
urlFullscreen: state.location.query.fullscreen === true,
|
||||
urlEdit: state.location.query.edit === true,
|
||||
urlFullscreen: !!state.location.query.fullscreen,
|
||||
urlEdit: !!state.location.query.edit,
|
||||
initPhase: state.dashboard.initPhase,
|
||||
isInitSlow: state.dashboard.isInitSlow,
|
||||
initError: state.dashboard.initError,
|
||||
|
Loading…
Reference in New Issue
Block a user