Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DLCM
UI
DLCM-Portal
Commits
dec9fba2
Commit
dec9fba2
authored
Dec 15, 2021
by
Florent Poittevin
Committed by
Alicia.DeDiosFuente
Dec 17, 2021
Browse files
feat: [DLCM-1985] improve sequential and parallel dispatch actions to manage intention and timeout
parent
0d70859c
Changes
28
Hide whitespace changes
Inline
Side-by-side
src/app/features/admin/funding-agencies/stores/admin-funding-agencies.state.ts
View file @
dec9fba2
...
...
@@ -27,8 +27,15 @@ import {
}
from
"
@shared/enums/routes.enum
"
;
import
{
StateEnum
}
from
"
@shared/enums/state.enum
"
;
import
{
SharedOrgUnitAction
}
from
"
@shared/stores/organizational-unit/shared-organizational-unit.action
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
Observable
,
of
,
switchMap
,
}
from
"
rxjs
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultAssociationStateInitValue
,
...
...
@@ -110,7 +117,7 @@ export class AdminFundingAgenciesState extends ResourceState<AdminFundingAgencie
}
@
Action
(
AdminFundingAgenciesAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
AdminFundingAgenciesStateModel
>
,
action
:
AdminFundingAgenciesAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
AdminFundingAgenciesStateModel
>
,
action
:
AdminFundingAgenciesAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -124,12 +131,13 @@ export class AdminFundingAgenciesState extends ResourceState<AdminFundingAgencie
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminFundingAgenciesAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminFundingAgenciesAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
@@ -180,12 +188,14 @@ export class AdminFundingAgenciesState extends ResourceState<AdminFundingAgencie
this
.
actions$
.
pipe
(
ofSolidifyActionCompleted
(
AdminFundingAgenciesOrgUnitAction
.
UpdateSuccess
)),
this
.
actions$
.
pipe
(
ofSolidifyActionCompleted
(
AdminFundingAgenciesOrgUnitAction
.
UpdateFail
)),
],
}]);
}]).
pipe
(
map
(
result
=>
result
.
success
),
);
}
@
OverrideDefaultAction
()
@
Action
(
AdminFundingAgenciesAction
.
Delete
)
delete
(
ctx
:
StateContext
<
AdminFundingAgenciesStateModel
>
,
action
:
AdminFundingAgenciesAction
.
Delete
):
Observable
<
an
y
>
{
delete
(
ctx
:
StateContext
<
AdminFundingAgenciesStateModel
>
,
action
:
AdminFundingAgenciesAction
.
Delete
):
Observable
<
FundingAgenc
y
>
{
const
oldOrgUnit
=
ctx
.
getState
().
admin_fundingAgencies_organizationalUnit
.
selected
.
map
(
o
=>
o
.
resId
);
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
...
...
@@ -200,11 +210,13 @@ export class AdminFundingAgenciesState extends ResourceState<AdminFundingAgencie
},
],
).
pipe
(
tap
(
deleteSubResourceWithSuccess
=>
{
if
(
deleteSubResourceWithSuccess
)
{
this
.
subscribe
(
super
.
delete
(
ctx
,
action
));
map
(
result
=>
result
.
success
),
switchMap
(
success
=>
{
if
(
success
)
{
return
super
.
delete
(
ctx
,
action
);
}
else
{
super
.
deleteFail
(
ctx
,
action
as
any
);
return
of
(
null
);
}
}),
);
...
...
src/app/features/admin/institution/stores/admin-institution.state.ts
View file @
dec9fba2
...
...
@@ -9,9 +9,7 @@ import {
}
from
"
@admin/institution/stores/organizational-unit/admin-institution-organizational-unit.state
"
;
import
{
HttpClient
}
from
"
@angular/common/http
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
Institution
,
}
from
"
@models
"
;
import
{
Institution
}
from
"
@models
"
;
import
{
Action
,
Actions
,
...
...
@@ -33,7 +31,10 @@ import {
ResourceLogoStateModeEnum
,
}
from
"
@shared/stores/resource-logo/resource-logo.state
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultAssociationStateInitValue
,
...
...
@@ -53,14 +54,15 @@ export interface AdminInstitutionStateModel extends ResourceLogoStateModel<Insti
@
Injectable
()
@
State
<
AdminInstitutionStateModel
>
({
name
:
StateEnum
.
admin_institution
,
defaults
:
{
...
defaultResourceLogoStateInitValue
(),
admin_institution_organizationalUnit
:
{...
defaultAssociationStateInitValue
()},
name
:
StateEnum
.
admin_institution
,
defaults
:
{
...
defaultResourceLogoStateInitValue
(),
admin_institution_organizationalUnit
:
{...
defaultAssociationStateInitValue
()},
},
children
:
[
AdminInstitutionOrganizationalUnitState
,
],
},
children
:
[
AdminInstitutionOrganizationalUnitState
,
]},
)
export
class
AdminInstitutionState
extends
ResourceLogoState
<
AdminInstitutionStateModel
,
Institution
>
{
constructor
(
protected
apiService
:
ApiService
,
...
...
@@ -127,7 +129,6 @@ export class AdminInstitutionState extends ResourceLogoState<AdminInstitutionSta
}
}
@
OverrideDefaultAction
()
@
Action
(
AdminInstitutionAction
.
Create
)
create
(
ctx
:
StateContext
<
AdminInstitutionStateModel
>
,
action
:
AdminInstitutionAction
.
Create
):
Observable
<
Institution
>
{
...
...
@@ -152,14 +153,16 @@ export class AdminInstitutionState extends ResourceLogoState<AdminInstitutionSta
return
super
.
internalUpdate
(
ctx
,
action
)
.
pipe
(
tap
(
model
=>
{
this
.
updateSubResource
(
model
,
action
,
ctx
)
.
subscribe
(
success
=>
{
if
(
success
)
{
ctx
.
dispatch
(
new
AdminInstitutionAction
.
UpdateSuccess
(
action
,
model
));
}
else
{
ctx
.
dispatch
(
new
AdminInstitutionAction
.
UpdateFail
(
action
));
}
});
this
.
subscribe
(
this
.
updateSubResource
(
model
,
action
,
ctx
).
pipe
(
tap
(
success
=>
{
if
(
success
)
{
ctx
.
dispatch
(
new
AdminInstitutionAction
.
UpdateSuccess
(
action
,
model
));
}
else
{
ctx
.
dispatch
(
new
AdminInstitutionAction
.
UpdateFail
(
action
));
}
}),
));
}),
);
}
...
...
@@ -177,7 +180,9 @@ export class AdminInstitutionState extends ResourceLogoState<AdminInstitutionSta
this
.
actions$
.
pipe
(
ofSolidifyActionCompleted
(
AdminInstitutionOrganizationalUnitAction
.
UpdateFail
)),
],
},
]);
]).
pipe
(
map
(
result
=>
result
.
success
),
);
}
}
src/app/features/admin/language/stores/admin-language.state.ts
View file @
dec9fba2
...
...
@@ -18,7 +18,7 @@ import {RoutesEnum} from "@shared/enums/routes.enum";
import
{
StateEnum
}
from
"
@shared/enums/state.enum
"
;
import
{
SharedLanguageAction
}
from
"
@shared/stores/language/shared-language.action
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
t
ap
}
from
"
rxjs/operators
"
;
import
{
m
ap
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultResourceStateInitValue
,
...
...
@@ -90,7 +90,7 @@ export class AdminLanguageState extends ResourceState<AdminLanguageStateModel, L
}
@
Action
(
AdminLanguageAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminLanguageAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminLanguageAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -104,12 +104,13 @@ export class AdminLanguageState extends ResourceState<AdminLanguageStateModel, L
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminLanguageAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminLanguageAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
src/app/features/admin/notification/stores/admin-notification.state.ts
View file @
dec9fba2
...
...
@@ -25,7 +25,10 @@ import {StateEnum} from "@shared/enums/state.enum";
import
{
SharedRoleAction
}
from
"
@shared/stores/role/shared-role.action
"
;
import
{
defaultStatusHistoryInitValue
}
from
"
@shared/stores/status-history/status-history.state
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultResourceStateInitValue
,
...
...
@@ -105,7 +108,7 @@ export class AdminNotificationState extends ResourceState<AdminNotificationState
@
OverrideDefaultAction
()
@
Action
(
AdminNotificationAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
AdminNotificationStateModel
>
,
action
:
AdminNotificationAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
AdminNotificationStateModel
>
,
action
:
AdminNotificationAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -119,12 +122,13 @@ export class AdminNotificationState extends ResourceState<AdminNotificationState
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminNotificationAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminNotificationAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
src/app/features/admin/oai-set/stores/admin-oai-set.state.ts
View file @
dec9fba2
...
...
@@ -20,7 +20,10 @@ import {
import
{
StateEnum
}
from
"
@shared/enums/state.enum
"
;
import
{
SharedOrgUnitAction
}
from
"
@shared/stores/organizational-unit/shared-organizational-unit.action
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultResourceStateInitValue
,
...
...
@@ -95,7 +98,7 @@ export class AdminOaiSetState extends ResourceState<AdminOaiSetStateModel, OaiSe
}
@
Action
(
AdminOaiSetAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
AdminOaiSetStateModel
>
,
action
:
AdminOaiSetAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
AdminOaiSetStateModel
>
,
action
:
AdminOaiSetAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -109,12 +112,13 @@ export class AdminOaiSetState extends ResourceState<AdminOaiSetStateModel, OaiSe
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminOaiSetAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminOaiSetAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
@@ -146,13 +150,13 @@ export class AdminOaiSetState extends ResourceState<AdminOaiSetStateModel, OaiSe
],
});
});
StoreUtil
.
dispatchSequentialActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
).
subscribe
(
success
=>
{
if
(
success
)
{
this
.
subscribe
(
StoreUtil
.
dispatchSequentialActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
).
pipe
(
tap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminOaiSetAction
.
BulkCreateSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminOaiSetAction
.
BulkCreateFail
(
action
));
}
});
})
))
;
}
@
Action
(
AdminOaiSetAction
.
BulkCreateSuccess
)
...
...
src/app/features/admin/organizational-unit/stores/admin-organizational-unit.state.ts
View file @
dec9fba2
...
...
@@ -69,7 +69,10 @@ import {
import
{
SharedRoleAction
}
from
"
@shared/stores/role/shared-role.action
"
;
import
{
SharedSubmissionPolicyAction
}
from
"
@shared/stores/submission-policy/shared-submission-policy.action
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultAssociationStateInitValue
,
...
...
@@ -188,7 +191,7 @@ export class AdminOrganizationalUnitState extends ResourceLogoState<AdminOrganiz
}
@
Action
(
AdminOrganizationalUnitAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminOrganizationalUnitAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminOrganizationalUnitAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -223,12 +226,13 @@ export class AdminOrganizationalUnitState extends ResourceLogoState<AdminOrganiz
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminOrganizationalUnitAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminOrganizationalUnitAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}));
}
...
...
@@ -349,7 +353,9 @@ export class AdminOrganizationalUnitState extends ResourceLogoState<AdminOrganiz
this
.
actions$
.
pipe
(
ofSolidifyActionCompleted
(
AdminOrganizationalUnitInstitutionAction
.
UpdateFail
)),
],
},
]);
]).
pipe
(
map
(
result
=>
result
.
success
),
);
}
@
OverrideDefaultAction
()
...
...
src/app/features/admin/organizational-unit/stores/dissemination-policy/admin-organizational-unit-dissemination-policy.state.ts
View file @
dec9fba2
...
...
@@ -21,7 +21,10 @@ import {
Observable
,
of
,
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ActionSubActionCompletionsWrapper
,
ApiService
,
...
...
@@ -107,7 +110,9 @@ export class AdminOrganizationalUnitDisseminationPolicyState extends Relation2Ti
if
(
isEmptyArray
(
listActionSubActionCompletionsWrapper
))
{
return
of
(
true
);
}
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
);
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
).
pipe
(
map
(
result
=>
result
.
success
),
);
}
private
getSubActionCompletions
():
Observable
<
ActionCompletion
<
BaseSubAction
<
AdminOrganizationalUnitDisseminationPolicyAction
.
UpdateRelation
>
,
Error
>>
[]
|
undefined
{
...
...
src/app/features/admin/organizational-unit/stores/preservation-policy/admin-organizational-unit-preservation-policy.state.ts
View file @
dec9fba2
...
...
@@ -21,7 +21,10 @@ import {
Observable
,
of
,
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ActionSubActionCompletionsWrapper
,
ApiService
,
...
...
@@ -107,7 +110,9 @@ export class AdminOrganizationalUnitPreservationPolicyState extends Relation2Tie
if
(
isEmptyArray
(
listActionSubActionCompletionsWrapper
))
{
return
of
(
true
);
}
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
);
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
).
pipe
(
map
(
result
=>
result
.
success
),
);
}
private
getSubActionCompletions
():
Observable
<
ActionCompletion
<
BaseSubAction
<
AdminOrganizationalUnitPreservationPolicyAction
.
UpdateRelation
>
,
Error
>>
[]
|
undefined
{
...
...
src/app/features/admin/organizational-unit/stores/submission-policy/admin-organizational-unit-submission-policy.state.ts
View file @
dec9fba2
...
...
@@ -21,7 +21,10 @@ import {
Observable
,
of
,
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ActionSubActionCompletionsWrapper
,
ApiService
,
...
...
@@ -107,7 +110,9 @@ export class AdminOrganizationalUnitSubmissionPolicyState extends Relation2Tiers
if
(
isEmptyArray
(
listActionSubActionCompletionsWrapper
))
{
return
of
(
true
);
}
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
);
return
StoreUtil
.
dispatchParallelActionAndWaitForSubActionsCompletion
(
ctx
,
listActionSubActionCompletionsWrapper
).
pipe
(
map
(
result
=>
result
.
success
),
);
}
private
getSubActionCompletions
():
Observable
<
ActionCompletion
<
BaseSubAction
<
AdminOrganizationalUnitSubmissionPolicyAction
.
UpdateRelation
>
,
Error
>>
[]
|
undefined
{
...
...
src/app/features/admin/person/stores/admin-person.state.ts
View file @
dec9fba2
...
...
@@ -32,7 +32,10 @@ import {
import
{
StateEnum
}
from
"
@shared/enums/state.enum
"
;
import
{
SharedRoleAction
}
from
"
@shared/stores/role/shared-role.action
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultAssociationStateInitValue
,
...
...
@@ -121,7 +124,7 @@ export class AdminPersonState extends ResourceState<AdminPersonStateModel, Perso
}
@
Action
(
AdminPersonAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminPersonAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminPersonAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -135,12 +138,13 @@ export class AdminPersonState extends ResourceState<AdminPersonStateModel, Perso
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminPersonAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminPersonAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
@@ -206,6 +210,8 @@ export class AdminPersonState extends ResourceState<AdminPersonStateModel, Perso
this
.
actions$
.
pipe
(
ofSolidifyActionCompleted
(
AdminPersonInstitutionsAction
.
UpdateFail
)),
],
},
]);
]).
pipe
(
map
(
result
=>
result
.
success
),
);
}
}
src/app/features/admin/research-domain/stores/admin-research-domain.state.ts
View file @
dec9fba2
...
...
@@ -18,7 +18,10 @@ import {RoutesEnum} from "@shared/enums/routes.enum";
import
{
StateEnum
}
from
"
@shared/enums/state.enum
"
;
import
{
SharedLanguageAction
}
from
"
@shared/stores/language/shared-language.action
"
;
import
{
Observable
}
from
"
rxjs
"
;
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
ApiService
,
defaultResourceStateInitValue
,
...
...
@@ -90,7 +93,7 @@ export class AdminResearchDomainState extends ResourceState<AdminResearchDomainS
}
@
Action
(
AdminResearchDomainAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminResearchDomainAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
DepositStateModel
>
,
action
:
AdminResearchDomainAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -104,12 +107,13 @@ export class AdminResearchDomainState extends ResourceState<AdminResearchDomainS
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminResearchDomainAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminResearchDomainAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
src/app/features/admin/user/stores/admin-user.state.ts
View file @
dec9fba2
...
...
@@ -30,6 +30,7 @@ import {
import
{
Observable
}
from
"
rxjs
"
;
import
{
catchError
,
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
...
...
@@ -112,7 +113,7 @@ export class AdminUserState extends ResourceLogoState<AdminUserStateModel, User>
}
@
Action
(
AdminUserAction
.
LoadResource
)
loadResource
(
ctx
:
StateContext
<
AdminUserStateModel
>
,
action
:
AdminUserAction
.
LoadResource
):
Observable
<
an
y
>
{
loadResource
(
ctx
:
StateContext
<
AdminUserStateModel
>
,
action
:
AdminUserAction
.
LoadResource
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -126,12 +127,13 @@ export class AdminUserState extends ResourceLogoState<AdminUserStateModel, User>
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
AdminUserAction
.
LoadResourceSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
AdminUserAction
.
LoadResourceFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
src/app/features/deposit/components/routables/deposit-root/deposit-root.routable.ts
View file @
dec9fba2
...
...
@@ -19,6 +19,7 @@ import {UserPreferencesUtil} from "@shared/utils/user-preferences.util";
import
{
tap
}
from
"
rxjs/operators
"
;
import
{
isEmptyArray
,
isFalse
,
isNullOrUndefined
,
MARK_AS_TRANSLATABLE
,
MemoizedUtil
,
...
...
@@ -51,8 +52,8 @@ export class DepositRootRoutable extends SharedAbstractRoutable implements OnIni
],
},
]).
pipe
(
tap
(
success
=>
{
if
(
!
success
)
{
tap
(
result
=>
{
if
(
isFalse
(
result
.
success
)
)
{
return
;
}
...
...
src/app/features/deposit/stores/collection/deposit-collection.state.ts
View file @
dec9fba2
...
...
@@ -29,6 +29,7 @@ import {defaultStatusHistoryInitValue} from "@shared/stores/status-history/statu
import
{
Observable
}
from
"
rxjs
"
;
import
{
catchError
,
map
,
tap
,
}
from
"
rxjs/operators
"
;
import
{
...
...
@@ -91,7 +92,7 @@ export class DepositCollectionState extends AssociationRemoteState<DepositCollec
}
@
Action
(
DepositCollectionAction
.
Refresh
)
refresh
(
ctx
:
StateContext
<
DepositCollectionStateModel
>
,
action
:
DepositCollectionAction
.
Refresh
):
Observable
<
an
y
>
{
refresh
(
ctx
:
StateContext
<
DepositCollectionStateModel
>
,
action
:
DepositCollectionAction
.
Refresh
):
Observable
<
boole
an
>
{
ctx
.
patchState
({
isLoadingCounter
:
ctx
.
getState
().
isLoadingCounter
+
1
,
});
...
...
@@ -112,12 +113,13 @@ export class DepositCollectionState extends AssociationRemoteState<DepositCollec
],
},
]).
pipe
(
t
ap
(
success
=>
{
if
(
success
)
{
m
ap
(
result
=>
{
if
(
result
.
success
)
{
ctx
.
dispatch
(
new
DepositCollectionAction
.
RefreshSuccess
(
action
));
}
else
{
ctx
.
dispatch
(
new
DepositCollectionAction
.
RefreshFail
(
action
));
}
return
result
.
success
;
}),
);
}
...
...
src/ap