Adds: dmp item actions

This commit is contained in:
apapachristou 2019-05-08 11:37:44 +03:00
parent 5bf1951da6
commit be06f26bcf
2 changed files with 46 additions and 7 deletions

View File

@ -1,8 +1,8 @@
<div class="dmp-listing-item row" (click)="itemClicked()"> <div class="dmp-listing-item row">
<div class="col-auto"> <div class="col-auto">
<mat-icon>lock</mat-icon> <mat-icon>lock</mat-icon>
</div> </div>
<div class="col"> <div class="col" (click)="itemClicked()">
<div class="row"> <div class="row">
<h4 class="col-12 title">{{dmp.label}}</h4> <h4 class="col-12 title">{{dmp.label}}</h4>
<h4 class="col-12 project-title">{{dmp.project}}</h4> <h4 class="col-12 project-title">{{dmp.project}}</h4>
@ -29,7 +29,23 @@
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<mat-icon>more_horiz</mat-icon> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon>
</button>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="openShareDialog(dmp.id,dmp.label)">
<mat-icon>share</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}
</button>
<button mat-menu-item (click)="addDataset(dmp.id)">
<mat-icon>add</mat-icon>{{'DMP-LISTING.ACTIONS.ADD-DATASET' | translate}}
</button>
<button mat-menu-item (click)="showDatasets(dmp.id, dmp.label)">
<mat-icon>list</mat-icon>{{'DMP-LISTING.ACTIONS.DATASETS' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
</mat-menu>
</div> </div>
</div> </div>
<mat-divider *ngIf="showDivider"></mat-divider> <mat-divider *ngIf="showDivider"></mat-divider>

View File

@ -1,5 +1,8 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DmpListingModel } from '../../../../core/model/dmp/dmp-listing'; import { DmpListingModel } from '../../../../core/model/dmp/dmp-listing';
import { MatDialog } from '@angular/material';
import { DmpInvitationDialogComponent } from '../../invitation/dmp-invitation.component';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-dmp-listing-item-component', selector: 'app-dmp-listing-item-component',
@ -12,10 +15,7 @@ export class DmpListingItemComponent implements OnInit {
@Input() showDivider: boolean = true; @Input() showDivider: boolean = true;
@Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter(); @Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter();
constructor( constructor(private router: Router, private dialog: MatDialog) { }
) {
}
ngOnInit() { ngOnInit() {
} }
@ -23,4 +23,27 @@ export class DmpListingItemComponent implements OnInit {
itemClicked() { itemClicked() {
this.onClick.emit(this.dmp); this.onClick.emit(this.dmp);
} }
openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px',
// width: '700px',
data: {
dmpId: rowId,
dmpName: rowName
}
});
}
addDataset(rowId: String) {
this.router.navigate(['/datasets/new/' + rowId]);
}
showDatasets(rowId: String, rowLabel: String) {
this.router.navigate(['/datasets/dmp/' + rowId, { dmpLabel: rowLabel }]);
}
viewVersions(rowId: String, rowLabel: String) {
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
}
} }