Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into history.delete_curre…
Browse files Browse the repository at this point in the history
…nt-id
  • Loading branch information
carlfeberhard committed Jul 25, 2016
2 parents 2b4a855 + 1e291e1 commit 877655c
Show file tree
Hide file tree
Showing 20 changed files with 144 additions and 91 deletions.
12 changes: 4 additions & 8 deletions client/galaxy/scripts/mvc/form/form-view.js
Expand Up @@ -74,14 +74,10 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc', 'mvc/form/form-sec
this.portlet.expand();
this.trigger('expand', input_id);
if (!silent) {
if (self==top) {
var $panel = this.$el.parents().filter(function() {
return $(this).css('overflow') == 'auto';
}).first();
$panel.animate({ scrollTop : $panel.scrollTop() + input_element.$el.offset().top - 50 }, 500);
} else {
$('html, body').animate({ scrollTop : input_element.$el.offset().top - 20 }, 500);
}
var $panel = this.$el.parents().filter(function() {
return [ 'auto', 'scroll' ].indexOf( $( this ).css( 'overflow' ) ) != -1;
}).first();
$panel.animate( { scrollTop : $panel.scrollTop() + input_element.$el.offset().top - 120 }, 500 );
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/tool/tool-form-base.js
Expand Up @@ -35,7 +35,7 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',
this.options = Utils.merge({
icon : options.icon,
title : '<b>' + options.name + '</b> ' + options.description + ' (Galaxy Version ' + options.version + ')',
operations : this._operations(),
operations : !this.options.hide_operations && this._operations(),
onchange : function() {
self.deferred.reset();
self.deferred.execute(function(process) {
Expand Down
105 changes: 61 additions & 44 deletions client/galaxy/scripts/mvc/tool/tool-form-composite.js
Expand Up @@ -3,18 +3,28 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
function( Utils, Deferred, Ui, Form, FormData, ToolFormBase, Modal ) {
var View = Backbone.View.extend({
initialize: function( options ) {
var self = this;
this.modal = parent.Galaxy.modal || new Modal.View();
this.model = options && options.model || new Backbone.Model( options );
this.deferred = new Deferred();
this.setElement( $( '<div/>' ).addClass( 'ui-form-composite' )
.append( this.$message = $( '<div/>' ) )
.append( this.$header = $( '<div/>' ) )
.append( this.$history = $( '<div/>' ) )
.append( this.$parameters = $( '<div/>' ) )
.append( this.$steps = $( '<div/>' ) ) );
$( 'body' ).append( this.$el );
this._configure();
this.render();
this._refresh();
this.$el.on( 'click', function() { self._refresh() } );
$( window ).resize( function() { self._refresh() } );
},

/** Refresh height of scrollable div below header */
_refresh: function() {
var margin = _.reduce( this.$el.children(), function( memo, child ) {
return memo + $( child ).outerHeight();
}, 0 ) - this.$steps.height() + 30;
this.$steps.css( 'height', $( window ).height() - margin );
},

/** Configures form/step options for each workflow step */
Expand Down Expand Up @@ -44,7 +54,9 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
cls_enable : 'fa fa-edit',
cls_disable : 'fa fa-undo',
errors : step.messages,
initial_errors : true
initial_errors : true,
cls : 'ui-portlet-narrow',
hide_operations : true
}, step );
self.steps[ i ] = step;
self.links[ i ] = [];
Expand Down Expand Up @@ -155,7 +167,7 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
this._renderHistory();
_.each ( this.steps, function( step, i ) { self._renderStep( step, i ) } );
this.deferred.execute( function() { self.execute_btn.unwait();
self.execute_btn.model.set( 'wait_text', 'Sending...' ) } );
self.execute_btn.model.set( { wait_text: 'Sending...', percentage: -1 } ) } );
},

/** Render header */
Expand All @@ -166,7 +178,7 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
title : 'Run workflow',
cls : 'btn btn-primary',
wait : true,
wait_text : 'Loading...',
wait_text : 'Preparing...',
onclick : function() { self._execute() }
});
this.$header.addClass( 'ui-form-header' ).empty()
Expand All @@ -191,14 +203,47 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
var self = this;
this.wp_form = null;
if ( !_.isEmpty( this.wp_inputs ) ) {
this.wp_form = new Form({ title: '<b>Workflow Parameters</b>', inputs: this.wp_inputs, onchange: function() {
_.each( self.wp_form.input_list, function( input_def, i ) {
_.each( input_def.links, function( step ) {
self._refreshStep( step );
this.wp_form = new Form({ title: '<b>Workflow Parameters</b>', inputs: this.wp_inputs, cls: 'ui-portlet-narrow', onchange: function() {
_.each( self.wp_form.input_list, function( input_def, i ) {
_.each( input_def.links, function( step ) {
self._refreshStep( step );
});
});
});
}});
this._append( this.$parameters.empty(), this.wp_form.$el );
}
});
this._append( this.$steps.empty(), this.wp_form.$el );
}
},

/** Render workflow parameters */
_renderHistory: function() {
this.history_form = null;
if ( !this.model.get( 'history_id' ) ) {
this.history_form = new Form({
cls : 'ui-portlet-narrow',
title : '<b>History Options</b>',
inputs : [{
type : 'conditional',
name : 'new_history',
test_param : {
name : 'check',
label : 'Send results to a new history',
type : 'boolean',
value : 'false',
help : ''
},
cases : [{
value : 'true',
inputs : [{
name : 'name',
label : 'History name',
type : 'text',
value : this.model.get( 'name' )
}]
}]
}]
});
this._append( this.$steps, this.history_form.$el );
}
},

Expand All @@ -207,6 +252,7 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
var self = this;
var form = null;
var current = null;
self.$steps.addClass( 'ui-steps' );
this.deferred.execute( function( promise ) {
current = promise;
if ( step.step_type == 'tool' ) {
Expand All @@ -231,8 +277,9 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
}
self.forms[ i ] = form;
self._refreshStep( step );
Galaxy.emit.debug( 'tool-form-composite::initialize()', i + ' : Workflow step state ready.', step );
self._resolve( form.deferred, promise );
self.execute_btn.model.set( 'percentage', ( i + 1 ) * 100.0 / self.steps.length );
Galaxy.emit.debug( 'tool-form-composite::initialize()', i + ' : Workflow step state ready.', step );
} );
},

Expand Down Expand Up @@ -283,39 +330,10 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
}
},

