mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
working on upload functionality
This commit is contained in:
@@ -125,7 +125,7 @@
|
|||||||
"moment-range": "^4.0.2",
|
"moment-range": "^4.0.2",
|
||||||
"morgan": "^1.9.1",
|
"morgan": "^1.9.1",
|
||||||
"ng-mocks": "^8.1.0",
|
"ng-mocks": "^8.1.0",
|
||||||
"ng2-file-upload": "1.2.1",
|
"ng2-file-upload": "1.4.0",
|
||||||
"ng2-nouislider": "^1.8.2",
|
"ng2-nouislider": "^1.8.2",
|
||||||
"ngx-bootstrap": "^5.3.2",
|
"ngx-bootstrap": "^5.3.2",
|
||||||
"ngx-infinite-scroll": "6.0.1",
|
"ngx-infinite-scroll": "6.0.1",
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div class="form-row">
|
<div class="form-row mb-2">
|
||||||
<select required id="process-parameters"
|
<select required id="process-parameters"
|
||||||
class="form-control col"
|
class="form-control col"
|
||||||
name="script"
|
name="script"
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-uploader dropMsg="process.parameter.file-upload"
|
||||||
|
dropOverDocumentMsg="process.parameter.file-upload"
|
||||||
|
[enableDragOverDocument]="true"
|
||||||
|
[uploadFilesOptions]="uploadFilesOptions"
|
||||||
|
(onCompleteItem)="onCompleteItem()"
|
||||||
|
(onUploadError)="onUploadError()"></ds-uploader>
|
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { FileValueInputComponent } from './file-value-input.component';
|
||||||
|
|
||||||
|
describe('FileValueInputComponent', () => {
|
||||||
|
let component: FileValueInputComponent;
|
||||||
|
let fixture: ComponentFixture<FileValueInputComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ FileValueInputComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(FileValueInputComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,33 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FileUploaderOptions } from 'ng2-file-upload';
|
||||||
|
import { UploaderOptions } from '../../../../../shared/uploader/uploader-options.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-file-value-input',
|
||||||
|
templateUrl: './file-value-input.component.html',
|
||||||
|
styleUrls: ['./file-value-input.component.scss']
|
||||||
|
})
|
||||||
|
export class FileValueInputComponent implements OnInit {
|
||||||
|
uploadFilesOptions: FileUploaderOptions;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.uploadFilesOptions = new UploaderOptions();
|
||||||
|
this.uploadFilesOptions.autoUpload = false;
|
||||||
|
this.uploadFilesOptions.url = 'bladibla';
|
||||||
|
this.uploadFilesOptions.authToken = 'bladibla';
|
||||||
|
this.uploadFilesOptions.disableMultipart = true;
|
||||||
|
this.uploadFilesOptions.formatDataFunctionIsAsync = false;
|
||||||
|
this.uploadFilesOptions.formatDataFunction((t) => console.log(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
onCompleteItem() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
onUploadError() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,3 +1,4 @@
|
|||||||
<div [ngSwitch]="parameter?.type">
|
<div [ngSwitch]="parameter?.type">
|
||||||
<ds-string-value-input *ngSwitchCase="parameterTypes.STRING"></ds-string-value-input>
|
<ds-string-value-input *ngSwitchCase="parameterTypes.STRING"></ds-string-value-input>
|
||||||
|
<ds-file-value-input *ngSwitchCase="parameterTypes.FILE"></ds-file-value-input>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { ProcessPageRoutingModule } from './process-page-routing.module';
|
import { ProcessPageRoutingModule } from './process-page-routing.module';
|
||||||
import { ProcessDataService } from '../core/data/processes/process-data.service';
|
|
||||||
import { ScriptDataService } from '../core/data/processes/script-data.service';
|
|
||||||
import { NewProcessComponent } from './new/new-process.component';
|
import { NewProcessComponent } from './new/new-process.component';
|
||||||
import { ScriptsSelectComponent } from './new/scripts-select/scripts-select.component';
|
import { ScriptsSelectComponent } from './new/scripts-select/scripts-select.component';
|
||||||
import { ScriptHelpComponent } from './new/script-help/script-help.component';
|
import { ScriptHelpComponent } from './new/script-help/script-help.component';
|
||||||
@@ -10,6 +8,7 @@ import { ParameterSelectComponent } from './new/process-parameters/parameter-sel
|
|||||||
import { ProcessParametersComponent } from './new/process-parameters/process-parameters.component';
|
import { ProcessParametersComponent } from './new/process-parameters/process-parameters.component';
|
||||||
import { StringValueInputComponent } from './new/process-parameters/parameter-value-input/string-value-input/string-value-input.component';
|
import { StringValueInputComponent } from './new/process-parameters/parameter-value-input/string-value-input/string-value-input.component';
|
||||||
import { ParameterValueInputComponent } from './new/process-parameters/parameter-value-input/parameter-value-input.component';
|
import { ParameterValueInputComponent } from './new/process-parameters/parameter-value-input/parameter-value-input.component';
|
||||||
|
import { FileValueInputComponent } from './new/process-parameters/parameter-value-input/file-value-input/file-value-input.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -24,6 +23,7 @@ import { ParameterValueInputComponent } from './new/process-parameters/parameter
|
|||||||
ProcessParametersComponent,
|
ProcessParametersComponent,
|
||||||
StringValueInputComponent,
|
StringValueInputComponent,
|
||||||
ParameterValueInputComponent,
|
ParameterValueInputComponent,
|
||||||
|
FileValueInputComponent,
|
||||||
],
|
],
|
||||||
entryComponents: []
|
entryComponents: []
|
||||||
})
|
})
|
||||||
|
@@ -113,12 +113,15 @@ export class UploaderComponent {
|
|||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
// Maybe to remove: needed to avoid CORS issue with our temp upload server
|
// Maybe to remove: needed to avoid CORS issue with our temp upload server
|
||||||
this.uploader.onAfterAddingFile = ((item) => {
|
this.uploader.onAfterAddingFile = ((item) => {
|
||||||
|
console.log(item);
|
||||||
|
|
||||||
item.withCredentials = false;
|
item.withCredentials = false;
|
||||||
});
|
});
|
||||||
if (isUndefined(this.onBeforeUpload)) {
|
if (isUndefined(this.onBeforeUpload)) {
|
||||||
this.onBeforeUpload = () => {return};
|
this.onBeforeUpload = () => {return};
|
||||||
}
|
}
|
||||||
this.uploader.onBeforeUploadItem = (item) => {
|
this.uploader.onBeforeUploadItem = (item) => {
|
||||||
|
|
||||||
if (item.url !== this.uploader.options.url) {
|
if (item.url !== this.uploader.options.url) {
|
||||||
item.url = this.uploader.options.url;
|
item.url = this.uploader.options.url;
|
||||||
}
|
}
|
||||||
|
10
yarn.lock
10
yarn.lock
@@ -8646,10 +8646,12 @@ ng-mocks@^8.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/ng-mocks/-/ng-mocks-8.1.0.tgz#d00a5e53ae53587f35c68147826590fab71a1658"
|
resolved "https://registry.yarnpkg.com/ng-mocks/-/ng-mocks-8.1.0.tgz#d00a5e53ae53587f35c68147826590fab71a1658"
|
||||||
integrity sha512-/314nyU6UrONCUKfvFRuJPLpNBxqocwJmQBlPy4he5Vueu6gObXjy+KLUlbbENuA7zTeBjp//RA6w/Fa1yQ4Fw==
|
integrity sha512-/314nyU6UrONCUKfvFRuJPLpNBxqocwJmQBlPy4he5Vueu6gObXjy+KLUlbbENuA7zTeBjp//RA6w/Fa1yQ4Fw==
|
||||||
|
|
||||||
ng2-file-upload@1.2.1:
|
ng2-file-upload@1.4.0:
|
||||||
version "1.2.1"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/ng2-file-upload/-/ng2-file-upload-1.2.1.tgz#5563c5dfd6f43fbfbe815c206e343464a0a6a197"
|
resolved "https://registry.yarnpkg.com/ng2-file-upload/-/ng2-file-upload-1.4.0.tgz#8dea28d573234c52af474ad2a4001b335271e5c4"
|
||||||
integrity sha1-VWPF39b0P7++gVwgbjQ0ZKCmoZc=
|
integrity sha512-3J/KPU/tyh/ad6TFeUbrxX+SihUj0iOEt2Zsg4EX7mB3GFiQscXOfcUOxCkBtPWWWaqt3azrYbVGzsYa3/7NzQ==
|
||||||
|
dependencies:
|
||||||
|
tslib "^1.9.0"
|
||||||
|
|
||||||
ng2-nouislider@^1.8.2:
|
ng2-nouislider@^1.8.2:
|
||||||
version "1.8.2"
|
version "1.8.2"
|
||||||
|
Reference in New Issue
Block a user