From deabfae99b6cbd65447f3364a1882c61781e89cd Mon Sep 17 00:00:00 2001 From: sfeutrie Date: Thu, 29 Nov 2018 19:31:34 +0100 Subject: [PATCH] ajout d'une classe qui contiendra les paramètres d'une mise à jour si l'utilisateur souhaite la stocker --- PFE06/src/main/java/com/PFE/ServerManager/MainController.java | 23 +++++++++++++++++++++++ PFE06/src/main/java/com/PFE/ServerManager/Maj.java | 35 +++++++++++++++++++++++++++++++++++ PFE06/src/main/resources/application.properties | 4 ++-- PFE06/src/main/resources/static/js/home.js | 11 +++++++++++ PFE06/src/main/resources/templates/home.html | 112 ++++------------------------------------------------------------------------------------------------------------ PFE06/src/main/resources/templates/session.html | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ PFE06/src/main/resources/templates/test.html | 12 ++++++++++++ 7 files changed, 267 insertions(+), 110 deletions(-) create mode 100644 PFE06/src/main/java/com/PFE/ServerManager/Maj.java create mode 100644 PFE06/src/main/resources/templates/session.html create mode 100644 PFE06/src/main/resources/templates/test.html diff --git a/PFE06/src/main/java/com/PFE/ServerManager/MainController.java b/PFE06/src/main/java/com/PFE/ServerManager/MainController.java index cb8401b..59981db 100644 --- a/PFE06/src/main/java/com/PFE/ServerManager/MainController.java +++ b/PFE06/src/main/java/com/PFE/ServerManager/MainController.java @@ -46,6 +46,17 @@ public class MainController { return modelAndView; } + @GetMapping(value="/session") + public ModelAndView session() { + ModelAndView modelAndView = new ModelAndView(); + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + Customer customer = customerRepository.findByEmail(auth.getName()); + modelAndView.addObject("customerName", customer.getEmail().split("@")[0]); + modelAndView.addObject("customerRole", customer.getRole()); + modelAndView.setViewName("session"); + return modelAndView; + } + @GetMapping(path="/registration") public ModelAndView registration() { ModelAndView modelAndView = new ModelAndView(); @@ -175,4 +186,16 @@ public class MainController { public String success(){ return "success"; } + + @GetMapping(path="/test") + public String testGet() { + return "test"; + } + + @PostMapping(path="/test") + public String test() { + //ModelAndView modelAndView = new ModelAndView(); + //modelAndView.setViewName("test"); + return "test"; + } } \ No newline at end of file diff --git a/PFE06/src/main/java/com/PFE/ServerManager/Maj.java b/PFE06/src/main/java/com/PFE/ServerManager/Maj.java new file mode 100644 index 0000000..c3b4b51 --- /dev/null +++ b/PFE06/src/main/java/com/PFE/ServerManager/Maj.java @@ -0,0 +1,35 @@ +package com.PFE.ServerManager; + +import javax.persistence.*; + +@Entity +@Table(name = "maj") +public class Maj { + @Id + @Column(name = "maj_id", columnDefinition = "serial") + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer maj_id; + + @Column(name = "maj") + private String maj; + + @Column(name = "date") + private String date; + + @Column(name = "nodes") + private String nodes; + + @Column(name = "file") + private String file; + + public void setMaj_id(Integer maj_id) { this.maj_id = maj_id; } + public Integer getMaj_id() { return maj_id; } + + public void setMaj(String maj) { + this.maj = maj; + } + public String getMaj() { return maj; } + + + +} diff --git a/PFE06/src/main/resources/application.properties b/PFE06/src/main/resources/application.properties index 8940957..08b2821 100644 --- a/PFE06/src/main/resources/application.properties +++ b/PFE06/src/main/resources/application.properties @@ -8,9 +8,9 @@ spring.jpa.hibernate.ddl-auto=create #"update" met à jour la base données #Postgres config : -spring.datasource.url=jdbc:postgresql://localhost:3306/sql_only +spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only spring.datasource.username=postgres -spring.datasource.password=admin +spring.datasource.password=idalurf123 # montre les communications JPA avec la BDD diff --git a/PFE06/src/main/resources/static/js/home.js b/PFE06/src/main/resources/static/js/home.js index 51c5fc2..5bc0200 100644 --- a/PFE06/src/main/resources/static/js/home.js +++ b/PFE06/src/main/resources/static/js/home.js @@ -21,6 +21,17 @@ $(document).ready(function() { nodeSet.delete(rowData[0]); } ); + document.getElementById("save_maj").addEventListener('click', function() { + var req = new XMLHttpRequest(); + req.open('POST','/test',true); + req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + req.onreadystatechange = function() {//Call a function when the state changes. + if(req.readyState == 4 && req.status == 200) { + alert(req.responseText); + } + } + req.send("salut"); + }); /********** Drop Zone **********/ var formData = new FormData(); diff --git a/PFE06/src/main/resources/templates/home.html b/PFE06/src/main/resources/templates/home.html index c52e892..24c607d 100644 --- a/PFE06/src/main/resources/templates/home.html +++ b/PFE06/src/main/resources/templates/home.html @@ -33,8 +33,11 @@
Enregistrer des utilisateurs Listes des utilisateurs + Paramétrer une mise à jour +
+
+ Paramétrer une mise à jour
-
A ajouter... @@ -45,113 +48,6 @@
-

