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
11db48e7
Commit
11db48e7
authored
Feb 12, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Highlight vizpicker input when there are no panels matching the search query
parent
b1aa8480
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
7 deletions
+22
-7
public/app/features/dashboard/panel_editor/EditorTabBody.tsx
+1
-1
public/app/features/dashboard/panel_editor/VisualizationTab.tsx
+17
-4
public/app/features/dashboard/panel_editor/VizTypePicker.tsx
+4
-2
No files found.
public/app/features/dashboard/panel_editor/EditorTabBody.tsx
View file @
11db48e7
...
...
@@ -36,7 +36,7 @@ export class EditorTabBody extends PureComponent<Props, State> {
toolbarItems
:
[],
};
constructor
(
props
)
{
constructor
(
props
:
Props
)
{
super
(
props
);
this
.
state
=
{
...
...
public/app/features/dashboard/panel_editor/VisualizationTab.tsx
View file @
11db48e7
// Libraries
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
,
ChangeEvent
}
from
'react'
;
// Utils & Services
import
{
AngularComponent
,
getAngularLoader
}
from
'app/core/services/AngularLoader'
;
...
...
@@ -31,6 +31,7 @@ interface Props {
interface
State
{
isVizPickerOpen
:
boolean
;
searchQuery
:
string
;
searchResults
:
PanelPlugin
[];
scrollTop
:
number
;
}
...
...
@@ -39,12 +40,13 @@ export class VisualizationTab extends PureComponent<Props, State> {
angularOptions
:
AngularComponent
;
searchInput
:
HTMLElement
;
constructor
(
props
)
{
constructor
(
props
:
Props
)
{
super
(
props
);
this
.
state
=
{
isVizPickerOpen
:
this
.
props
.
urlOpenVizPicker
,
searchQuery
:
''
,
searchResults
:
[],
scrollTop
:
0
,
};
}
...
...
@@ -170,7 +172,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
this
.
setState
({
isVizPickerOpen
:
false
});
};
onSearchQueryChange
=
evt
=>
{
onSearchQueryChange
=
(
evt
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
const
value
=
evt
.
target
.
value
;
this
.
setState
({
searchQuery
:
value
,
...
...
@@ -187,7 +189,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
<
label
className=
"gf-form--has-input-icon"
>
<
input
type=
"text"
className=
"gf-form-input width-13"
className=
{
`gf-form-input width-13 ${!this.hasSearchResults ? 'gf-form-input--invalid' : ''}`
}
placeholder=
""
onChange=
{
this
.
onSearchQueryChange
}
value=
{
searchQuery
}
...
...
@@ -219,6 +221,16 @@ export class VisualizationTab extends PureComponent<Props, State> {
}
};
setSearchResults
=
(
searchResults
:
PanelPlugin
[])
=>
{
this
.
setState
({
searchResults
:
searchResults
});
};
get
hasSearchResults
()
{
return
this
.
state
.
searchResults
&&
this
.
state
.
searchResults
.
length
>
0
;
}
renderHelp
=
()
=>
<
PluginHelp
plugin=
{
this
.
props
.
plugin
}
type=
"help"
/>;
setScrollTop
=
(
event
:
React
.
MouseEvent
<
HTMLElement
>
)
=>
{
...
...
@@ -251,6 +263,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
onTypeChanged=
{
this
.
onTypeChanged
}
searchQuery=
{
searchQuery
}
onClose=
{
this
.
onCloseVizPicker
}
onPluginListChange=
{
this
.
setSearchResults
}
/>
</
FadeIn
>
{
this
.
renderPanelOptions
()
}
...
...
public/app/features/dashboard/panel_editor/VizTypePicker.tsx
View file @
11db48e7
...
...
@@ -10,13 +10,14 @@ export interface Props {
onTypeChanged
:
(
newType
:
PanelPlugin
)
=>
void
;
searchQuery
:
string
;
onClose
:
()
=>
void
;
onPluginListChange
:
(
searchResults
:
PanelPlugin
[])
=>
void
;
}
export
class
VizTypePicker
extends
PureComponent
<
Props
>
{
searchInput
:
HTMLElement
;
pluginList
=
this
.
getPanelPlugins
(
''
);
constructor
(
props
)
{
constructor
(
props
:
Props
)
{
super
(
props
);
}
...
...
@@ -50,7 +51,7 @@ export class VizTypePicker extends PureComponent<Props> {
};
getFilteredPluginList
=
():
PanelPlugin
[]
=>
{
const
{
searchQuery
}
=
this
.
props
;
const
{
searchQuery
,
onPluginListChange
}
=
this
.
props
;
const
regex
=
new
RegExp
(
searchQuery
,
'i'
);
const
pluginList
=
this
.
pluginList
;
...
...
@@ -58,6 +59,7 @@ export class VizTypePicker extends PureComponent<Props> {
return
regex
.
test
(
item
.
name
);
});
onPluginListChange
(
filtered
);
return
filtered
;
};
...
...
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