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
bd2b26e9
Commit
bd2b26e9
authored
Nov 21, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashlist: fix tag filtering and some css
parent
ccbdb29f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
22 deletions
+91
-22
public/app/core/services/search_srv.ts
+1
-1
public/app/features/dashboard/dashboard_list_ctrl.ts
+17
-8
public/app/features/dashboard/partials/dashboardList.html
+16
-13
public/app/features/dashboard/specs/dashboard_list_ctrl.jest.ts
+57
-0
No files found.
public/app/core/services/search_srv.ts
View file @
bd2b26e9
...
...
@@ -52,7 +52,7 @@ export class SearchSrv {
}
search
(
options
)
{
if
(
!
options
.
query
)
{
if
(
!
options
.
query
&&
!
options
.
tag
)
{
return
this
.
browse
();
}
...
...
public/app/features/dashboard/dashboard_list_ctrl.ts
View file @
bd2b26e9
...
...
@@ -22,18 +22,27 @@ export class DashboardListCtrl {
}
getDashboards
()
{
return
this
.
searchSrv
.
browse
().
then
((
result
)
=>
{
if
(
this
.
query
.
query
.
length
===
0
&&
this
.
query
.
tag
.
length
===
0
)
{
return
this
.
searchSrv
.
browse
().
then
((
result
)
=>
{
return
this
.
initDashboardList
(
result
);
});
}
this
.
sections
=
result
;
return
this
.
searchSrv
.
search
(
this
.
query
).
then
((
result
)
=>
{
return
this
.
initDashboardList
(
result
);
});
}
for
(
let
section
of
this
.
sections
)
{
section
.
checked
=
false
;
initDashboardList
(
result
:
any
)
{
this
.
sections
=
result
;
for
(
let
dashboard
of
section
.
items
)
{
dashboard
.
checked
=
false
;
}
for
(
let
section
of
this
.
sections
)
{
section
.
checked
=
false
;
for
(
let
dashboard
of
section
.
items
)
{
dashboard
.
checked
=
false
;
}
}
);
}
}
selectionChanged
()
{
...
...
public/app/features/dashboard/partials/dashboardList.html
View file @
bd2b26e9
...
...
@@ -58,19 +58,22 @@
<select class="gf-form-input" ng-model="ctrl.query.tags" ng-options="t.term for t in ctrl.tags" />
</div> -->
<div
ng-repeat=
"section in ctrl.sections"
class=
"search-section"
>
<gf-form-switch
switch-class=
"gf-form-switch--table-cell"
on-change=
"ctrl.selectionChanged()"
checked=
"section.checked"
>
</gf-form-switch>
<a
class=
"search-section__header pointer"
ng-show=
"::section.title"
ng-click=
"section.collapsed = !section.collapsed"
>
<i
class=
"search-section__header__icon"
ng-class=
"section.icon"
></i>
<span
class=
"search-section__header__text"
>
{{::section.title}}
</span>
<i
class=
"fa fa-minus search-section__header__toggle"
ng-hide=
"section.collapsed"
></i>
<i
class=
"fa fa-plus search-section__header__toggle"
ng-show=
"section.collapsed"
></i>
</a>
<div
ng-if=
"!section.collapsed"
>
<div
class=
"search-section__header pointer"
ng-show=
"::section.title"
>
<gf-form-switch
switch-class=
"gf-form-switch--table-cell"
on-change=
"ctrl.selectionChanged()"
checked=
"section.checked"
>
</gf-form-switch>
<a
ng-click=
"ctrl.toggleFolder(section)"
>
<i
class=
"search-section__header__icon"
ng-class=
"section.icon"
></i>
<span
class=
"search-section__header__text"
>
{{::section.title}}
</span>
<i
class=
"fa fa-minus search-section__header__toggle"
ng-show=
"section.expanded"
></i>
<i
class=
"fa fa-plus search-section__header__toggle"
ng-hide=
"section.expanded"
></i>
</a>
</div>
<div
ng-if=
"section.expanded"
>
<div
ng-repeat=
"item in section.items"
class=
"search-item"
ng-class=
"{'selected': item.selected}"
>
<gf-form-switch
switch-class=
"gf-form-switch--table-cell"
...
...
@@ -124,7 +127,7 @@
</div>
</div>
<em
class=
"muted"
ng-hide=
"ctrl.
dashboard
s.length > 0"
>
<em
class=
"muted"
ng-hide=
"ctrl.
section
s.length > 0"
>
No Dashboards or Folders found.
</em>
</div>
...
...
public/app/features/dashboard/specs/dashboard_list_ctrl.jest.ts
View file @
bd2b26e9
...
...
@@ -61,6 +61,63 @@ describe('DashboardListCtrl', () => {
});
});
describe
(
'when searching dashboards'
,
()
=>
{
beforeEach
(()
=>
{
const
response
=
[
{
id
:
410
,
title
:
"afolder"
,
type
:
"dash-folder"
,
items
:
[
{
id
:
399
,
title
:
"Dashboard Test"
,
url
:
"dashboard/db/dashboard-test"
,
icon
:
'fa fa-folder'
,
tags
:
[],
isStarred
:
false
,
folderId
:
410
,
folderTitle
:
"afolder"
,
folderSlug
:
"afolder"
}
],
tags
:
[],
isStarred
:
false
},
{
id
:
0
,
title
:
"Root"
,
icon
:
'fa fa-folder-open'
,
uri
:
"db/something-else"
,
type
:
"dash-db"
,
items
:
[
{
id
:
500
,
title
:
"Dashboard Test"
,
url
:
"dashboard/db/dashboard-test"
,
icon
:
'fa fa-folder'
,
tags
:
[],
isStarred
:
false
}
],
tags
:
[],
isStarred
:
false
,
}
];
ctrl
=
createCtrlWithStubs
(
response
);
ctrl
.
query
.
query
=
'd'
;
return
ctrl
.
getDashboards
();
});
it
(
'should set checked to false on all sections and children'
,
()
=>
{
expect
(
ctrl
.
sections
.
length
).
toEqual
(
2
);
expect
(
ctrl
.
sections
[
0
].
checked
).
toEqual
(
false
);
expect
(
ctrl
.
sections
[
0
].
items
[
0
].
checked
).
toEqual
(
false
);
expect
(
ctrl
.
sections
[
1
].
checked
).
toEqual
(
false
);
expect
(
ctrl
.
sections
[
1
].
items
[
0
].
checked
).
toEqual
(
false
);
});
});
describe
(
'when selecting dashboards'
,
()
=>
{
let
ctrl
;
...
...
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