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
9fd82496
Unverified
Commit
9fd82496
authored
Mar 28, 2019
by
Dominik Prokop
Committed by
GitHub
Mar 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: added actionable message in Explore when no datasource configured (#16252)
parent
0bc314a4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
public/app/features/datasources/state/actions.ts
+1
-1
public/app/features/explore/Explore.tsx
+10
-3
public/app/features/explore/NoDataSourceCallToAction.tsx
+43
-0
No files found.
public/app/features/datasources/state/actions.ts
View file @
9fd82496
...
...
@@ -98,8 +98,8 @@ export function updateDataSource(dataSource: DataSourceSettings): ThunkResult<vo
export
function
deleteDataSource
():
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getStore
)
=>
{
const
dataSource
=
getStore
().
dataSources
.
dataSource
;
await
getBackendSrv
().
delete
(
`/api/datasources/
${
dataSource
.
id
}
`
);
await
updateFrontendSettings
();
dispatch
(
updateLocation
({
path
:
'/datasources'
}));
};
}
...
...
public/app/features/explore/Explore.tsx
View file @
9fd82496
...
...
@@ -38,6 +38,7 @@ import { LAST_USED_DATASOURCE_KEY, ensureQueries, DEFAULT_RANGE, DEFAULT_UI_STAT
import
{
Emitter
}
from
'app/core/utils/emitter'
;
import
{
ExploreToolbar
}
from
'./ExploreToolbar'
;
import
{
scanStopAction
}
from
'./state/actionTypes'
;
import
{
NoDataSourceCallToAction
}
from
'./NoDataSourceCallToAction'
;
interface
ExploreProps
{
StartPage
?:
ComponentClass
<
ExploreStartPageProps
>
;
...
...
@@ -192,6 +193,14 @@ export class Explore extends React.PureComponent<ExploreProps> {
}
};
renderEmptyState
=
()
=>
{
return
(
<
div
className=
"explore-container"
>
<
NoDataSourceCallToAction
/>
</
div
>
);
};
render
()
{
const
{
StartPage
,
...
...
@@ -213,9 +222,7 @@ export class Explore extends React.PureComponent<ExploreProps> {
<
div
className=
{
exploreClass
}
ref=
{
this
.
getRef
}
>
<
ExploreToolbar
exploreId=
{
exploreId
}
timepickerRef=
{
this
.
timepickerRef
}
onChangeTime=
{
this
.
onChangeTime
}
/>
{
datasourceLoading
?
<
div
className=
"explore-container"
>
Loading datasource...
</
div
>
:
null
}
{
datasourceMissing
?
(
<
div
className=
"explore-container"
>
Please add a datasource that supports Explore (e.g., Prometheus).
</
div
>
)
:
null
}
{
datasourceMissing
?
this
.
renderEmptyState
()
:
null
}
{
datasourceError
&&
(
<
div
className=
"explore-container"
>
...
...
public/app/features/explore/NoDataSourceCallToAction.tsx
0 → 100644
View file @
9fd82496
import
React
,
{
useContext
}
from
'react'
;
import
{
css
}
from
'emotion'
;
import
{
ThemeContext
,
ExtraLargeLinkButton
,
CallToActionCard
}
from
'@grafana/ui'
;
export
const
NoDataSourceCallToAction
=
()
=>
{
const
theme
=
useContext
(
ThemeContext
);
const
message
=
'Explore requires at least one data source. Once you have added a data source, you can query it here.'
;
const
footer
=
(
<>
<
i
className=
"fa fa-rocket"
/>
<>
ProTip: You can also define data sources through configuration files.
</>
<
a
href=
"http://docs.grafana.org/administration/provisioning/#datasources?utm_source=explore"
target=
"_blank"
className=
"text-link"
>
Learn more
</
a
>
</>
);
const
ctaElement
=
(
<
ExtraLargeLinkButton
href=
"/datasources/new"
icon=
"gicon gicon-add-datasources"
>
Add data source
</
ExtraLargeLinkButton
>
);
const
cardClassName
=
css
`
max-width:
${
theme
.
breakpoints
.
lg
}
;
`
;
return
(
<
CallToActionCard
callToActionElement=
{
ctaElement
}
className=
{
cardClassName
}
footer=
{
footer
}
message=
{
message
}
theme=
{
theme
}
/>
);
};
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