Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
f93a104d
Commit
f93a104d
authored
5 years ago
by
Kristof De Langhe
Browse files
Options
Downloads
Patches
Plain Diff
63945: deleteAndReturnResponse on data-service
parent
277aad26
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/core/data/data.service.ts
+29
-4
29 additions, 4 deletions
src/app/core/data/data.service.ts
with
29 additions
and
4 deletions
src/app/core/data/data.service.ts
+
29
−
4
View file @
f93a104d
...
@@ -284,6 +284,34 @@ export abstract class DataService<T extends CacheableObject> {
...
@@ -284,6 +284,34 @@ export abstract class DataService<T extends CacheableObject> {
* Return an observable that emits true when the deletion was successful, false when it failed
* Return an observable that emits true when the deletion was successful, false when it failed
*/
*/
delete
(
dso
:
T
):
Observable
<
boolean
>
{
delete
(
dso
:
T
):
Observable
<
boolean
>
{
const
requestId
=
this
.
deleteAndReturnRequestId
(
dso
);
return
this
.
requestService
.
getByUUID
(
requestId
).
pipe
(
find
((
request
:
RequestEntry
)
=>
request
.
completed
),
map
((
request
:
RequestEntry
)
=>
request
.
response
.
isSuccessful
)
);
}
/**
* Delete an existing DSpace Object on the server
* @param dso The DSpace Object to be removed
* Return an observable of the completed response
*/
deleteAndReturnResponse
(
dso
:
T
):
Observable
<
RestResponse
>
{
const
requestId
=
this
.
deleteAndReturnRequestId
(
dso
);
return
this
.
requestService
.
getByUUID
(
requestId
).
pipe
(
find
((
request
:
RequestEntry
)
=>
request
.
completed
),
map
((
request
:
RequestEntry
)
=>
request
.
response
)
);
}
/**
* Delete an existing DSpace Object on the server
* @param dso The DSpace Object to be removed
* Return the delete request's ID
*/
deleteAndReturnRequestId
(
dso
:
T
):
string
{
const
requestId
=
this
.
requestService
.
generateRequestId
();
const
requestId
=
this
.
requestService
.
generateRequestId
();
const
hrefObs
=
this
.
halService
.
getEndpoint
(
this
.
linkPath
).
pipe
(
const
hrefObs
=
this
.
halService
.
getEndpoint
(
this
.
linkPath
).
pipe
(
...
@@ -297,10 +325,7 @@ export abstract class DataService<T extends CacheableObject> {
...
@@ -297,10 +325,7 @@ export abstract class DataService<T extends CacheableObject> {
})
})
).
subscribe
();
).
subscribe
();
return
this
.
requestService
.
getByUUID
(
requestId
).
pipe
(
return
requestId
;
find
((
request
:
RequestEntry
)
=>
request
.
completed
),
map
((
request
:
RequestEntry
)
=>
request
.
response
.
isSuccessful
)
);
}
}
/**
/**
...
...
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