Commit 73d256b9 authored by Homada.Boumedane's avatar Homada.Boumedane
Browse files

refactor(portal): aip

add aip check action
parent a31c578d
......@@ -300,4 +300,37 @@ export class PreservationAipState extends ResourceState<PreservationAipStateMode
const path = [pathAipDetail, action.aip.resId];
ctx.dispatch(new Navigate(path));
}
@Action(PreservationAipAction.Check)
check(ctx: StateContext<PreservationAipStateModel>, action: PreservationAipAction.Check): Observable<string> {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter + 1,
});
return this.apiService.post<string>(`${this._urlResource}/${action.id}/${ApiActionEnum.CHECK}`, null)
.pipe(
tap(result => {
ctx.dispatch(new PreservationAipAction.CheckSuccess(action));
}),
catchError(error => {
ctx.dispatch(new PreservationAipAction.CheckFail(action));
throw error;
}),
);
}
@Action(PreservationAipAction.CheckSuccess)
checkSuccess(ctx: StateContext<PreservationAipStateModel>, action: PreservationAipAction.CheckSuccess): void {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter - 1,
});
this.notificationService.showInformation(TRANSLATE("notification.aip.action.check.success"), true);
}
@Action(PreservationAipAction.CheckFail)
checkFail(ctx: StateContext<PreservationAipStateModel>, action: PreservationAipAction.CheckFail): void {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter - 1,
});
this.notificationService.showError(TRANSLATE("notification.aip.action.check.fail"));
}
}
......@@ -19,6 +19,7 @@ export class ApiActionEnum {
public static ORDER_LIST_BY_USER: string = "list-for-user";
public static REINDEX: string = "reindex";
public static CHECK: string = "check";
public static CHECK_FIXITY: string = "check-fixity";
public static SEARCH_DOI: string = "search-doi";
......
......@@ -1824,6 +1824,10 @@
"simpleChecksum": {
"fail": "Impossible to do a simple checkum",
"success": "The AIP's simple checksums will be checked"
},
"check": {
"fail": "Impossible to do a check",
"success": "The AIP's check will be executed"
}
},
"file": {
......
......@@ -1824,6 +1824,10 @@
"simpleChecksum": {
"fail": "Impossible to do a simple checkum",
"success": "The AIP's simple checksums will be checked"
},
"check": {
"fail": "Impossible to do a check",
"success": "The AIP's check will be executed"
}
},
"file": {
......
......@@ -1824,6 +1824,10 @@
"simpleChecksum": {
"fail": "Impossible de faire un simple checksums",
"success": "Les checksums simple de l'AIP vont être vérifiés"
},
"check": {
"fail": "Impossible de faire une verification",
"success": "La verification de l'AIP vas être exécutée"
}
},
"file": {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment