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
8f4ad1e4
Commit
8f4ad1e4
authored
Nov 28, 2017
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashlist: handle recent dashboards removed from backend
parent
368a4d7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
public/app/core/services/search_srv.ts
+5
-2
public/app/core/specs/search_srv.jest.ts
+25
-0
No files found.
public/app/core/services/search_srv.ts
View file @
8f4ad1e4
...
...
@@ -38,8 +38,11 @@ export class SearchSrv {
return
this
.
backendSrv
.
search
({
dashboardIds
:
dashIds
}).
then
(
result
=>
{
return
dashIds
.
map
(
orderId
=>
{
return
this
.
transformToViewModel
(
_
.
find
(
result
,
{
id
:
orderId
}));
}).
filter
(
item
=>
!
item
.
isStarred
);
return
_
.
find
(
result
,
{
id
:
orderId
});
}).
filter
(
hit
=>
hit
&&
!
hit
.
isStarred
)
.
map
(
hit
=>
{
return
this
.
transformToViewModel
(
hit
);
});
});
}
...
...
public/app/core/specs/search_srv.jest.ts
View file @
8f4ad1e4
...
...
@@ -53,6 +53,31 @@ describe('SearchSrv', () => {
expect
(
results
[
0
].
items
[
0
].
title
).
toBe
(
'first but second'
);
expect
(
results
[
0
].
items
[
1
].
title
).
toBe
(
'second but first'
);
});
describe
(
'and 3 recent dashboards removed in backend'
,
()
=>
{
let
results
;
beforeEach
(()
=>
{
backendSrvMock
.
search
=
jest
.
fn
()
.
mockReturnValueOnce
(
Promise
.
resolve
([{
id
:
2
,
title
:
'two'
},
{
id
:
1
,
title
:
'one'
}]),
)
.
mockReturnValue
(
Promise
.
resolve
([]));
impressionSrv
.
getDashboardOpened
=
jest
.
fn
().
mockReturnValue
([
4
,
5
,
1
,
2
,
3
]);
return
searchSrv
.
search
({
query
:
''
}).
then
(
res
=>
{
results
=
res
;
});
});
it
(
'should return 2 dashboards'
,
()
=>
{
expect
(
results
[
0
].
items
.
length
).
toBe
(
2
);
expect
(
results
[
0
].
items
[
0
].
id
).
toBe
(
1
);
expect
(
results
[
0
].
items
[
1
].
id
).
toBe
(
2
);
});
});
});
describe
(
'With starred dashboards'
,
()
=>
{
...
...
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