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
a366b137
Commit
a366b137
authored
Oct 30, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashfolders: bulk edit tag filtering
Still ugly though
parent
e85abf68
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
12 deletions
+43
-12
public/app/features/dashboard/dashboard_list_ctrl.ts
+20
-2
public/app/features/dashboard/partials/dashboardList.html
+19
-6
public/app/features/dashboard/specs/dashboard_list_ctrl.jest.ts
+4
-4
No files found.
public/app/features/dashboard/dashboard_list_ctrl.ts
View file @
a366b137
...
...
@@ -11,12 +11,12 @@ export class DashboardListCtrl {
/** @ngInject */
constructor
(
private
backendSrv
,
navModelSrv
,
private
$q
)
{
this
.
navModel
=
navModelSrv
.
getNav
(
'cfg'
,
'dashboards'
);
this
.
query
=
''
;
this
.
query
=
{
query
:
''
,
mode
:
'tree'
,
tag
:
[]}
;
this
.
getDashboards
();
}
getDashboards
()
{
return
this
.
backendSrv
.
get
(
`/api/search?query=
${
this
.
query
}
&mode=tree`
).
then
((
result
)
=>
{
return
this
.
backendSrv
.
search
(
this
.
query
).
then
((
result
)
=>
{
this
.
dashboards
=
this
.
groupDashboardsInFolders
(
result
);
...
...
@@ -134,4 +134,22 @@ export class DashboardListCtrl {
model
:
{
dashboards
:
selectedDashboards
,
afterSave
:
this
.
getDashboards
.
bind
(
this
)}
});
}
filterByTag
(
tag
,
evt
)
{
this
.
query
.
tag
.
push
(
tag
);
this
.
getDashboards
();
if
(
evt
)
{
evt
.
stopPropagation
();
evt
.
preventDefault
();
}
}
removeTag
(
tag
,
evt
)
{
this
.
query
.
tag
=
_
.
without
(
this
.
query
.
tag
,
tag
);
this
.
getDashboards
();
if
(
evt
)
{
evt
.
stopPropagation
();
evt
.
preventDefault
();
}
}
}
public/app/features/dashboard/partials/dashboardList.html
View file @
a366b137
...
...
@@ -14,11 +14,24 @@
Create Folder
</a>
</div>
<div
class=
"gf-form width-15 gf-form-group"
>
<span
style=
"position: relative;"
>
<input
type=
"text"
class=
"gf-form-input"
placeholder=
"Find Dashboard by name"
tabindex=
"1"
give-focus=
"true"
ng-model=
"ctrl.query"
ng-model-options=
"{ debounce: 500 }"
spellcheck=
'false'
ng-change=
"ctrl.getDashboards()"
/>
</span>
<div
class=
"gf-form-group"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form width-15"
>
<span
style=
"position: relative;"
>
<input
type=
"text"
class=
"gf-form-input"
placeholder=
"Find Dashboard by name"
tabindex=
"1"
give-focus=
"true"
ng-model=
"ctrl.query.query"
ng-model-options=
"{ debounce: 500 }"
spellcheck=
'false'
ng-change=
"ctrl.getDashboards()"
/>
</span>
</div>
<div
class=
"gf-form"
ng-if=
"ctrl.query.tag.length"
>
Filtered by Tags:
<span
ng-repeat=
"tagName in ctrl.query.tag"
>
<a
ng-click=
"ctrl.removeTag(tagName, $event)"
tag-color-from-name=
"tagName"
class=
"label label-tag"
>
<i
class=
"fa fa-remove"
></i>
{{tagName}}
</a>
</span>
</div>
</div>
</div>
<div
class=
"gf-form-group"
ng-if=
"ctrl.dashboards.length > 1"
>
...
...
@@ -68,7 +81,7 @@
</span>
<span
class=
"search-result-link"
>
<i
class=
"fa search-result-icon"
></i>
<span
bo-text=
"dashboard.title"
></span
>
<span
bo-text=
"dashboard.title"
/
>
</span>
</a>
</td>
...
...
public/app/features/dashboard/specs/dashboard_list_ctrl.jest.ts
View file @
a366b137
...
...
@@ -21,7 +21,7 @@ describe('DashboardListCtrl', () => {
}
];
ctrl
=
new
DashboardListCtrl
({
get
:
()
=>
q
.
resolve
(
response
)},
{
getNav
:
()
=>
{}},
q
);
ctrl
=
new
DashboardListCtrl
({
search
:
()
=>
q
.
resolve
(
response
)},
{
getNav
:
()
=>
{}},
q
);
return
ctrl
.
getDashboards
();
});
...
...
@@ -62,7 +62,7 @@ describe('DashboardListCtrl', () => {
folderSlug
:
"afolder"
}
];
ctrl
=
new
DashboardListCtrl
({
get
:
()
=>
q
.
resolve
(
response
)},
{
getNav
:
()
=>
{}},
null
);
ctrl
=
new
DashboardListCtrl
({
search
:
()
=>
q
.
resolve
(
response
)},
{
getNav
:
()
=>
{}},
null
);
return
ctrl
.
getDashboards
();
});
...
...
@@ -78,7 +78,7 @@ describe('DashboardListCtrl', () => {
let
ctrl
;
beforeEach
(()
=>
{
ctrl
=
new
DashboardListCtrl
({
get
:
()
=>
q
.
resolve
([])},
{
getNav
:
()
=>
{}},
null
);
ctrl
=
new
DashboardListCtrl
({
search
:
()
=>
q
.
resolve
([])},
{
getNav
:
()
=>
{}},
null
);
});
describe
(
'and no dashboards are selected'
,
()
=>
{
...
...
@@ -174,7 +174,7 @@ describe('DashboardListCtrl', () => {
describe
(
'when deleting dashboards'
,
()
=>
{
beforeEach
(()
=>
{
ctrl
=
new
DashboardListCtrl
({
get
:
()
=>
q
.
resolve
([])},
{
getNav
:
()
=>
{}},
q
);
ctrl
=
new
DashboardListCtrl
({
search
:
()
=>
q
.
resolve
([])},
{
getNav
:
()
=>
{}},
q
);
ctrl
.
dashboards
=
[
{
id
:
1
,
type
:
'dash-folder'
,
checked
:
true
},
{
id
:
2
,
type
:
'dash-child'
,
checked
:
true
,
folderId
:
1
},
...
...
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