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() {
gapi.load('auth2', () => {debugger;
gapi.load('auth2', () => {
this.auth2 = gapi.auth2.init({
client_id: this.myClientId,
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, {},
(googleUser) => {
this.token = googleUser.getAuthResponse().id_token;

View File

@ -59,30 +59,30 @@
</button>
</div>
<div class="modal-body">
<form>
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewProject()">
<div class="form-group">
<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 class="form-group">
<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 class="form-group">
<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 class="form-group">
<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 class="form-group">
<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 class="form-group">
<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 class="form-group">
<label for="code-name" class="form-control-label">Code:</label>
@ -92,7 +92,7 @@
</div>
<div class="modal-footer">
<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>

View File

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

View File

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

View File

@ -38,7 +38,6 @@ export class ServerService {
}
public listDatasetIDs(){
return this.restBase.get("dataset");
}
@ -85,6 +84,18 @@ export class ServerService {
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() {