Refactors Dmp import, Dmp Profile import and Dataset import dialogues.

This commit is contained in:
Diamantis Tziotzios 2019-03-06 16:44:50 +02:00
parent 9a14a73b86
commit e8067b8620
7 changed files with 46 additions and 44 deletions

View File

@ -55,13 +55,13 @@ export class DatasetProfileCriteriaComponent extends BaseCriteriaComponent imple
message: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-FILE-TITLE'), message: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-FILE-TITLE'),
confirmButton: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML'), confirmButton: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML'),
cancelButton: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-FILE-CANCEL'), cancelButton: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-FILE-CANCEL'),
name: this.language.instant('DATASET-WIZARD.UPLOAD.UPLOAD-XML-NAME'), name: "",
file: FileList, file: FileList,
sucsess: false sucsess: false
} }
}); });
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
if (data.sucsess && data.name != null && data.file != null) { if (data && data.sucsess && data.name != null && data.file != null) {
this.datasetService.uploadFile(data.file, data.name) this.datasetService.uploadFile(data.file, data.name)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(); .subscribe();

View File

@ -5,19 +5,21 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<input class="hidden" type="file" #imgFileInput (change)="selectXML($event)" accept="text/xml" /> <input class="hidden" type="file" #imgFileInput (change)="selectXML($event)" accept="text/xml" />
<button mat-raised-button class="col-auto" color="{{btnColore}}" (click)="imgFileInput.click()" <button mat-icon-button class="col-auto" (click)="imgFileInput.click()" type="button">
type="button"><mat-icon>attach_file</mat-icon></button> <mat-icon color="{{btnColore}}">attach_file</mat-icon>
</button>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<mat-form-field class="col-12"> <mat-form-field class="col-12">
<input matInput placeholder="{{'DATASET-WIZARD.UPLOAD.UPLOAD-XML-NAME'| translate}}" <input matInput placeholder="{{'DATASET-WIZARD.UPLOAD.UPLOAD-XML-NAME'| translate}}" name="datasetProfileName" [(ngModel)]="data.name">
name="datasetProfileName" [(ngModel)]="data.name">
</mat-form-field> </mat-form-field>
<div class="col-auto"><button mat-raised-button color="primary" type="button" <div class="col-auto">
(click)="cancel()">{{ data.cancelButton }}</button></div> <button mat-raised-button color="primary" type="button" (click)="cancel()">{{ data.cancelButton }}</button>
</div>
<div class="col"></div> <div class="col"></div>
<div class="col-auto"><button mat-raised-button color="primary" type="button" <div class="col-auto">
(click)="confirm()" [disabled]="!hasProfile()">{{ data.confirmButton }}</button></div> <button mat-raised-button color="primary" type="button" (click)="confirm()" [disabled]="!hasProfile()">{{ data.confirmButton }}</button>
</div>
</div> </div>
</div> </div>

View File

@ -1,23 +1,25 @@
<div class="confirmation-dialog"> <div class="confirmation-dialog">
<div class="row"> <div class="row">
<div class="confirmation-message col"> <div class="confirmation-message col-auto align-self-center">
<h4>{{ data.message }}</h4> <h4>{{ data.message }}</h4>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<input class="hidden" type="file" #imgFileInput (change)="selectXML($event)" accept="text/xml" /> <input class="hidden" type="file" #imgFileInput (change)="selectXML($event)" accept="text/xml" />
<button mat-raised-button class="col-auto" color="{{btnColore}}" (click)="imgFileInput.click()" <button mat-icon-button class="col-auto" (click)="imgFileInput.click()" type="button">
type="button">{{ 'DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-IMPORT' | translate }}</button> <mat-icon color="{{btnColore}}">attach_file</mat-icon>
</button>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<mat-form-field class="col-12"> <mat-form-field class="col-12">
<input matInput placeholder="{{'DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-NAME'| translate}}" <input matInput placeholder="{{'DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-NAME'| translate}}" name="datasetProfileName" [(ngModel)]="data.name">
name="datasetProfileName" [(ngModel)]="data.name">
</mat-form-field> </mat-form-field>
<div class="col-auto"><button mat-raised-button color="primary" type="button" <div class="col-auto">
(click)="cancel()">{{ data.cancelButton }}</button></div> <button mat-raised-button color="primary" type="button" (click)="cancel()">{{ data.cancelButton }}</button>
</div>
<div class="col"></div> <div class="col"></div>
<div class="col-auto"><button mat-raised-button color="primary" type="button" <div class="col-auto">
(click)="confirm()" [disabled]="!hasProfile()">{{ data.confirmButton }}</button></div> <button mat-raised-button color="primary" type="button" (click)="confirm()" [disabled]="!hasProfile()">{{ data.confirmButton }}</button>
</div>
</div> </div>
</div> </div>

View File

@ -59,13 +59,13 @@ export class DmpProfileCriteriaComponent extends BaseCriteriaComponent implement
message: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-FILE-TITLE'), message: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-FILE-TITLE'),
confirmButton: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML'), confirmButton: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML'),
cancelButton: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-FILE-CANCEL'), cancelButton: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-FILE-CANCEL'),
name: this.language.instant('DMP-PROFILE-LISTING.UPLOAD.UPLOAD-XML-NAME'), name: '',
file: FileList, file: FileList,
sucsess: false sucsess: false
} }
}); });
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
if (data.sucsess && data.name != null && data.file != null) { if (data && data.sucsess && data.name != null && data.file != null) {
this.dmpProfileService.uploadFile(data.file, data.name) this.dmpProfileService.uploadFile(data.file, data.name)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(); .subscribe();

View File

@ -5,8 +5,8 @@
<h4>{{'CRITERIA.FILTERS'| translate}}</h4> <h4>{{'CRITERIA.FILTERS'| translate}}</h4>
</mat-card-title> </mat-card-title>
<div class="col"></div> <div class="col"></div>
<button class="uploadButton" mat-raised-button color="primary" (click)="fileSave($event)" type="button col-auto"> <button class="importButton" mat-raised-button color="primary" (click)="fileSave($event)" type="button col-auto">
{{'DMP-UPLOAD.UPLOAD-BUTTON' | translate}} {{'DMP-UPLOAD.ACTIONS.IMPORT' | translate}}
</button> </button>
</mat-card-header> </mat-card-header>
<div class="row"> <div class="row">

View File

@ -1,21 +1,19 @@
<div class="confirmation-dialog"> <div class="confirmation-dialog">
<div class="confirmation-message">
<div class="row"> <div class="row">
<div class="col-auto align-self-center">
<h4>{{'DMP-UPLOAD.TITLE' | translate}}</h4>
</div>
<div class="col-auto"> <div class="col-auto">
{{'DMP-UPLOAD.TITLE' | translate}} <button mat-icon-button class="col-auto" (click)="fileInput.click()" type="button">
</div> <mat-icon color="primary">attach_file</mat-icon>
<div class="uploadButton">
<button mat-raised-button color="primary" (click)="fileInput.click()" type="button col-auto">
{{'DMP-UPLOAD.UPLOAD-BUTTON' | translate}}
</button> </button>
<input class="hidden" #fileInput type="file" (change)="uploadFile($event)"> <input class="hidden" #fileInput type="file" (change)="uploadFile($event)" accept="text/xml">
</div> </div>
</div> </div>
</div> <div class="row">
<mat-form-field class="col"> <mat-form-field class="col-12">
<input class="uploadInput" [(ngModel)]="dmpTitle" matInput placeholder="DMP Name" name="uploadFileInput"> <input class="uploadInput" [(ngModel)]="dmpTitle" matInput placeholder="DMP Name" name="uploadFileInput">
</mat-form-field> </mat-form-field>
<div class="row">
<div class="col-auto"> <div class="col-auto">
<button mat-raised-button color="primary" type="button" (click)="cancel()">{{'DMP-UPLOAD.ACTIONS.CANCEL' | translate}}</button> <button mat-raised-button color="primary" type="button" (click)="cancel()">{{'DMP-UPLOAD.ACTIONS.CANCEL' | translate}}</button>
</div> </div>

View File

@ -216,7 +216,7 @@
} }
}, },
"DMP-UPLOAD": { "DMP-UPLOAD": {
"TITLE": "Upload Data Managment Plan via XML", "TITLE": "Import Data Managment Plan",
"UPLOAD-BUTTON": "Upload", "UPLOAD-BUTTON": "Upload",
"ACTIONS": { "ACTIONS": {
"IMPORT": "Import", "IMPORT": "Import",
@ -256,7 +256,7 @@
}, },
"UPLOAD": { "UPLOAD": {
"UPLOAD-XML": "Import", "UPLOAD-XML": "Import",
"UPLOAD-XML-FILE-TITLE": "Select Xml file with Dataset Profile to Upload", "UPLOAD-XML-FILE-TITLE": "Import Dataset Profile",
"UPLOAD-XML-NAME": "Name Of Dataset Profile", "UPLOAD-XML-NAME": "Name Of Dataset Profile",
"UPLOAD-XML-IMPORT": "File", "UPLOAD-XML-IMPORT": "File",
"UPLOAD-XML-FILE-CANCEL": "Cancel" "UPLOAD-XML-FILE-CANCEL": "Cancel"
@ -387,7 +387,7 @@
}, },
"UPLOAD": { "UPLOAD": {
"UPLOAD-XML": "Import", "UPLOAD-XML": "Import",
"UPLOAD-XML-FILE-TITLE": "Select Xml file with Dmp Profile to Upload", "UPLOAD-XML-FILE-TITLE": "Import Data Managment Plan Profile",
"UPLOAD-XML-NAME": "Name Of Dmp Profile", "UPLOAD-XML-NAME": "Name Of Dmp Profile",
"UPLOAD-XML-IMPORT": "File", "UPLOAD-XML-IMPORT": "File",
"UPLOAD-XML-FILE-CANCEL": "Cancel" "UPLOAD-XML-FILE-CANCEL": "Cancel"