Changes navigation of "XX Dataset Descriptions" on DMP overview to redirect on DMP edit "Dataset Descriptions" tab. (Issue #144)

This commit is contained in:
gkolokythas 2019-07-18 17:16:12 +03:00
parent f00ac97dbb
commit 131245850a
4 changed files with 15 additions and 4 deletions

View File

@ -38,7 +38,7 @@
</div> </div>
<form *ngIf="formGroup" (ngSubmit)="formSubmit()"> <form *ngIf="formGroup" (ngSubmit)="formSubmit()">
<div class="d-flex flex-column"> <div class="d-flex flex-column">
<mat-tab-group class="mt-3"> <mat-tab-group [(selectedIndex)]="selectedTab" class="mt-3">
<mat-tab> <mat-tab>
<ng-template mat-tab-label> <ng-template mat-tab-label>
<i class="material-icons-outlined mr-2">view_agenda</i> <i class="material-icons-outlined mr-2">view_agenda</i>

View File

@ -51,6 +51,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
isFinalized = false; isFinalized = false;
dmp: DmpEditorModel; dmp: DmpEditorModel;
formGroup: FormGroup = null; formGroup: FormGroup = null;
selectedTab = 0;
createNewVersion; createNewVersion;
associatedUsers: Array<UserModel>; associatedUsers: Array<UserModel>;
@ -85,6 +86,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
const itemId = params['id']; const itemId = params['id'];
const projectId = params['projectId']; const projectId = params['projectId'];
const publicId = params['publicId']; const publicId = params['publicId'];
const queryParams = this.route.snapshot.queryParams;
const tabToNav = queryParams['tab'];
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem(); const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria(); projectRequestItem.criteria = new ProjectCriteria();
@ -99,6 +102,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// }; // };
if (itemId != null) { if (itemId != null) {
this.isNew = false; this.isNew = false;
if (tabToNav == "datasetDescriptions") this.selectedTab = 2
this.dmpService.getSingle(itemId).map(data => data as DmpModel) this.dmpService.getSingle(itemId).map(data => data as DmpModel)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(async data => { .subscribe(async data => {

View File

@ -38,7 +38,7 @@
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }} <mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
</button> </button>
</mat-menu> </mat-menu>
<button mat-raised-button color="primary" (click)="editClicked(dmp)" class="lightblue-btn ml-2"> <button *ngIf="isDraftDmp(dmp)" mat-raised-button color="primary" (click)="editClicked(dmp)" class="lightblue-btn ml-2">
<mat-icon>edit</mat-icon> {{ 'DMP-LISTING.ACTIONS.EDIT' | translate }} <mat-icon>edit</mat-icon> {{ 'DMP-LISTING.ACTIONS.EDIT' | translate }}
</button> </button>
<button mat-raised-button color="primary" (click)="downloadPDF(dmp.id)" class="lightblue-btn ml-2"> <button mat-raised-button color="primary" (click)="downloadPDF(dmp.id)" class="lightblue-btn ml-2">
@ -50,7 +50,7 @@
<button *ngIf="isDraftDmp(dmp)" mat-raised-button color="primary" (click)="finalize(dmp)" class="lightblue-btn ml-2"> <button *ngIf="isDraftDmp(dmp)" mat-raised-button color="primary" (click)="finalize(dmp)" class="lightblue-btn ml-2">
<mat-icon>done_all</mat-icon> {{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }} <mat-icon>done_all</mat-icon> {{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }}
</button> </button>
<button *ngIf="hasDoi(dmp) && isFinalizedDmp(dmp)" mat-raised-button color="primary" (click)="getDoi(dmp)" class="lightblue-btn ml-2"> <button *ngIf="hasDoi(dmp) && isFinalizedDmp(dmp) && !this.isPublicView" mat-raised-button color="primary" (click)="getDoi(dmp)" class="lightblue-btn ml-2">
<mat-icon>archive</mat-icon> {{ 'DMP-LISTING.ACTIONS.GETDOI' | translate }} <mat-icon>archive</mat-icon> {{ 'DMP-LISTING.ACTIONS.GETDOI' | translate }}
</button> </button>
</div> </div>

View File

@ -33,6 +33,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
dmp: DmpOverviewModel; dmp: DmpOverviewModel;
isNew = true; isNew = true;
isFinalized = false; isFinalized = false;
isPublicView = true;
hasPublishButton: boolean = true; hasPublishButton: boolean = true;
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of(); breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of();
@ -58,6 +59,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
const publicId = params['publicId']; const publicId = params['publicId'];
if (itemId != null) { if (itemId != null) {
this.isNew = false; this.isNew = false;
this.isPublicView = false;
this.dmpService.getOverviewSingle(itemId) this.dmpService.getOverviewSingle(itemId)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
@ -71,6 +73,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
else if (publicId != null) { else if (publicId != null) {
this.isNew = false; this.isNew = false;
this.isFinalized = true; this.isFinalized = true;
this.isPublicView = true;
this.dmpService.getOverviewSinglePublic(publicId) this.dmpService.getOverviewSinglePublic(publicId)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
@ -102,7 +105,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
datasetsClicked(dmpId: String) { datasetsClicked(dmpId: String) {
if (!this.isFinalized) if (!this.isFinalized)
this.router.navigate(['/datasets'], { queryParams: { dmpId: dmpId } }); this.router.navigate(['/plans/edit/' + dmpId], { queryParams: { tab: "datasetDescriptions" } });
else else
this.router.navigate(['/explore'], { queryParams: { dmpId: dmpId } }); this.router.navigate(['/explore'], { queryParams: { dmpId: dmpId } });
} }
@ -279,6 +282,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return dmp.status == DmpStatus.Finalized; return dmp.status == DmpStatus.Finalized;
} }
isPublishedDMP(dmp: DmpOverviewModel) {
return (dmp.status == DmpStatus.Finalized && dmp.isPublic);
}
hasDoi(dmp: DmpOverviewModel) { hasDoi(dmp: DmpOverviewModel) {
return dmp.doi == null ? true : false; return dmp.doi == null ? true : false;
} }