create new Project

This commit is contained in:
annampak 2017-10-23 19:16:04 +03:00
parent 51c67ef022
commit 08ebd391d1
5 changed files with 47 additions and 14 deletions

View File

@ -42,7 +42,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
public googleInit() { public googleInit() {
gapi.load('auth2', () => {debugger; gapi.load('auth2', () => {
this.auth2 = gapi.auth2.init({ this.auth2 = gapi.auth2.init({
client_id: this.myClientId, client_id: this.myClientId,
cookie_policy: 'single_host_origin', cookie_policy: 'single_host_origin',
@ -53,7 +53,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
}); });
} }
public attachSignin(element) {debugger; public attachSignin(element) {
this.auth2.attachClickHandler(element, {}, this.auth2.attachClickHandler(element, {},
(googleUser) => { (googleUser) => {
this.token = googleUser.getAuthResponse().id_token; this.token = googleUser.getAuthResponse().id_token;

View File

@ -59,30 +59,30 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form> <form #newProjectForm="ngForm" (ngSubmit)="SaveNewProject()">
<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"> <input type="text" class="form-control" id="label-name" [(ngModel)]= "project.Label" name = "name">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="abbreviation-text" class="form-control-label">Abbreviation:</label> <label for="abbreviation-text" class="form-control-label">Abbreviation:</label>
<input class="form-control" id="abbreviation-text"> <input class="form-control" id="abbreviation-text" [(ngModel)]= "project.Abbreviation" name = "Abbreviation">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="reference-text" class="form-control-label">Reference:</label> <label for="reference-text" class="form-control-label">Reference:</label>
<input class="form-control" id="reference-text"> <input class="form-control" id="reference-text" [(ngModel)]= "project.Reference" name = "Reference">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="uri-text" class="form-control-label">Uri:</label> <label for="uri-text" class="form-control-label">Uri:</label>
<input class="form-control" id="uri-text"> <input class="form-control" id="uri-text" [(ngModel)]= "project.Uri" name = "Uri">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="start-date" class="form-control-label">Start Date:</label> <label for="start-date" class="form-control-label">Start Date:</label>
<input class="form-control" id="startDate-date"> <input class="form-control" id="startDate-date" [(ngModel)]= "project.name" name = "name">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="end-date" class="form-control-label">End Date:</label> <label for="end-date" class="form-control-label">End Date:</label>
<input class="form-control" id="endDate-date"> <input class="form-control" id="endDate-date" [(ngModel)]= "project.name" name = "name">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="code-name" class="form-control-label">Code:</label> <label for="code-name" class="form-control-label">Code:</label>
@ -92,7 +92,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="button" class="btn btn-primary">Save project</button> <button type="submit" class="btn btn-primary" (click)="SaveNewProject();">Save project</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -10,6 +10,8 @@ import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
import { Param } from '../entities/model/param'; import { Param } from '../entities/model/param';
import { ModalComponent } from '../modal/modal.component'; import { ModalComponent } from '../modal/modal.component';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { FormGroup, FormControl } from '@angular/forms'; //na dw an xreiazontai
import { NgForm } from '@angular/forms';
@Component({ @Component({
selector: 'projects', selector: 'projects',
@ -40,6 +42,7 @@ export class ProjectsComponent implements OnInit{
@Input() datasetDropDown:DropdownField; @Input() datasetDropDown:DropdownField;
@Input() dataSetVisibe:boolean; @Input() dataSetVisibe:boolean;
@Input() datasets: Dataset[]; @Input() datasets: Dataset[];
project: any;
@ViewChild(DataTable) projectsTable; @ViewChild(DataTable) projectsTable;
@ViewChild(DataTable) datasetsTable; @ViewChild(DataTable) datasetsTable;
@ -53,12 +56,19 @@ export class ProjectsComponent implements OnInit{
this.datasetDropDown.options = []; this.datasetDropDown.options = [];
this.dataSetVisibe= false; this.dataSetVisibe= false;
this.datasets = []; this.datasets = [];
this.project = {
label: '',
abbreviation:'',
reference:'',
uri:'',
definition:''
}
} }
ngOnInit() { ngOnInit() {
//this.projects = this.serverService.getDummyProjects(); //this.projects = this.serverService.getDummyProjects();
this.projects = []; this.projects = [];
this.serverService.getAllProjects().subscribe( //getProjects() this.serverService.getProjectOfUer().subscribe( //getProjects()
response => { response => {
@ -174,6 +184,18 @@ myFunction() {
} }
} }
SaveNewProject(){debugger;
console.log(this.project);
//this.http.post('http://someurl', JSON.stringify(this.project))
this.serverService.createProject(this.project)
.subscribe(
response =>{
console.log("response");
console.log(response);
}
);
}
// special params: // special params:
translations = <DataTableTranslations>{ translations = <DataTableTranslations>{
indexColumn: 'Index column', indexColumn: 'Index column',

View File

@ -18,7 +18,7 @@ export class RestBase {
protocol: string = "http"; protocol: string = "http";
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";// hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
port: number = 8080;//8080;// port: number = 8080;//8080;//
webappname: string = "dmp-backend-1";//"dmp-backend-new";// webappname: string = "dmp-backend-2";//"dmp-backend-new";//
/*protocol: string = "http"; /*protocol: string = "http";
hostname: string ="dionysus.di.uoa.gr" ; hostname: string ="dionysus.di.uoa.gr" ;

View File

@ -38,7 +38,6 @@ export class ServerService {
} }
public listDatasetIDs(){ public listDatasetIDs(){
return this.restBase.get("dataset"); return this.restBase.get("dataset");
} }
@ -58,7 +57,7 @@ export class ServerService {
public listDmpsLabelID(){ public listDmpsLabelID(){
return this.restBase.get("dmp/listDMPLabelID"); return this.restBase.get("dmp/listDMPLabelID");
} }
public getDmp(dmpid : string){ public getDmp(dmpid : string){
return this.restBase.get("dmps/"+dmpid); return this.restBase.get("dmps/"+dmpid);
@ -85,6 +84,18 @@ export class ServerService {
return this.restBase.get("project/listAllLabelIDs"); return this.restBase.get("project/listAllLabelIDs");
} }
public listDmpsUser(){
return this.restBase.get("dmp/listDMPLabelID");
}
public getProjectOfUer(){
return this.restBase.get("project/getofuser");
}
public createProject(data:any){
return this.restBase.post("project/createofuser", data);
}
signOut2() { signOut2() {