Commit 16e10b3c authored by Adrien PARROT's avatar Adrien PARROT
Browse files

searchPage in progress (get request)

parent ab61fe41
......@@ -477,9 +477,75 @@ sap.ui.controller("conceptmapper.searchPage", {
oDeleteDialog.open();
},
searcher : function (oEvt) {
var URL_concepts = "http://127.0.0.1:5000/concepts/";
var oDomainMCB_ref = sap.ui.getCore().byId('oDomainMCB').getSelectedItems();
var oDomainMCB_list = [];
for (var i in oDomainMCB_ref) {
oDomainMCB_list.push(oDomainMCB_ref[i].getProperty('text'));
}
var oVocMCB_ref = sap.ui.getCore().byId('oVocMCB').getSelectedItems();
var oVocMCB_list = [];
for (var i in oVocMCB_ref) {
oVocMCB_list.push(oVocMCB_ref[i].getProperty('text'));
}
var oLangMCB_ref = sap.ui.getCore().byId('oLangMCB').getSelectedItems();
var oLangMCB_list = [];
for (var i in oLangMCB_ref) {
oLangMCB_list.push(oLangMCB_ref[i].getProperty('text'));
}
var oData = {};
oData.search_string = sap.ui.getCore().byId('searchField').getProperty('value');
// standard => 'S' , classification concept => 'C', Null
oData.standard_concepts = sap.ui.getCore().byId('oStandardConcepts').getProperty('selected');
// valid => null, supprimer => 'D', updated => 'U'
var valid_concepts;
if (sap.ui.getCore().byId('oValidConcepts').getProperty('selected')) {
invalid_concepts = 'V';
} else {
invalid_concepts = 'U';
}
oData.invalid_reason = invalid_concepts;
oData.mini = sap.ui.getCore().byId('oMiniIB').getProperty('value');
oData.maxi = sap.ui.getCore().byId('oMaxiIB').getProperty('value');
oData.domain_id = oDomainMCB_list;
oData.vocabulary_id = oVocMCB_list;
oData.language_id = oLangMCB_list;
oData.user_id = [];
oData.frequency_id = [];
oData.limit = -1;
$.ajax({
type:"GET",
url:URL_concepts,
dataType:"json",
data: oData,
async: false,
header: {
"Content-Type": "application/json",
},
success: function(oData, response, xhr) {
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "concept");
console.log("connection");
},
error : function(error) {
sap.m.MessageToast.show("Connexion error");
console.log(error);
}
});
},
/**
......
......@@ -45,7 +45,9 @@ sap.ui.jsview("conceptmapper.searchPage", {
type : "Reject",
press : [ oController.openDeleteDialog, oController ],
}), new sap.m.SearchField({
placeholder : "{i18n>research}"
id: 'searchField',
placeholder : "{i18n>research}",
search : [ oController.searcher, oController ],
}) ]
}),
cellClick : [ oController.goToConceptDetail, oController ]
......@@ -175,14 +177,14 @@ sap.ui.jsview("conceptmapper.searchPage", {
// Master Page
var oStandardCB = new sap.m.CheckBox({
id : "standard_concepts",
id : "oStandardConcepts",
visible : true,
selected : true,
enabled : true,
text : "Standard concepts"
});
var oValidCB = new sap.m.CheckBox({
id : "valid_concepts",
id : "oValidConcepts",
visible : true,
selected : true,
enabled : true,
......
......@@ -288,7 +288,6 @@ sap.ui.controller("conceptmapper.userPage", {
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');
......
......@@ -17,7 +17,7 @@
// create an app
var app = new sap.m.App({
initialPage : "idHomePage"
initialPage : "idSearchPage"
});
// Adding all the pages to the app
......
Supports Markdown
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