Commit 91401a6c authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

fix: preview with backend update

parent 125632dd
......@@ -19,7 +19,7 @@ import {
FILE_VISUALIZERS,
} from "@shared/filevisualizer/services/abstract-file-visualizer.service";
import {DownloadService} from "@shared/services/download.service";
import {SharedVisualizationState} from "@shared/stores/visualization/shared-visualization-state.service";
import {SharedVisualizationState} from "@shared/stores/visualization/shared-visualization.state";
import {SharedVisualizationAction} from "@shared/stores/visualization/shared-visualization.action";
import {
BehaviorSubject,
......
......@@ -50,7 +50,9 @@ export class ArchiveDataFileHelper {
} as any,
smartSize: this._fileSizePipe.transform(archiveMetadata.metadata?.file?.size),
relativeLocation: archiveMetadata.metadata?.file?.path,
packageId: archiveMetadata.metadata?.archiveId,
infoPackage: {
resId: archiveMetadata.metadata?.archiveId,
},
initialPath: null,
finalData: null,
fileSize: archiveMetadata.metadata?.file?.size,
......@@ -83,7 +85,9 @@ export class ArchiveDataFileHelper {
statusMessage: null,
smartSize: this._fileSizePipe.transform(archiveMetadata.metadata?.aip?.size),
relativeLocation: null,
packageId: archiveMetadata.metadata?.archiveId,
infoPackage: {
resId: archiveMetadata.metadata?.archiveId,
},
initialPath: null,
finalData: null,
fileSize: archiveMetadata.metadata?.aip?.size,
......
......@@ -6,8 +6,9 @@ import {
ChangeInfo,
MetadataType,
} from "@models";
import {BaseResource} from "solidify-frontend";
export interface DataFile {
export interface DataFile<TPackage extends BaseResource = any> {
resId?: string;
creation?: ChangeInfo;
lastUpdate?: ChangeInfo;
......@@ -17,7 +18,6 @@ export interface DataFile {
virusCheck?: AipChecksumCheck;
smartSize?: string;
relativeLocation?: string;
packageId?: string;
initialPath?: string;
finalData?: string;
fileSize?: number;
......@@ -29,4 +29,5 @@ export interface DataFile {
complianceLevel?: string;
checksums?: Checksum[];
available?: boolean;
infoPackage?: TPackage;
}
......@@ -106,7 +106,7 @@ import {SharedOrganizationalUnitSubmissionPolicyState} from "@shared/stores/orga
import {SharedResearchDomainState} from "@shared/stores/research-domain/shared-research-domain.state";
import {SharedRoleState} from "@shared/stores/role/shared-role.state";
import {SharedUserState} from "@shared/stores/user/shared-user.state";
import {SharedVisualizationState} from "@shared/stores/visualization/shared-visualization-state.service";
import {SharedVisualizationState} from "@shared/stores/visualization/shared-visualization.state";
import {
PdfViewerComponent,
PdfViewerModule,
......
......@@ -92,7 +92,7 @@ import {SharedUserState} from "@shared/stores/user/shared-user.state";
import {
SharedVisualizationState,
SharedVisualizationStateModel,
} from "@shared/stores/visualization/shared-visualization-state.service";
} from "@shared/stores/visualization/shared-visualization.state";
import {Observable} from "rxjs";
import {tap} from "rxjs/operators";
import {
......
......@@ -7,8 +7,8 @@ import {
StateContext,
Store,
} from "@ngxs/store";
import {ApiActionNameEnum} from "../../enums/api-action-name.enum";
import {ApiResourceNameEnum} from "@shared/enums/api-resource-name.enum";
import {StateEnum} from "@shared/enums/state.enum";
import {DownloadService} from "@shared/services/download.service";
import {SharedVisualizationAction} from "@shared/stores/visualization/shared-visualization.action";
import {Observable} from "rxjs";
......@@ -27,7 +27,7 @@ import {
SolidifyStateError,
} from "solidify-frontend";
import {environment} from "../../../../environments/environment";
import {StateEnum} from "@shared/enums/state.enum";
import {ApiActionNameEnum} from "../../enums/api-action-name.enum";
export interface SharedVisualizationStateModel extends BaseResourceState {
blob: Blob;
......@@ -58,7 +58,7 @@ export class SharedVisualizationState extends BasicState<SharedVisualizationStat
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter + 1,
});
const url = `${this._urlResource}/${action.data.dataFile.packageId}/${ApiResourceNameEnum.DATAFILE}/${action.data.dataFile.resId}/${ApiActionNameEnum.DL}`;
const url = `${this._urlResource}/${action.data.dataFile.infoPackage.resId}/${ApiResourceNameEnum.DATAFILE}/${action.data.dataFile.resId}/${ApiActionNameEnum.DL}`;
return this.downloadService.downloadInMemory(url, action.data.dataFile.fileName, false)
.pipe(
tap(result => ctx.dispatch(new SharedVisualizationAction.DownloadSuccess(result, action.blobId))),
......
Markdown is supported
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