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

Add mapping_comment and mapping_rate

parent fb617ce6
......@@ -20,7 +20,7 @@ function deleteConceptRelationshipAjax(concept_id_1, oData) {
},
success: function(data, response, xhr) {
debugger;
var ret = "Item(s) mapped to " + oData.concept_id_2;
var ret = "Delete relation beetween concept_id = " + concept_id_1 + " and concept_id = " + oData.concept_id_2;
sap.m.MessageToast.show(ret);
console.log("Delete relation : success");
},
......@@ -53,7 +53,7 @@ function putConceptRelationshipAjax(concept_id_1, oData) {
},
success: function(data, response, xhr) {
debugger;
var ret = "Item(s) mapped to " + oData.concept_id_2;
var ret = "Item concept_id = " + concept_id_1 + " mapped to concept_id = " + oData.concept_id_2;
sap.m.MessageToast.show(ret);
console.log("addRelationAjax success");
},
......@@ -92,9 +92,64 @@ sap.ui.controller("conceptmapper.conceptDetailPage", {
},
moreInfos : function(oEvt) {
debugger;
concept_id_2 = sap.ui.getCore().byId(oEvt.getParameters('text').id).getParent().getAggregation('cells')[3].getProperty('text')
var relations = sap.ui.getCore().getModel('conceptDetailModel').oData.relations
for (var i in relations) {
if (relations[i].concept_id === parseInt(concept_id_2)) {
var m_mappping_rate = relations[i].m_mapping_rate;
var m_mapping_comment = relations[i].m_mapping_comment;
break;
}
}
if (m_mapping_comment === "") {
m_mapping_comment = "No Mapping Comment";
}
debugger;
var moreInfosDialog = new sap.m.Dialog({
title : "More infos",
icon : "sap-icon://doc-attachment",
content: [
new sap.m.RatingIndicator({
value: relations[i].m_mapping_rate,
enabled: false,
}),
new sap.m.TextArea({
placeholder: "no mapping comment!",
width: "100%",
value:m_mapping_comment,
enabled: false,
})
]
});
moreInfosDialog.addButton(
new sap.m.Button({
text: "Reject",
icon: "sap-icon://decline",
press: function () {
moreInfosDialog.close();
}
})
);
moreInfosDialog.open();
},
deleteRelation: function(oEvt) {
modifRelation: function(oEvt) {
// conceptsDetailModel
......
......@@ -90,7 +90,7 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
var oConceptPanelComment = new sap.m.FeedInput(
"oConceptPanelComment", {
icon: "sap-icon://post"
icon: "sap-icon://post",
});
......@@ -189,6 +189,11 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
text : "Valid"
}),
}),
new sap.m.Column({
header : new sap.m.Label({
text : "More infos"
}),
}),
new sap.m.Column({
header : new sap.m.Label({
text : "Delete"
......@@ -198,7 +203,6 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
];
var oTemplate = new sap.m.ColumnListItem({
//vAlign: "Middle",
//type : sap.m.ListType.Active,
......@@ -234,15 +238,26 @@ sap.ui.jsview("conceptmapper.conceptDetailPage", {
wrapping : false
}),
new sap.m.Button({
icon: "{conceptDetailModel>moreInfoIcon}",
text:"{conceptDetailModel>moreInfoText}",
enabled: "{conceptDetailModel>enabledMoreInfo}",
// visible: "{conceptDetailModel>erasable}",
text:"{conceptDetailModel>moreInfoText}",
type: "{conceptDetailModel>typeMoreInfoButton}",
press: [ oController.moreInfos, oController]
}),
new sap.m.Button({
icon: "{conceptDetailModel>erasableIcon}",
// ""sap-icon://delete",
// hoverColor: "red",
// activeColor: "red",
enabled: "{conceptDetailModel>enabled}",
enabled: "{conceptDetailModel>enabledErasable}",
text:"{conceptDetailModel>notErasableText}",
// visible: "{conceptDetailModel>erasable}",
type: "{conceptDetailModel>typeErasableButton}",
press: [ oController.deleteRelation, oController]
press: [ oController.modifRelation, oController]
}),
......
......@@ -164,6 +164,12 @@ sap.ui.controller("conceptmapper.mapperPage", {
var concepts = sap.ui.getCore().getModel('conceptsDetailModel').oData.to_map;
var oData = {};
debugger;
oData.m_mapping_rate = sap.ui.getCore().byId("oConceptMappingRate").getProperty('value');
oData.m_mapping_comment = sap.ui.getCore().byId("oConceptMappingComment").getProperty('value');
// 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';
......@@ -203,6 +209,7 @@ sap.ui.controller("conceptmapper.mapperPage", {
debugger;
var ret = "Item(s) mapped to " + oData.concept_id_2;
sap.m.MessageToast.show(ret);
console.log("addRelationAjax success");
},
beforeSend: function(xhr, settings) { debugger; xhr.setRequestHeader('Authorization','Bearer ' + token); } ,
......@@ -210,6 +217,7 @@ sap.ui.controller("conceptmapper.mapperPage", {
alert("pb in the connection");
console.log("addRelationAjax error");
console.log(error);
console.log(oData)
return;
}
});
......@@ -220,6 +228,15 @@ sap.ui.controller("conceptmapper.mapperPage", {
sap.ui.controller("conceptmapper.searchPage").searcher();
//reset comment and rate
parseInt(sap.ui.getCore().byId('oConceptMappingRate').resetProperty('value'));
parseInt(sap.ui.getCore().byId('oConceptMappingComment').resetProperty('value'));
parseInt(sap.ui.getCore().byId('oIcTBMapper').setExpanded(false));
app.to('idSearchPage');
......
......@@ -82,7 +82,7 @@ sap.ui.jsview("conceptmapper.mapperPage", {
var oppp = new sap.m.IconTabBar("itb5", {
var oppp = new sap.m.IconTabBar("oIcTBMapper", {
//upperCase: true,
//backgroundDesign: "Transparent",
expanded: false,
......@@ -187,14 +187,22 @@ sap.ui.jsview("conceptmapper.mapperPage", {
//count: "3",
key: "mappingCommentKey",
content: [
new sap.m.RatingIndicator({
// value: 3
}),
// new sap.m.RatingIndicator("oConceptMappingRate", {
//
//// value: 3
// }),
new sap.m.FeedInput(
// new sap.m.Button({
// icon: "sap-icon://post",
//
//
// }),
new sap.m.TextArea(
"oConceptMappingComment", {
icon: "sap-icon://post"
})
placeholder: "your mapping comment!",
width: "100%",
}),
]
}),
......@@ -525,7 +533,6 @@ sap.ui.jsview("conceptmapper.mapperPage", {
oTable.bindItems({
path: "conceptsMapperModel>/docs",
template : oTemplate,
......@@ -574,10 +581,29 @@ sap.ui.jsview("conceptmapper.mapperPage", {
//
// ]
// });
var oTableHeader = new sap.m.Toolbar({
content : [
new sap.m.Title({
text : "Choose a relation concept and click on the concept to map"
}),
new sap.m.ToolbarSpacer(),
new sap.m.Label({
text:"Relation mapping rate : "
}),
new sap.m.RatingIndicator("oConceptMappingRate", {
// value: 3
}),
]
});
var oContentPanel = new sap.m.Panel("oContentMapperPanel", {
expandable : false,
expanded : true,
headerText : "Choose an item to map and click on it (that's done)",
headerToolbar : oTableHeader,
// headerText : "Choose an item to map and click on it (that's done)",
content : [ oTable ]
});
......
......@@ -215,6 +215,8 @@ function getConceptDetailAjax(sVal) {
success: function(data, response, xhr) {
for (var i = 0; i < data.relations.length; i++) {
var relation = data.relations[i];
// DELETE actions
if (relation.m_user_id && relation.invalid_reason !== 'Deleted') {
relation.erasableIcon = "sap-icon://delete";
relation.notErasableText = "Delete relation";
......@@ -222,19 +224,31 @@ function getConceptDetailAjax(sVal) {
relation.action = "delete";
//relation.enabled = true;
} else if (relation.m_user_id && relation.invalid_reason === 'Deleted') {
} else if (relation.m_user_id) {
relation.erasableIcon = "sap-icon://undo";
relation.notErasableText = "Enable relation";
relation.typeErasableButton = "Accept";
relation.action = "undo";
} else {
// relation.erasable = false;
relation.notErasableText = "You can't delete it";
relation.typeErasableButton = "Transparent";
relation.enabled = false;
relation.enabledErasable = false;
}
if (relation.m_user_id && (relation.m_mapping_comment !== "" || relation.m_mapping_rate !== 0)) {
relation.moreInfoIcon = "sap-icon://add";
relation.typeMoreInfoButton = "Accept";
relation.moreInfoText = "";
} else {
relation.moreInfoText = "No more info";
relation.typeMoreInfoButton = "Transparent";
relation.enabledMoreInfo = false;
}
// More infos actions
}
debugger;
......
......@@ -72,6 +72,4 @@
padding-left: 171% !important;
padding-top: 22%;
padding-bottom: 88%;
}
}
\ No newline at end of file
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