Fixes breadcrumbs context, Removes actions on public dmp overview

This commit is contained in:
apapachristou 2019-06-07 18:21:09 +03:00
parent b502868c62
commit d80a0837af
13 changed files with 89 additions and 58 deletions

View File

@ -138,11 +138,11 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
label: this.datasetWizardModel.label,
url: '/datasets/edit/' + this.datasetWizardModel.id,
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: '/plans/overview/' + this.datasetWizardModel.dmp.id
},
// {
// parentComponentName: null,
// label: this.datasetWizardModel.dmp.label,
// url: '/plans/overview/' + this.datasetWizardModel.dmp.id
// },
{
parentComponentName: null,
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS').toUpperCase(),
@ -235,7 +235,8 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: '/plans/edit/' + this.datasetWizardModel.dmp.id,
}]
}
]
}]);
});
});
@ -247,7 +248,8 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
this.loadDatasetProfiles();
});
} else if (this.publicId != null) {
} else if (this.publicId != null) { // For Finalized -> Public Datasets
this.isNew = false;
this.datasetWizardService.getSinglePublic(this.publicId)
.pipe(takeUntil(this._destroyed))
.catch((error: any) => {
@ -266,23 +268,10 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
}
this.formGroup.get('dmp').setValue(this.datasetWizardModel.dmp);
this.loadDatasetProfiles();
this.breadCrumbs = Observable.of([
{
parentComponentName: null,
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS'),
url: '/datasets',
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.project.label,
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
},
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: '/plans/edit/' + this.datasetWizardModel.dmp.id,
}]
}]);
const breadcrumbs = [];
breadcrumbs.push({parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC DATASETS'), url: '/datasets'});
breadcrumbs.push({parentComponentName: null, label: this.datasetWizardModel.label, url: '/datasets/publicEdit/' + this.datasetWizardModel.id});
this.breadCrumbs = Observable.of(breadcrumbs);
}
});
this.publicMode = true;

View File

@ -1,6 +1,6 @@
<div class="container-fluid">
<div class="row d-flex">
<div class="col-12 add-dataset" (click)="addDataset(dmp.id)">
<div class="col-12 add-dataset" *ngIf="!isPublic" (click)="addDataset(dmp.id)">
<mat-icon>add</mat-icon><span>{{ 'DMP-LISTING.ACTIONS.ADD-DATASET' | translate }}</span>
</div>
</div>

View File

@ -11,6 +11,7 @@ import { DatasetOverviewModel } from '../../../../core/model/dataset/dataset-ove
export class DatasetsTabComponent implements OnInit {
@Input() dmp: DmpEditorModel;
@Input() isPublic: boolean;
constructor(
private router: Router

View File

@ -58,14 +58,14 @@
<mat-icon class="mr-2">library_books</mat-icon>
{{ 'DMP-LISTING.COLUMNS.DATASETS' | translate }}
</ng-template>
<app-datasets-tab [dmp]="dmp" ></app-datasets-tab>
<app-datasets-tab [dmp]="dmp" [isPublic]="isPublic"></app-datasets-tab>
</mat-tab>
<mat-tab [disabled]="isNew">
<ng-template mat-tab-label>
<mat-icon class="mr-2">person</mat-icon>
{{ 'DMP-LISTING.COLUMNS.PEOPLE' | translate }}
</ng-template>
<app-people-tab [formGroup]="formGroup" [dmp]="dmp"></app-people-tab>
<app-people-tab [formGroup]="formGroup" [dmp]="dmp" [isPublic]="isPublic"></app-people-tab>
</mat-tab>
<!-- <mat-tab>
<ng-template mat-tab-label>

View File

@ -124,11 +124,11 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
});
const breadcrumb = await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise();
breadCrumbs.push({
parentComponentName: 'DmpListingComponent',
label: this.dmp.label,
url: '/plans/edit/' + this.dmp.id,
// notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
}
parentComponentName: 'DmpListingComponent',
label: this.dmp.label,
url: '/plans/edit/' + this.dmp.id,
// notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
}
);
this.breadCrumbs = Observable.of(breadCrumbs);
}
@ -159,14 +159,18 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
if (!this.editMode || this.dmp.status === Status.Inactive) { this.formGroup.disable(); }
if (this.isAuthenticated()) {
// if (!this.isAuthenticated) {
this.breadCrumbs = Observable.of([
{
parentComponentName: 'DmpListingComponent',
label: this.language.instant('NAV-BAR.MY-DMPS'),
url: 'plans',
notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
}]
);
const breadcrumbs = [];
breadcrumbs.push({ parentComponentName: null, label:this.language.instant('NAV-BAR.MY-PUBLIC-DMPS').toUpperCase(), url: '/plans' });
breadcrumbs.push({ parentComponentName: null, label: this.dmp.label, url: '/plans/publicEdit/' + this.dmp.id });
this.breadCrumbs = Observable.of(breadcrumbs);
// this.breadCrumbs = Observable.of([
// {
// parentComponentName: 'DmpListingComponent',
// label: this.language.instant('NAV-BAR.MY-DMPS'),
// url: 'plans',
// notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
// }]
// );
this.associatedUsers = data.associatedUsers;
}
});
@ -182,10 +186,10 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
url: "/plans"
});
breadCrumbs.push({
parentComponentName: null,
label: "CREATE NEW DMP",
url: "/plans/new"
}
parentComponentName: null,
label: "CREATE NEW DMP",
url: "/plans/new"
}
);
this.breadCrumbs = Observable.of(breadCrumbs);
}
@ -242,8 +246,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.dmpService.createDmp(this.formGroup.getRawValue())
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onCallbackSuccess(),
error => this.onCallbackError(error)
complete => this.onCallbackSuccess(),
error => this.onCallbackError(error)
);
}
@ -291,8 +295,8 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
this.dmpService.delete(this.dmp.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => { this.onCallbackSuccess() },
error => this.onDeleteCallbackError(error)
complete => { this.onCallbackSuccess() },
error => this.onDeleteCallbackError(error)
);
}
});

