Commit f3a26628 authored by Adrien PARROT's avatar Adrien PARROT
Browse files

user ok

parent 1e8f38af
......@@ -17,7 +17,9 @@ sap.ui.controller("conceptmapper.userPage", {
/******* CREATE *******/
openCreateDialog : function (oEvt) {
var URL_user = "http://omop-mapper.fgh.ovh/user/"
// var URL_user = "http://omop-mapper.fgh.ovh/user/";
var URL_user = "http://127.0.0.1:5000/user/";
var oCreateDialog = new sap.m.Dialog({
title : "{i18n>create_user}",
......@@ -83,7 +85,7 @@ sap.ui.controller("conceptmapper.userPage", {
$.ajax({
type:"POST",
url: URL_user + oData.username,
url: URL_user + content[2].getValue(),
dataType:"json",
data: oData,
async: false,
......@@ -132,7 +134,9 @@ sap.ui.controller("conceptmapper.userPage", {
/******* UPDATE *******/
openUpdateDialog : function(oEvt) {
var URL_user = "http://omop-mapper.fgh.ovh/user/"
// var URL_user = "http://omop-mapper.fgh.ovh/user/";
var URL_user = "http://127.0.0.1:5000/user/";
var button_press = oEvt.getParameters().id;
var oTable_ref = sap.ui.getCore().byId(button_press).getParent().getParent();
......@@ -202,10 +206,9 @@ sap.ui.controller("conceptmapper.userPage", {
oData.address = content[10].getValue();
oData.email = content[12].getValue();
$.ajax({
type:"PUT",
url:URL_user + oData.username,
url:URL_user + content[2].getValue(),
dataType:"json",
data: oData,
async: false,
......@@ -255,7 +258,9 @@ sap.ui.controller("conceptmapper.userPage", {
/******* DELETE *******/
openDeleteDialog : function (oEvt) {
var URL_user = "http://omop-mapper.fgh.ovh/user/"
// var URL_user = "http://omop-mapper.fgh.ovh/user/";
var URL_user = "http://127.0.0.1:5000/user/";
var button_press = oEvt.getParameters().id;
var oTable_ref = sap.ui.getCore().byId(button_press).getParent().getParent();
......@@ -282,13 +287,18 @@ sap.ui.controller("conceptmapper.userPage", {
icon: "sap-icon://accept",
press: function () {
var oData = {};
oData.username = oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text');
debugger;
var URL = URL_user;
URL = URL + oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text');
//var URL = URL_user;
//URL = URL + oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text');
$.ajax({
type:"DELETE",
url:URL,
method:'DELETE',
url:URL_user + oTable_ref.getRows()[idx[0]].getCells()[0].getProperty('text'),
dataType:"json",
data: oData,
async: false,
header: {
"Content-Type": "application/json",
......@@ -302,7 +312,7 @@ sap.ui.controller("conceptmapper.userPage", {
oDeleteDialog.close();
// backend creation
sap.m.MessageToast.show("New user : '" + oData.username + " 'updated");
sap.m.MessageToast.show("New user : '" + oData.username + " 'deleted");
console.log("connection");
},
error : function(error) {
......@@ -342,7 +352,9 @@ sap.ui.controller("conceptmapper.userPage", {
* @memberOf conceptmapper.userPage
*/
onBeforeRendering: function() {
var URL_users = "http://omop-mapper.fgh.ovh/users"
//var URL_users = "http://omop-mapper.fgh.ovh/users"
var URL_users = "http://127.0.0.1:5000/users";
$.ajax({
type:"GET",
url: URL_users,
......@@ -352,7 +364,6 @@ sap.ui.controller("conceptmapper.userPage", {
"Content-Type": "application/json",
},
success: function(oData, response, xhr) {
//debugger;
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "user");
console.log("connection");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment