mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-19 16:03:02 +00:00
Merge branch 'main' into feature/CST-5729
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { EditBitstreamPageComponent } from './edit-bitstream-page/edit-bitstream-page.component';
|
|
||||||
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||||
import { BitstreamPageResolver } from './bitstream-page.resolver';
|
import { BitstreamPageResolver } from './bitstream-page.resolver';
|
||||||
import { BitstreamDownloadPageComponent } from './bitstream-download-page/bitstream-download-page.component';
|
import { BitstreamDownloadPageComponent } from './bitstream-download-page/bitstream-download-page.component';
|
||||||
@@ -13,6 +12,7 @@ import { LegacyBitstreamUrlResolver } from './legacy-bitstream-url.resolver';
|
|||||||
import { BitstreamBreadcrumbResolver } from '../core/breadcrumbs/bitstream-breadcrumb.resolver';
|
import { BitstreamBreadcrumbResolver } from '../core/breadcrumbs/bitstream-breadcrumb.resolver';
|
||||||
import { BitstreamBreadcrumbsService } from '../core/breadcrumbs/bitstream-breadcrumbs.service';
|
import { BitstreamBreadcrumbsService } from '../core/breadcrumbs/bitstream-breadcrumbs.service';
|
||||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
|
import { ThemedEditBitstreamPageComponent } from './edit-bitstream-page/themed-edit-bitstream-page.component';
|
||||||
|
|
||||||
const EDIT_BITSTREAM_PATH = ':id/edit';
|
const EDIT_BITSTREAM_PATH = ':id/edit';
|
||||||
const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
||||||
@@ -49,7 +49,7 @@ const EDIT_BITSTREAM_AUTHORIZATIONS_PATH = ':id/authorizations';
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: EDIT_BITSTREAM_PATH,
|
path: EDIT_BITSTREAM_PATH,
|
||||||
component: EditBitstreamPageComponent,
|
component: ThemedEditBitstreamPageComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
bitstream: BitstreamPageResolver,
|
bitstream: BitstreamPageResolver,
|
||||||
breadcrumb: BitstreamBreadcrumbResolver,
|
breadcrumb: BitstreamBreadcrumbResolver,
|
||||||
|
@@ -7,6 +7,7 @@ import { BitstreamAuthorizationsComponent } from './bitstream-authorizations/bit
|
|||||||
import { FormModule } from '../shared/form/form.module';
|
import { FormModule } from '../shared/form/form.module';
|
||||||
import { ResourcePoliciesModule } from '../shared/resource-policies/resource-policies.module';
|
import { ResourcePoliciesModule } from '../shared/resource-policies/resource-policies.module';
|
||||||
import { BitstreamDownloadPageComponent } from './bitstream-download-page/bitstream-download-page.component';
|
import { BitstreamDownloadPageComponent } from './bitstream-download-page/bitstream-download-page.component';
|
||||||
|
import { ThemedEditBitstreamPageComponent } from './edit-bitstream-page/themed-edit-bitstream-page.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module handles all components that are necessary for Bitstream related pages
|
* This module handles all components that are necessary for Bitstream related pages
|
||||||
@@ -22,6 +23,7 @@ import { BitstreamDownloadPageComponent } from './bitstream-download-page/bitstr
|
|||||||
declarations: [
|
declarations: [
|
||||||
BitstreamAuthorizationsComponent,
|
BitstreamAuthorizationsComponent,
|
||||||
EditBitstreamPageComponent,
|
EditBitstreamPageComponent,
|
||||||
|
ThemedEditBitstreamPageComponent,
|
||||||
BitstreamDownloadPageComponent,
|
BitstreamDownloadPageComponent,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@@ -0,0 +1,22 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { EditBitstreamPageComponent } from './edit-bitstream-page.component';
|
||||||
|
import { ThemedComponent } from '../../shared/theme-support/themed.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-themed-edit-bitstream-page',
|
||||||
|
styleUrls: [],
|
||||||
|
templateUrl: '../../shared/theme-support/themed.component.html',
|
||||||
|
})
|
||||||
|
export class ThemedEditBitstreamPageComponent extends ThemedComponent<EditBitstreamPageComponent> {
|
||||||
|
protected getComponentName(): string {
|
||||||
|
return 'EditBitstreamPageComponent';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importThemedComponent(themeName: string): Promise<any> {
|
||||||
|
return import(`../../../themes/${themeName}/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component`);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importUnthemedComponent(): Promise<any> {
|
||||||
|
return import('./edit-bitstream-page.component');
|
||||||
|
}
|
||||||
|
}
|
@@ -39,6 +39,8 @@ import { IdentifierDataComponent } from '../../shared/object-list/identifier-dat
|
|||||||
import { ItemRegisterDoiComponent } from './item-register-doi/item-register-doi.component';
|
import { ItemRegisterDoiComponent } from './item-register-doi/item-register-doi.component';
|
||||||
import { DsoSharedModule } from '../../dso-shared/dso-shared.module';
|
import { DsoSharedModule } from '../../dso-shared/dso-shared.module';
|
||||||
import { ItemCurateComponent } from './item-curate/item-curate.component';
|
import { ItemCurateComponent } from './item-curate/item-curate.component';
|
||||||
|
import { ThemedItemStatusComponent } from './item-status/themed-item-status.component';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module that contains all components related to the Edit Item page administrator functionality
|
* Module that contains all components related to the Edit Item page administrator functionality
|
||||||
@@ -67,6 +69,7 @@ import { ItemCurateComponent } from './item-curate/item-curate.component';
|
|||||||
ItemPublicComponent,
|
ItemPublicComponent,
|
||||||
ItemDeleteComponent,
|
ItemDeleteComponent,
|
||||||
ItemStatusComponent,
|
ItemStatusComponent,
|
||||||
|
ThemedItemStatusComponent,
|
||||||
ItemRelationshipsComponent,
|
ItemRelationshipsComponent,
|
||||||
ItemBitstreamsComponent,
|
ItemBitstreamsComponent,
|
||||||
ItemVersionHistoryComponent,
|
ItemVersionHistoryComponent,
|
||||||
@@ -89,6 +92,9 @@ import { ItemCurateComponent } from './item-curate/item-curate.component';
|
|||||||
IdentifierDataService,
|
IdentifierDataService,
|
||||||
ObjectValuesPipe
|
ObjectValuesPipe
|
||||||
],
|
],
|
||||||
|
exports: [
|
||||||
|
ItemOperationComponent,
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class EditItemPageModule {
|
export class EditItemPageModule {
|
||||||
|
|
||||||
|
@@ -6,7 +6,6 @@ import { ItemReinstateComponent } from './item-reinstate/item-reinstate.componen
|
|||||||
import { ItemPrivateComponent } from './item-private/item-private.component';
|
import { ItemPrivateComponent } from './item-private/item-private.component';
|
||||||
import { ItemPublicComponent } from './item-public/item-public.component';
|
import { ItemPublicComponent } from './item-public/item-public.component';
|
||||||
import { ItemDeleteComponent } from './item-delete/item-delete.component';
|
import { ItemDeleteComponent } from './item-delete/item-delete.component';
|
||||||
import { ItemStatusComponent } from './item-status/item-status.component';
|
|
||||||
import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component';
|
import { ItemBitstreamsComponent } from './item-bitstreams/item-bitstreams.component';
|
||||||
import { ItemCollectionMapperComponent } from './item-collection-mapper/item-collection-mapper.component';
|
import { ItemCollectionMapperComponent } from './item-collection-mapper/item-collection-mapper.component';
|
||||||
import { ItemMoveComponent } from './item-move/item-move.component';
|
import { ItemMoveComponent } from './item-move/item-move.component';
|
||||||
@@ -42,6 +41,7 @@ import { ItemPageCollectionMapperGuard } from './item-page-collection-mapper.gua
|
|||||||
import { ThemedDsoEditMetadataComponent } from '../../dso-shared/dso-edit-metadata/themed-dso-edit-metadata.component';
|
import { ThemedDsoEditMetadataComponent } from '../../dso-shared/dso-edit-metadata/themed-dso-edit-metadata.component';
|
||||||
import { ItemPageRegisterDoiGuard } from './item-page-register-doi.guard';
|
import { ItemPageRegisterDoiGuard } from './item-page-register-doi.guard';
|
||||||
import { ItemCurateComponent } from './item-curate/item-curate.component';
|
import { ItemCurateComponent } from './item-curate/item-curate.component';
|
||||||
|
import { ThemedItemStatusComponent } from './item-status/themed-item-status.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routing module that handles the routing for the Edit Item page administrator functionality
|
* Routing module that handles the routing for the Edit Item page administrator functionality
|
||||||
@@ -67,7 +67,7 @@ import { ItemCurateComponent } from './item-curate/item-curate.component';
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'status',
|
path: 'status',
|
||||||
component: ItemStatusComponent,
|
component: ThemedItemStatusComponent,
|
||||||
data: { title: 'item.edit.tabs.status.title', showBreadcrumbs: true },
|
data: { title: 'item.edit.tabs.status.title', showBreadcrumbs: true },
|
||||||
canActivate: [ItemPageStatusGuard]
|
canActivate: [ItemPageStatusGuard]
|
||||||
},
|
},
|
||||||
|
@@ -0,0 +1,23 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { ThemedComponent } from '../../../shared/theme-support/themed.component';
|
||||||
|
import { ItemStatusComponent } from './item-status.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-themed-item-status',
|
||||||
|
styleUrls: [],
|
||||||
|
templateUrl: '../../../shared/theme-support/themed.component.html',
|
||||||
|
})
|
||||||
|
export class ThemedItemStatusComponent extends ThemedComponent<ItemStatusComponent> {
|
||||||
|
protected getComponentName(): string {
|
||||||
|
return 'ItemStatusComponent';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importThemedComponent(themeName: string): Promise<any> {
|
||||||
|
return import(`../../../../themes/${themeName}/app/item-page/edit-item-page/item-status/item-status.component`);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importUnthemedComponent(): Promise<any> {
|
||||||
|
return import('./item-status.component');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
<div class="preserve-line-breaks ds-context-help-content">
|
<div class="preserve-line-breaks ds-context-help-content">
|
||||||
<ng-container *ngFor="let elem of (parsedContent$ | async)">
|
<ng-container *ngFor="let elem of (parsedContent$ | async)">
|
||||||
<ng-container *ngIf="elem.href">
|
<ng-container *ngIf="elem.href">
|
||||||
<a href="{{elem.href}}" target="_blank">{{elem.text}}</a>
|
<a href="{{elem.href}}" target="_blank" rel="noopener noreferrer">{{elem.text}}</a>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="elem.href === undefined">
|
<ng-container *ngIf="elem.href === undefined">
|
||||||
{{ elem }}
|
{{ elem }}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<button (click)="toggle()" (focusin)="focusBox = true" (focusout)="focusBox = false"
|
<button (click)="toggle()" (focusin)="focusBox = true" (focusout)="focusBox = false"
|
||||||
class="filter-name d-flex" [attr.aria-controls]="regionId" [id]="toggleId"
|
class="filter-name d-flex" [attr.aria-controls]="regionId" [id]="toggleId"
|
||||||
[attr.aria-expanded]="false"
|
[attr.aria-expanded]="false"
|
||||||
[attr.aria-label]="((collapsed$ | async) ? 'search.filters.filter.expand' : 'search.filters.filter.collapse') | translate"
|
[attr.aria-label]="(((collapsed$ | async) ? 'search.filters.filter.expand' : 'search.filters.filter.collapse') | translate) + ' ' + (('search.filters.filter.' + filter.name + '.head') | translate | lowercase)"
|
||||||
[attr.data-test]="'filter-toggle' | dsBrowserOnly"
|
[attr.data-test]="'filter-toggle' | dsBrowserOnly"
|
||||||
>
|
>
|
||||||
<h5 class="d-inline-block mb-0">
|
<h5 class="d-inline-block mb-0">
|
||||||
|
@@ -131,7 +131,6 @@ export class StartsWithDateComponent extends StartsWithAbstractComponent {
|
|||||||
} else {
|
} else {
|
||||||
this.startsWithYear = +startsWith;
|
this.startsWithYear = +startsWith;
|
||||||
}
|
}
|
||||||
this.setStartsWithParam(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -70,7 +70,6 @@ export abstract class StartsWithAbstractComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
setStartsWith(startsWith: string) {
|
setStartsWith(startsWith: string) {
|
||||||
this.startsWith = startsWith;
|
this.startsWith = startsWith;
|
||||||
this.setStartsWithParam(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<form class="w-100" [formGroup]="formData" (ngSubmit)="submitForm(formData.value)">
|
<form class="w-100" [formGroup]="formData" (ngSubmit)="submitForm(formData.value)">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group input-group col-8 col-sm-12 col-md-6">
|
<div class="form-group input-group col-8 col-sm-12 col-md-6">
|
||||||
<input class="form-control" placeholder="{{'browse.startsWith.type_text' | translate}}" type="text" name="startsWith" formControlName="startsWith" [value]="getStartsWith()" />
|
<input class="form-control" [attr.aria-label]="'browse.startsWith.input' | translate" placeholder="{{'browse.startsWith.type_text' | translate}}" type="text" name="startsWith" formControlName="startsWith" [value]="getStartsWith()" />
|
||||||
<span class="input-group-append">
|
<span class="input-group-append">
|
||||||
<button class="btn btn-primary" type="submit"><i class="fas fa-book-open"></i> {{'browse.startsWith.submit' | translate}}</button>
|
<button class="btn btn-primary" type="submit"><i class="fas fa-book-open"></i> {{'browse.startsWith.submit' | translate}}</button>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
class="btn btn-outline-primary"
|
class="btn btn-outline-primary"
|
||||||
(blur)="onClose()"
|
(blur)="onClose()"
|
||||||
(click)="onClose()"
|
(click)="onClose()"
|
||||||
[disabled]="(processingChange$ | async) || collectionModifiable == false"
|
[disabled]="(processingChange$ | async) || collectionModifiable == false || isReadonly"
|
||||||
ngbDropdownToggle>
|
ngbDropdownToggle>
|
||||||
<span *ngIf="(processingChange$ | async)"><i class='fas fa-circle-notch fa-spin'></i></span>
|
<span *ngIf="(processingChange$ | async)"><i class='fas fa-circle-notch fa-spin'></i></span>
|
||||||
<span *ngIf="!(processingChange$ | async)">{{ selectedCollectionName$ | async }}</span>
|
<span *ngIf="!(processingChange$ | async)">{{ selectedCollectionName$ | async }}</span>
|
||||||
|
@@ -252,6 +252,12 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
|||||||
expect(dropDown).toBeFalsy();
|
expect(dropDown).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('the dropdown button should be disabled when isReadonly is true', () => {
|
||||||
|
comp.isReadonly = true;
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(dropdowBtn.nativeNode.attributes.disabled).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
it('should be simulated when the drop-down menu is closed', () => {
|
it('should be simulated when the drop-down menu is closed', () => {
|
||||||
spyOn(comp, 'onClose');
|
spyOn(comp, 'onClose');
|
||||||
comp.onClose();
|
comp.onClose();
|
||||||
|
@@ -65,6 +65,11 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
|
|||||||
*/
|
*/
|
||||||
@Input() submissionId;
|
@Input() submissionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to indicate if the submission dropdown is read only
|
||||||
|
*/
|
||||||
|
@Input() isReadonly = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event fired when a different collection is selected.
|
* An event fired when a different collection is selected.
|
||||||
* Event's payload equals to new SubmissionObject.
|
* Event's payload equals to new SubmissionObject.
|
||||||
|
@@ -8,12 +8,15 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="submission-form-header-item mb-3 mb-sm-0 flex-sm-grow-1 flex-md-grow-0">
|
<div class="submission-form-header-item mb-3 mb-sm-0 flex-sm-grow-1 flex-md-grow-0">
|
||||||
|
<ng-container *ngIf="!isSectionHidden">
|
||||||
<ds-submission-form-collection [currentCollectionId]="collectionId"
|
<ds-submission-form-collection [currentCollectionId]="collectionId"
|
||||||
[currentDefinition]="definitionId"
|
[currentDefinition]="definitionId"
|
||||||
[submissionId]="submissionId"
|
[submissionId]="submissionId"
|
||||||
[collectionModifiable]="collectionModifiable"
|
[collectionModifiable]="collectionModifiable"
|
||||||
|
[isReadonly]="isSectionReadonly"
|
||||||
(collectionChange)="onCollectionChange($event)">
|
(collectionChange)="onCollectionChange($event)">
|
||||||
</ds-submission-form-collection>
|
</ds-submission-form-collection>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
<div class="submission-form-header-item text-right">
|
<div class="submission-form-header-item text-right">
|
||||||
<ds-submission-form-section-add [collectionId]="collectionId"
|
<ds-submission-form-section-add [collectionId]="collectionId"
|
||||||
|
@@ -25,6 +25,7 @@ import { createTestComponent } from '../../shared/testing/utils.test';
|
|||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import { SectionsService } from '../sections/sections.service';
|
import { SectionsService } from '../sections/sections.service';
|
||||||
|
import { VisibilityType } from '../sections/visibility-type';
|
||||||
|
|
||||||
describe('SubmissionFormComponent Component', () => {
|
describe('SubmissionFormComponent Component', () => {
|
||||||
|
|
||||||
@@ -156,6 +157,32 @@ describe('SubmissionFormComponent Component', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return the visibility object of the collection section', () => {
|
||||||
|
comp.submissionDefinition = submissionDefinition;
|
||||||
|
fixture.detectChanges();
|
||||||
|
const result = compAsAny.getCollectionVisibility();
|
||||||
|
expect(result).toEqual({
|
||||||
|
main: VisibilityType.HIDDEN,
|
||||||
|
other: VisibilityType.HIDDEN,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if collection section visibility is hidden', () => {
|
||||||
|
comp.submissionDefinition = submissionDefinition;
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(comp.isSectionHidden).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false for isSectionReadonly when collection section visibility is not READONLY', () => {
|
||||||
|
const visibility = {
|
||||||
|
main: VisibilityType.READONLY,
|
||||||
|
other: VisibilityType.READONLY,
|
||||||
|
};
|
||||||
|
comp.submissionDefinition = Object.assign({}, submissionDefinition, { visibility: visibility });
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(comp.isSectionReadonly).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it('should update properly on collection change', (done) => {
|
it('should update properly on collection change', (done) => {
|
||||||
comp.collectionId = collectionId;
|
comp.collectionId = collectionId;
|
||||||
comp.submissionId = submissionId;
|
comp.submissionId = submissionId;
|
||||||
|
@@ -9,7 +9,7 @@ import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
|||||||
import { SubmissionObject } from '../../core/submission/models/submission-object.model';
|
import { SubmissionObject } from '../../core/submission/models/submission-object.model';
|
||||||
import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model';
|
import { WorkspaceitemSectionsObject } from '../../core/submission/models/workspaceitem-sections.model';
|
||||||
|
|
||||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util';
|
||||||
import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model';
|
import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model';
|
||||||
import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
|
import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
|
||||||
import { SectionDataObject } from '../sections/models/section-data.model';
|
import { SectionDataObject } from '../sections/models/section-data.model';
|
||||||
@@ -18,6 +18,10 @@ import { Item } from '../../core/shared/item.model';
|
|||||||
import { SectionsType } from '../sections/sections-type';
|
import { SectionsType } from '../sections/sections-type';
|
||||||
import { SectionsService } from '../sections/sections.service';
|
import { SectionsService } from '../sections/sections.service';
|
||||||
import { SubmissionError } from '../objects/submission-error.model';
|
import { SubmissionError } from '../objects/submission-error.model';
|
||||||
|
import { SubmissionSectionVisibility } from './../../core/config/models/config-submission-section.model';
|
||||||
|
import { SubmissionSectionModel } from './../../core/config/models/config-submission-section.model';
|
||||||
|
import { VisibilityType } from '../sections/visibility-type';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents the submission form.
|
* This component represents the submission form.
|
||||||
@@ -188,6 +192,42 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the visibility object of the collection section
|
||||||
|
*/
|
||||||
|
private getCollectionVisibility(): SubmissionSectionVisibility {
|
||||||
|
const submissionSectionModel: SubmissionSectionModel =
|
||||||
|
this.submissionDefinition.sections.page.find(
|
||||||
|
(section) => isEqual(section.sectionType, SectionsType.Collection)
|
||||||
|
);
|
||||||
|
|
||||||
|
return isNotUndefined(submissionSectionModel.visibility) ? submissionSectionModel.visibility : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter to see if the collection section visibility is hidden
|
||||||
|
*/
|
||||||
|
get isSectionHidden(): boolean {
|
||||||
|
const visibility = this.getCollectionVisibility();
|
||||||
|
return (
|
||||||
|
hasValue(visibility) &&
|
||||||
|
isEqual(visibility.main, VisibilityType.HIDDEN) &&
|
||||||
|
isEqual(visibility.other, VisibilityType.HIDDEN)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter to see if the collection section visibility is readonly
|
||||||
|
*/
|
||||||
|
get isSectionReadonly(): boolean {
|
||||||
|
const visibility = this.getCollectionVisibility();
|
||||||
|
return (
|
||||||
|
hasValue(visibility) &&
|
||||||
|
isEqual(visibility.main, VisibilityType.READONLY) &&
|
||||||
|
isEqual(visibility.other, VisibilityType.READONLY)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsubscribe from all subscriptions, destroy instance variables
|
* Unsubscribe from all subscriptions, destroy instance variables
|
||||||
* and reset submission state
|
* and reset submission state
|
||||||
@@ -239,6 +279,8 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
|
|||||||
protected getSectionsList(): Observable<any> {
|
protected getSectionsList(): Observable<any> {
|
||||||
return this.submissionService.getSubmissionSections(this.submissionId).pipe(
|
return this.submissionService.getSubmissionSections(this.submissionId).pipe(
|
||||||
filter((sections: SectionDataObject[]) => isNotEmpty(sections)),
|
filter((sections: SectionDataObject[]) => isNotEmpty(sections)),
|
||||||
map((sections: SectionDataObject[]) => sections));
|
map((sections: SectionDataObject[]) =>
|
||||||
|
sections.filter((section: SectionDataObject) => !isEqual(section.sectionType,SectionsType.Collection))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,4 +8,5 @@ export enum SectionsType {
|
|||||||
AccessesCondition = 'accessCondition',
|
AccessesCondition = 'accessCondition',
|
||||||
SherpaPolicies = 'sherpaPolicy',
|
SherpaPolicies = 'sherpaPolicy',
|
||||||
Identifiers = 'identifiers',
|
Identifiers = 'identifiers',
|
||||||
|
Collection = 'collection',
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<p class="m-1">
|
<p class="m-1">
|
||||||
<a href="{{journal.url}}" target="_blank">
|
<a href="{{journal.url}}" target="_blank" rel="noopener noreferrer">
|
||||||
{{journal.url}}
|
{{journal.url}}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-4" *ngFor="let publisher of journal.publishers">
|
<div class="col-4" *ngFor="let publisher of journal.publishers">
|
||||||
<p class="m-1">
|
<p class="m-1">
|
||||||
<a href="{{publisher.uri}}" target="_blank">
|
<a href="{{publisher.uri}}" target="_blank" rel="noopener noreferrer">
|
||||||
{{publisher.name}}
|
{{publisher.name}}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let url of policy.urls | keyvalue">
|
<li *ngFor="let url of policy.urls | keyvalue">
|
||||||
<a href="{{url.key}}" target="_blank">{{url.value}}</a>
|
<a href="{{url.key}}" target="_blank" rel="noopener noreferrer">{{url.value}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -175,7 +175,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
|||||||
it('should init file data properly', () => {
|
it('should init file data properly', () => {
|
||||||
uploadService.getFileData.and.returnValue(observableOf(fileData));
|
uploadService.getFileData.and.returnValue(observableOf(fileData));
|
||||||
|
|
||||||
comp.ngOnChanges();
|
comp.ngOnChanges({});
|
||||||
|
|
||||||
expect(comp.fileData).toEqual(fileData);
|
expect(comp.fileData).toEqual(fileData);
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,13 @@
|
|||||||
import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
|
import {
|
||||||
|
ChangeDetectorRef,
|
||||||
|
Component,
|
||||||
|
Input,
|
||||||
|
OnChanges,
|
||||||
|
OnDestroy,
|
||||||
|
OnInit,
|
||||||
|
SimpleChanges,
|
||||||
|
ViewChild
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
@@ -27,7 +36,7 @@ import { NgbModalOptions } from '@ng-bootstrap/ng-bootstrap/modal/modal-config';
|
|||||||
styleUrls: ['./section-upload-file.component.scss'],
|
styleUrls: ['./section-upload-file.component.scss'],
|
||||||
templateUrl: './section-upload-file.component.html',
|
templateUrl: './section-upload-file.component.html',
|
||||||
})
|
})
|
||||||
export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit {
|
export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit, OnDestroy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of available access condition
|
* The list of available access condition
|
||||||
@@ -168,13 +177,13 @@ export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit {
|
|||||||
/**
|
/**
|
||||||
* Retrieve bitstream's metadata
|
* Retrieve bitstream's metadata
|
||||||
*/
|
*/
|
||||||
ngOnChanges() {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (this.availableAccessConditionOptions) {
|
if (this.availableAccessConditionOptions) {
|
||||||
// Retrieve file state
|
// Retrieve file state
|
||||||
this.subscriptions.push(
|
this.subscriptions.push(
|
||||||
this.uploadService
|
this.uploadService
|
||||||
.getFileData(this.submissionId, this.sectionId, this.fileId).pipe(
|
.getFileData(this.submissionId, this.sectionId, this.fileId)
|
||||||
filter((bitstream) => isNotUndefined(bitstream)))
|
.pipe(filter((bitstream) => isNotUndefined(bitstream)))
|
||||||
.subscribe((bitstream) => {
|
.subscribe((bitstream) => {
|
||||||
this.fileData = bitstream;
|
this.fileData = bitstream;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,93 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { SubmissionFormsModel } from 'src/app/core/config/models/config-submission-forms.model';
|
||||||
|
import { ThemedComponent } from 'src/app/shared/theme-support/themed.component';
|
||||||
|
import { SubmissionSectionUploadFileComponent } from './section-upload-file.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-themed-submission-upload-section-file',
|
||||||
|
styleUrls: [],
|
||||||
|
templateUrl: '../../../../shared/theme-support/themed.component.html'
|
||||||
|
})
|
||||||
|
export class ThemedSubmissionSectionUploadFileComponent
|
||||||
|
extends ThemedComponent<SubmissionSectionUploadFileComponent> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of available access condition
|
||||||
|
* @type {Array}
|
||||||
|
*/
|
||||||
|
@Input() availableAccessConditionOptions: any[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The submission id
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
@Input() collectionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define if collection access conditions policy type :
|
||||||
|
* POLICY_DEFAULT_NO_LIST : is not possible to define additional access group/s for the single file
|
||||||
|
* POLICY_DEFAULT_WITH_LIST : is possible to define additional access group/s for the single file
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
@Input() collectionPolicyType: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The configuration for the bitstream's metadata form
|
||||||
|
* @type {SubmissionFormsModel}
|
||||||
|
*/
|
||||||
|
@Input() configMetadataForm: SubmissionFormsModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bitstream id
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
@Input() fileId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bitstream array key
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
@Input() fileIndex: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bitstream id
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
@Input() fileName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The section id
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
@Input() sectionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The submission id
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
@Input() submissionId: string;
|
||||||
|
|
||||||
|
protected inAndOutputNames: (keyof SubmissionSectionUploadFileComponent & keyof this)[] = [
|
||||||
|
'availableAccessConditionOptions',
|
||||||
|
'collectionId',
|
||||||
|
'collectionPolicyType',
|
||||||
|
'configMetadataForm',
|
||||||
|
'fileId',
|
||||||
|
'fileIndex',
|
||||||
|
'fileName',
|
||||||
|
'sectionId',
|
||||||
|
'submissionId'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected getComponentName(): string {
|
||||||
|
return 'SubmissionSectionUploadFileComponent';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importThemedComponent(themeName: string): Promise<any> {
|
||||||
|
return import(`../../../../../themes/${themeName}/app/submission/sections/upload/file/section-upload-file.component`);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importUnthemedComponent(): Promise<any> {
|
||||||
|
return import(`./section-upload-file.component`);
|
||||||
|
}
|
||||||
|
}
|
@@ -28,7 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-container *ngFor="let fileEntry of fileList">
|
<ng-container *ngFor="let fileEntry of fileList">
|
||||||
<ds-submission-upload-section-file
|
<ds-themed-submission-upload-section-file
|
||||||
[availableAccessConditionOptions]="availableAccessConditionOptions"
|
[availableAccessConditionOptions]="availableAccessConditionOptions"
|
||||||
[collectionId]="collectionId"
|
[collectionId]="collectionId"
|
||||||
[collectionPolicyType]="collectionPolicyType"
|
[collectionPolicyType]="collectionPolicyType"
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
[fileIndex]="fileList.indexOf(fileEntry)"
|
[fileIndex]="fileList.indexOf(fileEntry)"
|
||||||
[fileName]="fileNames[fileList.indexOf(fileEntry)]"
|
[fileName]="fileNames[fileList.indexOf(fileEntry)]"
|
||||||
[sectionId]="sectionData.id"
|
[sectionId]="sectionData.id"
|
||||||
[submissionId]="submissionId"></ds-submission-upload-section-file>
|
[submissionId]="submissionId"></ds-themed-submission-upload-section-file>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<hr/>
|
<hr/>
|
||||||
|
4
src/app/submission/sections/visibility-type.ts
Normal file
4
src/app/submission/sections/visibility-type.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export enum VisibilityType {
|
||||||
|
HIDDEN = 'HIDDEN',
|
||||||
|
READONLY = 'READONLY',
|
||||||
|
}
|
@@ -49,6 +49,7 @@ import { ResearchEntitiesModule } from '../entity-groups/research-entities/resea
|
|||||||
import { ThemedSubmissionEditComponent } from './edit/themed-submission-edit.component';
|
import { ThemedSubmissionEditComponent } from './edit/themed-submission-edit.component';
|
||||||
import { ThemedSubmissionSubmitComponent } from './submit/themed-submission-submit.component';
|
import { ThemedSubmissionSubmitComponent } from './submit/themed-submission-submit.component';
|
||||||
import { ThemedSubmissionImportExternalComponent } from './import-external/themed-submission-import-external.component';
|
import { ThemedSubmissionImportExternalComponent } from './import-external/themed-submission-import-external.component';
|
||||||
|
import { ThemedSubmissionSectionUploadFileComponent } from './sections/upload/file/themed-section-upload-file.component';
|
||||||
import { FormModule } from '../shared/form/form.module';
|
import { FormModule } from '../shared/form/form.module';
|
||||||
import { NgbAccordionModule, NgbCollapseModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbAccordionModule, NgbCollapseModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { SubmissionSectionAccessesComponent } from './sections/accesses/section-accesses.component';
|
import { SubmissionSectionAccessesComponent } from './sections/accesses/section-accesses.component';
|
||||||
@@ -104,6 +105,7 @@ const DECLARATIONS = [
|
|||||||
PublisherPolicyComponent,
|
PublisherPolicyComponent,
|
||||||
PublicationInformationComponent,
|
PublicationInformationComponent,
|
||||||
MetadataInformationComponent,
|
MetadataInformationComponent,
|
||||||
|
ThemedSubmissionSectionUploadFileComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@@ -849,6 +849,8 @@
|
|||||||
|
|
||||||
"browse.startsWith.type_text": "Filter results by typing the first few letters",
|
"browse.startsWith.type_text": "Filter results by typing the first few letters",
|
||||||
|
|
||||||
|
"browse.startsWith.input": "Filter",
|
||||||
|
|
||||||
"browse.title": "Browsing {{ collection }} by {{ field }}{{ startsWith }} {{ value }}",
|
"browse.title": "Browsing {{ collection }} by {{ field }}{{ startsWith }} {{ value }}",
|
||||||
|
|
||||||
"browse.title.page": "Browsing {{ collection }} by {{ field }} {{ value }}",
|
"browse.title.page": "Browsing {{ collection }} by {{ field }} {{ value }}",
|
||||||
@@ -4061,7 +4063,7 @@
|
|||||||
|
|
||||||
"submission.general.cancel": "Cancel",
|
"submission.general.cancel": "Cancel",
|
||||||
|
|
||||||
"submission.general.cannot_submit": "You have not the privilege to make a new submission.",
|
"submission.general.cannot_submit": "You don't have permission to make a new submission.",
|
||||||
|
|
||||||
"submission.general.deposit": "Deposit",
|
"submission.general.deposit": "Deposit",
|
||||||
|
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
import { EditBitstreamPageComponent as BaseComponent } from '../../../../../app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component';
|
||||||
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-edit-bitstream-page',
|
||||||
|
// styleUrls: ['./edit-bitstream-page.component.scss'],
|
||||||
|
styleUrls: ['../../../../../app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.scss'],
|
||||||
|
// templateUrl: './edit-bitstream-page.component.html',
|
||||||
|
templateUrl: '../../../../../app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.html',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
|
})
|
||||||
|
export class EditBitstreamPageComponent extends BaseComponent {
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||||
|
import { fadeIn, fadeInOut } from '../../../../../../app/shared/animations/fade';
|
||||||
|
import { ItemStatusComponent as BaseComponent } from '../../../../../../app/item-page/edit-item-page/item-status/item-status.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-item-status',
|
||||||
|
// templateUrl: './item-status.component.html',
|
||||||
|
templateUrl: '../../../../../../app/item-page/edit-item-page/item-status/item-status.component.html',
|
||||||
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
|
animations: [
|
||||||
|
fadeIn,
|
||||||
|
fadeInOut
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ItemStatusComponent extends BaseComponent {
|
||||||
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {
|
||||||
|
SubmissionSectionUploadFileComponent as BaseComponent
|
||||||
|
} from 'src/app/submission/sections/upload/file/section-upload-file.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component represents a single bitstream contained in the submission
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-submission-upload-section-file',
|
||||||
|
// styleUrls: ['./section-upload-file.component.scss'],
|
||||||
|
styleUrls: ['../../../../../../../app/submission/sections/upload/file/section-upload-file.component.scss'],
|
||||||
|
// templateUrl: './section-upload-file.component.html'
|
||||||
|
templateUrl: '../../../../../../../app/submission/sections/upload/file/section-upload-file.component.html'
|
||||||
|
})
|
||||||
|
export class SubmissionSectionUploadFileComponent
|
||||||
|
extends BaseComponent {
|
||||||
|
}
|
@@ -141,6 +141,10 @@ import {
|
|||||||
import { NgxGalleryModule } from '@kolkov/ngx-gallery';
|
import { NgxGalleryModule } from '@kolkov/ngx-gallery';
|
||||||
import { WorkspaceItemsDeletePageComponent } from './app/workspace-items-delete-page/workspace-items-delete/workspace-items-delete.component';
|
import { WorkspaceItemsDeletePageComponent } from './app/workspace-items-delete-page/workspace-items-delete/workspace-items-delete.component';
|
||||||
import { ThumbnailComponent } from './app/thumbnail/thumbnail.component';
|
import { ThumbnailComponent } from './app/thumbnail/thumbnail.component';
|
||||||
|
import { SubmissionSectionUploadFileComponent } from './app/submission/sections/upload/file/section-upload-file.component';
|
||||||
|
import { ItemStatusComponent } from './app/item-page/edit-item-page/item-status/item-status.component';
|
||||||
|
import { EditBitstreamPageComponent } from './app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component';
|
||||||
|
import { FormModule } from '../../app/shared/form/form.module';
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
FileSectionComponent,
|
FileSectionComponent,
|
||||||
@@ -217,6 +221,9 @@ const DECLARATIONS = [
|
|||||||
MediaViewerVideoComponent,
|
MediaViewerVideoComponent,
|
||||||
WorkspaceItemsDeletePageComponent,
|
WorkspaceItemsDeletePageComponent,
|
||||||
ThumbnailComponent,
|
ThumbnailComponent,
|
||||||
|
SubmissionSectionUploadFileComponent,
|
||||||
|
ItemStatusComponent,
|
||||||
|
EditBitstreamPageComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -275,6 +282,7 @@ const DECLARATIONS = [
|
|||||||
DsoSharedModule,
|
DsoSharedModule,
|
||||||
SystemWideAlertModule,
|
SystemWideAlertModule,
|
||||||
NgxGalleryModule,
|
NgxGalleryModule,
|
||||||
|
FormModule,
|
||||||
],
|
],
|
||||||
declarations: DECLARATIONS,
|
declarations: DECLARATIONS,
|
||||||
exports: [
|
exports: [
|
||||||
|
Reference in New Issue
Block a user