mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:12:08 +08:00
redirect to new url
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/form/form-view' ], function( Utils, Ui, Form ) {
|
||||
|
||||
/** Dataset edit attributes view */
|
||||
var View = Backbone.View.extend({
|
||||
initialize: function() {
|
||||
this.setElement( '<div/>' );
|
||||
this.model = new Backbone.Model( { 'dataset_id': Galaxy.params.dataset_id } );
|
||||
this.render();
|
||||
},
|
||||
|
||||
// Fetch data for the selected dataset and
|
||||
render: function() {
|
||||
var data_url = Galaxy.root + 'api/datasets/' + this.model.get( 'dataset_id' ),
|
||||
self = this;
|
||||
|
||||
Utils.get({
|
||||
url : data_url,
|
||||
success : function( data_response ) {
|
||||
var job_url = Galaxy.root + 'api/jobs/' + data_response.creating_job + '?full=True';
|
||||
Utils.get({
|
||||
url : job_url,
|
||||
success : function( job_response ) {
|
||||
var job_url = Galaxy.root + 'api/jobs/' + data_response.creating_job + '?full=True';
|
||||
self.render_error_page( self, data_response, job_response );
|
||||
},
|
||||
error : function( response ) {
|
||||
var error_response = {
|
||||
'status': 'error',
|
||||
'message': 'Error occured while loading the job.',
|
||||
'persistent': true,
|
||||
'cls': 'errormessage'
|
||||
};
|
||||
self.display_message( error_response, self.$( '.response-message' ) );
|
||||
}
|
||||
});
|
||||
},
|
||||
error : function( response ) {
|
||||
var error_response = {
|
||||
'status': 'error',
|
||||
'message': 'Error occured while loading the dataset.',
|
||||
'persistent': true,
|
||||
'cls': 'errormessage'
|
||||
};
|
||||
self.display_message( error_response, self.$( '.response-message' ) );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** Render the view */
|
||||
render_error_page: function( self, data_response, job_response ) {
|
||||
self.$el.empty().append( self._templateHeader() );
|
||||
console.log(data_response, job_response);
|
||||
//self.display_message( message, self.$( '.response-message' ) );
|
||||
// Create all tabs
|
||||
//self.create_tabs( response, self.$( '.edit-attr' ) );
|
||||
self.$el.append('<p>An error occured while creating <b>' + data_response.name + '</b></p>');
|
||||
self.$el.append('<p>Tool execution generated the following messages:</p>');
|
||||
self.$el.append('<pre>' + job_response.stderr + '</pre>');
|
||||
self.$el.append('<h2>Report This Error</pre>');
|
||||
self.$el.append('<p>Usually the local Galaxy administrators regularly review errors that occur on the server. However, if you would like to provide additional information (such as what you were trying to do when the error occurred) and a contact e-mail address, we will be better able to investigate your problem and get back to you.</p>');
|
||||
self.$el.append(self._getBugFormTemplate());
|
||||
},
|
||||
|
||||
/** Perform AJAX post call */
|
||||
call_ajax: function( self, data, tab_name ) {
|
||||
var post_url = Galaxy.root + 'dataset/edit';
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: post_url,
|
||||
data: data,
|
||||
success: function( response ) {
|
||||
self.render_attribute_page( self, response );
|
||||
},
|
||||
error : function( response ) {
|
||||
var error_response = {
|
||||
'status': 'error',
|
||||
'message': 'Error occured while saving. Please fill all the required fields and try again.',
|
||||
'persistent': true,
|
||||
'cls': 'errormessage'
|
||||
};
|
||||
self.display_message( error_response, self.$( '.response-message' ) );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** Display actions messages */
|
||||
display_message: function( response, $el ) {
|
||||
$el.empty().html( new Ui.Message( response ).$el );
|
||||
},
|
||||
|
||||
/** Main template */
|
||||
_templateHeader: function() {
|
||||
return '<div class="page-container edit-attr">' +
|
||||
'<div class="response-message"></div>' +
|
||||
'<h2>Dataset Error</h2>' +
|
||||
'</div>';
|
||||
},
|
||||
|
||||
/** Convert tab template */
|
||||
_getBugFormTemplate: function( response ) {
|
||||
var self = this;
|
||||
var form = new Form({
|
||||
title : 'Error Report',
|
||||
inputs : [
|
||||
{
|
||||
"help": "Your email address",
|
||||
"options": [],
|
||||
"type": "text",
|
||||
"name": "email",
|
||||
"label": "Your email"
|
||||
},
|
||||
{
|
||||
"help": "Any additional comments you can provide regarding what you were doing at the time of the bug.",
|
||||
"options": [],
|
||||
"type": "text",
|
||||
"name": "email",
|
||||
"label": "Message"
|
||||
}
|
||||
],
|
||||
|
||||
operations: {
|
||||
'submit' : new Ui.ButtonIcon({
|
||||
tooltip : 'Submit the bug report.',
|
||||
title : 'Submit',
|
||||
icon : 'fa-bug',
|
||||
})
|
||||
}
|
||||
});
|
||||
return form.$el;
|
||||
},
|
||||
|
||||
/** Submit action */
|
||||
_submit: function( self, form, response, type ) {
|
||||
var form_data = form.data.create();
|
||||
form_data.dataset_id = response.dataset_id;
|
||||
switch( type ) {
|
||||
case "edit_attributes":
|
||||
form_data.save = 'Save';
|
||||
break;
|
||||
|
||||
case "auto-detect":
|
||||
form_data.detect = 'Auto-detect';
|
||||
break;
|
||||
|
||||
case "convert":
|
||||
if ( form_data.target_type !== null && form_data.target_type ) {
|
||||
form_data.dataset_id = response.dataset_id;
|
||||
form_data.convert_data = 'Convert';
|
||||
}
|
||||
break;
|
||||
|
||||
case "change":
|
||||
form_data.change = 'Save';
|
||||
break;
|
||||
|
||||
case "permissions":
|
||||
var post_data = {};
|
||||
post_data.permissions = JSON.stringify( form_data );
|
||||
post_data.update_roles_button = "Save";
|
||||
post_data.dataset_id = response.dataset_id;
|
||||
form_data = post_data;
|
||||
break;
|
||||
}
|
||||
self.call_ajax( self, form_data );
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
View : View
|
||||
};
|
||||
});
|
||||
@@ -197,7 +197,7 @@ var DatasetListItemEdit = _super.extend(
|
||||
_renderErrButton : function(){
|
||||
return faIconButton({
|
||||
title : _l( 'View or report this error' ),
|
||||
href : this.model.urls.report_error,
|
||||
href : Galaxy.root + 'datasets/error?dataset_id=' + this.model.attributes.id,
|
||||
classes : 'report-error-btn',
|
||||
target : this.linkTarget,
|
||||
faIcon : 'fa-bug'
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/** Workflow view */
|
||||
define( [ 'utils/utils' ], function( Utils ) {
|
||||
|
||||
/** 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( '<p>' + _.escape( message ) + '</p>' );
|
||||
}
|
||||
else {
|
||||
$el_message.html("");
|
||||
}
|
||||
}
|
||||
|
||||
/** View of the main workflow list page */
|
||||
var View = Backbone.View.extend({
|
||||
|
||||
initialize: function( options ) {
|
||||
var self = this;
|
||||
this.options = options;
|
||||
this.setElement( '<div/>' );
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
console.log('HI');
|
||||
var self = this;
|
||||
self.$el.empty().append( '<h1>Testing</h1>' );
|
||||
//var self = this,
|
||||
//min_query_length = 3;
|
||||
//$.getJSON( Galaxy.root + 'api/workflows/', function( workflows ) {
|
||||
//var $el_workflow = null;
|
||||
//// Add workflow header
|
||||
//// Add user actions message if any
|
||||
//build_messages( self );
|
||||
//$el_workflow = self.$el.find( '.user-workflows' );
|
||||
//// Add the actions buttons
|
||||
//$el_workflow.append( self._templateActionButtons() );
|
||||
//if( workflows.length > 0) {
|
||||
//$el_workflow.append( self._templateWorkflowTable( self, workflows) );
|
||||
//self.adjust_actiondropdown( $el_workflow );
|
||||
//// Register delete and run workflow events
|
||||
//_.each( workflows, function( wf ) {
|
||||
//self.confirm_delete( self, wf );
|
||||
//});
|
||||
//// Register search workflow event
|
||||
//self.search_workflow( self, self.$el.find( '.search-wf' ), self.$el.find( '.workflow-search tr' ), min_query_length );
|
||||
//}
|
||||
//else {
|
||||
//$el_workflow.append( self._templateNoWorkflow() );
|
||||
//}
|
||||
//});
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
View : View
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user