Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
04f2878b
Commit
04f2878b
authored
7 years ago
by
William Welling
Browse files
Options
Downloads
Patches
Plain Diff
using itemsRD observables
parent
595a741d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/+search-page/search.service.ts
+3
-14
3 additions, 14 deletions
src/app/+search-page/search.service.ts
with
3 additions
and
14 deletions
src/app/+search-page/search.service.ts
+
3
−
14
View file @
04f2878b
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs/Observable
'
;
import
{
BehaviorSubject
}
from
'
rxjs/BehaviorSubject
'
;
import
{
DSpaceObject
}
from
'
../core/shared/dspace-object.model
'
;
import
{
Item
}
from
'
../core/shared/item.model
'
;
...
...
@@ -69,11 +68,6 @@ export class SearchService {
self
+=
`&sortField=
${
searchOptions
.
sort
.
field
}
`
;
}
const
requestPendingSubject
=
new
BehaviorSubject
<
boolean
>
(
true
);
const
responsePendingSubject
=
new
BehaviorSubject
<
boolean
>
(
false
);
const
requestPending
=
requestPendingSubject
.
asObservable
();
const
responsePending
=
responsePendingSubject
.
asObservable
();
const
errorMessage
=
Observable
.
of
(
undefined
);
const
statusCode
=
Observable
.
of
(
'
200
'
);
const
returningPageInfo
=
new
PageInfo
();
...
...
@@ -94,7 +88,7 @@ export class SearchService {
const
pageInfo
=
itemsRD
.
pageInfo
.
map
((
info
:
PageInfo
)
=>
{
const
totalElements
=
info
.
totalElements
>
20
?
20
:
info
.
totalElements
;
return
Object
.
assign
({},
info
,
{
totalElements
:
totalElements
});
return
Object
.
assign
({},
info
,
{
totalElements
:
totalElements
});
});
const
payload
=
itemsRD
.
payload
.
map
((
items
:
Item
[])
=>
{
...
...
@@ -110,15 +104,10 @@ export class SearchService {
});
});
itemsRD
.
hasSucceeded
.
subscribe
((
success
:
boolean
)
=>
{
requestPendingSubject
.
next
(
!
success
);
responsePendingSubject
.
next
(
!
success
);
});
return
new
RemoteData
(
Observable
.
of
(
self
),
r
equestPending
,
r
esponsePending
,
itemsRD
.
isR
equestPending
,
itemsRD
.
isR
esponsePending
,
itemsRD
.
hasSucceeded
,
errorMessage
,
statusCode
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment