Commit 7bbee980 authored by Adrien PARROT's avatar Adrien PARROT
Browse files

Add registrationPage, add login dialog, add token on get concept

parent f805eeff
function getConceptAjax(sVal) {
// var URL_concept = "http://127.0.0.1:5000/api/concept/";
var URL_concept = "http://omop-mapper.fgh.ovh/api/concept/";
var URL_concept = "http://127.0.0.1:5000/concept/";
// var URL_concept = "http://omop-mapper.fgh.ovh/api/concept/";
if (sVal !== undefined) {
$.ajax({
......@@ -30,13 +30,113 @@ sap.ui.controller("conceptmapper.conceptDetailPage", {
goToConceptDetailol : function(oEvt) {
var sVal = oEvt.getSource().getAttributes()[0].getProperty('text');
debugger;
var sVal = oEvt.getSource().getAggregation('cells')[3].getProperty('text');
getConceptAjax(sVal);
// app.to('idConceptDetailPage', 'flip');
// sap.ui.getCore().byId("idSearchPage").getController().getConceptAjax(sVal);
},
deleteRelation: function(oEvt) {
var URL_concept_relationship = "http://127.0.0.1:5000/concept_relationship/";
// var URL_concept_relationship = "http://omop-mapper.fgh.ovh/api/concept_relationship/";
// conceptsDetailModel
var concepts = sap.ui.getCore().getModel('conceptDetailModel').oData;
var oData = {};
debugger;
// oData.concept_id_2 = oEvt.getParameters().srcControl.getAggregation('cells')[0].getProperty('text');
oData.concept_id_2 = oEvt.getSource().getAggregation('cells')[0].getProperty('text');
oData.relationship_id = 'Maps to';
debugger;
var odeleteRelationDialog = new sap.m.Dialog({
title : "Mapper",
icon : "sap-icon://doc-attachment"
});
odeleteRelationDialog.addContent(new sap.m.Text({text: "You will map concepts. Are you sure?"}));
odeleteRelationDialog.addButton(
new sap.m.Button({
text: "Yes",
type: "Accept",
icon: "sap-icon://accept",
press: function () {
$.ajax({
type:"POST",
url: URL_concept_relationship + concepts[id].concept_id,
dataType:"json",
async: false,
data: oData,
header: {
"Content-Type": "application/json",
},
success: function(data, response, xhr) {
debugger;
var ret = "Item(s) mapped to " + oData.concept_id_2;
sap.m.MessageToast.show(ret);
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
return;
}
});
odeleteRelationDialog.close();
sap.ui.controller("conceptmapper.searchPage").searcher();
}
})
);
odeleteRelationDialog.addButton(
new sap.m.Button({
text: "Reject",
icon: "sap-icon://decline",
press: function () {
odeleteRelationDialog.close();
}
})
);
odeleteRelationDialog.open();
},
......
......@@ -155,7 +155,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
header : new sap.m.Label({
text : "Relationship_id"
}),
mergeDuplicates: true
mergeDuplicates: true
}),
new sap.m.Column({
header : new sap.m.Label({
......@@ -175,7 +175,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
})
}),
new sap.m.Column({
header : new sap.m.Link({
header : new sap.m.Label({
text : "Concept_name"
}),
}),
......@@ -189,16 +189,21 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
text : "Valid"
}),
}),
new sap.m.Column({
header : new sap.m.Label({
text : "Delete"
}),
}),
];
var oTemplate = new sap.m.ColumnListItem({
//vAlign: "Middle",
//type : sap.m.ListType.Active,
type: "Active",
// detailPress: function() {
// sap.m.MessageToast.show("detail is predsdsssed");
// },
press: [oController.goToConceptDetailol, oController ],
cells : [
new sap.m.Text({
text : "{conceptDetailModel>relationship_id}",
......@@ -218,7 +223,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
}),
new sap.m.Text({
text : "{conceptDetailModel>concept_name}",
wrapping : false
wrapping : true
}),
new sap.m.Text({
text : "{conceptDetailModel>standard_concept}",
......@@ -228,6 +233,12 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
text : "{conceptDetailModel>invalid_reason}",
wrapping : false
}),
new sap.ui.core.Icon({
src: "sap-icon://delete",
hoverColor: "red",
activeColor: "red",
press: [oController.deleteRelation, oController]
}),
]
......@@ -300,26 +311,60 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
var oItemTemplateStandard = new sap.ui.core.Item({
key : "{isStandardModel>key}",
text : "{isStandardModel>text}",
enabled : "{isStandardModel>enabled}"
});
var oStandardMCB = new sap.m.MultiComboBox({
id : "oStandardDetailMCB",
// width : "400px",
placeholder : "{i18n>standard_label}",
items : {
path : "isStandardModel>/items",
template : oItemTemplateStandard
},
selectedKeys : {
path : "isStandardModel>/selected",
template : "{isStandardModel>selected}"
},
});
var oItemTemplateValid = new sap.ui.core.Item({
key : "{isValidModel>key}",
text : "{isValidModel>text}",
enabled : "{isValidModel>enabled}"
});
var oValidMCB = new sap.m.MultiComboBox({
id : "oValidDetailMCB",
placeholder : "{i18n>valid_label}",
items : {
path : "isValidModel>/items",
template : oItemTemplateValid
},
selectedKeys : {
path : "isValidModel>/selected",
template : "{isValidModel>selected}"
},
});
//
//
//
//
//
//
//
//
//
//
var oRelationToolBar = new sap.m.Toolbar({
content : [
new sap.m.Title({
text : "Relationships table"
}),
// new sap.m.ToolbarSpacer(),
// oValidMCB.addStyleClass(''), oStandardMCB,
]
});
var oHeaderPanel = new sap.m.Panel("oHeaderPanel", {
expandable : true,
expanded : false,
headerText : "Concept details",
//headerText : "Concept details",
content : [ oConceptPanelHeader
]
......@@ -336,7 +381,9 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
expandable : false,
expanded : true,
headerText : "Relationships table",
content : [ oTable ]
headerToolbar: oRelationToolBar,
content : [ oTable, ]
});
var oPage = new sap.m.Page({
......@@ -345,10 +392,10 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
subHeader : oSubHeader,
headerContent : [ new sap.m.Button({
// text:"lol",
icon : "sap-icon://home"
icon : "sap-icon://sys-help"
}), new sap.m.Button({
// text:"lol",
icon : "sap-icon://account"
icon : "sap-icon://employee"
}) ],
content : [ oHeaderPanel,
......
......@@ -89,16 +89,15 @@ sap.ui.controller("conceptmapper.mapperPage", {
goToConceptDetail : function (oEvt) {
// GET AJAX call on concept
getConceptAjax(oEvt.getSource().getProperty('text'));
debugger;
app.to('idConceptDetailPage', 'slide'); //('fade', 'flip', 'show', 'slide =default')
},
algo_one : function (oEvt) {
sap.ui.getCore().byId("algo1Toggle").setPressed(true);
......@@ -129,8 +128,10 @@ sap.ui.controller("conceptmapper.mapperPage", {
searcher : function() {
// mapperModel to construct
oData.select = ["concept_id", "concept_name", "domain_id", "vocabulary_id", "standard_concept", "concept_code", "is_mapped", "score"];
var oStandardMCB_ref = sap.ui.getCore().byId('oStandardMapperMCB').getSelectedItems();
var oStandardMCB_list = [];
for (var i in oStandardMCB_ref) {
......@@ -148,36 +149,16 @@ sap.ui.controller("conceptmapper.mapperPage", {
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'));
// }
//
// if (first !== 'undefined' && first === 1) {
// oLangMCB_list = ['FR'];
// }
// var oRowsNumber = parseInt(sap.ui.getCore().byId('oRowInPageInput').getProperty('value'));
var oData = {};
//
// if (!isNaN(oRowsNumber) && Number.isInteger(oRowsNumber)) {
// var oTable_ref = sap.ui.getCore().byId('oTable');
// oData.limit = oRowsNumber;
// }
// oData.mini = parseInt(sap.ui.getCore().byId('oMiniIB').getProperty('value'));
// oData.maxi = parseInt(sap.ui.getCore().byId('oMaxiIB').getProperty('value'));
oData.limit = 50;
oData.search_string = sap.ui.getCore().byId('searchFieldMapper').getProperty('value');
// Standard => 'S' , Classification => 'C', Non-Standard => Null
oData.standard_concept = oStandardMCB_list;
// Valid => null, Deleted => 'D', Updated => 'U'
// oData.invalid_reason = oValidMCB_list;
oData.invalid_reason = ['Valid'];
oData.domain_id = oDomainMCB_list;
oData.vocabulary_id = oVocMCB_list;
// oData.m_language_id = oLangMCB_list;
......@@ -186,7 +167,6 @@ sap.ui.controller("conceptmapper.mapperPage", {
//debugger;
//parseInt(sap.ui.getCore().byId('oSearchFielGoToPage').resetProperty('value'));
getConceptsMapperAjax(oData);
......@@ -196,52 +176,96 @@ sap.ui.controller("conceptmapper.mapperPage", {
},
mapper : function(oEvt) {
addRelation : function(oEvt) {
// var URL_concept_relationship = "http://omop-mapper.fgh.ovh/api/concept_relationship/";
var URL_concept_relationship = "http://127.0.0.1:5000/concept_relationship/";
// conceptsDetailModel
var concepts = sap.ui.getCore().getModel('conceptsDetailModel').oData.to_map;
var oData = {};
oData.concept_id_2 = oEvt.getParameters().srcControl.getAggregation('cells')[0].getProperty('text');
debugger;
// oData.concept_id_2 = oEvt.getParameters().srcControl.getAggregation('cells')[0].getProperty('text');
oData.concept_id_2 = oEvt.getSource().getAggregation('cells')[0].getProperty('text');
oData.relationship_id = 'Maps to';
debugger;
for (var id in concepts) {
debugger;
$.ajax({
type:"POST",
url: URL_concept_relationship + concepts[id].concept_id,
dataType:"json",
async: false,
data: oData,
header: {
"Content-Type": "application/json",
},
success: function(oData, response, xhr) {
debugger;
var ret = "Item(s) mapped to " + concepts[id].concept_id
sap.m.MessageToast.show(ret);
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
}
});
}
var oMapperDialog = new sap.m.Dialog({
title : "Mapper",
icon : "sap-icon://doc-attachment"
});
oMapperDialog.addContent(new sap.m.Text({text: "You will map concepts. Are you sure?"}));
oMapperDialog.addButton(
new sap.m.Button({
text: "Yes",
type: "Accept",
icon: "sap-icon://accept",
press: function () {
for (var id in concepts) {
debugger;
$.ajax({
type:"POST",
url: URL_concept_relationship + concepts[id].concept_id,
dataType:"json",
async: false,
data: oData,
header: {
"Content-Type": "application/json",
},
success: function(data, response, xhr) {
debugger;
var ret = "Item(s) mapped to " + oData.concept_id_2;
sap.m.MessageToast.show(ret);
console.log("connection");
},
error : function(error) {
alert("pb in the connection");
console.log(error);
return;
}
});
}
oMapperDialog.close();
sap.ui.controller("conceptmapper.searchPage").searcher();
app.to('idSearchPage');
}
})
);
oMapperDialog.addButton(
new sap.m.Button({
text: "Reject",
icon: "sap-icon://decline",
press: function () {
oMapperDialog.close();
}
})
);
oMapperDialog.open();
},
/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
......
......@@ -16,56 +16,6 @@ sap.ui.jsview("conceptmapper.mapperPage", {
/////////// FILTER TABS
var oConceptsdetailList = new sap.m.List("oConceptsDetailPanel", {
// headerText : "relations list",
});
oConceptsdetailList.bindItems({
path : "conceptsDetailModel>/to_map",
template : new sap.m.ObjectListItem({
title : "{conceptsDetailModel>concept_name}",
// number : "{conceptDetailModel>standard_concept}",
// numberUnit : "{conceptDetailModel>invalid_reason}",
// type:"Active",
// press: [oController.goToConceptDetailol, oController ],
attributes : [
new sap.m.ObjectAttribute({
title : "concept_id",
text : "{conceptsDetailModel>concept_id}",
active : true,
press: [ oController.goToConceptDetail, oController ],
// }), new sap.m.ObjectAttribute({
// title : "concept_code",
// text : "{conceptsDetailModel>concept_code}",
//
// }), new sap.m.ObjectAttribute({
// title : "concept_class_id",
// text : "{conceptDetailModel>concept_class_id}",
//// active : true,
}), new sap.m.ObjectAttribute({
title : "vocabulary_id",
text : "{conceptsDetailModel>vocabulary_id}",
}), new sap.m.ObjectAttribute({
title : "domain_id",
text : "{conceptsDetailModel>domain_id}",
}),
// new sap.m.ObjectAttribute({
// title : "relationship_id",
// text : "{conceptDetailModel>relationship_id}",
// }),
]
})
});
var oItemTemplateStandard = new sap.ui.core.Item({
key : "{isStandardModel>key}",
text : "{isStandardModel>text}",
......@@ -253,9 +203,60 @@ sap.ui.jsview("conceptmapper.mapperPage", {
});
// CONCEPTS DETAILS
// var oConceptsdetailList = new sap.m.List("oConceptsDetailPanel", {
//// headerText : "relations list",
// });
// oConceptsdetailList.bindItems({
// path : "conceptsDetailModel>/to_map",
// template : new sap.m.ObjectListItem({
// title : "{conceptsDetailModel>concept_name}",
//// number : "{conceptDetailModel>standard_concept}",
//// numberUnit : "{conceptDetailModel>invalid_reason}",
//
//// type:"Active",
//
//// press: [oController.goToConceptDetailol, oController ],
//
// attributes : [
// new sap.m.ObjectAttribute({
// title : "concept_id",
// text : "{conceptsDetailModel>concept_id}",
// active : true,
// press: [ oController.goToConceptDetail, oController ],
//
//// }), new sap.m.ObjectAttribute({
//// title : "concept_code",
//// text : "{conceptsDetailModel>concept_code}",
////
//// }), new sap.m.ObjectAttribute({
//// title : "concept_class_id",
//// text : "{conceptDetailModel>concept_class_id}",
////// active : true,
// }), new sap.m.ObjectAttribute({
// title : "vocabulary_id",
// text : "{conceptsDetailModel>vocabulary_id}",
// }), new sap.m.ObjectAttribute({
// title : "domain_id",
// text : "{conceptsDetailModel>domain_id}",
// }),
//// new sap.m.ObjectAttribute({
//// title : "relationship_id",
//// text : "{conceptDetailModel>relationship_id}",
//// }),
//
//
//
// ]
// })
// });
////////////// TABLEAU