Skip to content

Commit

Permalink
Improve error handling, add success and warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Mar 17, 2017
1 parent 474b0c1 commit 39c9f79
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
13 changes: 9 additions & 4 deletions client/galaxy/scripts/mvc/user/user-custom-builds.js
Expand Up @@ -78,8 +78,8 @@ define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/ui/ui-tabl
help : 'Provide the data source.',
type : 'select',
value : 'file',
data : [ { value : 'fasta', label : 'FASTA-file from History' },
{ value : 'file', label : 'Len-file from History' },
data : [ { value : 'fasta', label : 'FASTA-file from history' },
{ value : 'file', label : 'Len-file from history' },
{ value : 'text', label : 'Len-file by copy/paste' } ]
},
cases : [ {
Expand Down Expand Up @@ -118,16 +118,21 @@ define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view', 'mvc/ui/ui-tabl
onclick : function() {
var data = form.data.create();
if ( !data.id || !data.name ) {
self.message.update({ message: 'All inputs are required.', status: 'danger' });
self.message.update( { message: 'All inputs are required.', status: 'danger' } );
} else {
self.collection.create( data, {
wait : true,
success : function( response ) {
if ( response.get( 'message' ) ) {
self.message.update( { message: response.get( 'message' ), status: 'warning' } );
} else {
self.message.update( { message: 'Successfully added custom build.', status: 'success' } );
}
_.each( form.field_list, function( field ) { field.value( null ) } );
},
error : function( response, err ) {
var message = err && err.responseJSON && err.responseJSON.err_msg;
self.message.update({ message: message || 'Failed to create custom build.', status: 'danger' });
self.message.update( { message: message || 'Failed to create custom build.', status: 'danger' } );
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/api/users.py
Expand Up @@ -732,7 +732,7 @@ def add_custom_builds(self, trans, id, key, payload={}, **kwd):
lines_skipped += 1
continue
if chrom != escape(chrom):
message = 'Invalid chromosome(s) with HTML detected and skipped'
build_dict[ 'message' ] = 'Invalid chromosome(s) with HTML detected and skipped'
lines_skipped += 1
continue
counter += 1
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/user/user-custom-builds.js.map

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

4 changes: 2 additions & 2 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.

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/user/user-custom-builds.js

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

0 comments on commit 39c9f79

Please sign in to comment.