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 DataTableModule
], ],
providers: [{ providers: [
provide: HTTP_INTERCEPTORS, // {
useClass: GlobalInterceptor, // provide: HTTP_INTERCEPTORS,
multi: true, // useClass: GlobalInterceptor,
}, // multi: true,
// },
ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]

View File

@ -119,7 +119,7 @@ export class DatasetsComponent implements OnInit {
} }
reloadDatasets(params) { reloadDatasets(params) {
this.datasetResource = new DataTableResource(this.datasets); // this.datasetResource = new DataTableResource(this.datasets);
this.datasetResource.query(params).then(datasets => this.datasets = datasets); this.datasetResource.query(params).then(datasets => this.datasets = datasets);
} }
@ -128,7 +128,7 @@ export class DatasetsComponent implements OnInit {
this.datasetResource.count().then(count => this.datasetCount = count); 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}])); this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profileId, datasetId:item.id, datasetProperties:item.properties}]));
} }
@ -142,6 +142,30 @@ export class DatasetsComponent implements OnInit {
} }
) )
$("#newDatasetModal").modal("hide"); $("#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( this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
response => { response => {
@ -154,6 +178,9 @@ export class DatasetsComponent implements OnInit {
dt.id = resp.id; dt.id = resp.id;
dt.name = resp.label; dt.name = resp.label;
dt.uriDataset = resp.uri; dt.uriDataset = resp.uri;
dt.dmp = resp.dmp.label;
dt.profile = resp.profile.label;
dt.profileId = resp.profile.id;
this.datasets.push(dt); this.datasets.push(dt);
var params = { limit: 8, offset: 0, sortAsc: false } var params = { limit: 8, offset: 0, sortAsc: false }
this.afterLoad(); this.afterLoad();
@ -194,11 +221,12 @@ export class DatasetsComponent implements OnInit {
); );
} }
editRow(item) { editRow(item) { debugger;
this.dataset.label = item.label; this.dataset.label = item.name;
this.dataset.uri = item.uriDataset; this.dataset.uri = item.uriDataset;
this.dataset.dmp = item.dmp; this.dataset.dmp = item.dmp;
this.dataset.profile = item.profileId; this.dataset.profile = item.profileId;
this.dataset.id = item.id;
$("#newDatasetModal").modal("show"); $("#newDatasetModal").modal("show");
} }

View File

@ -1,6 +1,6 @@
<div style="margin: auto; max-width: 1000px; margin-top:50px"> <div style="margin: auto; max-width: 1000px; margin-top:50px">
<data-table id="films-grid" headerTitle="Datasets" [items]="datasets" [itemCount]="datasetCount" (reload)="reloadDatasets($event)" <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" > [translations]="translations" >
<data-table-column [property]="'name'" [header]="'Label'" [sortable]="true"> <data-table-column [property]="'name'" [header]="'Label'" [sortable]="true">
@ -84,7 +84,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)="SaveNewDataset();">Save Dmp</button> <button type="submit" class="btn btn-primary" (click)="SaveDataset();">Save Dmp</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -81,7 +81,7 @@ console.log(response);
this.dmpResource.query(params).then(dmps => this.dmps = dmps); this.dmpResource.query(params).then(dmps => this.dmps = dmps);
} }
); );
(err: HttpErrorResponse) => { (err: HttpErrorResponse) => {debugger;
if (err.error instanceof Error) { if (err.error instanceof Error) {
// A client-side or network error occurred. Handle it accordingly. // A client-side or network error occurred. Handle it accordingly.
console.log('An error occurred:', err.error.message); console.log('An error occurred:', err.error.message);
@ -113,7 +113,7 @@ console.log(response);
} }
reloadDmps(params) { reloadDmps(params) {
this.dmpResource = new DataTableResource(this.dmps); //this.dmpResource = new DataTableResource(this.dmps);
this.dmpResource.query(params).then(projects => this.dmps = projects); this.dmpResource.query(params).then(projects => this.dmps = projects);
} }
@ -142,7 +142,7 @@ filterGrid() {
SaveNewDmp(){ 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.http.post('http://someurl', JSON.stringify(this.project))
this.dmp.project = {"id":this.dmp.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"> <input type="text" id="myInput" (keyup)="filterGrid()" placeholder="Search for projects.." title="Type in a name">
</div> </div>
<data-table id="dmps-grid" headerTitle="My Dmps" [items]="dmps" [itemCount]="dmpCount" (reload)="reloadDmps($event)" <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)"> [translations]="translations" [indexColumnHeader]="'#'" [selectOnRowClick]="true" (rowClick)="selectDmp($event)">
<data-table-column [property]="'label'" [header]="'Label'" [sortable]="true"> <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 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.id = params.id;
this.datasetId = params.datasetId; this.datasetId = params.datasetId;
this.datasetProperties = params.datasetProperties this.datasetProperties = params.datasetProperties

View File

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

View File

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