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;
|
||||
researchers: ResearcherModel[];
|
||||
users: UserInfoListingModel[];
|
||||
lockStatus = false;
|
||||
// lockStatus: Boolean;
|
||||
lockStatus: Boolean;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -92,7 +91,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
.subscribe(data => {
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
});
|
||||
// this.checkLockStatus(this.dataset.id);
|
||||
this.checkLockStatus(this.dataset.id);
|
||||
this.setIsUserOwner();
|
||||
const breadCrumbs = [];
|
||||
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 => {
|
||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
});
|
||||
// this.checkLockStatus(this.dataset.id);
|
||||
this.checkLockStatus(this.dataset.id);
|
||||
this.setIsUserOwner();
|
||||
const breadCrumbs = [];
|
||||
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();
|
||||
}
|
||||
|
||||
reloadComponent(): void {
|
||||
reloadPage(): void {
|
||||
this.router.navigateByUrl('/datasets', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigate([`/datasets/overview/${this.dataset.id}`]);
|
||||
});
|
||||
|
@ -394,7 +393,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
.subscribe(
|
||||
complete => {
|
||||
this.onCallbackSuccess();
|
||||
this.reloadComponent();
|
||||
this.reloadPage();
|
||||
},
|
||||
error => this.onDeleteCallbackError(error)
|
||||
);
|
||||
|
|
|
@ -582,10 +582,19 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
this.location.back();
|
||||
}
|
||||
|
||||
reloadPage(): void {
|
||||
this.router.navigateByUrl('/plans', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigate([`/plans/overview/${this.dmp.id}`]);
|
||||
});
|
||||
}
|
||||
|
||||
updateUsers() {
|
||||
return this.dmpService.updateUsers(this.dmp.id, this.dmp.users).pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => { this.onCallbackSuccess() },
|
||||
complete => {
|
||||
this.onCallbackSuccess();
|
||||
this.reloadPage();
|
||||
},
|
||||
error => this.onDeleteCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<h1 mat-dialog-title class="title">{{'NAV-BAR.START-NEW-DMP' | translate}}</h1>
|
||||
<p class="text">{{'NAV-BAR.START-NEW-DMP-TXT' | translate}}</p>
|
||||
<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>
|
||||
{{ 'NAV-BAR.IMPORT-FROM-FILE' | translate }}
|
||||
</button>
|
||||
|
|
|
@ -1,21 +1,32 @@
|
|||
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 { 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({
|
||||
selector: 'app-start-new-dmp',
|
||||
templateUrl: './start-new-dmp-dialog.component.html',
|
||||
styleUrls: ['./start-new-dmp-dialog.component.scss']
|
||||
})
|
||||
export class StartNewDmpDialogComponent {
|
||||
export class StartNewDmpDialogComponent extends BaseComponent {
|
||||
|
||||
public isDialog: boolean = false;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<StartNewDmpDialogComponent>,
|
||||
@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;
|
||||
}
|
||||
|
||||
|
@ -36,4 +47,32 @@ export class StartNewDmpDialogComponent {
|
|||
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