Choix des noeuds

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NomIPArchitecture
NixonSystem ArchitectEdinburgh
WintersAccountantTokyo
CoxJunior Technical AuthorSan Francisco
KellySenior Javascript DeveloperEdinburgh
SatouAccountantTokyo
WilliamsonIntegration SpecialistNew York
ChandlerSales AssistantSan Francisco
DavidsonIntegration SpecialistTokyo
HurstJavascript DeveloperSan Francisco
FrostSoftware EngineerEdinburgh
GainesOffice ManagerLondon
FlynnSupport LeadEdinburgh
MarshallRegional DirectorSan Francisco
KennedySenior Marketing DesignerLondon
FitzpatrickRegional DirectorLondon
SilvaMarketing DesignerLondon
ByrdChief Financial Officer (CFO)New York
LittleSystems AdministratorNew York
GreerSoftware EngineerLondon

Uploader un fichier

Choix du fichier

diff --git a/PFE06/src/main/resources/templates/session.html b/PFE06/src/main/resources/templates/session.html new file mode 100644 index 0000000..612534c --- /dev/null +++ b/PFE06/src/main/resources/templates/session.html @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + Session + + + +
+ + +
+

Choix des noeuds

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NomIPArchitecture
NixonSystem ArchitectEdinburgh
WintersAccountantTokyo
CoxJunior Technical AuthorSan Francisco
KellySenior Javascript DeveloperEdinburgh
SatouAccountantTokyo
WilliamsonIntegration SpecialistNew York
ChandlerSales AssistantSan Francisco
DavidsonIntegration SpecialistTokyo
HurstJavascript DeveloperSan Francisco
FrostSoftware EngineerEdinburgh
GainesOffice ManagerLondon
FlynnSupport LeadEdinburgh
MarshallRegional DirectorSan Francisco
KennedySenior Marketing DesignerLondon
FitzpatrickRegional DirectorLondon
SilvaMarketing DesignerLondon
ByrdChief Financial Officer (CFO)New York
LittleSystems AdministratorNew York
GreerSoftware EngineerLondon
+
+ +
+
+ +
+ + + +
+
+ +
+ + + + + + + + + + diff --git a/PFE06/src/main/resources/templates/test.html b/PFE06/src/main/resources/templates/test.html new file mode 100644 index 0000000..2c839d2 --- /dev/null +++ b/PFE06/src/main/resources/templates/test.html @@ -0,0 +1,12 @@ + + + + + Data from js test + + +
+ +
+ + \ No newline at end of file -- libgit2 0.21.2