Skip to content

Commit

Permalink
Merge branch 'dev' into remove_grids_mako
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed May 31, 2017
2 parents f5671be + d61ab16 commit b764d35
Show file tree
Hide file tree
Showing 61 changed files with 1,447 additions and 389 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Expand Up @@ -104,7 +104,7 @@ The following individuals have contributed code to Galaxy:
* Michael Li <michael.li@uwaterloo.ca>
* Pierre Lindenbaum <plindenbaum@yahoo.fr>
* Mikael Loaec <mikael.loaec@versailles.inra.fr>
* Thoba Lose @thobalose
* Thoba Lose <lose.thoba@gmail.com>
* Philip Mabon <philipmabon@gmail.com>
* Remi Marenco <remi.marenco@gmail.com> <remimarenco@gmail.com>
* Zipho Mashologu <zipho@trustpay.biz>
Expand Down
12 changes: 10 additions & 2 deletions client/galaxy/scripts/apps/analysis.js
Expand Up @@ -9,8 +9,9 @@ var jQuery = require( 'jquery' ),
UserPreferences = require( 'mvc/user/user-preferences' ),
CustomBuilds = require( 'mvc/user/user-custom-builds' ),
Tours = require( 'mvc/tours' ),
Workflows = require( 'mvc/workflow/workflow' );
GridView = require( 'mvc/grid/grid-view' )
Workflows = require( 'mvc/workflow/workflow' ),
WorkflowsConfigureMenu = require( 'mvc/workflow/workflow-configure-menu' );

