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
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
1f1846c4
Commit
1f1846c4
authored
5 years ago
by
Kristof De Langhe
Browse files
Options
Downloads
Patches
Plain Diff
69432: Immediate patch
parent
004297fc
Branches
Branches containing commit
Tags
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
+27
-1
27 additions, 1 deletion
src/app/core/data/data.service.ts
with
27 additions
and
1 deletion
src/app/core/data/data.service.ts
+
27
−
1
View file @
1f1846c4
...
@@ -44,7 +44,7 @@ import {
...
@@ -44,7 +44,7 @@ import {
FindByIDRequest
,
FindByIDRequest
,
FindListOptions
,
FindListOptions
,
FindListRequest
,
FindListRequest
,
GetRequest
GetRequest
,
PatchRequest
}
from
'
./request.models
'
;
}
from
'
./request.models
'
;
import
{
RequestEntry
}
from
'
./request.reducer
'
;
import
{
RequestEntry
}
from
'
./request.reducer
'
;
import
{
RequestService
}
from
'
./request.service
'
;
import
{
RequestService
}
from
'
./request.service
'
;
...
@@ -337,6 +337,32 @@ export abstract class DataService<T extends CacheableObject> {
...
@@ -337,6 +337,32 @@ export abstract class DataService<T extends CacheableObject> {
this
.
objectCache
.
addPatch
(
href
,
operations
);
this
.
objectCache
.
addPatch
(
href
,
operations
);
}
}
/**
* Send out an immediate patch request, instead of adding to the object cache first
* This is useful in cases where you need the returned response and an object cache update is not needed
* @param dso The dso to send the patch to
* @param operations The patch operations
*/
immediatePatch
(
dso
:
T
,
operations
:
Operation
[]):
Observable
<
RestResponse
>
{
const
requestId
=
this
.
requestService
.
generateRequestId
();
const
hrefObs
=
this
.
halService
.
getEndpoint
(
this
.
linkPath
).
pipe
(
map
((
endpoint
:
string
)
=>
this
.
getIDHref
(
endpoint
,
dso
.
uuid
)));
hrefObs
.
pipe
(
find
((
href
:
string
)
=>
hasValue
(
href
)),
map
((
href
:
string
)
=>
{
const
request
=
new
PatchRequest
(
requestId
,
href
,
operations
);
this
.
requestService
.
configure
(
request
);
})
).
subscribe
();
return
this
.
requestService
.
getByUUID
(
requestId
).
pipe
(
find
((
request
:
RequestEntry
)
=>
request
.
completed
),
map
((
request
:
RequestEntry
)
=>
request
.
response
)
);
}
/**
/**
* Add a new patch to the object cache
* Add a new patch to the object cache
* The patch is derived from the differences between the given object and its version in the object cache
* The patch is derived from the differences between the given object and its version in the object cache
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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