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
08ac2959
Commit
08ac2959
authored
Jan 10, 2019
by
Peter Holmberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving to grafana ui, fix issue with TestRuleResult
parent
7e106b0f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
28 deletions
+28
-28
packages/grafana-ui/src/components/LoadingPlaceholder/LoadingPlaceholder.tsx
+11
-0
packages/grafana-ui/src/components/index.ts
+1
-0
public/app/features/alerting/AlertTab.tsx
+6
-15
public/app/features/alerting/TestRuleButton.test.tsx
+3
-3
public/app/features/alerting/TestRuleResult.tsx
+4
-2
public/app/features/dashboard/dashgrid/QueriesTab.tsx
+3
-8
No files found.
packages/grafana-ui/src/components/LoadingPlaceholder/LoadingPlaceholder.tsx
0 → 100644
View file @
08ac2959
import
React
,
{
SFC
}
from
'react'
;
interface
LoadingPlaceholderProps
{
text
:
string
;
}
export
const
LoadingPlaceholder
:
SFC
<
LoadingPlaceholderProps
>
=
({
text
})
=>
(
<
div
className=
"gf-form-group"
>
{
text
}
<
i
className=
"fa fa-spinner fa-spin"
/>
</
div
>
);
packages/grafana-ui/src/components/index.ts
View file @
08ac2959
...
...
@@ -2,3 +2,4 @@ export { DeleteButton } from './DeleteButton/DeleteButton';
export
{
Tooltip
}
from
'./Tooltip/Tooltip'
;
export
{
Portal
}
from
'./Portal/Portal'
;
export
{
CustomScrollbar
}
from
'./CustomScrollbar/CustomScrollbar'
;
export
{
LoadingPlaceholder
}
from
'./LoadingPlaceholder/LoadingPlaceholder'
;
public/app/features/alerting/AlertTab.tsx
View file @
08ac2959
// Libraries
import
React
,
{
PureComponent
,
SFC
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
// Services & Utils
import
{
AngularComponent
,
getAngularLoader
}
from
'app/core/services/AngularLoader'
;
import
appEvents
from
'app/core/app_events'
;
// Components
import
{
LoadingPlaceholder
}
from
'@grafana/ui'
;
import
{
EditorTabBody
,
EditorToolbarView
}
from
'../dashboard/dashgrid/EditorTabBody'
;
import
EmptyListCTA
from
'app/core/components/EmptyListCTA/EmptyListCTA'
;
import
StateHistory
from
'./StateHistory'
;
...
...
@@ -14,7 +15,7 @@ import 'app/features/alerting/AlertTabCtrl';
// Types
import
{
DashboardModel
}
from
'../dashboard/dashboard_model'
;
import
{
PanelModel
}
from
'../dashboard/panel_model'
;
import
{
TestRule
Button
}
from
'./TestRuleButton
'
;
import
{
TestRule
Result
}
from
'./TestRuleResult
'
;
interface
Props
{
angularPanel
?:
AngularComponent
;
...
...
@@ -22,16 +23,6 @@ interface Props {
panel
:
PanelModel
;
}
interface
LoadingPlaceholderProps
{
text
:
string
;
}
const
LoadingPlaceholder
:
SFC
<
LoadingPlaceholderProps
>
=
({
text
})
=>
(
<
div
className=
"gf-form-group"
>
{
text
}
<
i
className=
"fa fa-spinner fa-spin"
/>
</
div
>
);
export
class
AlertTab
extends
PureComponent
<
Props
>
{
element
:
any
;
component
:
AngularComponent
;
...
...
@@ -120,14 +111,14 @@ export class AlertTab extends PureComponent<Props> {
};
};
renderTestRule
Button
=
()
=>
{
renderTestRule
Result
=
()
=>
{
const
{
panel
,
dashboard
}
=
this
.
props
;
return
<
TestRule
Button
panelId=
{
panel
.
id
}
dashboard=
{
dashboard
}
LoadingPlaceholder=
{
LoadingPlaceholder
}
/>;
return
<
TestRule
Result
panelId=
{
panel
.
id
}
dashboard=
{
dashboard
}
LoadingPlaceholder=
{
LoadingPlaceholder
}
/>;
};
testRule
=
():
EditorToolbarView
=>
({
title
:
'Test Rule'
,
render
:
()
=>
this
.
renderTestRule
Button
(),
render
:
()
=>
this
.
renderTestRule
Result
(),
});
onAddAlert
=
()
=>
{
...
...
public/app/features/alerting/TestRuleButton.test.tsx
View file @
08ac2959
import
React
from
'react'
;
import
{
shallow
}
from
'enzyme'
;
import
{
DashboardModel
}
from
'../dashboard/dashboard_model'
;
import
{
Props
,
TestRule
Button
}
from
'./TestRuleButton
'
;
import
{
Props
,
TestRule
Result
}
from
'./TestRuleResult
'
;
jest
.
mock
(
'app/core/services/backend_srv'
,
()
=>
({
getBackendSrv
:
()
=>
({
...
...
@@ -18,9 +18,9 @@ const setup = (propOverrides?: object) => {
Object
.
assign
(
props
,
propOverrides
);
const
wrapper
=
shallow
(<
TestRule
Button
{
...
props
}
/>);
const
wrapper
=
shallow
(<
TestRule
Result
{
...
props
}
/>);
return
{
wrapper
,
instance
:
wrapper
.
instance
()
as
TestRule
Button
};
return
{
wrapper
,
instance
:
wrapper
.
instance
()
as
TestRule
Result
};
};
describe
(
'Render'
,
()
=>
{
...
...
public/app/features/alerting/TestRule
Button
.tsx
→
public/app/features/alerting/TestRule
Result
.tsx
View file @
08ac2959
...
...
@@ -14,7 +14,7 @@ interface State {
testRuleResponse
:
{};
}
export
class
TestRule
Button
extends
PureComponent
<
Props
,
State
>
{
export
class
TestRule
Result
extends
PureComponent
<
Props
,
State
>
{
readonly
state
:
State
=
{
isLoading
:
false
,
testRuleResponse
:
{},
...
...
@@ -27,8 +27,10 @@ export class TestRuleButton extends PureComponent<Props, State> {
async
testRule
()
{
const
{
panelId
,
dashboard
}
=
this
.
props
;
const
payload
=
{
dashboard
:
dashboard
.
getSaveModelClone
(),
panelId
};
this
.
setState
({
isLoading
:
true
});
const
testRuleResponse
=
await
getBackendSrv
().
post
(
`/api/alerts/test`
,
payload
);
this
.
setState
(
prevState
=>
({
...
prevState
,
isLoading
:
false
,
testRuleResponse
})
);
this
.
setState
(
{
isLoading
:
false
,
testRuleResponse
}
);
}
render
()
{
...
...
public/app/features/dashboard/dashgrid/QueriesTab.tsx
View file @
08ac2959
// Libraries
import
React
,
{
PureComponent
,
SFC
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
_
from
'lodash'
;
// Components
import
'app/features/panel/metrics_tab'
;
import
{
EditorTabBody
,
EditorToolbarView
}
from
'./EditorTabBody'
;
import
{
EditorTabBody
,
EditorToolbarView
}
from
'./EditorTabBody'
;
import
{
DataSourcePicker
}
from
'app/core/components/Select/DataSourcePicker'
;
import
{
QueryInspector
}
from
'./QueryInspector'
;
import
{
QueryOptions
}
from
'./QueryOptions'
;
import
{
AngularQueryComponentScope
}
from
'app/features/panel/metrics_tab'
;
import
{
PanelOptionSection
}
from
'./PanelOptionSection'
;
import
{
LoadingPlaceholder
}
from
'@grafana/ui'
;
// Services
import
{
getDatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
...
...
@@ -36,12 +37,6 @@ interface State {
isAddingMixed
:
boolean
;
}
interface
LoadingPlaceholderProps
{
text
:
string
;
}
const
LoadingPlaceholder
:
SFC
<
LoadingPlaceholderProps
>
=
({
text
})
=>
<
h2
>
{
text
}
</
h2
>;
export
class
QueriesTab
extends
PureComponent
<
Props
,
State
>
{
element
:
HTMLElement
;
component
:
AngularComponent
;
...
...
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