bug fixes

This commit is contained in:
annampak 2017-10-30 18:37:17 +02:00
parent 873b204b3f
commit 407c520fe9
8 changed files with 55 additions and 23 deletions

View File

@ -56,11 +56,12 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http';
DataTableModule
],
providers: [{
provide: HTTP_INTERCEPTORS,
useClass: GlobalInterceptor,
multi: true,
},
providers: [
// {
// provide: HTTP_INTERCEPTORS,
// useClass: GlobalInterceptor,
// multi: true,
// },
ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService
],
bootstrap: [AppComponent]

View File

@ -119,7 +119,7 @@ export class DatasetsComponent implements OnInit {
}
reloadDatasets(params) {
this.datasetResource = new DataTableResource(this.datasets);
// this.datasetResource = new DataTableResource(this.datasets);
this.datasetResource.query(params).then(datasets => this.datasets = datasets);
}
@ -128,11 +128,11 @@ export class DatasetsComponent implements OnInit {
this.datasetResource.count().then(count => this.datasetCount = count);
}
selectDataset(item) {debugger;
selectDataset(item) {
this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profileId, datasetId:item.id, datasetProperties:item.properties}]));
}
SaveNewDataset() {
SaveNewDataset() {
this.dataset.dmp = { "id": this.dmpIdforDatasets }
this.dataset.profile = { "id": this.dataset.profile }
this.serverService.createDatasetForDmp(this.dataset).subscribe(
@ -142,18 +142,45 @@ export class DatasetsComponent implements OnInit {
}
)
$("#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 => {
console.log("response");
console.log(response);
this.datasets = [];
response.forEach(resp => {
let dt = new Dataset();
dt.id = resp.id;
dt.name = resp.label;
dt.uriDataset = resp.uri;
dt.dmp = resp.dmp.label;
dt.profile = resp.profile.label;
dt.profileId = resp.profile.id;
this.datasets.push(dt);
var params = { limit: 8, offset: 0, sortAsc: false }
this.afterLoad();
@ -162,7 +189,7 @@ export class DatasetsComponent implements OnInit {
}
);
}
// special params:
translations = <DataTableTranslations>{
indexColumn: 'Index column',
@ -194,11 +221,12 @@ export class DatasetsComponent implements OnInit {
);
}
editRow(item) {
this.dataset.label = item.label;
editRow(item) { debugger;
this.dataset.label = item.name;
this.dataset.uri = item.uriDataset;
this.dataset.dmp = item.dmp;
this.dataset.profile = item.profileId;
this.dataset.id = item.id;
$("#newDatasetModal").modal("show");
}

View File

@ -1,6 +1,6 @@
<div style="margin: auto; max-width: 1000px; margin-top:50px">
<data-table id="films-grid" headerTitle="Datasets" [items]="datasets" [itemCount]="datasetCount" (reload)="reloadDatasets($event)"
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [substituteRows]="false"
[limit]="8" [sortBy]="'name'" [sortAsc]="false" [substituteRows]="false"
[translations]="translations" >
<data-table-column [property]="'name'" [header]="'Label'" [sortable]="true">
@ -84,7 +84,7 @@
</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 Dmp</button>
</div>
</div>
</div>

View File

@ -81,7 +81,7 @@ console.log(response);
this.dmpResource.query(params).then(dmps => this.dmps = dmps);
}
);
(err: HttpErrorResponse) => {
(err: HttpErrorResponse) => {debugger;
if (err.error instanceof Error) {
// A client-side or network error occurred. Handle it accordingly.
console.log('An error occurred:', err.error.message);
@ -113,7 +113,7 @@ console.log(response);
}
reloadDmps(params) {
this.dmpResource = new DataTableResource(this.dmps);
//this.dmpResource = new DataTableResource(this.dmps);
this.dmpResource.query(params).then(projects => this.dmps = projects);
}
@ -142,7 +142,7 @@ filterGrid() {
SaveNewDmp(){
console.log(this.dmp, this.dmp.projectsDropDownKey); debugger;
console.log(this.dmp, this.dmp.projectsDropDownKey);
//this.http.post('http://someurl', JSON.stringify(this.project))
this.dmp.project = {"id":this.dmp.project};

View File

@ -6,7 +6,7 @@
<input type="text" id="myInput" (keyup)="filterGrid()" placeholder="Search for projects.." title="Type in a name">
</div>
<data-table id="dmps-grid" headerTitle="My Dmps" [items]="dmps" [itemCount]="dmpCount" (reload)="reloadDmps($event)"
[limit]="8" [sortBy]="'rating'" [sortAsc]="false" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
[limit]="8" [sortBy]="'label'" [sortAsc]="true" [selectColumn]="true" [multiSelect]="false" [substituteRows]="false"
[translations]="translations" [indexColumnHeader]="'#'" [selectOnRowClick]="true" (rowClick)="selectDmp($event)">
<data-table-column [property]="'label'" [header]="'Label'" [sortable]="true">

View File

@ -54,7 +54,7 @@ export class DynamicFormComponent implements OnInit {
//let id = this.route.snapshot.paramMap.get('id'); //get the project id
let sub = this.route.params.subscribe(params => {debugger;
let sub = this.route.params.subscribe(params => {
this.id = params.id;
this.datasetId = params.datasetId;
this.datasetProperties = params.datasetProperties

View File

@ -97,8 +97,7 @@ export class ModalComponent implements OnInit {
this.show = false;
}
showDatasets(dmpId, event) {
debugger;
showDatasets(dmpId, event) {
this.dataSetVisibe = true;
$("#exampleModalDmps").modal("hide");
this.show = false;

View File

@ -121,9 +121,13 @@ public getAllDatsetsProfile(){
return this.restBase.get("datasetprofile/getAll");
}
public getDatsetsProfile(id){debugger;
public getDatsetsProfile(id){
return this.restBase.get("datasetprofiles/"+id);
}
public updateDatsetsProfile(data:any){
return this.restBase.post("dataset/update", data);
}
logOut() {