mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-9639] Validation, translations and style fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<ds-access-control-form-container
|
||||
titleMessage="collection-access-control-title"
|
||||
*ngIf="itemRD$ | async as itemRD"
|
||||
[itemRD]="itemRD"
|
||||
[showLimitToSpecificBitstreams]="false">
|
||||
<p title>{{'collection-access-control-title' | translate}}</p>
|
||||
</ds-access-control-form-container>
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<ds-access-control-form-container
|
||||
titleMessage="community-access-control-title"
|
||||
*ngIf="itemRD$ | async as itemRD"
|
||||
[itemRD]="itemRD"
|
||||
[showLimitToSpecificBitstreams]="false">
|
||||
<p title>{{'community-access-control-title' | translate }}</p>
|
||||
</ds-access-control-form-container>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<ds-access-control-form-container
|
||||
titleMessage="item-access-control-title"
|
||||
*ngIf="itemRD$ | async as itemRD"
|
||||
[itemRD]="itemRD"
|
||||
[showLimitToSpecificBitstreams]="true">
|
||||
<p title>{{ 'item-access-control-title' | translate }}</p>
|
||||
</ds-access-control-form-container>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<form [formGroup]="form">
|
||||
<div *ngIf="accessControl.controls.length === 0 && form.status !== 'DISABLED'" class="alert alert-warning">
|
||||
<div *ngIf="allControlsAreEmpty && form.status !== 'DISABLED'" class="alert alert-warning">
|
||||
{{'access-control-no-access-conditions-warning-message' | translate}}
|
||||
</div>
|
||||
|
||||
|
@@ -34,6 +34,13 @@ export class AccessControlArrayFormComponent implements OnInit, OnDestroy {
|
||||
return this.form.get('accessControl') as FormArray;
|
||||
}
|
||||
|
||||
get allControlsAreEmpty() {
|
||||
if (this.accessControl.length === 0) {
|
||||
return true;
|
||||
}
|
||||
return this.accessControl.value.every(x => x.itemName === null || x.itemName === '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new access control item to the form.
|
||||
* Start and end date are disabled by default.
|
||||
|
@@ -1,7 +1,11 @@
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card border-0">
|
||||
<div class="card-body">
|
||||
<ng-content select="[title]"></ng-content>
|
||||
<ds-alert
|
||||
*ngIf="titleMessage"
|
||||
[type]="AlertType.Info"
|
||||
[content]="titleMessage">
|
||||
</ds-alert>
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col-12 col-md-6 border-right">
|
||||
@@ -75,7 +79,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio"
|
||||
<input class="form-check-input mt-2" type="radio"
|
||||
name="changesLimit" id="processSelected" value="selected"
|
||||
[disabled]="!state.bitstream.toggleStatus"
|
||||
[(ngModel)]="state.bitstream.changesLimit">
|
||||
@@ -85,9 +89,9 @@
|
||||
|
||||
<button
|
||||
*ngIf="itemRD"
|
||||
[disabled]="!state.bitstream.toggleStatus && state.bitstream.changesLimit !== 'selected'"
|
||||
[disabled]="!state.bitstream.toggleStatus || state.bitstream.changesLimit !== 'selected'"
|
||||
(click)="openSelectBitstreamsModal(itemRD.payload)"
|
||||
class="btn btn-outline-dark" type="button">
|
||||
class="btn btn-outline-dark border-0" type="button">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
|
||||
|
@@ -16,6 +16,7 @@ import {
|
||||
import { BulkAccessConfigDataService } from '../../core/config/bulk-access-config-data.service';
|
||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||
import { BulkAccessConditionOptions } from '../../core/config/models/bulk-access-condition-options.model';
|
||||
import { AlertType } from '../alert/aletr-type';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-access-control-form-container',
|
||||
@@ -30,6 +31,11 @@ export class AccessControlFormContainerComponent<T extends DSpaceObject> impleme
|
||||
*/
|
||||
@Input() showLimitToSpecificBitstreams = false;
|
||||
|
||||
/**
|
||||
* The title message of the access control form (translate key)
|
||||
*/
|
||||
@Input() titleMessage = '';
|
||||
|
||||
/**
|
||||
* The item to which the access control form applies
|
||||
*/
|
||||
@@ -45,6 +51,8 @@ export class AccessControlFormContainerComponent<T extends DSpaceObject> impleme
|
||||
@ViewChild('bitstreamAccessCmp', { static: true }) bitstreamAccessCmp: AccessControlArrayFormComponent;
|
||||
@ViewChild('itemAccessCmp', { static: true }) itemAccessCmp: AccessControlArrayFormComponent;
|
||||
|
||||
readonly AlertType = AlertType;
|
||||
|
||||
constructor(
|
||||
private bulkAccessConfigService: BulkAccessConfigDataService,
|
||||
private bulkAccessControlService: BulkAccessControlService,
|
||||
@@ -145,18 +153,19 @@ export class AccessControlFormContainerComponent<T extends DSpaceObject> impleme
|
||||
ngOnDestroy(): void {
|
||||
this.selectableListService.deselectAll(ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const initialState: AccessControlFormState = {
|
||||
item: {
|
||||
toggleStatus: false,
|
||||
accessMode: '',
|
||||
accessMode: 'replace',
|
||||
},
|
||||
bitstream: {
|
||||
toggleStatus: false,
|
||||
accessMode: '',
|
||||
changesLimit: '', // 'all' | 'selected'
|
||||
accessMode: 'replace',
|
||||
changesLimit: 'all', // 'all' | 'selected'
|
||||
selectedBitstreams: [] as ListableObject[],
|
||||
},
|
||||
};
|
||||
|
@@ -43,22 +43,25 @@ export class BulkAccessControlService {
|
||||
}
|
||||
|
||||
export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => {
|
||||
const itemEnabled = payload.state.item.toggleStatus;
|
||||
const bitstreamEnabled = payload.state.bitstream.toggleStatus;
|
||||
|
||||
const constraints = { uuid: [] };
|
||||
|
||||
if (payload.state.bitstream.changesLimit === 'selected') {
|
||||
if (bitstreamEnabled && payload.state.bitstream.changesLimit === 'selected') {
|
||||
// @ts-ignore
|
||||
constraints.uuid = payload.state.bitstream.selectedBitstreams.map((x) => x.id);
|
||||
}
|
||||
|
||||
return {
|
||||
item: {
|
||||
mode: payload.state.item.accessMode,
|
||||
accessConditions: payload.itemAccess
|
||||
mode: itemEnabled ? payload.state.item.accessMode : '',
|
||||
accessConditions: itemEnabled ? payload.itemAccess : []
|
||||
},
|
||||
bitstream: {
|
||||
constraints,
|
||||
mode: payload.state.bitstream.accessMode,
|
||||
accessConditions: payload.bitstreamAccess
|
||||
mode: bitstreamEnabled ? payload.state.bitstream.accessMode : '',
|
||||
accessConditions: bitstreamEnabled ? payload.bitstreamAccess : []
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Hi there!</h4>
|
||||
<h4 class="modal-title">
|
||||
{{'access-control-select-bitstreams-modal.title' | translate}}
|
||||
</h4>
|
||||
<button type="button" class="close" aria-label="Close"
|
||||
(click)="activeModal.dismiss('Cross click')">
|
||||
<span aria-hidden="true">×</span>
|
||||
@@ -20,7 +22,7 @@
|
||||
|
||||
<div *ngIf="data && data.payload.page.length === 0"
|
||||
class="alert alert-info w-100" role="alert">
|
||||
{{'browse.empty' | translate}}
|
||||
{{'access-control-select-bitstreams-modal.no-items' | translate}}
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
@@ -28,6 +30,6 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-dark"
|
||||
(click)="activeModal.close('Close click')">
|
||||
Close
|
||||
{{'access-control-select-bitstreams-modal.close' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -5326,7 +5326,7 @@
|
||||
|
||||
"admin.system-wide-alert.title": "System-wide Alerts",
|
||||
|
||||
"item-access-control-title": "This form allows you to perform changes to the access condition of all the items owned by collection under this community. Changes can be performed on the access condition for the metadata (item) or for the content (bitstream).",
|
||||
"item-access-control-title": "This form allows you to perform changes to the access condition of all the item's metadata and all its bitstreams.",
|
||||
"collection-access-control-title": "This form allows you to perform changes to the access condition of all the items owned by collection under this community. Changes can be performed on the access condition for the metadata (item) or for the content (bitstream).",
|
||||
"community-access-control-title": "This form allows you to perform changes to the access condition of all the items owned by collection under this community. Changes can be performed on the access condition for the metadata (item) or for the content (bitstream).",
|
||||
"access-control-item-header-toggle": "Item's Metadata",
|
||||
@@ -5341,8 +5341,9 @@
|
||||
"access-control-bitstreams-selected": "bitstreams selected",
|
||||
"access-control-reset": "Reset",
|
||||
"access-control-execute": "Execute",
|
||||
"access-control-add-more": "Add more"
|
||||
|
||||
|
||||
"access-control-add-more": "Add more",
|
||||
"access-control-select-bitstreams-modal.title": "Select bitstreams",
|
||||
"access-control-select-bitstreams-modal.no-items": "No items to show.",
|
||||
"access-control-select-bitstreams-modal.close": "Close"
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user