/** Render history form */
_renderHistory: function() {
this.history_form = null;
if ( !this.model.get( 'history_id' ) ) {
this.history_form = new Form({
inputs : [{
type : 'conditional',
name : 'new_history',
test_param : {
name : 'check',
label : 'Send results to a new history',
type : 'boolean',
value : 'false',
help : ''
},
cases : [{
value : 'true',
inputs : [{
name : 'name',
label : 'History name',
type : 'text',
value : this.model.get( 'name' )
}]
}]
}]
});
this._append( this.$history.empty(), this.history_form.$el );
}
},

/** Execute workflow */
_execute: function() {
var self = this;
this._enabled( false );
var job_def = {
new_history_name : this.history_form.data.create()[ 'new_history|name' ],
replacement_params : this.wp_form ? this.wp_form.data.create() : {},
Expand Down Expand Up @@ -355,7 +373,6 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
self._enabled( true );
Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation failed.', job_def );
} else {
self._enabled( false );
Galaxy.emit.debug( 'tool-form-composite::submit()', 'Validation complete.', job_def );
Utils.request({
type : 'POST',
Expand Down
28 changes: 18 additions & 10 deletions client/galaxy/scripts/mvc/ui/ui-buttons.js
Expand Up @@ -8,15 +8,17 @@ define( [ 'utils/utils' ], function( Utils ) {
title : '',
floating : 'right',
icon : '',
cls : 'ui-button btn btn-default',
cls : 'btn btn-default',
wait : false,
wait_text : 'Sending...',
wait_cls : 'btn btn-info',
disabled : false
disabled : false,
percentage : -1
}).set( options );
this.setElement( $( '<button/>' ).attr( 'type', 'button' )
.append( this.$icon = $( '<i/>' ) )
.append( this.$title = $( '<span/>' ) ) );
.append( this.$icon = $( '<i/>' ) )
.append( this.$title = $( '<span/>' ) )
.append( this.$progress = $( '<div/>' ).append( this.$progress_bar = $( '<div/>' ) ) ) );
this.listenTo( this.model, 'change', this.render, this );
this.render();
},
Expand All @@ -25,7 +27,7 @@ define( [ 'utils/utils' ], function( Utils ) {
var self = this;
var options = this.model.attributes;
this.$el.removeClass()
.addClass( options.cls )
.addClass( 'ui-button-default' )
.addClass( options.disabled && 'disabled' )
.attr( 'id', options.id )
.attr( 'disabled', options.disabled )
Expand All @@ -35,13 +37,19 @@ define( [ 'utils/utils' ], function( Utils ) {
options.onclick && !self.disabled && options.onclick();
})
.tooltip( { title: options.tooltip, placement: 'bottom' } );
this.$icon.removeClass().addClass( 'icon fa' ).addClass( options.icon );
this.$title.removeClass().addClass( 'title' ).html( options.title );
options.icon && options.title && this.$icon.addClass( 'ui-margin-right' );
this.$progress.addClass( 'progress' ).css( 'display', options.percentage !== -1 ? 'block' : 'none' );
this.$progress_bar.addClass( 'progress-bar' ).css( { width : options.percentage + '%' } );
this.$icon.removeClass().addClass( 'icon fa' );
this.$title.removeClass().addClass( 'title' );
if ( options.wait ) {
this.$el.removeClass( options.cls ).addClass( options.wait_cls ).prop( 'disabled', true );
this.$icon.removeClass( options.icon ).addClass( 'fa-spinner fa-spin' );
this.$el.addClass( options.wait_cls ).prop( 'disabled', true );
this.$icon.addClass( 'fa-spinner fa-spin ui-margin-right' );
this.$title.html( options.wait_text );
} else {
this.$el.addClass( options.cls );
this.$icon.addClass( options.icon );
this.$title.html( options.title );
options.icon && options.title && this.$icon.addClass( 'ui-margin-right' );
}
},

Expand Down
35 changes: 30 additions & 5 deletions client/galaxy/style/less/ui.less
Expand Up @@ -32,6 +32,7 @@
@ui-margin-vertical-large: 10px;
@ui-margin-horizontal: 5px;
@ui-margin-horizontal-small: 4px;
@ui-margin-horizontal-large: 10px;

// margins
.ui-margin-top {
Expand Down Expand Up @@ -114,11 +115,21 @@
}

// buttons
.ui-button {
.ui-button-default {
.icon {
font-size: 1.1em;
}
.progress {
height: 4px;
margin: 0px;
margin-top: 2px;
.progress-bar {
&:extend(.no-transition);
background: darken(@state-success-bg, 30%);
}
}
}

.ui-button-icon {
&:extend(.icon-btn);
&:extend(.no-highlight);
Expand Down Expand Up @@ -336,10 +347,24 @@
width: ~'calc(100% - 200px)';
}
}
.ui-button {
&:extend(.btn all);
&:extend(.btn-default all);
margin-left: @ui-margin-horizontal;
.ui-steps {
overflow: scroll;
margin-top: 15px;
border: dashed 1px darken(@form-heading-bg, 30%);
border-radius: @border-radius-base;
padding: @ui-margin-horizontal;
.ui-portlet-narrow {
.portlet-header {
padding: 1px 5px 0px 8px;
}
padding: 0px @ui-margin-horizontal 0px @ui-margin-horizontal;
.portlet-content {
padding: 0px @ui-margin-horizontal 0px @ui-margin-horizontal;
}
.ui-table-section, .ui-portlet-repeat .portlet-content {
padding-left: @ui-margin-horizontal-large;
}
}
}
.ui-message {
margin-top: 0px;
Expand Down

0 comments on commit 877655c

Please sign in to comment.