Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build job success messages within tool form view #2355

Merged
merged 1 commit into from
May 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions client/galaxy/scripts/mvc/tool/tool-form.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/**
This is the regular tool form.
*/
define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tool/tool-form-base', 'mvc/tool/tool-template'],
function( Utils, Ui, ToolFormBase, ToolTemplate ) {
define([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/tool/tool-form-base' ],
function( Utils, Ui, ToolFormBase ) {
var View = ToolFormBase.extend({
initialize: function( options ) {
var self = this;
ToolFormBase.prototype.initialize.call( this, Utils.merge({
customize : function( options ) {
customize: function( options ) {
// build execute button
options.buttons = {
execute : execute_btn = new Ui.Button({
execute: execute_btn = new Ui.Button({
icon : 'fa-check',
tooltip : 'Execute: ' + options.name + ' (' + options.version + ')',
title : 'Execute',
Expand Down Expand Up @@ -74,7 +74,7 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tool/tool-form-base', 'mvc/tool/to
data : job_def,
success : function( response ) {
callback && callback();
self.$el.empty().append( ToolTemplate.success( response ) );
self.$el.empty().append( self._templateSuccess( response ) );
parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.refreshContents();
},
error : function( response ) {
Expand All @@ -87,12 +87,13 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tool/tool-form-base', 'mvc/tool/to
break;
}
} else {
self.modal.show({
var modal = parent.Galaxy.modal;
modal && modal.show({
title : 'Job submission failed',
body : ( response && response.err_msg ) || ToolTemplate.error( job_def ),
body : ( response && response.err_msg ) || self._templateError( job_def ),
buttons : {
'Close' : function() {
self.modal.hide();
modal.hide();
}
}
});
Expand Down Expand Up @@ -141,6 +142,28 @@ define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tool/tool-form-base', 'mvc/tool/to
}
}
return true;
},

_templateSuccess: function( response ) {
if ( response.jobs && response.jobs.length > 0 ) {
var njobs = response.jobs.length;
var njobs_text = njobs == 1 ? '1 job has' : njobs + ' jobs have';
var $message = $( '<div/>' ).addClass( 'donemessagelarge' )
.append( $( '<p/>' ).text( njobs_text + ' been successfully added to the queue - resulting in the following datasets:' ) );
_.each( response.outputs, function( output ) {
$message.append( $( '<p/>' ).addClass( 'messagerow' ).append( $( '<b/>' ).text( output.hid + ': ' + output.name ) ) );
});
$message.append( $( '<p/>' ).append( '<b/>' ).text( 'You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from \'running\' to \'finished\' if completed successfully or \'error\' if problems were encountered.' ) );
return $message;
} else {
return this._templateError( response );
}
},

_templateError: function( response ) {
return $( '<div/>' ).addClass( 'errormessagelarge' )
.append( $( '<p/>' ).text( 'The server could not complete the request. Please contact the Galaxy Team if this error persists.' ) )
.append( $( '<pre/>' ).text( JSON.stringify( response, null, 4 ) ) );
}
});

Expand Down
3 changes: 3 additions & 0 deletions client/galaxy/style/less/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,9 @@ input[type="submit"], button {
background-image: url(error_large.png);
background-repeat: no-repeat;
background-position: 10px 8px;
.messagerow {
padding: 10px 20px;
}
}

.errormessagelarge {
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/tool/tool-form.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions static/scripts/bundled/analysis.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/analysis.bundled.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/scripts/bundled/libs.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/mvc/tool/tool-form.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/style/blue/base.css

Large diffs are not rendered by default.