mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
Merge branch 'master' into w2p-68346_Bundles-in-edit-item-Updates
Conflicts: package.json resources/i18n/en.json5 src/app/+item-page/item-page.module.ts src/app/core/core.module.ts src/app/core/data/bundle-data.service.ts src/app/core/data/data.service.spec.ts src/app/core/data/data.service.ts src/app/core/data/item-data.service.ts src/app/core/data/object-updates/object-updates.service.ts src/app/core/shared/hal-endpoint.service.ts src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts src/app/shared/mocks/mock-request.service.ts src/app/shared/shared.module.ts src/app/shared/trackable/abstract-trackable.component.ts yarn.lock
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { RestRequestMethod } from '../../core/data/rest-request-method';
|
||||
|
||||
export class UploaderOptions {
|
||||
/**
|
||||
@@ -9,5 +10,15 @@ export class UploaderOptions {
|
||||
|
||||
disableMultipart = false;
|
||||
|
||||
itemAlias: string;
|
||||
itemAlias: string = null;
|
||||
|
||||
/**
|
||||
* Automatically send out an upload request when adding files
|
||||
*/
|
||||
autoUpload = true;
|
||||
|
||||
/**
|
||||
* The request method to use for the file upload request
|
||||
*/
|
||||
method: RestRequestMethod = RestRequestMethod.POST;
|
||||
}
|
||||
|
@@ -19,23 +19,24 @@
|
||||
(fileOver)="fileOverBase($event)"
|
||||
class="well ds-base-drop-zone mt-1 mb-3 text-muted">
|
||||
<p class="text-center m-0 p-0 d-flex justify-content-center align-items-center" *ngIf="uploader?.queue?.length === 0">
|
||||
<span><i class="fas fa-cloud-upload" aria-hidden="true"></i> {{dropMsg | translate}} {{'uploader.or' | translate}}
|
||||
<label class="btn btn-link m-0 p-0">
|
||||
<input class="d-none" type="file" ng2FileSelect [uploader]="uploader" multiple />
|
||||
{{'uploader.browse' | translate}}
|
||||
</label>
|
||||
</span>
|
||||
<span><i class="fas fa-cloud-upload" aria-hidden="true"></i> {{dropMsg | translate}} {{'uploader.or' | translate}}</span>
|
||||
<label class="btn btn-link m-0 p-0 ml-1">
|
||||
<input class="d-none" type="file" ng2FileSelect [uploader]="uploader" multiple />
|
||||
{{'uploader.browse' | translate}}
|
||||
</label>
|
||||
</p>
|
||||
<div *ngIf="(isOverBaseDropZone | async) || uploader?.queue?.length !== 0">
|
||||
<div class="m-1">
|
||||
<div class="upload-item-top">
|
||||
<span class="filename">{{'uploader.queue-length' | translate}}: {{ uploader?.queue?.length }} | {{ uploader?.queue[0]?.file.name }}</span>
|
||||
<span class="filename">
|
||||
<span *ngIf="!uploader.options.disableMultipart">{{'uploader.queue-length' | translate}}: {{ uploader?.queue?.length }} | </span>{{ uploader?.queue[0]?.file.name }}
|
||||
</span>
|
||||
<div class="btn-group btn-group-sm float-right" role="group">
|
||||
<button type="button" class="btn btn-danger" (click)="uploader.clearQueue()" [disabled]="!uploader.queue.length">
|
||||
<i class="fas fa-trash" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<span *ngIf="uploader.progress < 100" class="float-right mr-3">{{ uploader.progress }}%</span>
|
||||
<span *ngIf="uploader.progress < 100 && !(uploader.progress === 0 && !uploader.options.autoUpload)" class="float-right mr-3">{{ uploader.progress }}%</span>
|
||||
<span *ngIf="uploader.progress === 100" class="float-right mr-3">{{'uploader.processing' | translate}}...</span>
|
||||
</div>
|
||||
<div class="ds-base-drop-zone-progress clearfix mt-2">
|
||||
|
@@ -64,12 +64,12 @@ describe('Chips component', () => {
|
||||
template: ``
|
||||
})
|
||||
class TestComponent {
|
||||
public uploadFilesOptions: UploaderOptions = {
|
||||
public uploadFilesOptions: UploaderOptions = Object.assign(new UploaderOptions(), {
|
||||
url: 'http://test',
|
||||
authToken: null,
|
||||
disableMultipart: false,
|
||||
itemAlias: null
|
||||
};
|
||||
});
|
||||
|
||||
/* tslint:disable:no-empty */
|
||||
public onBeforeUpload = () => {
|
||||
|
@@ -101,7 +101,8 @@ export class UploaderComponent {
|
||||
disableMultipart: this.uploadFilesOptions.disableMultipart,
|
||||
itemAlias: this.uploadFilesOptions.itemAlias,
|
||||
removeAfterUpload: true,
|
||||
autoUpload: true
|
||||
autoUpload: this.uploadFilesOptions.autoUpload,
|
||||
method: this.uploadFilesOptions.method
|
||||
});
|
||||
|
||||
if (isUndefined(this.enableDragOverDocument)) {
|
||||
@@ -123,7 +124,10 @@ export class UploaderComponent {
|
||||
if (isUndefined(this.onBeforeUpload)) {
|
||||
this.onBeforeUpload = () => {return};
|
||||
}
|
||||
this.uploader.onBeforeUploadItem = () => {
|
||||
this.uploader.onBeforeUploadItem = (item) => {
|
||||
if (item.url !== this.uploader.options.url) {
|
||||
item.url = this.uploader.options.url;
|
||||
}
|
||||
this.onBeforeUpload();
|
||||
this.isOverDocumentDropZone = observableOf(false);
|
||||
|
||||
|
Reference in New Issue
Block a user