From 732b16f8e850a1ee83d4932ceb65f7897162ca87 Mon Sep 17 00:00:00 2001 From: guillermo2519 Date: Mon, 6 Apr 2026 12:12:44 -0600 Subject: [PATCH] Fix #5381: disable delete button for last bitstream with tooltip message --- .../file/section-upload-file.component.html | 31 ++++++++++++------- .../file/section-upload-file.component.ts | 7 +++++ .../themed-section-upload-file.component.ts | 8 +++++ .../upload/section-upload.component.html | 1 + src/assets/i18n/en.json5 | 2 ++ 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.html b/src/app/submission/sections/upload/file/section-upload-file.component.html index c1cdf266aaf..e09e79ff7fd 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.html +++ b/src/app/submission/sections/upload/file/section-upload-file.component.html @@ -36,18 +36,25 @@ (click)="$event.preventDefault();editBitstreamData();"> - + + + +
diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.ts b/src/app/submission/sections/upload/file/section-upload-file.component.ts index c6949bd3828..6822330e5f8 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.ts +++ b/src/app/submission/sections/upload/file/section-upload-file.component.ts @@ -184,6 +184,13 @@ export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit, */ protected formMetadata: string[] = []; + /** + * Total number of files currently attached to the item. + * Used to prevent deletion when only one bitstream remains. + * @type {number} + */ + @Input() totalFiles: number; + /** * Initialize instance variables * diff --git a/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts b/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts index 792ed087e74..c49d104799f 100644 --- a/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts +++ b/src/app/submission/sections/upload/file/themed-section-upload-file.component.ts @@ -77,6 +77,13 @@ export class ThemedSubmissionSectionUploadFileComponent */ @Input() submissionId: string; + /** + * Total number of files currently attached to the item. + * Used to prevent deletion when only one bitstream remains. + * @type {number} + */ + @Input() totalFiles: number; + protected inAndOutputNames: (keyof SubmissionSectionUploadFileComponent & keyof this)[] = [ 'availableAccessConditionOptions', 'isPrimary', @@ -88,6 +95,7 @@ export class ThemedSubmissionSectionUploadFileComponent 'fileName', 'sectionId', 'submissionId', + 'totalFiles', ]; protected getComponentName(): string { diff --git a/src/app/submission/sections/upload/section-upload.component.html b/src/app/submission/sections/upload/section-upload.component.html index 7bcfa1d242d..5ffa1d6838c 100644 --- a/src/app/submission/sections/upload/section-upload.component.html +++ b/src/app/submission/sections/upload/section-upload.component.html @@ -33,6 +33,7 @@