Maintenance - Mise à jour mensuelle Lundi 6 Avril 2020 entre 7h00 et 9h00

Commit ec975b7e authored by maxchaza's avatar maxchaza

Merge branch 'release/3.0.0'

parents fa283b97 302ab19a
......@@ -7,7 +7,7 @@
/**
* The version of the application.
*/
"version": "2.8.16",
"version": "3.0.0
/**
* The relative path to the application's markup file (html, jsp, asp, etc.).
......@@ -298,7 +298,7 @@
"bundle": true
},
{
"path": "resources/lib/model/ColorMapping.js",
"path": "resources/lib/model/ValueMapping.js",
"bundle": true
},
{
......@@ -333,6 +333,14 @@
"path": "resources/lib/functions/NodeStyleForm.js",
"bundle": true
},
{
"path": "resources/lib/functions/GraphColorScaleEditor.js",
"bundle": true
},
{
"path": "resources/lib/functions/GraphNumberScaleEditor.js",
"bundle": true
},
{
"path": "resources/lib/functions/Features.js",
"bundle": true
......
......@@ -9,10 +9,16 @@ Ext.define('metExploreViz.Application', {
name: 'metExploreViz',
stores: [
'metExploreViz.view.form.selectCondition.ConditionStore',
'conditionStore'
// TODO: add global / shared stores here
],
launch: function () {
Ext.create('metExploreViz.view.form.selectCondition.ConditionStore');
// TODO - Launch the application
},
......
......@@ -24,6 +24,9 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
reloadMapping:function(){
view.reset();
},
jsonmapping : function(mappingJSON){
me.addConditions(mappingJSON);
},
scope:me
});
},
......@@ -34,6 +37,7 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
* @param title : file title
*/
loadData : function(tabTxt, title) {
var me=this;
var data = tabTxt;
tabTxt = tabTxt.replace(/\r/g, "");
var lines = tabTxt.split('\n');
......@@ -50,17 +54,47 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
_metExploreViz.addMapping(mapping);
for (var i = lines.length - 1; i >= 0; i--) {
lines[i] = lines[i].split('\t');
lines[i] = lines[i].split('\t').map(function (val) {
return val.replace(",", ".");
});
}
// Launch mapping
metExploreD3.GraphMapping.mapNodeData(mapping, lines);
metExploreD3.fireEventArg('selectMappingVisu', "jsonmapping", mapping);
metExploreD3.fireEventArg('buttonMap', "jsonmapping", mapping);
metExploreD3.fireEventArg('selectMapping', "jsonmapping", mapping);
}
else
{
// Warning for bad syntax file
metExploreD3.displayWarning("Syntaxe error", 'File have bad syntax. See <a target="_blank" href="http://metexplore.toulouse.inra.fr/metexploreViz/doc/documentation.php#import">MetExploreViz documentation</a>.');
}
},
/*****************************************************
* Fill condition store store
* @param mapping : Mapping object
*/
addConditions : function(mapping) {
// Launch mapping
var conditions = mapping.getConditions();
var conditionStore = Ext.getStore("conditionStore");
var newConditions = [];
if(conditions[0]!==undefined){
mapping.getConditions().forEach(function (condition) {
newConditions.push(mapping.getName()+" / "+condition);
});
}
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'}); });
}
});
......@@ -25,7 +25,9 @@ Ext.define('metExploreViz.view.button.buttonImportToNetwork.ButtonImportToNetwor
}
metExploreD3.GraphUtils.handleFileSelect(view.lookupReference('importNetwork').fileInputEl.dom, function(json){
// Allows to reload the same file
metExploreD3.GraphPanel.refreshPanel(json, view.lookupReference('importNetwork').reset());
metExploreD3.GraphPanel.refreshPanel(json, function(){
view.lookupReference('importNetwork').reset();
});
});
},
scope : me
......
......@@ -13,8 +13,8 @@ Ext.define('metExploreViz.view.form.SelectConditionType', {
data : [
{"name":"Continuous"},
{"name":"Discrete"},
{"name":"Flux"},
{"name":"Suggestion"}
{"name":"As selection"}
//,{"name":"Alias"}
]
},
listeners: {
......@@ -23,11 +23,12 @@ Ext.define('metExploreViz.view.form.SelectConditionType', {
target: c.getEl(),
html: 'Select a type of data'
});
},
change: function(){
var comboCond = Ext.getCmp('selectCondition');
comboCond.clearValue();
}
// ,
// change: function(){
// var comboCond = Ext.getCmp('selectCondition');
// comboCond.clearValue();
// }
},
displayField: 'name',
valueField: 'name',
......
/**
* @author MC
* @description AStyleForm : Display Settings
*/
Ext.define('metExploreViz.view.form.aStyleForm.AStyleForm', {
extend: 'Ext.panel.Panel',
alias: 'widget.aStyleForm',
requires: [
"metExploreViz.view.form.aStyleForm.AStyleFormController"
],
controller: "form-aStyleForm-aStyleForm",
region:'north',
margin :'0 0 5 0',
flex:0,
border:false,
scrollable:true,
cls: "aStyleForm",
layout: {
type: 'vbox'
},
header:{
referenceHolder: true,
style:{
padding:'5px 5px 5px 5px'
},
items:[{
xtype: 'button',
reference: "numberButton",
hidden: true,
cls: "aStyleFormButton",
// text: '2000',
html:"<svg width='30px' height='30px'><text id='textNumberButton' font-family='Verdana' font-size='10' text-anchor='middle' x='46%' y='50%' dominant-baseline='middle'></text></svg>",
height:"30px",
width:"30px"
},{
xtype: 'panel',
reference: "colorButton",
hidden: true,
border: false,
cls: "aStyleFormColor",
height:"30px",
width:"30px",
html: '<input ' +
'type="color" ' +
'id="html5colorpicker" ' +
'value="#1698ff" ' +
'style="width:30px; height:30px;">',
listeners : {
render: function(c) {
var tipColorButton = Ext.create('Ext.tip.ToolTip', {
target: c.getEl(),
html: '"Color : "',
listeners : {
beforeshow: function(tooltip) {
var color = tooltip.target.el.dom.querySelector("#html5colorpicker").getAttribute("value");
tooltip.update(color);
}
}
});
c.tip = tipColorButton;
}
}
},{
xtype: 'button',
reference: "mappingButton",
cls: "aStyleFormButton",
text: '',
height:"30px",
width:"30px"
},{
xtype: 'button',
disabled: false,
cls: "aStyleFormButton",
reference: "bypassButton",
border: "1px",
text: '',
height:"30px",
width:"30px",
listeners : {
render: function(c) {
if(c.isDisabled())
c.setTooltip("To override the visual property, select one or more nodes");
},
disable: function(c) {
c.setTooltip("To override the visual property, select one or more nodes");
},
enable: function(c) {
c.setTooltip("");
}
}
},{
xtype: 'panel',
reference: "colorButtonBypass",
hidden: true,
border: false,
cls: "aStyleFormColor",
height:"30px",
width:"30px",
html: '<input ' +
'type="color" ' +
'id="html5colorpicker" ' +
'value="#1698ff" ' +
'style="width:30px; height:30px;">'
},{
xtype: 'button',
reference: "numberButtonBypass",
hidden: true,
cls: "aStyleFormButton",
// text: '2000',
html:"<svg width='30px' height='30px'><text id='textNumberButton' font-family='Verdana' font-size='10' text-anchor='middle' x='46%' y='50%' dominant-baseline='middle'></text></svg>",
height:"30px",
width:"30px"
}],
titlePosition: 6
},
items: [
{
xtype: 'form',
itemId: 'slider',
bodyStyle: 'background-color:inherit',
width: "100%",
top:'10',
border: false,
items: [
{
reference: "selectConditionForm",
xtype:'selectConditionForm'
}
]
}
]
});
\ No newline at end of file
This diff is collapsed.
/**
* @author MC
* @description AllStylesByTypeForm : Display Settings
*/
Ext.define('metExploreViz.view.form.allStylesByTypeForm.AllStylesByTypeForm', {
extend: 'Ext.panel.Panel',
alias: 'widget.allStylesByTypeForm',
requires: [
"metExploreViz.view.form.allStylesByTypeForm.AllStylesByTypeFormController",
"metExploreViz.view.form.aStyleForm.AStyleForm"
],
controller: "form-allStylesByTypeForm-allStylesByTypeForm",
autoScroll: true,
items: [
{
xtype:'toolbar',
//reference: 'caption',
region:'north',
reference:"captiontoolbar",
cls:"captiontoolbar",
border:false,
height: 38,
disabled: true,
title: false,
items: [
{ xtype: 'tbspacer',reference: 'caption', width: 150 },
'->',//spliter to shift next component up to end of right
{
xtype: 'button',
reference: 'saveAllScales',
iconCls:'saveStyle',
align:"right",
scale : 'small',
margin:'5 5 5 0',
tooltip: "Save scale"
},
{
xtype: 'filefield',
reference: 'importAllScales',
buttonOnly: true,
buttonText: '',
scale : 'small',
margin:'5 0 5 0',
style:{
width: "40px !important"
},
buttonConfig: {
cls:["x-toolbar-item","x-btn-default-toolbar-small"],
iconCls:'importStyle',
align:"right",
scale : 'small',
style:{
margin:'0 5px 0 0'
}
}
}
]
},
{
reference: 'listPanel',
xtype:'panel',
title: false,
layout: {
type: 'accordion',
fill: false,
multi: true,
animate: true,
titleCollapse: false,
expandedItem: false
},
defaults: {
padding:'0',
width: '100%',
collapsible: true,
collapsed: true,
reorderable: true
},
items: [
{
collapsed: false,
border: 0,
height: 0,
minHeight: 0
}]
}]
});
\ No newline at end of file
/**
* @author MC
* @description class to control settings or configs
*/
Ext.define('metExploreViz.view.form.allStylesByTypeForm.AllStylesByTypeFormController', {
extend: 'Ext.app.ViewController',
alias: 'controller.form-allStylesByTypeForm-allStylesByTypeForm',
/**
* Init function Checks the changes on drawing style
*/
init : function() {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
view.store.data.forEach(function (styleBar) {
var myPanel = Ext.create('metExploreViz.view.form.aStyleForm.AStyleForm', {
title: styleBar.title,
access: styleBar.access,
biologicalType: styleBar.biologicalType,
styleType: styleBar.type,
default: styleBar.default,
min: styleBar.min,
max: styleBar.max,
styleName: styleBar.style,
attrName: styleBar.attr,
attrType: styleBar.attrType,
target: styleBar.target
});
view.lookupReference("listPanel").add(myPanel);
});
view.on(
{
afterStyleLoading : me.updateForm,
updateSelectionSet : me.updateSelection,
afterrender : me.createCaption,
scope:me
});
},
createCaption : function(){
var me = this;
var view = me.getView();
if(view)
{
var parentElement = view.lookupReference("caption").el.dom;
// Obtenir une référence au premier enfant
var theFirstChild = parentElement.firstChild;
// Créer un nouvel élément
var newElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
parentElement.insertBefore(newElement, theFirstChild);
var svg = d3.select(newElement)
.style("background-color", "#eee")
.attr("height", "40")
.attr("width", "100%");
svg.append("polygon")
.attr("points", "6,38 6,25 40,0 78,0 42,25 42,38")
.attr("fill", "rgb(20, 71, 120)");
svg.append("text")
.text("Default")
.attr("transform","translate(36, 22) rotate(-35)")
.style("text-anchor","middle")
.style("fill", "#ffffff");
svg.append("polygon")
.attr("points", "42,38 42,25 78,0 114,0 78,25 78,38")
.attr("fill", "rgb(95, 130, 163)");
svg.append("text")
.text("Mapping")
.attr("transform","translate(71, 22) rotate(-35)")
.style("text-anchor","middle")
.style("fill", "#ffffff");
svg.append("polygon")
.attr("points", "78,38 78,25 114,0 150,0 114,25 114,38")
.attr("fill", "rgb(20, 71, 120)");
svg.append("text")
.text("Bypass")
.attr("transform","translate(106, 22) rotate(-35)")
.style("text-anchor","middle")
.style("fill", "#ffffff");
}
},
updateForm : function(){
var me = this;
var view = me.getView();
if(view)
{
view.query("aStyleForm").forEach(function (aStyleForm) {
metExploreD3.fireEvent(aStyleForm.id, "afterStyleLoading");
});
}
},
updateSelection : function(){
var me = this;
var view = me.getView();
if(view)
{
if(view.rendered)
{
view.query("aStyleForm").forEach(function (aStyleForm) {
metExploreD3.fireEvent(aStyleForm.id, "updateSelectionSet");
});
}
}
}
});
/**
* @author MC
* (a)description AllStylesForm : Display pathway and compartment caption
*/
Ext.define('metExploreViz.view.form.allStylesForm.AllStylesForm', {
extend: 'Ext.tab.Panel',
alias: 'widget.allStylesForm',
requires: [
"metExploreViz.view.form.allStylesForm.AllStylesFormController",
"metExploreViz.view.form.allStylesForm.AllStylesFormModel",
"metExploreViz.view.form.allStylesByTypeForm.AllStylesByTypeForm",
"metExploreViz.view.form.metaboliteStyleForm.MetaboliteStyleForm",
"metExploreViz.view.form.reactionStyleForm.ReactionStyleForm",
"metExploreViz.view.form.linkStyleForm.LinkStyleForm"
],
controller: "form-allStylesForm-allStylesForm",
viewModel: {
type: "form-allStylesForm-allStylesForm"
},
layout:{
type:'vbox',
align:'stretch'
},
region:'north',
width:'100%',
height:'20%',
maxHeight:'20%',
margins:'0 0 0 0',
scrollable: true,
tabBar:{
cls:"vizTBarStyle"
},
items: [
{
title:'Metabolite',
id:'metaboliteStyleForm',
xtype: "metaboliteStyleForm"
},
{
title:'Reaction',
id:'reactionStyleForm',
xtype: "reactionStyleForm"
},
{
title:'Link',
id:'linkStyleForm',
xtype: "linkStyleForm"
}
]
});
\ No newline at end of file
/**
* @author MC
* (a)description AllStylesFormController : Control displaying pathway and compartment caption
*/
Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
extend: 'Ext.app.ViewController',
alias: 'controller.form-allStylesForm-allStylesForm',
/**
* Aplies event linsteners to the view
*/
init:function(){
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.lookupReference('saveAllScales')
.on({
click : me.saveAllScales,
scope:me
});
});
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.lookupReference('importAllScales')
.on({
change : me.importAllScales,
scope:allStylesByTypeForm.controller
});
});
},
saveAllScales:function () {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
var scales = [];
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
var partOfAllScales = allStylesByTypeForm.query("aStyleForm")
.map(function (aStyleForm) {
return {
biologicalType:aStyleForm.biologicalType,
title:aStyleForm.title,
default : aStyleForm.default,
scaleRange : aStyleForm.scaleRange,
valueDiscreteMappings : aStyleForm.valueDiscreteMappings,
valueAsSelectionMappings : aStyleForm.valueAsSelectionMappings,
valueAliasMappings : aStyleForm.valueAliasMappings
};
});
scales = scales.concat(partOfAllScales);
});
metExploreD3.GraphUtils.saveStyles(scales, true);
},
importAllScales:function () {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
var scales = [];
metExploreD3.GraphUtils.handleFileSelect(view.lookupReference('importAllScales').fileInputEl.dom, function(allStyles){
// Allows to reload the same file
var allScales = metExploreD3.GraphUtils.decodeJSON(allStyles);
allScales.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){
if (scale.default){
if(scale.default!==theStyleForm.default){
theStyleForm.default=scale.default;
theStyleForm.getController().updateDefaultFormValues();
metExploreD3.GraphStyleEdition.setCollectionStyle(theStyleForm.target, theStyleForm.attrType, theStyleForm.attrName, theStyleForm.biologicalType, scale.default);
}
}
if (scale.scaleRange){
if(scale.scaleRange!==theStyleForm.scaleRange){
theStyleForm.scaleRange=scale.scaleRange;
var selectConditionForm = theStyleForm.lookupReference('selectConditionForm');
var selectCondition = selectConditionForm.lookupReference('selectCondition');
var selectConditionType = selectConditionForm.lookupReference('selectConditionType');
var dataType = selectConditionType.getValue();
var selectedCondition = selectCondition.getValue();
if(dataType==="Continuous" && selectedCondition!==null){
theStyleForm.getController().updateContinuousCaption();