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
|
<ds-access-control-form-container
|
||||||
|
titleMessage="collection-access-control-title"
|
||||||
*ngIf="itemRD$ | async as itemRD"
|
*ngIf="itemRD$ | async as itemRD"
|
||||||
[itemRD]="itemRD"
|
[itemRD]="itemRD"
|
||||||
[showLimitToSpecificBitstreams]="false">
|
[showLimitToSpecificBitstreams]="false">
|
||||||
<p title>{{'collection-access-control-title' | translate}}</p>
|
|
||||||
</ds-access-control-form-container>
|
</ds-access-control-form-container>
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<ds-access-control-form-container
|
<ds-access-control-form-container
|
||||||
|
titleMessage="community-access-control-title"
|
||||||
*ngIf="itemRD$ | async as itemRD"
|
*ngIf="itemRD$ | async as itemRD"
|
||||||
[itemRD]="itemRD"
|
[itemRD]="itemRD"
|
||||||
[showLimitToSpecificBitstreams]="false">
|
[showLimitToSpecificBitstreams]="false">
|
||||||
<p title>{{'community-access-control-title' | translate }}</p>
|
|
||||||
</ds-access-control-form-container>
|
</ds-access-control-form-container>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<ds-access-control-form-container
|
<ds-access-control-form-container
|
||||||
|
titleMessage="item-access-control-title"
|
||||||
*ngIf="itemRD$ | async as itemRD"
|
*ngIf="itemRD$ | async as itemRD"
|
||||||
[itemRD]="itemRD"
|
[itemRD]="itemRD"
|
||||||
[showLimitToSpecificBitstreams]="true">
|
[showLimitToSpecificBitstreams]="true">
|
||||||
<p title>{{ 'item-access-control-title' | translate }}</p>
|
|
||||||
</ds-access-control-form-container>
|
</ds-access-control-form-container>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<form [formGroup]="form">
|
<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}}
|
{{'access-control-no-access-conditions-warning-message' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -34,6 +34,13 @@ export class AccessControlArrayFormComponent implements OnInit, OnDestroy {
|
|||||||
return this.form.get('accessControl') as FormArray;
|
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.
|
* Add a new access control item to the form.
|
||||||
* Start and end date are disabled by default.
|
* Start and end date are disabled by default.
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card">
|
<div class="card border-0">
|
||||||
<div class="card-body">
|
<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="row mt-5">
|
||||||
<div class="col-12 col-md-6 border-right">
|
<div class="col-12 col-md-6 border-right">
|
||||||
@@ -75,7 +79,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<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"
|
name="changesLimit" id="processSelected" value="selected"
|
||||||
[disabled]="!state.bitstream.toggleStatus"
|
[disabled]="!state.bitstream.toggleStatus"
|
||||||
[(ngModel)]="state.bitstream.changesLimit">
|
[(ngModel)]="state.bitstream.changesLimit">
|
||||||
@@ -85,9 +89,9 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
*ngIf="itemRD"
|
*ngIf="itemRD"
|
||||||
[disabled]="!state.bitstream.toggleStatus && state.bitstream.changesLimit !== 'selected'"
|
[disabled]="!state.bitstream.toggleStatus || state.bitstream.changesLimit !== 'selected'"
|
||||||
(click)="openSelectBitstreamsModal(itemRD.payload)"
|
(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>
|
<i class="fa fa-search"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ import {
|
|||||||
import { BulkAccessConfigDataService } from '../../core/config/bulk-access-config-data.service';
|
import { BulkAccessConfigDataService } from '../../core/config/bulk-access-config-data.service';
|
||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
import { BulkAccessConditionOptions } from '../../core/config/models/bulk-access-condition-options.model';
|
import { BulkAccessConditionOptions } from '../../core/config/models/bulk-access-condition-options.model';
|
||||||
|
import { AlertType } from '../alert/aletr-type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-access-control-form-container',
|
selector: 'ds-access-control-form-container',
|
||||||
@@ -30,6 +31,11 @@ export class AccessControlFormContainerComponent<T extends DSpaceObject> impleme
|
|||||||
*/
|
*/
|
||||||
@Input() showLimitToSpecificBitstreams = false;
|
@Input() showLimitToSpecificBitstreams = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title message of the access control form (translate key)
|
||||||
|
*/
|
||||||
|
@Input() titleMessage = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item to which the access control form applies
|
* 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('bitstreamAccessCmp', { static: true }) bitstreamAccessCmp: AccessControlArrayFormComponent;
|
||||||
@ViewChild('itemAccessCmp', { static: true }) itemAccessCmp: AccessControlArrayFormComponent;
|
@ViewChild('itemAccessCmp', { static: true }) itemAccessCmp: AccessControlArrayFormComponent;
|
||||||
|
|
||||||
|
readonly AlertType = AlertType;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private bulkAccessConfigService: BulkAccessConfigDataService,
|
private bulkAccessConfigService: BulkAccessConfigDataService,
|
||||||
private bulkAccessControlService: BulkAccessControlService,
|
private bulkAccessControlService: BulkAccessControlService,
|
||||||
@@ -145,18 +153,19 @@ export class AccessControlFormContainerComponent<T extends DSpaceObject> impleme
|
|||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.selectableListService.deselectAll(ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID);
|
this.selectableListService.deselectAll(ITEM_ACCESS_CONTROL_SELECT_BITSTREAMS_LIST_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const initialState: AccessControlFormState = {
|
const initialState: AccessControlFormState = {
|
||||||
item: {
|
item: {
|
||||||
toggleStatus: false,
|
toggleStatus: false,
|
||||||
accessMode: '',
|
accessMode: 'replace',
|
||||||
},
|
},
|
||||||
bitstream: {
|
bitstream: {
|
||||||
toggleStatus: false,
|
toggleStatus: false,
|
||||||
accessMode: '',
|
accessMode: 'replace',
|
||||||
changesLimit: '', // 'all' | 'selected'
|
changesLimit: 'all', // 'all' | 'selected'
|
||||||
selectedBitstreams: [] as ListableObject[],
|
selectedBitstreams: [] as ListableObject[],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -43,22 +43,25 @@ export class BulkAccessControlService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => {
|
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: [] };
|
const constraints = { uuid: [] };
|
||||||
|
|
||||||
if (payload.state.bitstream.changesLimit === 'selected') {
|
if (bitstreamEnabled && payload.state.bitstream.changesLimit === 'selected') {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
constraints.uuid = payload.state.bitstream.selectedBitstreams.map((x) => x.id);
|
constraints.uuid = payload.state.bitstream.selectedBitstreams.map((x) => x.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
item: {
|
item: {
|
||||||
mode: payload.state.item.accessMode,
|
mode: itemEnabled ? payload.state.item.accessMode : '',
|
||||||
accessConditions: payload.itemAccess
|
accessConditions: itemEnabled ? payload.itemAccess : []
|
||||||
},
|
},
|
||||||
bitstream: {
|
bitstream: {
|
||||||
constraints,
|
constraints,
|
||||||
mode: payload.state.bitstream.accessMode,
|
mode: bitstreamEnabled ? payload.state.bitstream.accessMode : '',
|
||||||
accessConditions: payload.bitstreamAccess
|
accessConditions: bitstreamEnabled ? payload.bitstreamAccess : []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<div class="modal-header">
|
<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"
|
<button type="button" class="close" aria-label="Close"
|
||||||
(click)="activeModal.dismiss('Cross click')">
|
(click)="activeModal.dismiss('Cross click')">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
@@ -20,7 +22,7 @@
|
|||||||
|
|
||||||
<div *ngIf="data && data.payload.page.length === 0"
|
<div *ngIf="data && data.payload.page.length === 0"
|
||||||
class="alert alert-info w-100" role="alert">
|
class="alert alert-info w-100" role="alert">
|
||||||
{{'browse.empty' | translate}}
|
{{'access-control-select-bitstreams-modal.no-items' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@@ -28,6 +30,6 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-outline-dark"
|
<button type="button" class="btn btn-outline-dark"
|
||||||
(click)="activeModal.close('Close click')">
|
(click)="activeModal.close('Close click')">
|
||||||
Close
|
{{'access-control-select-bitstreams-modal.close' | translate}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -5326,7 +5326,7 @@
|
|||||||
|
|
||||||
"admin.system-wide-alert.title": "System-wide Alerts",
|
"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).",
|
"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).",
|
"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",
|
"access-control-item-header-toggle": "Item's Metadata",
|
||||||
@@ -5341,8 +5341,9 @@
|
|||||||
"access-control-bitstreams-selected": "bitstreams selected",
|
"access-control-bitstreams-selected": "bitstreams selected",
|
||||||
"access-control-reset": "Reset",
|
"access-control-reset": "Reset",
|
||||||
"access-control-execute": "Execute",
|
"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