@@ -52,12 +52,12 @@ import {
5252 ZipFileStatus ,
5353 ApplicationId ,
5454 SnackBarService ,
55+ StartupService ,
5556} from 'vitamui-library' ;
5657import { ArchiveCollectService } from '../archive-collect.service' ;
5758import { FormControl , Validators } from '@angular/forms' ;
5859import { last , tap } from 'rxjs/operators' ;
5960import { HttpEventType } from '@angular/common/http' ;
60- import { ActivatedRoute } from '@angular/router' ;
6161
6262export 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