Commit 0d79ee99 authored by maxchaza's avatar maxchaza

Fix mapping reload

parent 5fdd5a6b
......@@ -22,7 +22,7 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
view.on({
reloadMapping:function(){
view.reset();
me.resetCondition();
},
jsonmapping : function(mappingJSON){
me.addConditions(mappingJSON);
......@@ -110,11 +110,23 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
}
else
newConditions.push(mapping.getName());
newConditions
.filter(function(cond){
return !(cond.includes("PathwayEnrichment") || cond.includes("PathwayCoverage"))
})
.forEach(function (value) { conditionStore.add({name: value, type: 'int', biologicalType: biologicalType}); });
.forEach(function (value) {
if(conditionStore.find("name", value)===-1)
conditionStore.add({name: value, type: 'int', biologicalType: biologicalType});
});
},
/*****************************************************
* Fill condition store store
* @param mapping : Mapping object
*/
resetCondition : function() {
var conditionStore = Ext.getStore("conditionStore");
conditionStore.loadData([], false);
}
});
......@@ -463,7 +463,6 @@ Ext.define('metExploreViz.view.form.aStyleForm.AStyleFormController', {
metExploreD3.GraphStyleEdition.setCollectionStyle(view.target, view.attrType, view.attrName, view.biologicalType, val);
styleToUse[view.access] = val;
view.default = val;
console.log(styleToUse);
});
},
scope : me
......@@ -523,8 +522,6 @@ Ext.define('metExploreViz.view.form.aStyleForm.AStyleFormController', {
metExploreD3.GraphStyleEdition.setCollectionStyle(view.target, view.attrType, view.attrName, view.biologicalType, color);
styleToUse[view.access]=color;
console.log(styleToUse);
});
colorButtonBypass.on({
......
......@@ -15,6 +15,11 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
viewModel = me.getViewModel(),
view = me.getView();
view.on({
refreshAllStyles : this.reloadAllScales,
scope:me
});
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.lookupReference('saveAllScales')
.on({
......@@ -167,7 +172,6 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
}
}
console.log('--------------------------------------------------');
});
view.query("allStylesByTypeForm")
......@@ -182,5 +186,65 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
});
},
reloadAllScales:function () {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
var allScales = [];
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
var partOfAllScales = allStylesByTypeForm.query("aStyleForm")
.forEach(function (scale) {
var form = Ext.getCmp(scale.biologicalType+"StyleForm");
if(form){
var theStyleForm = form.query("aStyleForm").find(function (aStyleForm) { return aStyleForm.title===scale.title;});
if(theStyleForm){
var selectConditionForm = theStyleForm.lookupReference('selectConditionForm');
var selectCondition = selectConditionForm.lookupReference('selectCondition');
var selectConditionType = selectConditionForm.lookupReference('selectConditionType');
var dataType = selectConditionType.getValue();
var selectedCondition = selectCondition.getValue();
if (scale.scaleRange){
if(dataType==="Continuous" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
if (scale.valueDiscreteMappings){
if(dataType==="Discrete" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
if (scale.valueAsSelectionMappings){
if(dataType==="As selection" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
if (scale.valueAliasMappings){
if(dataType==="Alias" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
}
}
});
});
/*
view.query("allStylesByTypeForm")
.forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.query("aStyleForm")
.forEach(function (aStyleForm) {
if (aStyleForm.scaleRange)
aStyleForm.getController().updateContinuousCaption();
})
});
*/
}
});
\ No newline at end of file
......@@ -478,13 +478,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', {
}
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -493,13 +491,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim=== true) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......
......@@ -51,10 +51,6 @@ Ext.define('metExploreViz.view.form.continuousNumberMappingEditor.ContinuousNumb
view.lookupReference('textfieldValue').on({
focusleave : function(that){
console.log(me);
console.log(view);
var value =parseFloat(that.getRawValue());
if(value==="< min" || value==="> max")
......
......@@ -544,7 +544,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
* @param fluxType : string, one or two arrows for fluxes
*/
graphMapping : function(dataType, conditionName, parentAStyleForm) {
var session = _metExploreViz.getSessionById('viz');
var session = _metExploreViz.getSessionById('viz');
if(dataType==="Continuous"){
metExploreD3.GraphMapping.graphMappingContinuousData(conditionName, parentAStyleForm);
......@@ -566,6 +567,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
metExploreD3.GraphMapping.graphMappingDiscreteData(conditionName, parentAStyleForm);
}
if(dataType==="As selection"){
session.setMappingDataType(dataType);
metExploreD3.GraphMapping.graphMappingAsSelectionData(conditionName, parentAStyleForm);
......@@ -597,7 +600,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
var aStyleFormParent = me.getAStyleFormParent();
if(type!=="suggestion"){
networkVizSession.setMapped(selectedCondition);
colorStore = aStyleFormParent.getController().getValueMappingsSet(networkVizSession.getMappingDataType());
colorStore = aStyleFormParent.getController().getValueMappingsSet(dataType);
}
else {
......
......@@ -16,6 +16,9 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
view = me.getView();
view.on({
reloadMapping:function(){
me.resetMapping();
},
jsonmapping : function(mappingJSON){
me.initMapping(mappingJSON);
},
......@@ -23,6 +26,15 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
});
},
/*****************************************************
* Fill condition store store
* @param mapping : Mapping object
*/
resetMapping : function() {
var store = Ext.getStore("mappingStore");
store.loadData([], false);
},
initMapping:function(mappingJSON){
var me = this,
view = me.getView();
......@@ -36,7 +48,8 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
var store = Ext.getStore("mappingStore");
store.add({name: mappingJSON.getName()});
if(store.find("name", mappingJSON.getName())===-1)
store.add({name: mappingJSON.getName()});
//
// //take an array to store the object that we will get from the ajax response
// var records = [];
......
......@@ -19,7 +19,6 @@ Ext.define('metExploreViz.view.form.selectMappingForExtraction.SelectMappingForE
show : function(that){
var store = Ext.getStore("mappingStore");
store.filter(function (mapping) {
console.log(mapping.get("name"));
return mapping.get("name")!=="None";
})
},
......
......@@ -1390,7 +1390,7 @@ metExploreD3.GraphFunction = {
{
if(force!=undefined)
{
if(session.isAnimated("viz")== true)
if(session.isAnimated("viz"))
force.alpha(1).restart();
}
}
......
This diff is collapsed.
......@@ -752,7 +752,7 @@ metExploreD3.GraphNetwork = {
session.setLinked(true);
mainSession.setLinked(true);
if (anim == "true")
if (anim)
metExploreD3.GraphNetwork.animationButtonOn(panel);
else
metExploreD3.GraphNetwork.animationButtonOff(panel);
......@@ -1417,6 +1417,7 @@ metExploreD3.GraphNetwork = {
var session = _metExploreViz.getSessionById(panel);
var force = session.getForce();
console.log("refreshSvg");
if(session.isAnimated())
force.alpha(1).restart();
else
......@@ -1465,6 +1466,8 @@ metExploreD3.GraphNetwork = {
metExploreD3.GraphNetwork.tick(panel);
metExploreD3.hideMask(mask);
metExploreD3.fireEvent('allStylesForm', "refreshAllStyles");
}
catch (e) {
e.functionUsed="refreshViz";
......@@ -1686,7 +1689,7 @@ metExploreD3.GraphNetwork = {
metExploreD3.GraphNetwork.addLinkInDrawing(link.getSource().getDbIdentifier()+"-"+link.getTarget().getId(), link.getSource(), link.getTarget(), "out", false, "viz", false)
});
if (session.isAnimated("viz")==true || session.isAnimated("viz")=="true") {
if (session.isAnimated("viz")) {
force.alpha(1).restart();
}
else
......@@ -2807,7 +2810,7 @@ metExploreD3.GraphNetwork = {
var force = session.getForce();
if(force!=undefined)
{
if(session.isAnimated("viz") || session.isAnimated("viz")==true)
if(session.isAnimated("viz"))
force.alpha(1).restart();
}
}
......@@ -2864,7 +2867,7 @@ metExploreD3.GraphNetwork = {
var force = session.getForce();
if(force!=undefined)
{
if(session.isAnimated("viz")=="true")
if(session.isAnimated("viz")===true)
force.alpha(1).restart();
}
}
......@@ -2951,7 +2954,7 @@ metExploreD3.GraphNetwork = {
var force = session.getForce();
if(force!=undefined)
{
if(session.isAnimated("viz")=="true")
if(session.isAnimated("viz"))
force.alpha(1).restart();
}
}
......
......@@ -195,12 +195,11 @@ metExploreD3.GraphPanel = {
var vizComp = Ext.getCmp("viz");
if(vizComp!=undefined){
var panel;
console.log(Ext.getCmp("maskInit"));
if(Ext.getCmp("maskInit").isHidden())
panel = 'graphPanel';
else
panel = "maskInit";
console.log(panel);
var myMask = metExploreD3.createLoadMask("Refresh in process...", panel);
if(myMask!= undefined){
......@@ -648,7 +647,6 @@ console.log(panel);
if(jsonParsed.generalStyle)
{
console.log(jsonParsed.generalStyle);
var oldGeneralStyle = metExploreD3.getGeneralStyle();
var style = new GeneralStyle(
oldGeneralStyle.getWebsiteName(),
......@@ -790,7 +788,6 @@ console.log(panel);
if(sessions[key].duplicatedNodes)
{
console.log(sessions[key]);
sessions[key].duplicatedNodes.filter(metExploreD3.GraphUtils.onlyUnique).forEach(function(nodeId){
var nodeSC = networkVizSession.getD3Data().getNodeById(nodeId);
metExploreD3.fireEventParentWebSite("sideCompound", nodeSC);
......@@ -804,6 +801,7 @@ console.log(panel);
if(btn=="yes")
{
_metExploreViz.getMappingsSet().forEach(function(mapping){
metExploreD3.GraphMapping.reloadMapping(mapping);
metExploreD3.fireEventArg('buttonMap', "jsonmapping", mapping);
metExploreD3.fireEventArg('selectMapping', "jsonmapping", mapping);
......@@ -895,8 +893,7 @@ console.log(panel);
networkData.cloneObject(jsonParsed);
var metaboliteStyle = metExploreD3.getMetaboliteStyle();
var reactionStyle = metExploreD3.getReactionStyle();
console.log(metaboliteStyle);
console.log(reactionStyle);
var nodes = networkData.getNodes();
nodes.forEach(function(node){
if(node.getBiologicalType()=="metabolite")
......@@ -978,6 +975,7 @@ console.log(panel);
metExploreD3.GraphNetwork.tick("viz");
}
});
}
}
......@@ -985,12 +983,15 @@ console.log(panel);
if(_metExploreViz.getMappingsLength()>0)
{
// metExploreD3.fireEventArg('buttonMap', "reloadMapping", false);
// metExploreD3.fireEventArg('selectMapping', "reloadMapping", false);
_metExploreViz.getMappingsSet().forEach(function(mapping){
metExploreD3.GraphMapping.reloadMapping(mapping);
metExploreD3.fireEventArg('buttonMap', "jsonmapping", mapping);
metExploreD3.fireEventArg('selectMapping', "jsonmapping", mapping);
});
metExploreD3.fireEventArg('buttonRefresh', "reloadMapping", true);
});
metExploreD3.GraphNetwork.tick("viz");
}
}
func();
......
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