argos/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts

59 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-04-25 16:04:54 +02:00
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DmpListingModel } from '../../../../core/model/dmp/dmp-listing';
2019-05-08 10:37:44 +02:00
import { MatDialog } from '@angular/material';
import { DmpInvitationDialogComponent } from '../../invitation/dmp-invitation.component';
import { Router } from '@angular/router';
import { ProjectListingModel } from '../../../../core/model/project/project-listing';
2019-04-25 16:04:54 +02:00
@Component({
selector: 'app-dmp-listing-item-component',
templateUrl: './dmp-listing-item.component.html',
styleUrls: ['./dmp-listing-item.component.scss'],
})
export class DmpListingItemComponent implements OnInit {
@Input() dmp: DmpListingModel;
@Input() showDivider: boolean = true;
@Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter();
isDraft: boolean;
2019-05-08 10:37:44 +02:00
constructor(private router: Router, private dialog: MatDialog) { }
2019-04-25 16:04:54 +02:00
ngOnInit() {
if (this.dmp.status == 0) { this.isDraft = true }
else { this.isDraft = false }
2019-04-25 16:04:54 +02:00
}
2019-05-08 10:37:44 +02:00
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 } });
}
itemClicked() {
this.onClick.emit(this.dmp);
}
projectClicked(projectId: String) {
this.router.navigate(['/projects/edit/' + projectId]);
}
2019-04-25 16:04:54 +02:00
}