This commit is contained in:
Nikolaos Laskaris 2017-11-01 11:41:22 +02:00
commit 9652d049c8
4 changed files with 81 additions and 35 deletions

View File

@ -50,6 +50,7 @@ export class DatasetsComponent implements OnInit {
@Input() datasetCount = 0;
@Input() dmpIdforDatasets: string;
dataset: any;
saveAndDescribe:boolean;
//@ViewChild(DataTable) projectsTable;
@ -83,10 +84,11 @@ export class DatasetsComponent implements OnInit {
this.datasetProfileDropDown = new DropdownField();
this.datasetProfileDropDown.options = [];
this.saveAndDescribe = false;
}
ngOnInit() {
ngOnInit() { debugger;
//this.projects = this.serverService.getDummyProjects();
this.datasets = [];
console.log(this.dmpIdforDatasets);debugger;
@ -124,12 +126,37 @@ export class DatasetsComponent implements OnInit {
this.dataset.dmp = { "id": this.dmpIdforDatasets }
this.dataset.profile = { "id": this.dataset.profile }
this.serverService.createDatasetForDmp(this.dataset).subscribe(
response => {
console.log(response);
//if (this.saveAndDescribe == true)
//this.describeDataset(); PWS THA VRISKOUME TO ITEM GIA NA ANOIGEI TO SWSTO DATASET???
}
)
$("#newDatasetModal").modal("hide");
this.CallDatasets();
}
SaveEditedDataset(){
this.dataset.dmp = { "id": this.dmpIdforDatasets }
this.dataset.profile = { "id": this.dataset.profile }
this.serverService.updateDatsetsProfile(this.dataset).subscribe(
response => {
console.log(response);
}
)
$("#newDatasetModal").modal("hide");
this.CallDatasets();
}
SaveDataset(){
if(this.dataset.id ==null)
this.SaveNewDataset();
else
this.SaveEditedDataset();
}
CallDatasets(){
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
response => {
@ -170,20 +197,30 @@ export class DatasetsComponent implements OnInit {
);
}
editRow(item) {
editRow(item) { debugger;
this.dataset.label = item.label;
this.dataset.uri = item.uriDataset;
this.dataset.dmp = item.dmp;
this.dataset.profile = item.profileId;
this.dataset.uri = item.uri;
//this.dataset.dmp = item.dmp;
this.dataset.profile = item.profile.id;
this.dataset.id = item.id;
$("#newDatasetModal").modal("show");
}
newDataset() {
this.dataset.label = "";
this.dataset.uri = "";
this.dataset.dmp =this.dmpIdforDatasets;
this.dataset.dmp =this.dmpLabelforDatasets;
this.dataset.profile = "";
$("#newDatasetModal").modal("show");
}
SaveDescribeDataset(){
this.saveAndDescribe = true;
this.SaveDataset();
}
describeDataset(item) {
this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profileId, datasetId:item.id, datasetProperties:item.properties}]));
}
}

View File

