Commit 929dd7f9 authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

feat: deposit back to list preserve tab status previously active

parent d36f932c
......@@ -25,6 +25,7 @@ import {AppState} from "@app/stores/app.state";
import {AppBannerAction} from "@app/stores/banner/app-banner.action";
import {AppBannerState} from "@app/stores/banner/app-banner.state";
import {AppOrgUnitPersonRoleAction} from "@app/stores/organizational-unit-person-role/app-organizational-unit-person-role.action";
import {DepositRejectDialog} from "@deposit/components/dialogs/deposit-reject/deposit-reject.dialog";
import {ModeDepositTabEnum} from "@deposit/enums/mode-deposit-tab.enum";
import {DepositService} from "@deposit/services/deposit.service";
import {DepositCollectionAction} from "@deposit/stores/collection/deposit-collection.action";
......@@ -83,7 +84,6 @@ import {
Override,
QueryParameters,
} from "solidify-frontend";
import {DepositRejectDialog} from "@deposit/components/dialogs/deposit-reject/deposit-reject.dialog";
@Component({
selector: "dlcm-deposit-detail-edit-routable",
......@@ -490,7 +490,8 @@ export class DepositDetailEditRoutable extends SharedAbstractDetailEditRoutable<
}
backToList(): void {
this._store.dispatch(new Navigate([AppRoutesEnum.deposit, this._orgUnitResId]));
const depositTabStatus = MemoizedUtil.selectSnapshot(this._store, DepositState, state => state.activeListTabStatus);
this._store.dispatch(new Navigate([AppRoutesEnum.deposit, this._orgUnitResId, depositTabStatus]));
}
@Override()
......
......@@ -240,6 +240,8 @@ export class DepositListRoutable extends SharedAbstractListRoutable<Deposit, Dep
if (this.selectedTabIndex !== -1) {
this.currentTabStatus = this.listTabStatus[this.selectedTabIndex];
}
this._store.dispatch(new DepositAction.SetActiveListTabStatus(this.currentTabStatus.tabEnum));
}
private download(deposit: Deposit): void {
......
......@@ -2,6 +2,7 @@ import {DepositDataFile} from "@app/features/deposit/models/deposit-data-file.mo
import {FileUploadWrapper} from "@app/features/deposit/models/file-upload-wrapper.model";
import {UploadFileStatus} from "@app/features/deposit/models/upload-file-status.model";
import {LocalStateEnum} from "@app/shared/enums/local-state.enum";
import {DepositTabStatusEnum} from "@deposit/enums/deposit-tab-status.enum";
import {Enums} from "@enums";
import {Deposit} from "@models";
import {FileListModel} from "@shared/models/business/file-list.model";
......@@ -440,6 +441,14 @@ export namespace DepositAction {
export class ComputeModeTab extends BaseAction {
static readonly type: string = `[${state}] Compute Mode Tab`;
}
export class SetActiveListTabStatus extends BaseAction {
static readonly type: string = `[${state}] Set Active List Tab Status`;
constructor(public activeListTabStatus: DepositTabStatusEnum) {
super();
}
}
}
export const depositActionNameSpace: ResourceLogoNameSpace = DepositAction;
......@@ -37,6 +37,7 @@ import {
import {AppAction} from "@app/stores/app.action";
import {AppAuthorizedOrganizationalUnitState} from "@app/stores/authorized-organizational-unit/app-authorized-organizational-unit.state";
import {DepositFormPresentational} from "@deposit/components/presentationals/deposit-form/deposit-form.presentational";
import {DepositTabStatusEnum} from "@deposit/enums/deposit-tab-status.enum";
import {ModeDepositTabEnum} from "@deposit/enums/mode-deposit-tab.enum";
import {
DepositAipState,
......@@ -153,6 +154,7 @@ export interface DepositStateModel extends ResourceLogoStateModel<Deposit> {
formPresentational: DepositFormPresentational | undefined;
depositModeTabEnum: ModeDepositTabEnum;
dataFileLogo: DataFile | undefined;
activeListTabStatus: DepositTabStatusEnum;
}
@Injectable()
......@@ -185,6 +187,7 @@ export interface DepositStateModel extends ResourceLogoStateModel<Deposit> {
depositModeTabEnum: ModeDepositTabEnum.UNDEFINED,
dataFileLogo: undefined,
isLoadingPhoto: false,
activeListTabStatus: DepositTabStatusEnum.inProgress,
},
children: [
DepositDataFileState,
......@@ -892,6 +895,13 @@ export class DepositState extends ResourceLogoState<DepositStateModel, Deposit>
});
}
@Action(DepositAction.SetActiveListTabStatus)
setActiveListTabStatus(ctx: StateContext<DepositStateModel>, action: DepositAction.SetActiveListTabStatus): void {
ctx.patchState({
activeListTabStatus: action.activeListTabStatus,
});
}
@OverrideDefaultAction()
@Action(DepositAction.UploadPhoto)
uploadPhoto(ctx: StateContext<DepositStateModel>, action: DepositAction.UploadPhoto): Observable<any> {
......
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