Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
1adc1a60
Unverified
Commit
1adc1a60
authored
Feb 15, 2019
by
Torkel Ödegaard
Committed by
GitHub
Feb 15, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15455 from grafana/fixed-handling-of-alert-urls
Fixed handling of alert urls with true flags
parents
4c28ec83
7699706e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
8 deletions
+40
-8
pkg/services/alerting/eval_context.go
+1
-1
public/app/features/alerting/AlertRuleItem.tsx
+1
-1
public/app/features/alerting/__snapshots__/AlertRuleItem.test.tsx.snap
+2
-2
public/app/features/dashboard/containers/DashboardPage.test.tsx
+33
-1
public/app/features/dashboard/containers/DashboardPage.tsx
+3
-3
No files found.
pkg/services/alerting/eval_context.go
View file @
1adc1a60
...
@@ -104,7 +104,7 @@ func (c *EvalContext) GetDashboardUID() (*m.DashboardRef, error) {
...
@@ -104,7 +104,7 @@ func (c *EvalContext) GetDashboardUID() (*m.DashboardRef, error) {
return
c
.
dashboardRef
,
nil
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
)
{
func
(
c
*
EvalContext
)
GetRuleUrl
()
(
string
,
error
)
{
if
c
.
IsTestRun
{
if
c
.
IsTestRun
{
...
...
public/app/features/alerting/AlertRuleItem.tsx
View file @
1adc1a60
...
@@ -29,7 +29,7 @@ class AlertRuleItem extends PureComponent<Props> {
...
@@ -29,7 +29,7 @@ class AlertRuleItem extends PureComponent<Props> {
'fa-pause'
:
rule
.
state
!==
'paused'
,
'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
(
return
(
<
li
className=
"alert-rule-item"
>
<
li
className=
"alert-rule-item"
>
...
...
public/app/features/alerting/__snapshots__/AlertRuleItem.test.tsx.snap
View file @
1adc1a60
...
@@ -21,7 +21,7 @@ exports[`Render should render component 1`] = `
...
@@ -21,7 +21,7 @@ exports[`Render should render component 1`] = `
className="alert-rule-item__name"
className="alert-rule-item__name"
>
>
<a
<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
<Highlighter
highlightClassName="highlight-search-match"
highlightClassName="highlight-search-match"
...
@@ -73,7 +73,7 @@ exports[`Render should render component 1`] = `
...
@@ -73,7 +73,7 @@ exports[`Render should render component 1`] = `
</button>
</button>
<a
<a
className="btn btn-small btn-inverse alert-list__btn width-2"
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"
title="Edit alert rule"
>
>
<i
<i
...
...
public/app/features/dashboard/containers/DashboardPage.test.tsx
View file @
1adc1a60
import
React
from
'react'
;
import
React
from
'react'
;
import
{
shallow
,
ShallowWrapper
}
from
'enzyme'
;
import
{
shallow
,
ShallowWrapper
}
from
'enzyme'
;
import
{
DashboardPage
,
Props
,
State
}
from
'./DashboardPage'
;
import
{
DashboardPage
,
Props
,
State
,
mapStateToProps
}
from
'./DashboardPage'
;
import
{
DashboardModel
}
from
'../state'
;
import
{
DashboardModel
}
from
'../state'
;
import
{
cleanUpDashboard
}
from
'../state/actions'
;
import
{
cleanUpDashboard
}
from
'../state/actions'
;
import
{
getNoPayloadActionCreatorMock
,
NoPayloadActionCreatorMock
}
from
'app/core/redux'
;
import
{
getNoPayloadActionCreatorMock
,
NoPayloadActionCreatorMock
}
from
'app/core/redux'
;
...
@@ -250,4 +250,36 @@ describe('DashboardPage', () => {
...
@@ -250,4 +250,36 @@ describe('DashboardPage', () => {
expect
(
ctx
.
cleanUpDashboardMock
.
calls
).
toBe
(
1
);
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
);
});
});
});
public/app/features/dashboard/containers/DashboardPage.tsx
View file @
1adc1a60
...
@@ -284,15 +284,15 @@ export class DashboardPage extends PureComponent<Props, State> {
...
@@ -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
,
urlUid
:
state
.
location
.
routeParams
.
uid
,
urlSlug
:
state
.
location
.
routeParams
.
slug
,
urlSlug
:
state
.
location
.
routeParams
.
slug
,
urlType
:
state
.
location
.
routeParams
.
type
,
urlType
:
state
.
location
.
routeParams
.
type
,
editview
:
state
.
location
.
query
.
editview
,
editview
:
state
.
location
.
query
.
editview
,
urlPanelId
:
state
.
location
.
query
.
panelId
,
urlPanelId
:
state
.
location
.
query
.
panelId
,
urlFolderId
:
state
.
location
.
query
.
folderId
,
urlFolderId
:
state
.
location
.
query
.
folderId
,
urlFullscreen
:
state
.
location
.
query
.
fullscreen
===
true
,
urlFullscreen
:
!!
state
.
location
.
query
.
fullscreen
,
urlEdit
:
state
.
location
.
query
.
edit
===
true
,
urlEdit
:
!!
state
.
location
.
query
.
edit
,
initPhase
:
state
.
dashboard
.
initPhase
,
initPhase
:
state
.
dashboard
.
initPhase
,
isInitSlow
:
state
.
dashboard
.
isInitSlow
,
isInitSlow
:
state
.
dashboard
.
isInitSlow
,
initError
:
state
.
dashboard
.
initError
,
initError
:
state
.
dashboard
.
initError
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment