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>
<form *ngIf="formGroup" (ngSubmit)="formSubmit()">
<div class="d-flex flex-column">
<mat-tab-group class="mt-3">
<mat-tab-group [(selectedIndex)]="selectedTab" class="mt-3">
<mat-tab>
<ng-template mat-tab-label>
<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;
dmp: DmpEditorModel;
formGroup: FormGroup = null;
selectedTab = 0;
createNewVersion;
associatedUsers: Array<UserModel>;
@ -85,6 +86,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
const itemId = params['id'];
const projectId = params['projectId'];
const publicId = params['publicId'];
const queryParams = this.route.snapshot.queryParams;
const tabToNav = queryParams['tab'];
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
@ -99,6 +102,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
// };
if (itemId != null) {
this.isNew = false;
if (tabToNav == "datasetDescriptions") this.selectedTab = 2
this.dmpService.getSingle(itemId).map(data => data as DmpModel)
.pipe(takeUntil(this._destroyed))
.subscribe(async data => {

View File

@ -38,7 +38,7 @@
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
</button>
</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 }}
</button>
<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">
<mat-icon>done_all</mat-icon> {{ 'DMP-LISTING.ACTIONS.FINALIZE' | translate }}
</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 }}
</button>
</div>

View File

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