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
27bbadce
Commit
27bbadce
authored
Feb 13, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add EmptySearchResult ui component and use it in VizTypePicker
parent
b6305c2d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
12 deletions
+36
-12
packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx
+13
-0
packages/grafana-ui/src/components/EmptySearchResult/_EmptySearchResult.scss
+7
-0
packages/grafana-ui/src/components/index.scss
+2
-0
packages/grafana-ui/src/components/index.ts
+1
-0
public/app/features/dashboard/panel_editor/VizTypePicker.tsx
+13
-12
No files found.
packages/grafana-ui/src/components/EmptySearchResult/EmptySearchResult.tsx
0 → 100644
View file @
27bbadce
import
React
,
{
FC
}
from
'react'
;
export
interface
Props
{
children
:
JSX
.
Element
|
string
;
}
const
EmptySearchResult
:
FC
<
Props
>
=
({
children
})
=>
{
return
(
<
div
className=
"empty-search-result"
>
{
children
}
</
div
>
);
};
export
{
EmptySearchResult
};
packages/grafana-ui/src/components/EmptySearchResult/_EmptySearchResult.scss
0 → 100644
View file @
27bbadce
.empty-search-result
{
background-color
:
$empty-list-cta-bg
;
padding
:
$spacer
;
border-radius
:
$border-radius
;
margin-bottom
:
$spacer
*
2
;
}
\ No newline at end of file
packages/grafana-ui/src/components/index.scss
View file @
27bbadce
...
...
@@ -8,3 +8,4 @@
@import
'ColorPicker/ColorPicker'
;
@import
'ValueMappingsEditor/ValueMappingsEditor'
;
@import
"FormField/FormField"
;
@import
"EmptySearchResult/EmptySearchResult"
;
\ No newline at end of file
packages/grafana-ui/src/components/index.ts
View file @
27bbadce
...
...
@@ -23,3 +23,4 @@ export { PanelOptionsGrid } from './PanelOptionsGrid/PanelOptionsGrid';
export
{
ValueMappingsEditor
}
from
'./ValueMappingsEditor/ValueMappingsEditor'
;
export
{
Gauge
}
from
'./Gauge/Gauge'
;
export
{
Switch
}
from
'./Switch/Switch'
;
export
{
EmptySearchResult
}
from
'./EmptySearchResult/EmptySearchResult'
;
public/app/features/dashboard/panel_editor/VizTypePicker.tsx
View file @
27bbadce
import
React
,
{
PureComponent
}
from
'react'
;
import
_
from
'lodash'
;
import
config
from
'app/core/config'
;
import
{
PanelPlugin
}
from
'app/types/plugins'
;
import
VizTypePickerPlugin
from
'./VizTypePickerPlugin'
;
import
{
EmptySearchResult
}
from
'@grafana/ui'
;
export
interface
Props
{
current
:
PanelPlugin
;
...
...
@@ -14,9 +14,9 @@ export interface Props {
export
class
VizTypePicker
extends
PureComponent
<
Props
>
{
searchInput
:
HTMLElement
;
pluginList
=
this
.
getPanelPlugins
(
''
)
;
pluginList
=
this
.
getPanelPlugins
;
constructor
(
props
)
{
constructor
(
props
:
Props
)
{
super
(
props
);
}
...
...
@@ -25,14 +25,13 @@ export class VizTypePicker extends PureComponent<Props> {
return
filteredPluginList
.
length
-
1
;
}
getPanelPlugins
(
filter
):
PanelPlugin
[]
{
const
panels
=
_
.
chain
(
config
.
panels
)
.
filter
({
hideFromList
:
false
})
.
map
(
item
=>
item
)
.
value
();
get
getPanelPlugins
():
PanelPlugin
[]
{
const
allPanels
=
config
.
panels
;
// add sort by sort property
return
_
.
sortBy
(
panels
,
'sort'
);
return
Object
.
keys
(
allPanels
)
.
filter
(
key
=>
allPanels
[
key
][
'hideFromList'
]
===
false
)
.
map
(
key
=>
allPanels
[
key
])
.
sort
((
a
:
PanelPlugin
,
b
:
PanelPlugin
)
=>
a
.
sort
-
b
.
sort
);
}
renderVizPlugin
=
(
plugin
:
PanelPlugin
,
index
:
number
)
=>
{
...
...
@@ -63,11 +62,13 @@ export class VizTypePicker extends PureComponent<Props> {
render
()
{
const
filteredPluginList
=
this
.
getFilteredPluginList
();
const
hasResults
=
filteredPluginList
.
length
>
0
;
return
(
<
div
className=
"viz-picker"
>
<
div
className=
"viz-picker-list"
>
{
filteredPluginList
.
map
((
plugin
,
index
)
=>
this
.
renderVizPlugin
(
plugin
,
index
))
}
{
hasResults
?
filteredPluginList
.
map
((
plugin
,
index
)
=>
this
.
renderVizPlugin
(
plugin
,
index
))
:
<
EmptySearchResult
>
No panels matching your query were found
</
EmptySearchResult
>
}
</
div
>
</
div
>
);
...
...
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