From 55b7f782e8c06a1c6a65a0a91ff1ba5c5f4e2698 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 19 Dec 2023 13:44:59 +0100 Subject: [PATCH 1/2] The admin could see in the bitstream admin UI if the bitstream is stored in both storages (S3, local). --- src/app/core/shared/bitstream.model.ts | 9 +++++++++ .../item-bitstreams/item-bitstreams.component.html | 1 + .../item-bitstreams/item-bitstreams.component.ts | 6 ++++-- .../item-edit-bitstream.component.html | 7 +++++++ .../item-edit-bitstream/item-edit-bitstream.component.ts | 7 ++++++- src/assets/i18n/cs.json5 | 3 +++ src/assets/i18n/en.json5 | 2 ++ 7 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts index c855325d2d6..bbc5455eead 100644 --- a/src/app/core/shared/bitstream.model.ts +++ b/src/app/core/shared/bitstream.model.ts @@ -11,6 +11,9 @@ import {BUNDLE} from './bundle.resource-type'; import {Bundle} from './bundle.model'; import { ChildHALResource } from './child-hal-resource.model'; +// Store number if the bitstream is stored in the both stores (S3 and local) +export const SYNCHRONIZED_STORES_NUMBER = 77; + @typedObject @inheritSerialization(DSpaceObject) export class Bitstream extends DSpaceObject implements ChildHALResource { @@ -34,6 +37,12 @@ export class Bitstream extends DSpaceObject implements ChildHALResource { @autoserialize bundleName: string; + /** + * The number of the store where the bitstream is store, it could be S3, local or both. + */ + @autoserialize + storeNumber: number; + /** * The {@link HALLink}s for this Bitstream */ diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html index 4cb9577fcb5..b5c84ab8760 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html @@ -32,6 +32,7 @@
{{'item.edit.bitstreams.headers.description' | translate}}
{{'item.edit.bitstreams.headers.format' | translate}}
{{'item.edit.bitstreams.headers.actions' | translate}}
+
{{'item.edit.bitstreams.headers.synchronized' | translate}}
+
+
+ + + +
+
diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts index fcb5c706ac7..ec527f349c9 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild, ViewContainerRef } from '@angular/core'; -import { Bitstream } from '../../../../core/shared/bitstream.model'; +import { Bitstream, SYNCHRONIZED_STORES_NUMBER } from '../../../../core/shared/bitstream.model'; import cloneDeep from 'lodash/cloneDeep'; import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service'; import { Observable } from 'rxjs'; @@ -63,6 +63,11 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit { */ format$: Observable; + /** + * The value of the store number if the bitstream is stored in both stores (S3 and local) + */ + syncStoresNumber = SYNCHRONIZED_STORES_NUMBER; + constructor(private objectUpdatesService: ObjectUpdatesService, private dsoNameService: DSONameService, private viewContainerRef: ViewContainerRef) { diff --git a/src/assets/i18n/cs.json5 b/src/assets/i18n/cs.json5 index 758f92a42bb..28ccdec45b0 100644 --- a/src/assets/i18n/cs.json5 +++ b/src/assets/i18n/cs.json5 @@ -3208,6 +3208,9 @@ // "item.edit.bitstreams.empty": "This item doesn't contain any bitstreams. Click the upload button to create one.", "item.edit.bitstreams.empty" : "Tato položka neobsahuje žádné bitstreamy. Klikněte na tlačítko pro nahrání a jeden vytvořte.", + // "item.edit.bitstreams.headers.synchronized": "Synchronized", + "item.edit.bitstreams.headers.synchronized": "Synchronizováno", + // "item.edit.bitstreams.headers.actions": "Actions", "item.edit.bitstreams.headers.actions" : "Akce", diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 72a9eacb8a7..31e22ac7616 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -2175,6 +2175,8 @@ "item.edit.bitstreams.empty": "This item doesn't contain any bitstreams. Click the upload button to create one.", + "item.edit.bitstreams.headers.synchronized": "Synchronized", + "item.edit.bitstreams.headers.actions": "Actions", "item.edit.bitstreams.headers.bundle": "Bundle", From 2a110c97c5d3ee44a4574dd91c216afed674a651 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 19 Dec 2023 16:14:06 +0100 Subject: [PATCH 2/2] Fixed failing unit test - updated columnSizes object --- .../item-edit-bitstream.component.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts index 306c0d41e39..ca9aff92e1a 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts @@ -21,8 +21,9 @@ let fixture: ComponentFixture; const columnSizes = new ResponsiveTableSizes([ new ResponsiveColumnSizes(2, 2, 3, 4, 4), new ResponsiveColumnSizes(2, 3, 3, 3, 3), - new ResponsiveColumnSizes(2, 2, 2, 2, 2), - new ResponsiveColumnSizes(6, 5, 4, 3, 3) + new ResponsiveColumnSizes(1, 1, 1, 1, 1), + new ResponsiveColumnSizes(5, 4, 3, 2, 2), + new ResponsiveColumnSizes(2, 2, 2, 2, 2) ]); const format = Object.assign(new BitstreamFormat(), {