From 02c40bbcbe644f03ba5ea3b83d33bde895fb58e5 Mon Sep 17 00:00:00 2001 From: anuprulez Date: Sun, 30 Jul 2017 19:06:46 +0200 Subject: [PATCH] Fix review comments: removing self from multiple places and correct '>' --- .../galaxy/scripts/mvc/workflow/workflow.js | 52 +++++++++---------- static/maps/mvc/workflow/workflow.js.map | 2 +- static/maps/nls/fr/locale.js.map | 2 +- static/scripts/bundled/analysis.bundled.js | 2 +- .../scripts/bundled/analysis.bundled.js.map | 2 +- static/scripts/bundled/libs.bundled.js | 2 +- static/scripts/bundled/libs.bundled.js.map | 2 +- static/scripts/mvc/workflow/workflow.js | 2 +- static/scripts/nls/fr/locale.js | 2 +- 9 files changed, 33 insertions(+), 35 deletions(-) diff --git a/client/galaxy/scripts/mvc/workflow/workflow.js b/client/galaxy/scripts/mvc/workflow/workflow.js index 562660410a6..7a1aa2cf2a0 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow.js +++ b/client/galaxy/scripts/mvc/workflow/workflow.js @@ -1,19 +1,17 @@ /** Workflow view */ -define( [ 'utils/utils' ], function( Utils ) { +define( [ 'utils/utils', 'mvc/ui/ui-misc' ], function( Utils, Ui ) { /** Build messages after user action */ - function build_messages( self ) { - var $el_message = self.$el.find( '.response-message' ), - status = Utils.getQueryString( 'status' ), - message = Utils.getQueryString( 'message' ); - - if( message && message !== null && message !== "" ) { - $el_message.addClass( status + 'message' ); - $el_message.html( '

' + _.escape( message ) + '

' ); - } - else { - $el_message.html(""); - } + function build_messages() { + var $el_message = this.$( '.response-message' ), + response = {}; + response = { + 'status': Utils.getQueryString( 'status' ), + 'message': _.escape( Utils.getQueryString( 'message' ) ), + 'persistent': true, + 'cls': Utils.getQueryString( 'status' ) + 'message' + }; + $el_message.empty().html( new Ui.Message( response ).$el ); } /** View of the main workflow list page */ @@ -32,8 +30,8 @@ define( [ 'utils/utils' ], function( Utils ) { // Add workflow header self.$el.empty().append( self._templateHeader() ); // Add user actions message if any - build_messages( self ); - $el_workflow = self.$el.find( '.user-workflows' ); + build_messages(); + $el_workflow = self.$( '.user-workflows' ); // Add the actions buttons $el_workflow.append( self._templateActionButtons() ); if( workflows.length > 0) { @@ -41,11 +39,11 @@ define( [ 'utils/utils' ], function( Utils ) { self.adjust_actiondropdown( $el_workflow ); // Register delete and run workflow events _.each( workflows, function( wf ) { - self.confirm_delete( self, wf ); + self.confirm_delete( wf ); }); - self.register_show_tool_menu( self ); + self.register_show_tool_menu(); // Register search workflow event - self.search_workflow( self, self.$el.find( '.search-wf' ), self.$el.find( '.workflow-search tr' ), min_query_length ); + self.search_workflow( self.$( '.search-wf' ), self.$( '.workflow-search tr' ), min_query_length ); } else { $el_workflow.append( self._templateNoWorkflow() ); @@ -54,8 +52,8 @@ define( [ 'utils/utils' ], function( Utils ) { }, // Save the workflow as an item in Tool panel - register_show_tool_menu: function( self ) { - var $el_checkboxes = self.$el.find( '.show-in-tool-panel' ); + register_show_tool_menu: function() { + var $el_checkboxes = this.$( '.show-in-tool-panel' ); $el_checkboxes.on( 'click', function( e ) { var ids = []; // Look for all the checked checkboxes @@ -78,9 +76,9 @@ define( [ 'utils/utils' ], function( Utils ) { }, /** Add confirm box before removing/unsharing workflow */ - confirm_delete: function( self, workflow ) { - var $el_wf_link = self.$el.find( '.link-confirm-' + workflow.id ), - $el_shared_wf_link = self.$el.find( '.link-confirm-shared-' + workflow.id ); + confirm_delete: function( workflow ) { + var $el_wf_link = this.$( '.link-confirm-' + workflow.id ), + $el_shared_wf_link = this.$( '.link-confirm-shared-' + workflow.id ); $el_wf_link.click( function() { return confirm( "Are you sure you want to delete workflow '" + workflow.name + "'?" ); }); @@ -90,7 +88,7 @@ define( [ 'utils/utils' ], function( Utils ) { }, /** Implement client side workflow search/filtering */ - search_workflow: function( self, $el_searchinput, $el_tabletr, min_querylen ) { + search_workflow: function( $el_searchinput, $el_tabletr, min_querylen ) { $el_searchinput.on( 'keyup', function () { var query = $( this ).val(); // Filter when query is at least 3 characters @@ -156,7 +154,7 @@ define( [ 'utils/utils' ], function( Utils ) { 'Show in Tools panel' + ''; _.each( workflows, function( wf ) { - var checkbox_html = wf.show_in_tool_panel ? '' : ''; trHtml = trHtml + '' + '' + '