@ -23,9 +23,9 @@
<th>
<mfDefaultSorter by="label">Label</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="dmp">DMP</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="uri">Uri</mfDefaultSorter>
</th>
@ -46,16 +46,16 @@
<td colspan="5">No elements</td>
</tr>
<tr *ngFor="let dmp of mf.data" class="hover">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp.id}}</td>
<td>{{dmp?.label}}</td>
<td>{{dmp?.version}}</td>
<td>{{dmp?.previous}}</td>
<td>{{dmp?.project?.label}}</td>
<td>{{dmp?.description}}</td>
<td><a class="editGridColumn" (click)="editRow(dmp, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit Dataset" id="editDataset"></i>
<tr *ngFor="let dataset of mf.data" class="hover">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dataset.id}}</td>
<td>{{dataset?.label}}</td>
<td>{{dataset?.status}}</td>
<td>{{dataset?.uri}}</td>
<td>{{dataset?.profile?.label}}</td>
<td>{{dataset?.description}}</td>
<td><a class="editGridColumn" (click)="editRow(dataset, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit Properties" id="editDataset"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete Dataset"></i>
<i class="fa fa-table fa-fw" data-toggle="tooltip" title="describe dataset" id="describeDataset"></i></a></td>
<i class="fa fa-list-alt fa-fw" data-toggle="tooltip" title="describe dataset" id="describeDataset"></i></a></td>
</tr>
</tbody>
@ -70,10 +70,6 @@
</table>
<<<<<<< HEAD
>>>>>>> 573e1fd92cc726405b415b5214ed96fa1a0ce420
=======
>>>>>>> 573e1fd92cc726405b415b5214ed96fa1a0ce420
<div class="modal fade" id="newDatasetModal" tabindex="-1" role="dialog" aria-labelledby="newDatasetModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
@ -98,29 +94,26 @@
</div>
<div class="form-group">
<label for="abbreviation-text" class="form-control-label">DMP:</label>
<input class="form-control" id="abbreviation-text" [(ngModel)]= "dataset.dmp" name = "dmp">
<input class="form-control" id="abbreviation-text" [(ngModel)]= "dataset.dmp" name = "dmp" disabled>
</div>
<div class="form-group">
<label for="uri-text" class="form-control-label">Uri:</label>
<input class="form-control" id="uri-text" [(ngModel)]= "dataset.uri" name = "uri">
</div>
<div class="form-group">
<!-- <div class="form-group">
<label for="start-date" class="form-control-label">Properties:</label>
<input class="form-control" id="startDate-date" [(ngModel)]= "dataset.properties" name = "properties">
</div>
</div> -->
<!-- <div class="form-group">
<label for="end-date" class="form-control-label">End Date:</label>
<input class="form-control" id="endDate-date" [(ngModel)]= "dataset.endDate" name = "endDate">
</div> -->
<div class="form-group">
<label for="code-name" class="form-control-label">Code:</label>
<input type="text" class="form-control" id="code-name" disabled>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" (click)="SaveNewDataset();">Save Dmp</button>
<button type="submit" class="btn btn-primary" (click)="SaveDataset();">Save</button>
<button type="submit" class="btn btn-primary" (click)="SaveDescribeDataset();">Save and describe</button>
</div>
</div>
</div>

View File

@ -201,6 +201,8 @@ SaveUpdatesDmp(){
}
);
$("#newDmpModal").modal("hide");
$("#newVersionDmpModal").modal("hide");
}
SaveDmp(){ debugger;
@ -254,7 +256,7 @@ editRow(item, event){
newDmp(item){
this.dmp.label = "";
this.dmp.previous = "";
this.dmp.id = null;
this.dmp.version = "";
this.dmp.profile = "";
this.dmp.profileData = "";

View File

@ -34,6 +34,9 @@
<th>
<mfDefaultSorter by="description">Description</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter>Actions </mfDefaultSorter>
</th>
@ -52,7 +55,8 @@
<td>{{dmp?.previous}}</td>
<td>{{dmp?.project?.label}}</td>
<td>{{dmp?.description}}</td>
<td><a class="editGridColumn" (click)="editRow(dmp, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit DMP" id="editDMP"></i>
<td>{{dmp?.status}}</td>
<td><a class="editGridColumn" (click)="editRow(dmp, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i>
<i class="fa fa-clone fa-fw" data-toggle="tooltip" title="create new version" id="changeVersionDMP"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete DMP"></i>
<i class="fa fa-table fa-fw" data-toggle="tooltip" title="show dataset for this DMP" id="showDatasets"></i></a></td>
@ -91,14 +95,24 @@
<select class="form-control" [id]="projectsDropDownKey" [(ngModel)]="dmp.project" [name]="projectsDropDown" #datasetfield>
<option *ngFor="let opt of projectsDropDown.options" [value]="opt.key">{{opt.value}}</option>
</select>
</div>
</div>
<!-- <div class="form-group">
<label for="recipient-name" class="col-form-label">Status:</label>
<select class="form-control" [id]="statusDropDownKey" [(ngModel)]="dmp.status" [name]="statusDropDown" #datasetfield>
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
</select>
</div> -->
<div class="form-group">
<label for="label-name" class="form-control-label">Previous:</label>
<input type="text" class="form-control" id="label-previous" [(ngModel)]="dmp.previous" name="previous">
<input type="text" class="form-control" id="label-previous" [(ngModel)]="dmp.previous" name="previous" disabled>
</div>
<div class="form-group">
<label for="abbreviation-text" class="form-control-label">Version:</label>
<input class="form-control" id="abbreviation-text" [(ngModel)]= "dmp.version" name = "version">
<input class="form-control" id="abbreviation-text" [(ngModel)]="dmp.version" name="version" >
</div>
<div class="form-group">
<label for="abbreviation-text" class="form-control-label">Description:</label>
<textarea class="form-control" id="abbreviation-text" [(ngModel)]="dmp.description" name="version" ></textarea>
</div>
<!-- <div class="form-group">
<label for="reference-text" class="form-control-label">Profile Data:</label>