Skip to content

Commit

Permalink
ufal/fe-s3-customization (#428)
Browse files Browse the repository at this point in the history
* The admin could see in the bitstream admin UI if the bitstream is stored in both storages (S3, local).

* Fixed failing unit test - updated columnSizes object
  • Loading branch information
milanmajchrak authored Dec 21, 2023
1 parent 2d073dd commit dd80fde
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/app/core/shared/bitstream.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<div class="{{columnSizes.columns[1].buildClasses()}} row-element">{{'item.edit.bitstreams.headers.description' | translate}}</div>
<div class="{{columnSizes.columns[2].buildClasses()}} text-center row-element">{{'item.edit.bitstreams.headers.format' | translate}}</div>
<div class="{{columnSizes.columns[3].buildClasses()}} text-center row-element">{{'item.edit.bitstreams.headers.actions' | translate}}</div>
<div class="{{columnSizes.columns[4].buildClasses()}} text-center row-element">{{'item.edit.bitstreams.headers.synchronized' | translate}}</div>
</div>
<ds-item-edit-bitstream-bundle *ngFor="let bundle of bundles"
[bundle]="bundle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
// Description column
new ResponsiveColumnSizes(2, 3, 3, 3, 3),
// Format column
new ResponsiveColumnSizes(2, 2, 2, 2, 2),
new ResponsiveColumnSizes(1, 1, 1, 1, 1),
// Actions column
new ResponsiveColumnSizes(6, 5, 4, 3, 3)
new ResponsiveColumnSizes(5, 4, 3, 2, 2),
// Store synchronization columns
new ResponsiveColumnSizes(2, 2, 2, 2, 2)
]);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@
</div>
</div>
</div>
<div class="{{columnSizes.columns[4].buildClasses()}} row-element d-flex align-items-center justify-content-center">
<div class="float-left d-flex align-items-center overflow-hidden">
<span class="text-center">
<i [class]="bitstream.storeNumber === syncStoresNumber ? 'fas fa-check' : 'fas fa-times'"></i>
</span>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ let fixture: ComponentFixture<ItemEditBitstreamComponent>;
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(), {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -63,6 +63,11 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit {
*/
format$: Observable<BitstreamFormat>;

/**
* 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) {
Expand Down
3 changes: 3 additions & 0 deletions src/assets/i18n/cs.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,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",

Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,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",
Expand Down

0 comments on commit dd80fde

Please sign in to comment.