/** define the 'Analyze Data'/analysis/main/home page for Galaxy
* * has a masthead
Expand Down Expand Up @@ -80,13 +81,16 @@ window.app = function app( options, bootstrapped ){
'(/)user(/)' : 'show_user',
'(/)user(/)(:form_id)' : 'show_user_form',
'(/)workflow(/)' : 'show_workflows',
'(/)custom_builds' : 'show_custom_builds',
'(/)pages(/)(:action_id)' : 'show_pages',
'(/)workflow/configure_menu(/)' : 'show_configure_menu',
'(/)custom_builds' : 'show_custom_builds'
},

require_login: [
'show_user',
'show_user_form',
'show_workflows',
'show_configure_menu'
],

loginRequired: function() {
Expand Down Expand Up @@ -121,6 +125,10 @@ window.app = function app( options, bootstrapped ){
this.page.display( new Workflows.View() );
},

show_configure_menu : function(){
this.page.display( new WorkflowsConfigureMenu.View() );
},

show_custom_builds : function() {
var self = this;
var historyPanel = this.page.historyPanel.historyView;
Expand Down
153 changes: 153 additions & 0 deletions client/galaxy/scripts/mvc/workflow/workflow-configure-menu.js
@@ -0,0 +1,153 @@
/** Configure Workflow Menu View */
define( [], function() {
var View = Backbone.View.extend({

initialize: function( options ) {
this.setElement( '<div/>' );
this.render();
},

render: function() {
var self = this;
$.getJSON( Galaxy.root + 'api/workflows/menu/', function( response ) {
var workflows = response.workflows,
ids_in_menu = response.ids_in_menu,
$el_config_worflow = null;

// Add configure workflow header
self.$el.empty().append( self._templateConfigWorkflowHeader() );
$el_config_worflow = self.$el.find( '.configure-workflows' );
$el_config_worflow.append( self._templateActionButtons() );
if( workflows.length > 0 ) {
$el_config_worflow.append( self._templateConfigureWorkflow( self, workflows, ids_in_menu ) );
self.save_workflow_menu( self );
self.make_checked( self, ids_in_menu );
self.register_check_uncheck_all( self );
}
else {
$el_config_worflow.append( self._templateNoWorkflow() );
}
});
},

/** Register check and uncheck all callbacks*/
register_check_uncheck_all: function( self ) {
var $el_check_all = self.$el.find( '.check-all-wf' ),
$el_uncheck_all = self.$el.find( '.uncheck-all-wf' );

$el_check_all.click(function( e ) {
self.check_uncheck_all( self, true );
});
$el_uncheck_all.click(function( e ) {
self.check_uncheck_all( self, false );
});
},

/** Check or uncheck all workflows */
check_uncheck_all: function( self, checked ) {
$.each(self.$el.find( '.wf-config-item' ), function() {
var wf_checkbox = $( this )[0];
wf_checkbox.checked = checked;
});
},

/** Make the worflows as checked if present in the menu */
make_checked: function( self, ids_in_menu ) {
$.each(self.$el.find( '.wf-config-item' ), function() {
var wf_checkbox = $( this )[0];
_.each( ids_in_menu, function( id ) {
if ( parseInt( wf_checkbox.value ) === id ) {
wf_checkbox.checked = true;
}
});
});
},

/** Save the changes for workflow menu */
save_workflow_menu: function( self ) {
var $el_save_workflow_menu = self.$el.find( '.wf-save-menu' );
$el_save_workflow_menu.click( function( e ) {
var ids = [];
$.each(self.$el.find( '.wf-config-item' ), function() {
var wf_checkbox = $( this )[0];
if( wf_checkbox.checked || wf_checkbox.checked === 'true' ) {
ids.push( parseInt( wf_checkbox.value ) );
}
});
$.ajax({
type: 'PUT',
url: Galaxy.root + 'api/workflows/menu/',
data: JSON.stringify( { 'workflow_ids': ids } ),
contentType : 'application/json'
}).done( function( response ) {
window.location = Galaxy.root + 'workflow?status='+ response.status +'&message=' + response.message;
});
});
},

/** Template for actions buttons */
_templateActionButtons: function() {
return '<ul class="manage-table-actions">' +
'<li>' +
'<a class="fa fa-check-square-o wf-action check-all-wf" title="Select all workflows" href="#">' +
'</a>' +
'</li>' +
'<li>' +
'<a class="fa fa-square-o wf-action uncheck-all-wf" title="Unselect all workflows" href="#">' +
'</a>' +
'</li>' +
'</ul>';
},

/** Template for configure workflow table */
_templateConfigureWorkflow: function( self, workflows, ids_in_menu ) {
var tableHtml = "", trHtml = "";
tableHtml = tableHtml + '<table class="table colored"><thead>' +
'<tr class="header">' +
'<th class="wf-td">Name</th>' +
'<th class="wf-td">Owner</th>' +
'<th class="wf-td"># of Steps</th>' +
'<th class="wf-td">Show in menu</th>' +
'</tr></thead>';
_.each( workflows, function( wf ) {
trHtml = trHtml + '<tr>' +
'<td class="wf-td">' + _.escape( wf.name ) +'</td>' +
'<td>' + ( wf.owner === Galaxy.user.attributes.username ? "You" : wf.owner ) +'</td>' +
'<td class="wf-td">' + wf.number_of_steps + '</td>' +
'<td class="wf-td">' + self._templateInputCheckbox( self, wf, ids_in_menu ) + '</td>' +
'</tr>';
});
tableHtml = tableHtml + '<tbody class="workflow-config-menu">' + trHtml + '</tbody></table>';
tableHtml = tableHtml + '<a class="action-button wf-save-menu wf-action fa fa-floppy-o" href="#" title="Save">' +
'<span>Save</span>' +
'</a>' +
'<a class="action-button wf-back wf-action fa fa-arrow-left" href="'+ Galaxy.root +'workflow" title="Back to workflow">' +
'<span>Back to workflow</span>' +
'</a>';
return tableHtml;
},

/** Template for no workflow */
_templateNoWorkflow: function() {
return '<div class="wf-nodata"> You do not have any accessible workflows. </div>';
},

/** Template for checkboxes */
_templateInputCheckbox: function( self, wf ) {
return '<input type="checkbox" class="wf-config-item" name="workflow_ids" value="'+ wf.id +'" />';
},

/** Template for main config workflow menu */
_templateConfigWorkflowHeader: function() {
return '<div class="page-container">' +
'<div class="configure-workflows wf">' +
'<h2>Configure workflow menu</h2>' +
'</div>'+
'</div>';
}
});

return {
View : View
};
});
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/workflow/workflow.js
Expand Up @@ -45,7 +45,7 @@ define( [], function() {

if( message && message !== null && message !== "" ) {
$el_message.addClass( status + 'message' );
$el_message.html( '<p>' + message + '</p>' );
$el_message.html( '<p>' + _.escape(message) + '</p>' );
}
else {
$el_message.html("");
Expand Down
6 changes: 5 additions & 1 deletion client/galaxy/style/less/base.less
Expand Up @@ -1787,6 +1787,10 @@ div.toolTitleNoSection
padding-left: 1%;
}

.other-options {
.wf-back {
margin-left: 0.5%;
}

.other-options, .configure-workflows {
margin-bottom: 2%;
}

0 comments on commit b764d35

Please sign in to comment.