View File

@ -3,7 +3,7 @@
<div class="col-12 pt-4 pb-4 pl-4">
<div class="table-header col-auto d-flex">
<span class="table-title">Collaborators</span>
<div class="table-action" (click)="openShareDialog(dmp.id, dmp.label)">
<div class="table-action" *ngIf="!isPublic" (click)="openShareDialog(dmp.id, dmp.label)">
<mat-icon>add</mat-icon><span>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}</span>
</div>
</div>

View File

@ -19,6 +19,7 @@ export class PeopleTabComponent implements OnInit {
@Input() formGroup: FormGroup;
@Input() dmp: DmpEditorModel;
@Input() isPublic: boolean;
constructor(
private dialog: MatDialog,

View File

@ -28,7 +28,7 @@
</div>
</div>
<div class="row">
<div class="col-12 about-item">
<div class="col-12 d-flex flex-wrap">
<mat-icon *ngIf="isDraft" class="draft-icon">lock</mat-icon>
<mat-icon *ngIf="!isDraft">lock</mat-icon>
<h4 class="title" *ngIf="isDraft"><span>{{ 'TYPES.DMP.DRAFT' | translate }}:</span>{{dmp.label}}</h4>
@ -43,7 +43,7 @@
<div class="row">
<div class="col-12 about-item">
<mat-icon class="gray-icon pt-2">settings</mat-icon>
<h4 class="mt-2 ml-1 mr-3 p-1">{{roleDisplay(dmp.users)}}</h4>
<h4 class="mt-2 ml-1 mr-3 p-1">{{roleDisplay(dmp.users).toUpperCase()}}</h4>
<div class="datasets-counter">
<mat-icon (click)="$event.stopImmediatePropagation(); datasetClicked(dmp)" class="gray-icon pt-2">

View File

@ -25,6 +25,12 @@
flex-wrap: wrap;
}
.about-item h4 {
font-size: 0.92rem;
line-height: 1.3em;
font-weight: 500;
}
// .about-item .length {
// color: rgb(70, 135, 240);
// }

View File

@ -18,8 +18,8 @@
</div>
<div class="row">
<div class="col-12 about-item">
<mat-icon class="gray-icon pt-2">settings</mat-icon>
<h4 class="mt-2 ml-1 mr-3 p-1">OWNER</h4>
<!-- <mat-icon class="gray-icon pt-2">settings</mat-icon> -->
<!-- <h4 class="mt-2 ml-1 mr-3 p-1">{{roleDisplay(dmp.users).toUpperCase()}}</h4> -->
<mat-icon class="gray-icon pt-2">storage</mat-icon>
<h4 class="length mt-2 ml-1 mr-3 p-1">{{dmp.datasets.length}}</h4>
@ -28,7 +28,7 @@
<div *ngFor="let profile of dmp.associatedProfiles" class="pt-1">
<div matTooltip="{{profile.label}}" class="chip ml-2 mr-2">{{profile.label}}</div>
</div>
<p>Published {{dmp.creationTime | date: "shortDate"}}</p>
<p>{{'DMP-PROFILE-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.creationTime | date: "shortDate"}}</p>
</div>
</div>
</div>

View File

@ -15,6 +15,12 @@
flex-wrap: wrap;
}
.about-item h4 {
font-size: 0.92rem;
line-height: 1.3em;
font-weight: 500;
}
.about-item .length {
color: rgb(70, 135, 240);
}

View File

@ -1,5 +1,8 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DmpListingModel } from '../../../core/model/dmp/dmp-listing';
import { Principal } from '../../../core/model/auth/Principal';
import { AuthService } from '../../../core/services/auth/auth.service';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-explore-dmp-listing-item-component',
@ -13,9 +16,9 @@ export class ExploreDmpListingItemComponent implements OnInit {
@Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter();
constructor(
) {
}
private authentication: AuthService,
private translate: TranslateService
) { }
ngOnInit() {
}
@ -23,4 +26,25 @@ export class ExploreDmpListingItemComponent implements OnInit {
itemClicked() {
this.onClick.emit(this.dmp);
}
roleDisplay(value: any) {
const principal: Principal = this.authentication.current();
let role: number;
if (principal) {
value.forEach(element => {
if (principal.id === element.id) {
role = element.role;
}
});
}
if (role === 0) {
return this.translate.instant('DMP-PUBLIC-LISTING.OWNER');
}
else if (role === 1) {
return this.translate.instant('DMP-PUBLIC-LISTING.MEMBER');
}
else {
return this.translate.instant('DMP-PUBLIC-LISTING.VIEW-ONLY');
}
}
}

View File

@ -1,6 +1,6 @@
<div class="row">
<mat-form-field class="col-md-6">
<mat-select placeholder="Sources" [(ngModel)]="choice" (selectionChange)="selectionChange($event)" [disabled]="formArray.disabled">
<mat-select placeholder="{{'TYPES.EXTERNAL-DATASET-TYPE.SOURCES' | translate}}" [(ngModel)]="choice" (selectionChange)="selectionChange($event)" [disabled]="formArray.disabled">
<mat-option *ngFor="let option of options" [value]="option.key">
{{ option.label }}
</mat-option>