Skip to content

Commit d8f792c

Browse files
author
Salim Terres
committed
Bug #15605 - [Collect] Archive addition: issues with ZIP hierarchy and the Operations Log banner.
1 parent 14c22b1 commit d8f792c

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/add-units/add-units.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
<mat-dialog-content>
6565
<div class="main-content">
6666
<div class="form-group">
67-
@if (projectUnits && importType === ImportType.DIRECTORIES_FILES) {
67+
@if (projectUnits && (importType === ImportType.DIRECTORIES_FILES || importType === ImportType.COMPRESSED)) {
6868
<vitamui-library-filing-plan [mode]="FilingPlanMode.SOLO" [formControl]="linkParentIdControl" [dataSource]="projectUnits">
6969
</vitamui-library-filing-plan>
70-
} @else if (importType === ImportType.COMPRESSED || importType === ImportType.SIP) {
70+
} @else if (importType === ImportType.SIP) {
7171
<span class="text meduim">
7272
{{ 'COLLECT.MODAL.ARCHIVE_POSITION_MSG_FOR_SIP' | translate }}
7373
</span>

ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/add-units/add-units.component.ts

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ import {
5252
ZipFileStatus,
5353
ApplicationId,
5454
SnackBarService,
55+
StartupService,
5556
} from 'vitamui-library';
5657
import { ArchiveCollectService } from '../archive-collect.service';
5758
import { FormControl, Validators } from '@angular/forms';
5859
import { last, tap } from 'rxjs/operators';
5960
import { HttpEventType } from '@angular/common/http';
60-
import { ActivatedRoute } from '@angular/router';
6161

6262
export enum ImportType {
6363
DIRECTORIES_FILES = 'DIRECTORIES_FILES',
@@ -75,7 +75,6 @@ export class AddUnitsComponent implements OnInit {
7575
protected readonly FilingPlanMode = FilingPlanMode;
7676
protected readonly uploadMaxSizeInBytes = Math.pow(1024, 3); // 1 Gb
7777

78-
uploadedOperationId: string;
7978
isLoading = false;
8079
stepIndex = 0;
8180

@@ -93,7 +92,7 @@ export class AddUnitsComponent implements OnInit {
9392
public data: {
9493
transaction: Transaction;
9594
},
96-
private route: ActivatedRoute,
95+
private startupService: StartupService,
9796
private snackBarService: SnackBarService,
9897
private dialog: MatDialog,
9998
private addUnitsDialogRef: MatDialogRef<AddUnitsComponent>,
@@ -141,9 +140,6 @@ export class AddUnitsComponent implements OnInit {
141140
}
142141

143142
close(filesUploaded: boolean) {
144-
if (filesUploaded && this.importType === ImportType.SIP && this.uploadedOperationId) {
145-
this.handleUploadSIPSuccess(this.uploadedOperationId);
146-
}
147143
this.confirmCancelDialog?.close(true);
148144
this.addUnitsDialogRef.close(filesUploaded);
149145
}
@@ -176,8 +172,13 @@ export class AddUnitsComponent implements OnInit {
176172
tap((httpEvent) => zipFile.updateUploadingZipFileStatus(httpEvent)),
177173
last((httpEvent) => httpEvent.type === HttpEventType.Response),
178174
tap((httpEvent) => {
179-
if (this.importType === ImportType.SIP && httpEvent.type === HttpEventType.Response) {
180-
this.uploadedOperationId = httpEvent.body;
175+
if (httpEvent.type === HttpEventType.Response) {
176+
if (this.importType === ImportType.SIP) {
177+
this.handleUploadSuccess(httpEvent.body);
178+
} else {
179+
// For ZIP and DIRECTORIES_FILES, show success banner without operation ID
180+
this.handleUploadSuccess(null);
181+
}
181182
}
182183
}),
183184
finalize(() => (this.isLoading = false)),
@@ -193,19 +194,28 @@ export class AddUnitsComponent implements OnInit {
193194
this.filesToUploadControl.setValue([]);
194195
}
195196

196-
private handleUploadSIPSuccess(operationId: string): void {
197-
const tenantId = this.route.snapshot.params.tenantIdentifier;
198-
this.snackBarService.open({
199-
message: 'COLLECT.MODAL.IMPORT_SIP_ARCHIVES_PACKAGE_WITH_SUCCESS',
200-
buttons: [
201-
{
202-
appId: ApplicationId.LOGBOOK_OPERATION_APP,
203-
path: `/tenant/${tenantId}?guid=${operationId}`,
204-
label: 'SNACK_BAR.TO_OPERATION_APP',
205-
},
206-
],
207-
duration: 100_000,
208-
});
197+
private handleUploadSuccess(operationId: string | null): void {
198+
if (operationId) {
199+
// For SIP imports with operation ID
200+
const tenantId = this.startupService.getTenantIdentifier();
201+
this.snackBarService.open({
202+
message: 'COLLECT.MODAL.IMPORT_SIP_ARCHIVES_PACKAGE_WITH_SUCCESS',
203+
buttons: [
204+
{
205+
appId: ApplicationId.LOGBOOK_OPERATION_APP,
206+
path: `/tenant/${tenantId}?guid=${operationId}`,
207+
label: 'SNACK_BAR.TO_OPERATION_APP',
208+
},
209+
],
210+
duration: 100_000,
211+
});
212+
} else {
213+
// For ZIP and DIRECTORIES_FILES imports without operation ID
214+
this.snackBarService.open({
215+
message: 'COLLECT.UPLOAD.TERMINATED',
216+
duration: 10_000,
217+
});
218+
}
209219
}
210220

211221
get importType(): string | null {

0 commit comments

Comments
 (0)