Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign
This commit is contained in:
commit
3af197c3aa
|
@ -49,8 +49,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
||||||
hasDOIToken = false;
|
hasDOIToken = false;
|
||||||
researchers: ResearcherModel[];
|
researchers: ResearcherModel[];
|
||||||
users: UserInfoListingModel[];
|
users: UserInfoListingModel[];
|
||||||
lockStatus = false;
|
lockStatus: Boolean;
|
||||||
// lockStatus: Boolean;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -92,7 +91,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||||
});
|
});
|
||||||
// this.checkLockStatus(this.dataset.id);
|
this.checkLockStatus(this.dataset.id);
|
||||||
this.setIsUserOwner();
|
this.setIsUserOwner();
|
||||||
const breadCrumbs = [];
|
const breadCrumbs = [];
|
||||||
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'), url: "/datasets" });
|
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'), url: "/datasets" });
|
||||||
|
@ -121,7 +120,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||||
});
|
});
|
||||||
// this.checkLockStatus(this.dataset.id);
|
this.checkLockStatus(this.dataset.id);
|
||||||
this.setIsUserOwner();
|
this.setIsUserOwner();
|
||||||
const breadCrumbs = [];
|
const breadCrumbs = [];
|
||||||
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: "/explore" });
|
breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: "/explore" });
|
||||||
|
@ -158,7 +157,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadComponent(): void {
|
reloadPage(): void {
|
||||||
this.router.navigateByUrl('/datasets', { skipLocationChange: true }).then(() => {
|
this.router.navigateByUrl('/datasets', { skipLocationChange: true }).then(() => {
|
||||||
this.router.navigate([`/datasets/overview/${this.dataset.id}`]);
|
this.router.navigate([`/datasets/overview/${this.dataset.id}`]);
|
||||||
});
|
});
|
||||||
|
@ -394,7 +393,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => {
|
complete => {
|
||||||
this.onCallbackSuccess();
|
this.onCallbackSuccess();
|
||||||
this.reloadComponent();
|
this.reloadPage();
|
||||||
},
|
},
|
||||||
error => this.onDeleteCallbackError(error)
|
error => this.onDeleteCallbackError(error)
|
||||||
);
|
);
|
||||||
|
|
|
@ -582,10 +582,19 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reloadPage(): void {
|
||||||
|
this.router.navigateByUrl('/plans', { skipLocationChange: true }).then(() => {
|
||||||
|
this.router.navigate([`/plans/overview/${this.dmp.id}`]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
updateUsers() {
|
updateUsers() {
|
||||||
return this.dmpService.updateUsers(this.dmp.id, this.dmp.users).pipe(takeUntil(this._destroyed))
|
return this.dmpService.updateUsers(this.dmp.id, this.dmp.users).pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => { this.onCallbackSuccess() },
|
complete => {
|
||||||
|
this.onCallbackSuccess();
|
||||||
|
this.reloadPage();
|
||||||
|
},
|
||||||
error => this.onDeleteCallbackError(error)
|
error => this.onDeleteCallbackError(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<h1 mat-dialog-title class="title">{{'NAV-BAR.START-NEW-DMP' | translate}}</h1>
|
<h1 mat-dialog-title class="title">{{'NAV-BAR.START-NEW-DMP' | translate}}</h1>
|
||||||
<p class="text">{{'NAV-BAR.START-NEW-DMP-TXT' | translate}}</p>
|
<p class="text">{{'NAV-BAR.START-NEW-DMP-TXT' | translate}}</p>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button type="button" class="normal-btn upload-btn d-flex flex-row align-items-center">
|
<button type="button" class="normal-btn upload-btn d-flex flex-row align-items-center" (click)="uploadFile($event)">
|
||||||
<mat-icon class="pr-2">file_upload</mat-icon>
|
<mat-icon class="pr-2">file_upload</mat-icon>
|
||||||
{{ 'NAV-BAR.IMPORT-FROM-FILE' | translate }}
|
{{ 'NAV-BAR.IMPORT-FROM-FILE' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,21 +1,32 @@
|
||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { DmpUploadDialogue } from '../listing/upload-dialogue/dmp-upload-dialogue.component';
|
||||||
|
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-start-new-dmp',
|
selector: 'app-start-new-dmp',
|
||||||
templateUrl: './start-new-dmp-dialog.component.html',
|
templateUrl: './start-new-dmp-dialog.component.html',
|
||||||
styleUrls: ['./start-new-dmp-dialog.component.scss']
|
styleUrls: ['./start-new-dmp-dialog.component.scss']
|
||||||
})
|
})
|
||||||
export class StartNewDmpDialogComponent {
|
export class StartNewDmpDialogComponent extends BaseComponent {
|
||||||
|
|
||||||
public isDialog: boolean = false;
|
public isDialog: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public dialogRef: MatDialogRef<StartNewDmpDialogComponent>,
|
public dialogRef: MatDialogRef<StartNewDmpDialogComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
private router: Router
|
private router: Router,
|
||||||
|
public dialog: MatDialog,
|
||||||
|
private uiNotificationService: UiNotificationService,
|
||||||
|
private language: TranslateService,
|
||||||
|
private dmpService: DmpService
|
||||||
) {
|
) {
|
||||||
|
super();
|
||||||
this.isDialog = data.isDialog;
|
this.isDialog = data.isDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,4 +47,32 @@ export class StartNewDmpDialogComponent {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uploadFile(event) {
|
||||||
|
const dialogRef = this.dialog.open(DmpUploadDialogue, {
|
||||||
|
data: {
|
||||||
|
fileList: FileList,
|
||||||
|
success: Boolean,
|
||||||
|
dmpTitle: String
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
|
if (result && result.success) {
|
||||||
|
this.dmpService.uploadXml(result.fileList, result.dmpTitle, result.dmpProfiles)
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe((complete) => this.onCallbackImportComplete(),
|
||||||
|
(error) => this.onCallbackImportFail(error.error));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private onCallbackImportComplete() {
|
||||||
|
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success);
|
||||||
|
this.router.navigate(['/reload']).then(() => this.router.navigate(['/plans']));
|
||||||
|
// this.router.navigate(['/reload']).then(() => this.isPublic ? this.router.navigate(['/explore-plans']) : this.router.navigate(['/plans']));
|
||||||
|
}
|
||||||
|
|
||||||
|
private onCallbackImportFail(error: any) {
|
||||||
|
this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue