Skip to content

Commit

Permalink
Merge pull request #2531 from guerler/charts_revision_000
Browse files Browse the repository at this point in the history
Charts revision
  • Loading branch information
bgruening committed Jul 21, 2016
2 parents 2075af4 + 9c1ee51 commit 5ff6d7a
Show file tree
Hide file tree
Showing 52 changed files with 1,474 additions and 2,527 deletions.
14 changes: 10 additions & 4 deletions client/galaxy/scripts/mvc/form/form-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ define([ 'utils/utils' ], function( Utils ) {
this.app = app;
},

/** Creates a checksum.
*/
/** Creates a checksum. */
checksum: function() {
var sum = '';
var self = this;
Expand All @@ -22,8 +21,15 @@ define([ 'utils/utils' ], function( Utils ) {
return sum;
},

/** Convert dom into a dictionary of flat id/value pairs used e.g. on job submission.
*/
/** Set parameter values from model */
set: function( model ) {
for ( var attr in model.attributes ) {
var index = this.match( attr );
index && this.app.field_list[ index ].value( model.get( attr ) );
}
},

/** Convert dom into a dictionary of flat id/value pairs used e.g. on job submission. */
create: function() {
var self = this;

Expand Down
101 changes: 33 additions & 68 deletions client/galaxy/scripts/mvc/form/form-parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@ define(['utils/utils',
'ftpfile' : '_fieldFtp'
},

initialize: function( app, options ) {
this.app = app;
},

/** Returns an input field for a given field type
*/
/** Returns an input field for a given field type */
create: function( input_def ) {
var fieldClass = this.types[ input_def.type ];
var field = typeof( this[ fieldClass ] ) === 'function' ? this[ fieldClass ].call( this, input_def ) : null;
if ( !field ) {
this.app.incompatible = true;
field = input_def.options ? this._fieldSelect( input_def ) : this._fieldText( input_def );
Galaxy.emit.debug('form-parameters::_addRow()', 'Auto matched field type (' + input_def.type + ').');
}
Expand All @@ -50,10 +44,8 @@ define(['utils/utils',
return field;
},

/** Data input field
*/
/** Data input field */
_fieldData: function( input_def ) {
var self = this;
return new SelectContent.View({
id : 'field-' + input_def.id,
extensions : input_def.extensions,
Expand All @@ -62,14 +54,11 @@ define(['utils/utils',
type : input_def.type,
flavor : input_def.flavor,
data : input_def.options,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** Select/Checkbox/Radio options field
*/
/** Select/Checkbox/Radio options field */
_fieldSelect: function ( input_def ) {
// show text field e.g. in workflow editor
if( input_def.is_workflow ) {
Expand All @@ -81,11 +70,14 @@ define(['utils/utils',
input_def.error_text = 'Missing columns in referenced dataset.'
}

// configure options fields
var options = [];
_.each( input_def.options, function( option ) {
options.push( { label: option[ 0 ], value: option[ 1 ] } );
});
// identify available options
var data = input_def.data;
if( !data ) {
data = [];
_.each( input_def.options, function( option ) {
data.push( { label: option[ 0 ], value: option[ 1 ] } );
});
}

// identify display type
var SelectClass = Ui.Select;
Expand All @@ -96,48 +88,43 @@ define(['utils/utils',
case 'radio':
SelectClass = Ui.Radio;
break;
case 'radiobutton':
SelectClass = Ui.RadioButton;
break;
}

// create select field
var self = this;
return new SelectClass.View({
id : 'field-' + input_def.id,
data : options,
data : data,
error_text : input_def.error_text || 'No options available',
multiple : input_def.multiple,
optional : input_def.optional,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** Drill down options field
*/
/** Drill down options field */
_fieldDrilldown: function ( input_def ) {
// show text field e.g. in workflow editor
if( input_def.is_workflow ) {
return this._fieldText( input_def );
}

// create drill down field
var self = this;
return new Ui.Drilldown.View({
id : 'field-' + input_def.id,
data : input_def.options,
display : input_def.display,
optional : input_def.optional,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** Text input field
*/
/** Text input field */
_fieldText: function( input_def ) {
// field replaces e.g. a select field
if ( input_def.options ) {
if ( input_def.options && input_def.data ) {
input_def.area = input_def.multiple;
if ( Utils.isEmpty( input_def.value ) ) {
input_def.value = null;
Expand All @@ -156,92 +143,70 @@ define(['utils/utils',
}
}
// create input element
var self = this;
return new Ui.Input({
id : 'field-' + input_def.id,
area : input_def.area,
onchange : function( new_value ) {
input_def.onchange ? input_def.onchange( new_value ) : self.app.trigger( 'change' );
}
placeholder : input_def.placeholder,
onchange : input_def.onchange
});
},

/** Slider field
*/
/** Slider field */
_fieldSlider: function( input_def ) {
var self = this;
return new Ui.Slider.View({
id : 'field-' + input_def.id,
precise : input_def.type == 'float',
is_workflow : input_def.is_workflow,
min : input_def.min,
max : input_def.max,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** Hidden field
*/
/** Hidden field */
_fieldHidden: function( input_def ) {
return new Ui.Hidden({
id : 'field-' + input_def.id,
info : input_def.info
});
},

/** Boolean field
*/
/** Boolean field */
_fieldBoolean: function( input_def ) {
var self = this;
return new Ui.RadioButton.View({
id : 'field-' + input_def.id,
data : [ { label : 'Yes', value : 'true' },
{ label : 'No', value : 'false' }],
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** Color picker field
*/
/** Color picker field */
_fieldColor: function( input_def ) {
var self = this;
return new ColorPicker({
id : 'field-' + input_def.id,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** Library dataset field
*/
/** Library dataset field */
_fieldLibrary: function( input_def ) {
var self = this;
return new SelectLibrary.View({
id : 'field-' + input_def.id,
optional : input_def.optional,
multiple : input_def.multiple,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
},

/** FTP file field
*/
_fieldFtp: function( input_def ) {
var self = this;
return new SelectFtp.View({
id : 'field-' + input_def.id,
optional : input_def.optional,
multiple : input_def.multiple,
onchange : function() {
self.app.trigger( 'change' );
}
onchange : input_def.onchange
});
}
});
Expand Down
29 changes: 14 additions & 15 deletions client/galaxy/scripts/mvc/form/form-repeat.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// dependencies
/** This class creates a ui component which enables the dynamic creation of portlets */
define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc'],
function(Utils, Table, Portlet, Ui) {

/** This class creates a ui component which enables the dynamic creation of portlets
*/
var View = Backbone.View.extend({
initialize : function(options) {
var self = this;
Expand Down Expand Up @@ -41,14 +38,12 @@ var View = Backbone.View.extend({
this.n = 0;
},

/** Number of repeat blocks
*/
/** Number of repeat blocks */
size: function() {
return this.n;
},

/** Add new repeat block
*/
/** Add new repeat block */
add: function(options) {
if (!options.id || this.list[options.id]) {
Galaxy.emit.debug('form-repeat::add()', 'Duplicate repeat block id.');
Expand All @@ -68,7 +63,7 @@ var View = Backbone.View.extend({
var portlet = new Portlet.View({
id : options.id,
title : 'placeholder',
cls : 'ui-portlet-repeat',
cls : options.cls || 'ui-portlet-repeat',
operations : {
button_delete : button_delete
}
Expand All @@ -84,8 +79,7 @@ var View = Backbone.View.extend({
this._refresh();
},

/** Delete repeat block
*/
/** Delete repeat block */
del: function(id) {
if (!this.list[id]) {
Galaxy.emit.debug('form-repeat::del()', 'Invalid repeat block id.');
Expand All @@ -99,8 +93,14 @@ var View = Backbone.View.extend({
this._refresh();
},

/** Hides add/del options
*/
/** Remove all */
delAll: function() {
for( var id in this.list ) {
this.del( id );
}
},

/** Hides add/del options */
hideOptions: function() {
this.button_new.$el.hide();
_.each( this.list, function( portlet ) {
Expand All @@ -111,8 +111,7 @@ var View = Backbone.View.extend({
}
},

/** Refresh view
*/
/** Refresh view */
_refresh: function() {
var index = 0;
for (var id in this.list) {
Expand Down
4 changes: 3 additions & 1 deletion client/galaxy/scripts/mvc/form/form-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define(['utils/utils',

// create/render views
this.table = new Table.View(options);
this.parameters = new Parameters(app, options);
this.parameters = new Parameters();
this.setElement(this.table.$el);
this.render();
},
Expand Down Expand Up @@ -187,7 +187,9 @@ define(['utils/utils',
/** Add a single input field element
*/
_addRow: function(input_def) {
var self = this;
var id = input_def.id;
input_def.onchange = function() { self.app.trigger( 'change' ) };
var field = this.parameters.create(input_def);
this.app.field_list[id] = field;
var input_element = new InputElement(this.app, {
Expand Down
14 changes: 8 additions & 6 deletions client/galaxy/scripts/mvc/form/form-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc', 'mvc/form/form-sec
}
},

/** Highlights errors
*/
/** Highlights errors */
errors: function(options) {
this.trigger('reset');
if (options && options.errors) {
Expand All @@ -101,8 +100,12 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc', 'mvc/form/form-sec
}
},

/** Render tool form
*/
/** Modify onchange event handler */
setOnChange: function( callback ) {
this.options.onchange = callback;
},

/** Render tool form */
render: function() {
// link this
var self = this;
Expand Down Expand Up @@ -153,8 +156,7 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc', 'mvc/form/form-sec
return this;
},

/** Renders the UI elements required for the form
*/
/** Renders the UI elements required for the form */
_renderForm: function() {
// create message view
this.message = new Ui.Message();
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/ui/ui-misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ define(['utils/utils',
if ( !this.model.get( 'persistent' ) ) {
var self = this;
this.timeout = window.setTimeout( function() {
self.$el.fadeOut();
self.model.set( 'message', '' );
}, 3000 );
}
} else {
Expand Down
Loading

0 comments on commit 5ff6d7a

Please sign in to comment.