minor changes

This commit is contained in:
Nikolaos Laskaris 2017-11-16 19:07:27 +02:00
parent 441489623c
commit 624eec5ba2
6 changed files with 57 additions and 31 deletions

View File

@ -45,7 +45,7 @@ export class DmpComponent implements OnInit{
showIDs : boolean = false; showIDs : boolean = false;
dmp : any = null; dmp : any;
@Input() projectsDropDown:DropdownField; @Input() projectsDropDown:DropdownField;
@Input() statusDropDown: DropdownField; @Input() statusDropDown: DropdownField;
@ -60,10 +60,9 @@ export class DmpComponent implements OnInit{
this.projectsDropDown = new DropdownField(); this.projectsDropDown = new DropdownField();
this.projectsDropDown.options = []; this.projectsDropDown.options = [];
this.statusDropDown = new DropdownField(); this.statusDropDown = new DropdownField();
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}] this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
//this.projects = []; //this.projects = [];
this.dmp = this.clearDmp();
} }
@ -101,15 +100,10 @@ export class DmpComponent implements OnInit{
} }
) )
} this.clearDmp();
showDMPDetails(dmp) {
console.log("Showing details for dmp : " + JSON.stringify(dmp));
// TODO: Add here code to show details of dmp.
//1. hide dmp table and show component for detailed dmp
//2. also edit the breadcrumb
}
}
getDmps(muted? : boolean){ getDmps(muted? : boolean){
@ -198,7 +192,7 @@ export class DmpComponent implements OnInit{
newDmpForm(item){ newDmpForm(item){
this.dmp = this.clearDmp(); this.clearDmp();
$("#newDmpModal").modal("show"); $("#newDmpModal").modal("show");
} }

View File

@ -65,11 +65,11 @@
<tr *ngFor="let dmp of mf.data" class="hover"> <tr *ngFor="let dmp of mf.data" class="hover">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp?.id}}</td> <td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp?.id}}</td>
<td class="url-like" (click)="viewDetailedDMP(dmp)">{{dmp?.label}}</td> <td class="url-like" (click)="viewDetailedDMP(dmp)">{{(dmp?.label?.length > 40) ? (dmp?.label | slice:0:40)+'...':(dmp?.label) }}</td>
<td style="width:20px;">{{dmp?.version}}</td> <td style="width:20px;">{{dmp?.version}}</td>
<td style="width:300px;">{{dmp?.previous}}</td> <td style="width:300px;">{{dmp?.previous}}</td>
<td>{{dmp?.project?.label}}</td> <td>{{(dmp?.project?.label?.length > 40) ? (dmp?.project?.label | slice:0:40)+'...':(dmp?.project?.label) }}</td>
<td>{{(dmp?.description?.length > 20) ? (dmp?.description | slice:0:20)+'...':(dmp?.description) }}</td> <td>{{(dmp?.description?.length > 40) ? (dmp?.description | slice:0:40)+'...':(dmp?.description) }}</td>
<td>{{dmp?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td> <td>{{dmp?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{dmp?.status | statusToString }}</td> <td>{{dmp?.status | statusToString }}</td>
<td> <td>
@ -111,14 +111,14 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()"> <form #dmpForm="ngForm" (ngSubmit)="SaveNewDmp()">
<div class="form-group"> <div class="form-group">
<div class="form-group"> <div class="form-group">
<label for="label-name" class="form-control-label">Label:</label> <label for="label-name" class="form-control-label">Label:</label>
<input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label"> <input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label" required>
</div> </div>
<label for="recipient-name" class="col-form-label">Project:</label> <label for="recipient-name" class="col-form-label">Project:</label>
<select class="form-control" id="projectsDropDownKey" [ngModel]="dmp?.project" (ngModelChange)="dmp.project=$event" name="projectsDropDown"> <select class="form-control" id="projectsDropDownKey" [ngModel]="dmp?.project" (ngModelChange)="dmp.project=$event" name="projectsDropDown" required>
<option *ngFor="let opt of projectsDropDown.options" [value]="opt.key">{{opt.value}}</option> <option *ngFor="let opt of projectsDropDown.options" [value]="opt.key">{{opt.value}}</option>
</select> </select>
</div> </div>
@ -176,7 +176,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()"> <form #dmpForm="ngForm" (ngSubmit)="SaveNewDmp()">
<div class="form-group"> <div class="form-group">
<label for="label-name" class="form-control-label">Label:</label> <label for="label-name" class="form-control-label">Label:</label>
<input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label"> <input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label">
@ -201,7 +201,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" (click)="cloneDMP(dmp);">Save Dmp</button> <button type="submit" class="btn btn-primary" [disabled]="!dmpForm.form.valid" (click)="cloneDMP(dmp);">Save Dmp</button>
</div> </div>
</div> </div>
</div> </div>
@ -229,5 +229,3 @@
<!-- Confirmation module- do not delete --> <!-- Confirmation module- do not delete -->
<confirmation [confirmationID]="'delete-dmp-confirm'" [confirmationTitle]="'Caution'" [confirmationDescr]="'This action will delete this DMP. Are you sure ? This is not revertable !'" (responseSender)="deleteDMP($event)"></confirmation> <confirmation [confirmationID]="'delete-dmp-confirm'" [confirmationTitle]="'Caution'" [confirmationDescr]="'This action will delete this DMP. Are you sure ? This is not revertable !'" (responseSender)="deleteDMP($event)"></confirmation>

View File

@ -1,3 +1,12 @@
<h1>
Works <div class="jumbotron">
</h1> <h1>Hello {{ userInfo?.name!=null ? userInfo?.name : userInfo?.email }}</h1>
<p>Welcome {{ userInfo?.created != userInfo?.lastloggedin ? "back" : "" }} to the <a href="https://en.wikipedia.org/wiki/Data_management_plan">Data Management Plans</a> application. </p>
<!--
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
-->
</div>
<!--
{{userInfo | json}}
-->

View File

@ -1,4 +1,6 @@
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ServerService } from '../../app/services/server.service';
@Component({ @Component({
selector: 'homepage', selector: 'homepage',
@ -6,4 +8,25 @@ import { Component } from '@angular/core';
styleUrls: ['./homepage.component.css'], styleUrls: ['./homepage.component.css'],
providers: [] providers: []
}) })
export class HomepageComponent {} export class HomepageComponent implements OnInit{
private userInfo: any;
constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router){
}
ngOnInit() {
this.serverService.whoami().subscribe(
userInfo => {
this.userInfo = userInfo;
},
error => {
}
);
}
}

View File

@ -53,12 +53,12 @@
<tr *ngFor="let project of mf.data" class="hover"> <tr *ngFor="let project of mf.data" class="hover">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{project?.id}}</td> <td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{project?.id}}</td>
<td>{{project?.label}}</td> <td>{{(project?.label?.length > 40) ? (project?.label | slice:0:40)+'...':(project?.label) }}</td>
<td>{{project?.abbreviation}}</td> <td>{{project?.abbreviation}}</td>
<td>{{project?.startdate | date:'yyyy-MM-dd HH:mm:ss Z' }}</td> <td>{{project?.startdate | date:'yyyy-MM-dd HH:mm:ss Z' }}</td>
<td>{{project?.enddate | date:'yyyy-MM-dd HH:mm:ss Z'}}</td> <td>{{project?.enddate | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{project?.status | statusToString}}</td> <td>{{project?.status | statusToString}}</td>
<td>{{project?.description}}</td> <td>{{(project?.description?.length > 40) ? (project?.description | slice:0:40)+'...':(project?.description) }}</td>
<td> <td>
<a [ngClass]="{'not-active': whoami?.id!=project?.creationUser }" class="editGridColumn" (click)="editRow(project, $event)"> <a [ngClass]="{'not-active': whoami?.id!=project?.creationUser }" class="editGridColumn" (click)="editRow(project, $event)">
<i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP" ></i> <i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP" ></i>

View File

@ -7,7 +7,9 @@ import { Component, OnInit } from '@angular/core';
}) })
export class DmpDetailedComponent implements OnInit { export class DmpDetailedComponent implements OnInit {
constructor() { } constructor() {
}
ngOnInit() { ngOnInit() {