Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ufal/fe-s3-customization #428

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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",

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 @@ -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",
Expand Down
Loading