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
6433ff4b
Unverified
Commit
6433ff4b
authored
Dec 10, 2018
by
Torkel Ödegaard
Committed by
GitHub
Dec 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14424 from grafana/fix-search-tag-issues
Fix search tag UI issues
parents
acf24bd6
e05f6c53
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
21 deletions
+18
-21
public/app/core/angular_wrappers.ts
+1
-1
public/app/core/components/TagFilter/TagFilter.tsx
+10
-11
public/app/core/components/search/search.html
+1
-1
public/app/core/components/search/search.ts
+6
-8
No files found.
public/app/core/angular_wrappers.ts
View file @
6433ff4b
...
...
@@ -16,7 +16,7 @@ export function registerAngularDirectives() {
react2AngularDirective
(
'searchResult'
,
SearchResult
,
[]);
react2AngularDirective
(
'tagFilter'
,
TagFilter
,
[
'tags'
,
[
'on
Select
'
,
{
watchDepth
:
'reference'
}],
[
'on
Change
'
,
{
watchDepth
:
'reference'
}],
[
'tagOptions'
,
{
watchDepth
:
'reference'
}],
]);
}
public/app/core/components/TagFilter/TagFilter.tsx
View file @
6433ff4b
...
...
@@ -10,7 +10,7 @@ import ResetStyles from 'app/core/components/Picker/ResetStyles';
export
interface
Props
{
tags
:
string
[];
tagOptions
:
()
=>
any
;
on
Select
:
(
tag
:
string
)
=>
void
;
on
Change
:
(
tags
:
string
[]
)
=>
void
;
}
export
class
TagFilter
extends
React
.
Component
<
Props
,
any
>
{
...
...
@@ -18,12 +18,9 @@ export class TagFilter extends React.Component<Props, any> {
constructor
(
props
)
{
super
(
props
);
this
.
searchTags
=
this
.
searchTags
.
bind
(
this
);
this
.
onChange
=
this
.
onChange
.
bind
(
this
);
}
searchTags
(
query
)
{
onLoadOptions
=
query
=>
{
return
this
.
props
.
tagOptions
().
then
(
options
=>
{
return
options
.
map
(
option
=>
({
value
:
option
.
term
,
...
...
@@ -31,18 +28,20 @@ export class TagFilter extends React.Component<Props, any> {
count
:
option
.
count
,
}));
});
}
}
;
onChange
(
newTags
)
{
this
.
props
.
on
Select
(
newTags
);
}
onChange
=
(
newTags
:
any
[])
=>
{
this
.
props
.
on
Change
(
newTags
.
map
(
tag
=>
tag
.
value
)
);
}
;
render
()
{
const
tags
=
this
.
props
.
tags
.
map
(
tag
=>
({
value
:
tag
,
label
:
tag
,
count
:
0
}));
const
selectOptions
=
{
classNamePrefix
:
'gf-form-select-box'
,
isMulti
:
true
,
defaultOptions
:
true
,
loadOptions
:
this
.
searchTag
s
,
loadOptions
:
this
.
onLoadOption
s
,
onChange
:
this
.
onChange
,
className
:
'gf-form-input gf-form-input--form-dropdown'
,
placeholder
:
'Tags'
,
...
...
@@ -50,7 +49,7 @@ export class TagFilter extends React.Component<Props, any> {
noOptionsMessage
:
()
=>
'No tags found'
,
getOptionValue
:
i
=>
i
.
value
,
getOptionLabel
:
i
=>
i
.
label
,
value
:
t
his
.
props
.
t
ags
,
value
:
tags
,
styles
:
ResetStyles
,
components
:
{
Option
:
TagOption
,
...
...
public/app/core/components/search/search.html
View file @
6433ff4b
...
...
@@ -41,7 +41,7 @@
</a>
</div>
<tag-filter
tags=
"ctrl.query.tag"
tagOptions=
"ctrl.getTags"
on
Select=
"ctrl.onTagSelect
"
>
<tag-filter
tags=
"ctrl.query.tag"
tagOptions=
"ctrl.getTags"
on
Change=
"ctrl.onTagFiltersChanged
"
>
</tag-filter>
</div>
...
...
public/app/core/components/search/search.ts
View file @
6433ff4b
...
...
@@ -25,8 +25,6 @@ export class SearchCtrl {
appEvents
.
on
(
'hide-dash-search'
,
this
.
closeSearch
.
bind
(
this
),
$scope
);
this
.
initialFolderFilterTitle
=
'All'
;
this
.
getTags
=
this
.
getTags
.
bind
(
this
);
this
.
onTagSelect
=
this
.
onTagSelect
.
bind
(
this
);
this
.
isEditor
=
contextSrv
.
isEditor
;
this
.
hasEditPermissionInFolders
=
contextSrv
.
hasEditPermissionInFolders
;
}
...
...
@@ -162,7 +160,7 @@ export class SearchCtrl {
const
localSearchId
=
this
.
currentSearchId
;
const
query
=
{
...
this
.
query
,
tag
:
this
.
query
.
tag
.
map
(
i
=>
i
.
value
)
,
tag
:
this
.
query
.
tag
,
};
return
this
.
searchSrv
.
search
(
query
).
then
(
results
=>
{
...
...
@@ -195,14 +193,14 @@ export class SearchCtrl {
evt
.
preventDefault
();
}
getTags
()
{
getTags
=
()
=>
{
return
this
.
searchSrv
.
getDashboardTags
();
}
}
;
onTag
Select
(
newTags
)
{
this
.
query
.
tag
=
newT
ags
;
onTag
FiltersChanged
=
(
tags
:
string
[])
=>
{
this
.
query
.
tag
=
t
ags
;
this
.
search
();
}
}
;
clearSearchFilter
()
{
this
.
query
.
tag
=
[];
...
...
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