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
bf046d75
Unverified
Commit
bf046d75
authored
Apr 03, 2020
by
Dominik Prokop
Committed by
GitHub
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NewPanelEditor Render search results in front of the list of plugins (#23302)
parent
b63b8297
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
public/app/features/dashboard/components/PanelEditor/VisualizationTab.tsx
+12
-0
public/app/features/dashboard/panel_editor/VizTypePicker.tsx
+5
-5
public/app/features/dashboard/panel_editor/VizTypePickerPlugin.tsx
+7
-2
No files found.
public/app/features/dashboard/components/PanelEditor/VisualizationTab.tsx
View file @
bf046d75
...
...
@@ -34,6 +34,13 @@ export const VisualizationTabUnconnected: FC<Props> = ({ panel, plugin, changePa
const
onPluginTypeChange
=
(
meta
:
PanelPluginMeta
)
=>
{
changePanelPlugin
(
panel
,
meta
.
id
);
};
const
suffix
=
searchQuery
!==
''
?
(
<
span
className=
{
styles
.
searchClear
}
onClick=
{
()
=>
setSearchQuery
(
''
)
}
>
<
Icon
name=
"times"
/>
Clear filter
</
span
>
)
:
null
;
return
(
<
div
className=
{
styles
.
wrapper
}
>
...
...
@@ -42,6 +49,7 @@ export const VisualizationTabUnconnected: FC<Props> = ({ panel, plugin, changePa
value=
{
searchQuery
}
onChange=
{
e
=>
setSearchQuery
(
e
.
currentTarget
.
value
)
}
prefix=
{
<
Icon
name=
"filter"
className=
{
styles
.
icon
}
/>
}
suffix=
{
suffix
}
placeholder=
"Filter visualisations"
autoFocus
/>
...
...
@@ -77,6 +85,10 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => {
flex-shrink: 1;
margin-bottom:
${
theme
.
spacing
.
sm
}
;
`
,
searchClear
:
css
`
color:
${
theme
.
colors
.
gray60
}
;
cursor: pointer;
`
,
visList
:
css
`
flex-grow: 1;
height: 100%;
...
...
public/app/features/dashboard/panel_editor/VizTypePicker.tsx
View file @
bf046d75
import
React
,
{
useMemo
}
from
'react'
;
import
React
,
{
use
Callback
,
use
Memo
}
from
'react'
;
import
config
from
'app/core/config'
;
import
VizTypePickerPlugin
from
'./VizTypePickerPlugin'
;
...
...
@@ -41,22 +41,22 @@ export const VizTypePicker: React.FC<Props> = ({ searchQuery, onTypeChange, curr
);
};
const
getFilteredPluginList
=
():
PanelPluginMeta
[]
=>
{
const
getFilteredPluginList
=
useCallback
(
():
PanelPluginMeta
[]
=>
{
const
regex
=
new
RegExp
(
searchQuery
,
'i'
);
return
pluginsList
.
filter
(
item
=>
{
return
regex
.
test
(
item
.
name
);
});
};
}
,
[
searchQuery
])
;
const
filteredPluginList
=
getFilteredPluginList
();
const
hasResults
=
filteredPluginList
.
length
>
0
;
const
renderList
=
filteredPluginList
.
concat
(
pluginsList
.
filter
(
p
=>
filteredPluginList
.
indexOf
(
p
)
===
-
1
));
return
(
<
div
className=
{
styles
.
wrapper
}
>
<
div
className=
{
styles
.
grid
}
>
{
hasResults
?
(
plugins
List
.
map
((
plugin
,
index
)
=>
renderVizPlugin
(
plugin
,
index
))
render
List
.
map
((
plugin
,
index
)
=>
renderVizPlugin
(
plugin
,
index
))
)
:
(
<
EmptySearchResult
>
Could not find anything matching your query
</
EmptySearchResult
>
)
}
...
...
public/app/features/dashboard/panel_editor/VizTypePickerPlugin.tsx
View file @
bf046d75
...
...
@@ -29,10 +29,11 @@ const VizTypePickerPlugin: React.FC<Props> = ({ isCurrent, plugin, onClick, disa
};
const
getStyles
=
stylesFactory
((
theme
:
GrafanaTheme
)
=>
{
const
itemBorder
=
`1px solid
${
theme
.
isLight
?
theme
.
colors
.
gray3
:
theme
.
colors
.
dark10
}
`
;
return
{
item
:
css
`
background:
${
theme
.
isLight
?
theme
.
colors
.
white
:
theme
.
colors
.
gray05
}
;
border:
1px solid
${
theme
.
isLight
?
theme
.
colors
.
gray3
:
theme
.
colors
.
dark10
}
;
border:
${
itemBorder
}
;
border-radius: 3px;
height: 100px;
width: 100%;
...
...
@@ -68,7 +69,11 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => {
disabled
:
css
`
opacity: 0.2;
filter: grayscale(1);
cursor: pointer;
cursor: default;
&:hover {
box-shadow: none;
border:
${
itemBorder
}
;
}
`
,
name
:
css
`
text-overflow: ellipsis;
...
...
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