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
0a1c8fda
Commit
0a1c8fda
authored
Nov 27, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:grafana/grafana into develop
parents
e98af1b3
7ce766d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
1 deletions
+64
-1
public/app/features/dashboard/dashboard_list_ctrl.ts
+10
-1
public/app/features/dashboard/partials/dashboardList.html
+12
-0
public/app/features/dashboard/specs/dashboard_list_ctrl.jest.ts
+42
-0
No files found.
public/app/features/dashboard/dashboard_list_ctrl.ts
View file @
0a1c8fda
...
@@ -10,6 +10,7 @@ export class DashboardListCtrl {
...
@@ -10,6 +10,7 @@ export class DashboardListCtrl {
navModel
:
any
;
navModel
:
any
;
canDelete
=
false
;
canDelete
=
false
;
canMove
=
false
;
canMove
=
false
;
hasFilters
=
false
;
selectAllChecked
=
false
;
selectAllChecked
=
false
;
starredFilterOptions
=
[{
text
:
'Filter by Starred'
,
disabled
:
true
},
{
text
:
'Yes'
},
{
text
:
'No'
}];
starredFilterOptions
=
[{
text
:
'Filter by Starred'
,
disabled
:
true
},
{
text
:
'Yes'
},
{
text
:
'No'
}];
selectedStarredFilter
:
any
;
selectedStarredFilter
:
any
;
...
@@ -17,7 +18,7 @@ export class DashboardListCtrl {
...
@@ -17,7 +18,7 @@ export class DashboardListCtrl {
/** @ngInject */
/** @ngInject */
constructor
(
private
backendSrv
,
navModelSrv
,
private
$q
,
private
searchSrv
:
SearchSrv
)
{
constructor
(
private
backendSrv
,
navModelSrv
,
private
$q
,
private
searchSrv
:
SearchSrv
)
{
this
.
navModel
=
navModelSrv
.
getNav
(
'dashboards'
,
'dashboards'
);
this
.
navModel
=
navModelSrv
.
getNav
(
'dashboards'
,
'dashboards'
);
this
.
query
=
{
query
:
''
,
mode
:
'tree'
,
tag
:
[]};
this
.
query
=
{
query
:
''
,
mode
:
'tree'
,
tag
:
[]
,
starred
:
false
};
this
.
selectedStarredFilter
=
this
.
starredFilterOptions
[
0
];
this
.
selectedStarredFilter
=
this
.
starredFilterOptions
[
0
];
this
.
getDashboards
().
then
(()
=>
{
this
.
getDashboards
().
then
(()
=>
{
...
@@ -35,6 +36,7 @@ export class DashboardListCtrl {
...
@@ -35,6 +36,7 @@ export class DashboardListCtrl {
this
.
canMove
=
false
;
this
.
canMove
=
false
;
this
.
canDelete
=
false
;
this
.
canDelete
=
false
;
this
.
selectAllChecked
=
false
;
this
.
selectAllChecked
=
false
;
this
.
hasFilters
=
this
.
query
.
query
.
length
>
0
||
this
.
query
.
tag
.
length
>
0
||
this
.
query
.
starred
;
if
(
!
result
)
{
if
(
!
result
)
{
this
.
sections
=
[];
this
.
sections
=
[];
...
@@ -194,4 +196,11 @@ export class DashboardListCtrl {
...
@@ -194,4 +196,11 @@ export class DashboardListCtrl {
this
.
selectionChanged
();
this
.
selectionChanged
();
}
}
clearFilters
()
{
this
.
query
.
query
=
''
;
this
.
query
.
tag
=
[];
this
.
query
.
starred
=
false
;
this
.
getDashboards
();
}
}
}
public/app/features/dashboard/partials/dashboardList.html
View file @
0a1c8fda
...
@@ -32,6 +32,18 @@
...
@@ -32,6 +32,18 @@
</span>
</span>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form-button-row"
ng-show=
"ctrl.hasFilters"
>
<button
type=
"button"
class=
"btn gf-form-button btn-inverse btn-small"
ng-click=
"ctrl.clearFilters()"
>
<i
class=
"fa fa-close"
></i>
Clear current search query and filters
</button>
</div>
</div>
<div
class=
"gf-form-group"
>
<div
class=
"gf-form-group"
>
<div
class=
"gf-form-button-row"
>
<div
class=
"gf-form-button-row"
>
<button
type=
"button"
<button
type=
"button"
...
...
public/app/features/dashboard/specs/dashboard_list_ctrl.jest.ts
View file @
0a1c8fda
...
@@ -124,6 +124,10 @@ describe('DashboardListCtrl', () => {
...
@@ -124,6 +124,10 @@ describe('DashboardListCtrl', () => {
expect
(
ctrl
.
canDelete
).
toBeFalsy
();
expect
(
ctrl
.
canDelete
).
toBeFalsy
();
});
});
it
(
'should have active filters'
,
()
=>
{
expect
(
ctrl
.
hasFilters
).
toBeTruthy
();
});
describe
(
'when select all is checked'
,
()
=>
{
describe
(
'when select all is checked'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
ctrl
.
selectAllChecked
=
true
;
ctrl
.
selectAllChecked
=
true
;
...
@@ -143,6 +147,16 @@ describe('DashboardListCtrl', () => {
...
@@ -143,6 +147,16 @@ describe('DashboardListCtrl', () => {
it
(
'should enable delete button'
,
()
=>
{
it
(
'should enable delete button'
,
()
=>
{
expect
(
ctrl
.
canDelete
).
toBeTruthy
();
expect
(
ctrl
.
canDelete
).
toBeTruthy
();
});
});
describe
(
'when clearing filters'
,
()
=>
{
beforeEach
(()
=>
{
return
ctrl
.
clearFilters
();
});
it
(
'should reset query filter'
,
()
=>
{
expect
(
ctrl
.
query
.
query
).
toEqual
(
''
);
});
});
});
});
});
});
...
@@ -155,6 +169,20 @@ describe('DashboardListCtrl', () => {
...
@@ -155,6 +169,20 @@ describe('DashboardListCtrl', () => {
expect
(
ctrl
.
sections
.
length
).
toEqual
(
1
);
expect
(
ctrl
.
sections
.
length
).
toEqual
(
1
);
expect
(
ctrl
.
query
.
tag
[
0
]).
toEqual
(
'test'
);
expect
(
ctrl
.
query
.
tag
[
0
]).
toEqual
(
'test'
);
});
});
it
(
'should have active filters'
,
()
=>
{
expect
(
ctrl
.
hasFilters
).
toBeTruthy
();
});
describe
(
'when clearing filters'
,
()
=>
{
beforeEach
(()
=>
{
return
ctrl
.
clearFilters
();
});
it
(
'should reset tag filter'
,
()
=>
{
expect
(
ctrl
.
query
.
tag
.
length
).
toEqual
(
0
);
});
});
});
});
describe
(
'with starred filter'
,
()
=>
{
describe
(
'with starred filter'
,
()
=>
{
...
@@ -169,6 +197,20 @@ describe('DashboardListCtrl', () => {
...
@@ -169,6 +197,20 @@ describe('DashboardListCtrl', () => {
expect
(
ctrl
.
sections
.
length
).
toEqual
(
1
);
expect
(
ctrl
.
sections
.
length
).
toEqual
(
1
);
expect
(
ctrl
.
query
.
starred
).
toEqual
(
true
);
expect
(
ctrl
.
query
.
starred
).
toEqual
(
true
);
});
});
it
(
'should have active filters'
,
()
=>
{
expect
(
ctrl
.
hasFilters
).
toBeTruthy
();
});
describe
(
'when clearing filters'
,
()
=>
{
beforeEach
(()
=>
{
return
ctrl
.
clearFilters
();
});
it
(
'should reset starred filter'
,
()
=>
{
expect
(
ctrl
.
query
.
starred
).
toEqual
(
false
);
});
});
});
});
});
});
...
...
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