mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
UI: move base-mvc, annotation and tag editors, user model and quotameter to AMD; fix loading order and currUser in masthead, view, history; remove loggable mixin from scatterplot
This commit is contained in:
@@ -29,7 +29,7 @@ todo:
|
||||
* configuring which data will be used
|
||||
* configuring the plot display
|
||||
*/
|
||||
var ScatterplotConfigEditor = Backbone.View.extend( LoggableMixin ).extend({
|
||||
var ScatterplotConfigEditor = Backbone.View.extend({
|
||||
//TODO: !should be a view on a visualization model
|
||||
//logger : console,
|
||||
className : 'scatterplot-control-form',
|
||||
@@ -39,13 +39,13 @@ var ScatterplotConfigEditor = Backbone.View.extend( LoggableMixin ).extend({
|
||||
if( !this.model ){
|
||||
this.model = new Visualization({ type: 'scatterplot' });
|
||||
}
|
||||
this.log( this + '.initialize, attributes:', attributes );
|
||||
//this.log( this + '.initialize, attributes:', attributes );
|
||||
|
||||
if( !attributes || !attributes.dataset ){
|
||||
throw new Error( "ScatterplotConfigEditor requires a dataset" );
|
||||
}
|
||||
this.dataset = attributes.dataset;
|
||||
this.log( 'dataset:', this.dataset );
|
||||
//this.log( 'dataset:', this.dataset );
|
||||
|
||||
this.display = new ScatterplotDisplay({
|
||||
dataset : attributes.dataset,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -32,7 +32,6 @@ ${h.js( 'libs/jquery/jquery',
|
||||
'libs/backbone/backbone',
|
||||
'libs/d3',
|
||||
'libs/handlebars.runtime',
|
||||
'mvc/base-mvc',
|
||||
'mvc/ui',
|
||||
'mvc/visualization/visualization-model' )}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
define([
|
||||
], function(){
|
||||
"mvc/base-mvc"
|
||||
], function( baseMVC ){
|
||||
// =============================================================================
|
||||
/** A view on any model that has a 'annotation' attribute
|
||||
*/
|
||||
var AnnotationEditor = Backbone.View.extend( LoggableMixin ).extend( HiddenUntilActivatedViewMixin ).extend({
|
||||
var AnnotationEditor = Backbone.View
|
||||
.extend( baseMVC.LoggableMixin )
|
||||
.extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({
|
||||
|
||||
tagName : 'div',
|
||||
className : 'annotation-display',
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
define([
|
||||
], function(){
|
||||
//ASSUMES: backbone
|
||||
//==============================================================================
|
||||
/** @class Mixin to add logging capabilities to an object.
|
||||
* Designed to allow switching an objects log output off/on at one central
|
||||
@@ -188,3 +191,10 @@ var HiddenUntilActivatedViewMixin = /** @lends hiddenUntilActivatedMixin# */{
|
||||
return this.HUAVOptions.showFn.apply( this.HUAVOptions.$elementShown, arguments );
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
return {
|
||||
LoggableMixin : LoggableMixin,
|
||||
SessionStorageModel : SessionStorageModel,
|
||||
HiddenUntilActivatedViewMixin : HiddenUntilActivatedViewMixin
|
||||
};});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
define([
|
||||
"mvc/dataset/hda-model"
|
||||
], function( hdaModel ){
|
||||
/* global Backbone, LoggableMixin, HistoryDatasetAssociation, HDABaseView */
|
||||
"mvc/dataset/hda-model",
|
||||
"mvc/base-mvc"
|
||||
], function( hdaModel, baseMVC ){
|
||||
/* global Backbone */
|
||||
//==============================================================================
|
||||
/** @class Read only view for HistoryDatasetAssociation.
|
||||
* @name HDABaseView
|
||||
@@ -11,7 +12,7 @@ define([
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var HDABaseView = Backbone.View.extend( LoggableMixin ).extend(
|
||||
var HDABaseView = Backbone.View.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends HDABaseView.prototype */{
|
||||
|
||||
///** logger used to record this.log messages, commonly set to console */
|
||||
|
||||
@@ -13,7 +13,7 @@ define([
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var HDAEditView = hdaBase.HDABaseView.extend( LoggableMixin ).extend(
|
||||
var HDAEditView = hdaBase.HDABaseView.extend(
|
||||
/** @lends HDAEditView.prototype */{
|
||||
|
||||
// ......................................................................... set up
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
define([
|
||||
], function(){
|
||||
"mvc/base-mvc"
|
||||
], function( baseMVC ){
|
||||
//==============================================================================
|
||||
/** @class (HDA) model for a Galaxy dataset
|
||||
* related to a history.
|
||||
@@ -10,7 +11,7 @@ define([
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var HistoryDatasetAssociation = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
var HistoryDatasetAssociation = Backbone.Model.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends HistoryDatasetAssociation.prototype */{
|
||||
|
||||
///** logger used to record this.log messages, commonly set to console */
|
||||
@@ -401,7 +402,7 @@ HistoryDatasetAssociation.NOT_READY_STATES = [
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var HDACollection = Backbone.Collection.extend( LoggableMixin ).extend(
|
||||
var HDACollection = Backbone.Collection.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends HDACollection.prototype */{
|
||||
model : HistoryDatasetAssociation,
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
define([
|
||||
"mvc/dataset/hda-edit",
|
||||
"mvc/history/history-panel"
|
||||
], function( hdaEdit, hpanel ){
|
||||
"mvc/history/history-panel",
|
||||
"mvc/base-mvc"
|
||||
], function( hdaEdit, hpanel, baseMVC ){
|
||||
// ============================================================================
|
||||
/** session storage for history panel preferences (and to maintain state)
|
||||
*/
|
||||
var HistoryPanelPrefs = SessionStorageModel.extend({
|
||||
var HistoryPanelPrefs = baseMVC.SessionStorageModel.extend({
|
||||
defaults : {
|
||||
/** is the panel currently showing the search/filter controls? */
|
||||
searching : false,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
define([
|
||||
"mvc/dataset/hda-model"
|
||||
], function( hdaModel ){
|
||||
"mvc/dataset/hda-model",
|
||||
"mvc/base-mvc"
|
||||
], function( hdaModel, baseMVC ){
|
||||
//==============================================================================
|
||||
/** @class Model for a Galaxy history resource - both a record of user
|
||||
* tool use and a collection of the datasets those tools produced.
|
||||
@@ -11,7 +12,7 @@ define([
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var History = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
var History = Backbone.Model.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends History.prototype */{
|
||||
|
||||
///** logger used to record this.log messages, commonly set to console */
|
||||
@@ -114,13 +115,6 @@ var History = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
},
|
||||
|
||||
// ........................................................................ common queries
|
||||
/** is this model already associated with a user? */
|
||||
//TODO: remove
|
||||
hasUser : function(){
|
||||
var user = this.get( 'user' );
|
||||
return !!( user && user.id );
|
||||
},
|
||||
|
||||
/** T/F is this history owned by the current user (Galaxy.currUser)
|
||||
* Note: that this will return false for an anon user even if the history is theirs.
|
||||
*/
|
||||
@@ -295,7 +289,7 @@ History.getHistoryData = function getHistoryData( historyId, options ){
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var HistoryCollection = Backbone.Collection.extend( LoggableMixin ).extend(
|
||||
var HistoryCollection = Backbone.Collection.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends HistoryCollection.prototype */{
|
||||
model : History,
|
||||
urlRoot : galaxy_config.root + 'api/histories'
|
||||
|
||||
@@ -84,7 +84,7 @@ var HistoryPanel = readonlyPanel.ReadOnlyHistoryPanel.extend(
|
||||
|
||||
$newRender.append( HistoryPanel.templates.historyPanel( this.model.toJSON() ) );
|
||||
this.$emptyMessage( $newRender ).text( this.emptyMsg );
|
||||
if( Galaxy.currUser.id && Galaxy.currUser.id === this.model.get( 'user_id' ) ){
|
||||
if( Galaxy && Galaxy.currUser && Galaxy.currUser.id && Galaxy.currUser.id === this.model.get( 'user_id' ) ){
|
||||
this._renderTags( $newRender );
|
||||
this._renderAnnotation( $newRender );
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
define([
|
||||
"mvc/history/history-model",
|
||||
"mvc/dataset/hda-base"
|
||||
], function( historyModel, hdaBase ){
|
||||
"mvc/dataset/hda-base",
|
||||
"mvc/base-mvc"
|
||||
], function( historyModel, hdaBase, baseMVC ){
|
||||
// ============================================================================
|
||||
/** session storage for individual history preferences */
|
||||
var HistoryPrefs = SessionStorageModel.extend({
|
||||
var HistoryPrefs = baseMVC.SessionStorageModel.extend({
|
||||
defaults : {
|
||||
//TODO:?? expandedHdas to array?
|
||||
expandedHdas : {},
|
||||
@@ -71,7 +72,7 @@ TODO:
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var ReadOnlyHistoryPanel = Backbone.View.extend( LoggableMixin ).extend(
|
||||
var ReadOnlyHistoryPanel = Backbone.View.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends ReadOnlyHistoryPanel.prototype */{
|
||||
|
||||
/** logger used to record this.log messages, commonly set to console */
|
||||
@@ -311,11 +312,11 @@ var ReadOnlyHistoryPanel = Backbone.View.extend( LoggableMixin ).extend(
|
||||
attributes = attributes || {};
|
||||
//this.log( 'JSONToModel:', newHistoryJSON, newHdaJSON.length, attributes );
|
||||
|
||||
// set up the new model and render
|
||||
if( Galaxy && Galaxy.currUser ){
|
||||
//TODO: global
|
||||
newHistoryJSON.user = Galaxy.currUser.toJSON();
|
||||
}
|
||||
// // set up the new model and render
|
||||
// if( Galaxy && Galaxy.currUser ){
|
||||
////TODO: global
|
||||
// newHistoryJSON.user = Galaxy.currUser.toJSON();
|
||||
// }
|
||||
var model = new historyModel.History( newHistoryJSON, newHdaJSON, attributes );
|
||||
this.setModel( model );
|
||||
return this;
|
||||
@@ -334,10 +335,10 @@ var ReadOnlyHistoryPanel = Backbone.View.extend( LoggableMixin ).extend(
|
||||
|
||||
if( model ){
|
||||
// set up the new model with user, logger, storage, events
|
||||
if( Galaxy && Galaxy.currUser ){
|
||||
//TODO: global
|
||||
model.user = Galaxy.currUser.toJSON();
|
||||
}
|
||||
// if( Galaxy && Galaxy.currUser ){
|
||||
////TODO: global
|
||||
// model.user = Galaxy.currUser.toJSON();
|
||||
// }
|
||||
this.model = model;
|
||||
if( this.logger ){
|
||||
this.model.logger = this.logger;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
define([
|
||||
], function(){
|
||||
"mvc/base-mvc"
|
||||
], function( baseMVC ){
|
||||
// =============================================================================
|
||||
/** A view on any model that has a 'tags' attribute (a list of tag strings)
|
||||
* Incorporates the select2 jQuery plugin for tags display/editing:
|
||||
* http://ivaynberg.github.io/select2/
|
||||
*/
|
||||
var TagsEditor = Backbone.View.extend( LoggableMixin ).extend( HiddenUntilActivatedViewMixin ).extend({
|
||||
var TagsEditor = Backbone.View.extend( baseMVC.LoggableMixin ).extend( baseMVC.HiddenUntilActivatedViewMixin ).extend({
|
||||
|
||||
tagName : 'div',
|
||||
className : 'tags-display',
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
define([
|
||||
"mvc/base-mvc"
|
||||
], function( baseMVC ){
|
||||
//==============================================================================
|
||||
/** @class Model for a Galaxy user (including anonymous users).
|
||||
* @name User
|
||||
*
|
||||
@@ -6,7 +10,7 @@
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var User = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
var User = Backbone.Model.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends User.prototype */{
|
||||
|
||||
///** logger used to record this.log messages, commonly set to console */
|
||||
@@ -107,8 +111,14 @@ User.getCurrentUserFromApi = function( options ){
|
||||
};
|
||||
|
||||
// (stub) collection for users (shouldn't be common unless admin UI)
|
||||
var UserCollection = Backbone.Collection.extend( LoggableMixin ).extend({
|
||||
var UserCollection = Backbone.Collection.extend( baseMVC.LoggableMixin ).extend({
|
||||
model : User,
|
||||
urlRoot : galaxy_config.root + 'api/users'
|
||||
//logger : console,
|
||||
});
|
||||
|
||||
|
||||
//==============================================================================
|
||||
return {
|
||||
User : User
|
||||
};});
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
define([
|
||||
"mvc/base-mvc"
|
||||
], function( baseMVC ){
|
||||
//==============================================================================
|
||||
/** @class View to display a user's disk/storage usage
|
||||
* either as a progress bar representing the percentage of a quota used
|
||||
* or a simple text element displaying the human readable size used.
|
||||
@@ -8,7 +12,7 @@
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var UserQuotaMeter = Backbone.View.extend( LoggableMixin ).extend(
|
||||
var UserQuotaMeter = Backbone.View.extend( baseMVC.LoggableMixin ).extend(
|
||||
/** @lends UserQuotaMeter.prototype */{
|
||||
|
||||
///** logger used to record this.log messages, commonly set to console */
|
||||
@@ -149,3 +153,9 @@ var UserQuotaMeter = Backbone.View.extend( LoggableMixin ).extend(
|
||||
return 'UserQuotaMeter(' + this.model + ')';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//==============================================================================
|
||||
return {
|
||||
UserQuotaMeter : UserQuotaMeter
|
||||
};});
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
/** @class Model for a saved Galaxy visualization.
|
||||
*
|
||||
* @augments Backbone.Model
|
||||
* @borrows LoggableMixin#logger as #logger
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var Visualization = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
var Visualization = Backbone.Model.extend(
|
||||
/** @lends Visualization.prototype */{
|
||||
|
||||
///** logger used to record this.log messages, commonly set to console */
|
||||
@@ -31,7 +29,7 @@ var Visualization = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
* @see Backbone.Model#initialize
|
||||
*/
|
||||
initialize : function( data ){
|
||||
this.log( this + '.initialize', data, this.attributes );
|
||||
//this.log( this + '.initialize', data, this.attributes );
|
||||
|
||||
// munge config sub-object here since bbone won't handle defaults with this
|
||||
if( _.isObject( data.config ) && _.isObject( this.defaults.config ) ){
|
||||
@@ -84,7 +82,7 @@ var Visualization = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
* @borrows LoggableMixin#log as #log
|
||||
* @constructs
|
||||
*/
|
||||
var VisualizationCollection = Backbone.Collection.extend( LoggableMixin ).extend(
|
||||
var VisualizationCollection = Backbone.Collection.extend(
|
||||
/** @lends VisualizationCollection.prototype */{
|
||||
model : Visualization,
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
define([],function(){var a=Backbone.View.extend(LoggableMixin).extend(HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(b){b=b||{};this.tooltipConfig=b.tooltipConfig||{placement:"bottom"};this.listenTo(this.model,"change:annotation",function(){this.render()});this.hiddenUntilActivated(b.$activator,b)},render:function(){var b=this;this.$el.html(this._template());this.$el.find("[title]").tooltip(this.tooltipConfig);this.$annotation().make_text_editable({use_textarea:true,on_finish:function(c){b.$annotation().text(c);b.model.save({annotation:c},{silent:true}).fail(function(){b.$annotation().text(b.model.previous("annotation"))})}});return this},_template:function(){var b=this.model.get("annotation");return['<label class="prompt">',_l("Annotation"),"</label>",'<div class="annotation" title="',_l("Edit annotation"),'">',b,"</div>"].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off();this.stopListening(this.model);Backbone.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",this.model+"",")"].join("")}});return{AnnotationEditor:a}});
|
||||
define(["mvc/base-mvc"],function(a){var b=Backbone.View.extend(a.LoggableMixin).extend(a.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"annotation-display",initialize:function(c){c=c||{};this.tooltipConfig=c.tooltipConfig||{placement:"bottom"};this.listenTo(this.model,"change:annotation",function(){this.render()});this.hiddenUntilActivated(c.$activator,c)},render:function(){var c=this;this.$el.html(this._template());this.$el.find("[title]").tooltip(this.tooltipConfig);this.$annotation().make_text_editable({use_textarea:true,on_finish:function(d){c.$annotation().text(d);c.model.save({annotation:d},{silent:true}).fail(function(){c.$annotation().text(c.model.previous("annotation"))})}});return this},_template:function(){var c=this.model.get("annotation");return['<label class="prompt">',_l("Annotation"),"</label>",'<div class="annotation" title="',_l("Edit annotation"),'">',c,"</div>"].join("")},$annotation:function(){return this.$el.find(".annotation")},remove:function(){this.$annotation.off();this.stopListening(this.model);Backbone.View.prototype.remove.call(this)},toString:function(){return["AnnotationEditor(",this.model+"",")"].join("")}});return{AnnotationEditor:b}});
|
||||
@@ -1 +1 @@
|
||||
var LoggableMixin={logger:null,log:function(){if(this.logger){var a=this.logger.log;if(typeof this.logger.log==="object"){a=Function.prototype.bind.call(this.logger.log,this.logger)}return a.apply(this.logger,arguments)}return undefined}};var SessionStorageModel=Backbone.Model.extend({initialize:function(b){b.id=(!_.isString(b.id))?(_.uniqueId()):(b.id);this.id=b.id;var a=(!this.isNew())?(this._read(this)):({});this.clear({silent:true});this.save(_.extend({},this.defaults,a,b),{silent:true});this.on("change",function(){this.save()})},sync:function(d,b,a){if(!a.silent){b.trigger("request",b,{},a)}var c;switch(d){case"create":c=this._create(b);break;case"read":c=this._read(b);break;case"update":c=this._update(b);break;case"delete":c=this._delete(b);break}if(c!==undefined||c!==null){if(a.success){a.success()}}else{if(a.error){a.error()}}return c},_create:function(a){var b=a.toJSON(),c=sessionStorage.setItem(a.id,JSON.stringify(b));return(c===null)?(c):(b)},_read:function(a){return JSON.parse(sessionStorage.getItem(a.id))},_update:function(a){return a._create(a)},_delete:function(a){return sessionStorage.removeItem(a.id)},isNew:function(){return !sessionStorage.hasOwnProperty(this.id)},_log:function(){return JSON.stringify(this.toJSON(),null," ")},toString:function(){return"SessionStorageModel("+this.id+")"}});(function(){SessionStorageModel.prototype=_.omit(SessionStorageModel.prototype,"url","urlRoot")}());var HiddenUntilActivatedViewMixin={hiddenUntilActivated:function(a,c){c=c||{};this.HUAVOptions={$elementShown:this.$el,showFn:jQuery.prototype.toggle,showSpeed:"fast"};_.extend(this.HUAVOptions,c||{});this.HUAVOptions.hasBeenShown=this.HUAVOptions.$elementShown.is(":visible");this.hidden=this.isHidden();if(a){var b=this;a.on("click",function(d){b.toggle(b.HUAVOptions.showSpeed)})}},isHidden:function(){return(this.HUAVOptions.$elementShown.is(":hidden"))},toggle:function(){if(this.hidden){if(!this.HUAVOptions.hasBeenShown){if(_.isFunction(this.HUAVOptions.onshowFirstTime)){this.HUAVOptions.hasBeenShown=true;this.HUAVOptions.onshowFirstTime.call(this)}}if(_.isFunction(this.HUAVOptions.onshow)){this.HUAVOptions.onshow.call(this);this.trigger("hiddenUntilActivated:shown",this)}this.hidden=false}else{if(_.isFunction(this.HUAVOptions.onhide)){this.HUAVOptions.onhide.call(this);this.trigger("hiddenUntilActivated:hidden",this)}this.hidden=true}return this.HUAVOptions.showFn.apply(this.HUAVOptions.$elementShown,arguments)}};
|
||||
define([],function(){var c={logger:null,log:function(){if(this.logger){var d=this.logger.log;if(typeof this.logger.log==="object"){d=Function.prototype.bind.call(this.logger.log,this.logger)}return d.apply(this.logger,arguments)}return undefined}};var a=Backbone.Model.extend({initialize:function(e){e.id=(!_.isString(e.id))?(_.uniqueId()):(e.id);this.id=e.id;var d=(!this.isNew())?(this._read(this)):({});this.clear({silent:true});this.save(_.extend({},this.defaults,d,e),{silent:true});this.on("change",function(){this.save()})},sync:function(g,e,d){if(!d.silent){e.trigger("request",e,{},d)}var f;switch(g){case"create":f=this._create(e);break;case"read":f=this._read(e);break;case"update":f=this._update(e);break;case"delete":f=this._delete(e);break}if(f!==undefined||f!==null){if(d.success){d.success()}}else{if(d.error){d.error()}}return f},_create:function(d){var e=d.toJSON(),f=sessionStorage.setItem(d.id,JSON.stringify(e));return(f===null)?(f):(e)},_read:function(d){return JSON.parse(sessionStorage.getItem(d.id))},_update:function(d){return d._create(d)},_delete:function(d){return sessionStorage.removeItem(d.id)},isNew:function(){return !sessionStorage.hasOwnProperty(this.id)},_log:function(){return JSON.stringify(this.toJSON(),null," ")},toString:function(){return"SessionStorageModel("+this.id+")"}});(function(){a.prototype=_.omit(a.prototype,"url","urlRoot")}());var b={hiddenUntilActivated:function(d,f){f=f||{};this.HUAVOptions={$elementShown:this.$el,showFn:jQuery.prototype.toggle,showSpeed:"fast"};_.extend(this.HUAVOptions,f||{});this.HUAVOptions.hasBeenShown=this.HUAVOptions.$elementShown.is(":visible");this.hidden=this.isHidden();if(d){var e=this;d.on("click",function(g){e.toggle(e.HUAVOptions.showSpeed)})}},isHidden:function(){return(this.HUAVOptions.$elementShown.is(":hidden"))},toggle:function(){if(this.hidden){if(!this.HUAVOptions.hasBeenShown){if(_.isFunction(this.HUAVOptions.onshowFirstTime)){this.HUAVOptions.hasBeenShown=true;this.HUAVOptions.onshowFirstTime.call(this)}}if(_.isFunction(this.HUAVOptions.onshow)){this.HUAVOptions.onshow.call(this);this.trigger("hiddenUntilActivated:shown",this)}this.hidden=false}else{if(_.isFunction(this.HUAVOptions.onhide)){this.HUAVOptions.onhide.call(this);this.trigger("hiddenUntilActivated:hidden",this)}this.hidden=true}return this.HUAVOptions.showFn.apply(this.HUAVOptions.$elementShown,arguments)}};return{LoggableMixin:c,SessionStorageModel:a,HiddenUntilActivatedViewMixin:b}});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
define(["mvc/dataset/hda-edit","mvc/history/history-panel"],function(b,e){var c=SessionStorageModel.extend({defaults:{searching:false,tagsEditorShown:false,annotationEditorShown:false},toString:function(){return"HistoryPanelPrefs("+JSON.stringify(this.toJSON())+")"}});c.storageKey=function d(){return("history-panel")};var a=e.HistoryPanel.extend({HDAViewClass:b.HDAEditView,emptyMsg:_l("This history is empty. Click 'Get Data' on the left tool menu to start"),noneFoundMsg:_l("No matching datasets found"),initialize:function(f){f=f||{};this.preferences=new c(_.extend({id:c.storageKey()},_.pick(f,_.keys(c.prototype.defaults))));e.HistoryPanel.prototype.initialize.call(this,f)},loadCurrentHistory:function(g){var f=this;return this.loadHistoryWithHDADetails("current",g).then(function(i,h){f.trigger("current-history",f)})},switchToHistory:function(i,h){var f=this,g=function(){return jQuery.post(galaxy_config.root+"api/histories/"+i+"/set_as_current")};return this.loadHistoryWithHDADetails(i,h,g).then(function(k,j){f.trigger("switched-history",f)})},createNewHistory:function(h){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",_l("You must be logged in to create histories"));return $.when()}var f=this,g=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,h,g).then(function(j,i){f.trigger("new-history",f)})},setModel:function(g,f,h){e.HistoryPanel.prototype.setModel.call(this,g,f,h);if(this.model){this.log("checking for updates");this.model.checkForUpdates()}return this},_setUpModelEventHandlers:function(){e.HistoryPanel.prototype._setUpModelEventHandlers.call(this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("state:ready",function(g,h,f){if((!g.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[g.id])}},this)},render:function(h,i){h=(h===undefined)?(this.fxSpeed):(h);var f=this,g;if(this.model){g=this.renderModel()}else{g=this.renderWithoutModel()}$(f).queue("fx",[function(j){if(h&&f.$el.is(":visible")){f.$el.fadeOut(h,j)}else{j()}},function(j){f.$el.empty();if(g){f.$el.append(g.children());f.renderBasedOnPrefs()}j()},function(j){if(h&&!f.$el.is(":visible")){f.$el.fadeIn(h,j)}else{j()}},function(j){if(i){i.call(this)}f.trigger("rendered",this);j()}]);return this},renderBasedOnPrefs:function(){if(this.preferences.get("searching")){this.toggleSearchControls(0,true)}},_renderEmptyMsg:function(h){var g=this,f=g.$emptyMessage(h),i=$(".toolMenuContainer");if((_.isEmpty(g.hdaViews)&&!g.searchFor)&&(Galaxy&&Galaxy.upload&&i.size())){f.empty();f.html([_l("This history is empty. "),_l("You can "),'<a class="uploader-link" href="javascript:void(0)">',_l("load your own data"),"</a>",_l(" or "),'<a class="get-data-link" href="javascript:void(0)">',_l("get data from an external source"),"</a>"].join(""));f.find(".uploader-link").click(function(j){Galaxy.upload._eventShow(j)});f.find(".get-data-link").click(function(j){i.parent().scrollTop(0);i.find('span:contains("Get Data")').click()});f.show()}else{e.HistoryPanel.prototype._renderEmptyMsg.call(this,h)}return this},toggleSearchControls:function(g,f){var h=e.HistoryPanel.prototype.toggleSearchControls.call(this,g,f);this.preferences.set("searching",h)},_renderTags:function(f){var g=this;e.HistoryPanel.prototype._renderTags.call(this,f);if(this.preferences.get("tagsEditorShown")){this.tagsEditor.toggle(true)}this.tagsEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(h){g.preferences.set("tagsEditorShown",h.hidden)})},_renderAnnotation:function(f){var g=this;e.HistoryPanel.prototype._renderAnnotation.call(this,f);if(this.preferences.get("annotationEditorShown")){this.annotationEditor.toggle(true)}this.annotationEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(h){g.preferences.set("annotationEditorShown",h.hidden)})},connectToQuotaMeter:function(f){if(!f){return this}this.listenTo(f,"quota:over",this.showQuotaMessage);this.listenTo(f,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(f&&f.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var f=this.$el.find(".quota-message");if(f.is(":hidden")){f.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var f=this.$el.find(".quota-message");if(!f.is(":hidden")){f.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(f){if(!f){return this}this.on("new-storage",function(h,g){if(f&&h){f.findItemByHtml(_l("Include Deleted Datasets")).checked=h.get("show_deleted");f.findItemByHtml(_l("Include Hidden Datasets")).checked=h.get("show_hidden")}});return this},toString:function(){return"CurrentHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{CurrentHistoryPanel:a}});
|
||||
define(["mvc/dataset/hda-edit","mvc/history/history-panel","mvc/base-mvc"],function(b,f,c){var d=c.SessionStorageModel.extend({defaults:{searching:false,tagsEditorShown:false,annotationEditorShown:false},toString:function(){return"HistoryPanelPrefs("+JSON.stringify(this.toJSON())+")"}});d.storageKey=function e(){return("history-panel")};var a=f.HistoryPanel.extend({HDAViewClass:b.HDAEditView,emptyMsg:_l("This history is empty. Click 'Get Data' on the left tool menu to start"),noneFoundMsg:_l("No matching datasets found"),initialize:function(g){g=g||{};this.preferences=new d(_.extend({id:d.storageKey()},_.pick(g,_.keys(d.prototype.defaults))));f.HistoryPanel.prototype.initialize.call(this,g)},loadCurrentHistory:function(h){var g=this;return this.loadHistoryWithHDADetails("current",h).then(function(j,i){g.trigger("current-history",g)})},switchToHistory:function(j,i){var g=this,h=function(){return jQuery.post(galaxy_config.root+"api/histories/"+j+"/set_as_current")};return this.loadHistoryWithHDADetails(j,i,h).then(function(l,k){g.trigger("switched-history",g)})},createNewHistory:function(i){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",_l("You must be logged in to create histories"));return $.when()}var g=this,h=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,i,h).then(function(k,j){g.trigger("new-history",g)})},setModel:function(h,g,i){f.HistoryPanel.prototype.setModel.call(this,h,g,i);if(this.model){this.log("checking for updates");this.model.checkForUpdates()}return this},_setUpModelEventHandlers:function(){f.HistoryPanel.prototype._setUpModelEventHandlers.call(this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("state:ready",function(h,i,g){if((!h.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[h.id])}},this)},render:function(i,j){i=(i===undefined)?(this.fxSpeed):(i);var g=this,h;if(this.model){h=this.renderModel()}else{h=this.renderWithoutModel()}$(g).queue("fx",[function(k){if(i&&g.$el.is(":visible")){g.$el.fadeOut(i,k)}else{k()}},function(k){g.$el.empty();if(h){g.$el.append(h.children());g.renderBasedOnPrefs()}k()},function(k){if(i&&!g.$el.is(":visible")){g.$el.fadeIn(i,k)}else{k()}},function(k){if(j){j.call(this)}g.trigger("rendered",this);k()}]);return this},renderBasedOnPrefs:function(){if(this.preferences.get("searching")){this.toggleSearchControls(0,true)}},_renderEmptyMsg:function(i){var h=this,g=h.$emptyMessage(i),j=$(".toolMenuContainer");if((_.isEmpty(h.hdaViews)&&!h.searchFor)&&(Galaxy&&Galaxy.upload&&j.size())){g.empty();g.html([_l("This history is empty. "),_l("You can "),'<a class="uploader-link" href="javascript:void(0)">',_l("load your own data"),"</a>",_l(" or "),'<a class="get-data-link" href="javascript:void(0)">',_l("get data from an external source"),"</a>"].join(""));g.find(".uploader-link").click(function(k){Galaxy.upload._eventShow(k)});g.find(".get-data-link").click(function(k){j.parent().scrollTop(0);j.find('span:contains("Get Data")').click()});g.show()}else{f.HistoryPanel.prototype._renderEmptyMsg.call(this,i)}return this},toggleSearchControls:function(h,g){var i=f.HistoryPanel.prototype.toggleSearchControls.call(this,h,g);this.preferences.set("searching",i)},_renderTags:function(g){var h=this;f.HistoryPanel.prototype._renderTags.call(this,g);if(this.preferences.get("tagsEditorShown")){this.tagsEditor.toggle(true)}this.tagsEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(i){h.preferences.set("tagsEditorShown",i.hidden)})},_renderAnnotation:function(g){var h=this;f.HistoryPanel.prototype._renderAnnotation.call(this,g);if(this.preferences.get("annotationEditorShown")){this.annotationEditor.toggle(true)}this.annotationEditor.on("hiddenUntilActivated:shown hiddenUntilActivated:hidden",function(i){h.preferences.set("annotationEditorShown",i.hidden)})},connectToQuotaMeter:function(g){if(!g){return this}this.listenTo(g,"quota:over",this.showQuotaMessage);this.listenTo(g,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(g&&g.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var g=this.$el.find(".quota-message");if(g.is(":hidden")){g.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var g=this.$el.find(".quota-message");if(!g.is(":hidden")){g.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(g){if(!g){return this}this.on("new-storage",function(i,h){if(g&&i){g.findItemByHtml(_l("Include Deleted Datasets")).checked=i.get("show_deleted");g.findItemByHtml(_l("Include Hidden Datasets")).checked=i.get("show_hidden")}});return this},toString:function(){return"CurrentHistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});return{CurrentHistoryPanel:a}});
|
||||
@@ -1 +1 @@
|
||||
define(["mvc/dataset/hda-model"],function(a){var c=Backbone.Model.extend(LoggableMixin).extend({defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",diskSize:0,deleted:false},urlRoot:galaxy_config.root+"api/histories",renameUrl:function(){var e=this.get("id");if(!e){return undefined}return galaxy_config.root+"history/rename_async?id="+this.get("id")},annotateUrl:function(){var e=this.get("id");if(!e){return undefined}return galaxy_config.root+"history/annotate_async?id="+this.get("id")},tagUrl:function(){var e=this.get("id");if(!e){return undefined}return galaxy_config.root+"tag/get_tagging_elt_async?item_id="+this.get("id")+"&item_class=History"},initialize:function(f,g,e){e=e||{};this.logger=e.logger||null;this.log(this+".initialize:",f,g,e);this.hdas=new a.HDACollection(g||[],{historyId:this.get("id")});if(g&&_.isArray(g)){this.hdas.reset(g)}this._setUpListeners();this.updateTimeoutId=null},_setUpListeners:function(){this.on("error",function(f,i,e,h,g){this.errorHandler(f,i,e,h,g)});if(this.hdas){this.listenTo(this.hdas,"error",function(){this.trigger.apply(this,["error:hdas"].concat(jQuery.makeArray(arguments)))})}this.on("change:id",function(f,e){if(this.hdas){this.hdas.historyId=e}},this)},errorHandler:function(f,i,e,h,g){this.clearUpdateTimeout()},hasUser:function(){var e=this.get("user");return !!(e&&e.id)},ownedByCurrUser:function(){if(!Galaxy||!Galaxy.currUser){return false}if(Galaxy.currUser.isAnonymous()||Galaxy.currUser.id!==this.get("user_id")){return false}return true},hdaCount:function(){return _.reduce(_.values(this.get("state_details")),function(e,f){return e+f},0)},checkForUpdates:function(e){if(this.hdas.running().length){this.setUpdateTimeout()}else{this.trigger("ready");if(_.isFunction(e)){e.call(this)}}return this},setUpdateTimeout:function(e){e=e||c.UPDATE_DELAY;var f=this;this.clearUpdateTimeout();this.updateTimeoutId=setTimeout(function(){f.refresh()},e);return this.updateTimeoutId},clearUpdateTimeout:function(){if(this.updateTimeoutId){clearTimeout(this.updateTimeoutId);this.updateTimeoutId=null}},refresh:function(f,e){f=f||[];e=e||{};var g=this;e.data=e.data||{};if(f.length){e.data.details=f.join(",")}var h=this.hdas.fetch(e);h.done(function(i){g.checkForUpdates(function(){this.fetch()})});return h},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}});c.UPDATE_DELAY=4000;c.getHistoryData=function d(f,p){p=p||{};var j=p.hdaDetailIds||[];var l=jQuery.Deferred(),k=null;function g(q){return jQuery.ajax(galaxy_config.root+"api/histories/"+f)}function e(q){if(!q||!q.state_ids){return 0}return _.reduce(q.state_ids,function(r,t,s){return r+t.length},0)}function o(r){if(!e(r)){return[]}if(_.isFunction(j)){j=j(r)}var q=(j.length)?({details:j.join(",")}):({});return jQuery.ajax(galaxy_config.root+"api/histories/"+r.id+"/contents",{data:q})}var n=p.historyFn||g,m=p.hdaFn||o;var i=n(f);i.done(function(q){k=q;l.notify({status:"history data retrieved",historyJSON:k})});i.fail(function(s,q,r){l.reject(s,"loading the history")});var h=i.then(m);h.then(function(q){l.notify({status:"dataset data retrieved",historyJSON:k,hdaJSON:q});l.resolve(k,q)});h.fail(function(s,q,r){l.reject(s,"loading the datasets",{history:k})});return l};var b=Backbone.Collection.extend(LoggableMixin).extend({model:c,urlRoot:galaxy_config.root+"api/histories"});return{History:c,HistoryCollection:b}});
|
||||
define(["mvc/dataset/hda-model","mvc/base-mvc"],function(b,a){var d=Backbone.Model.extend(a.LoggableMixin).extend({defaults:{model_class:"History",id:null,name:"Unnamed History",state:"new",diskSize:0,deleted:false},urlRoot:galaxy_config.root+"api/histories",renameUrl:function(){var f=this.get("id");if(!f){return undefined}return galaxy_config.root+"history/rename_async?id="+this.get("id")},annotateUrl:function(){var f=this.get("id");if(!f){return undefined}return galaxy_config.root+"history/annotate_async?id="+this.get("id")},tagUrl:function(){var f=this.get("id");if(!f){return undefined}return galaxy_config.root+"tag/get_tagging_elt_async?item_id="+this.get("id")+"&item_class=History"},initialize:function(g,h,f){f=f||{};this.logger=f.logger||null;this.log(this+".initialize:",g,h,f);this.hdas=new b.HDACollection(h||[],{historyId:this.get("id")});if(h&&_.isArray(h)){this.hdas.reset(h)}this._setUpListeners();this.updateTimeoutId=null},_setUpListeners:function(){this.on("error",function(g,j,f,i,h){this.errorHandler(g,j,f,i,h)});if(this.hdas){this.listenTo(this.hdas,"error",function(){this.trigger.apply(this,["error:hdas"].concat(jQuery.makeArray(arguments)))})}this.on("change:id",function(g,f){if(this.hdas){this.hdas.historyId=f}},this)},errorHandler:function(g,j,f,i,h){this.clearUpdateTimeout()},ownedByCurrUser:function(){if(!Galaxy||!Galaxy.currUser){return false}if(Galaxy.currUser.isAnonymous()||Galaxy.currUser.id!==this.get("user_id")){return false}return true},hdaCount:function(){return _.reduce(_.values(this.get("state_details")),function(f,g){return f+g},0)},checkForUpdates:function(f){if(this.hdas.running().length){this.setUpdateTimeout()}else{this.trigger("ready");if(_.isFunction(f)){f.call(this)}}return this},setUpdateTimeout:function(f){f=f||d.UPDATE_DELAY;var g=this;this.clearUpdateTimeout();this.updateTimeoutId=setTimeout(function(){g.refresh()},f);return this.updateTimeoutId},clearUpdateTimeout:function(){if(this.updateTimeoutId){clearTimeout(this.updateTimeoutId);this.updateTimeoutId=null}},refresh:function(g,f){g=g||[];f=f||{};var h=this;f.data=f.data||{};if(g.length){f.data.details=g.join(",")}var i=this.hdas.fetch(f);i.done(function(j){h.checkForUpdates(function(){this.fetch()})});return i},toString:function(){return"History("+this.get("id")+","+this.get("name")+")"}});d.UPDATE_DELAY=4000;d.getHistoryData=function e(g,q){q=q||{};var k=q.hdaDetailIds||[];var m=jQuery.Deferred(),l=null;function h(r){return jQuery.ajax(galaxy_config.root+"api/histories/"+g)}function f(r){if(!r||!r.state_ids){return 0}return _.reduce(r.state_ids,function(s,u,t){return s+u.length},0)}function p(s){if(!f(s)){return[]}if(_.isFunction(k)){k=k(s)}var r=(k.length)?({details:k.join(",")}):({});return jQuery.ajax(galaxy_config.root+"api/histories/"+s.id+"/contents",{data:r})}var o=q.historyFn||h,n=q.hdaFn||p;var j=o(g);j.done(function(r){l=r;m.notify({status:"history data retrieved",historyJSON:l})});j.fail(function(t,r,s){m.reject(t,"loading the history")});var i=j.then(n);i.then(function(r){m.notify({status:"dataset data retrieved",historyJSON:l,hdaJSON:r});m.resolve(l,r)});i.fail(function(t,r,s){m.reject(t,"loading the datasets",{history:l})});return m};var c=Backbone.Collection.extend(a.LoggableMixin).extend({model:d,urlRoot:galaxy_config.root+"api/histories"});return{History:d,HistoryCollection:c}});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
define([],function(){var a=Backbone.View.extend(LoggableMixin).extend(HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",initialize:function(b){this.listenTo(this.model,"change:tags",function(){this.render()});this.hiddenUntilActivated(b.$activator,b)},render:function(){var b=this;this.$el.html(this._template());this.$input().select2({placeholder:"Add tags",width:"100%",tags:function(){return b._getTagsUsed()}});this._setUpBehaviors();return this},_template:function(){return['<label class="prompt">',_l("Tags"),"</label>",'<input class="tags-input" value="',this.tagsToCSV(),'" />'].join("")},tagsToCSV:function(){var b=this.model.get("tags");if(!_.isArray(b)||_.isEmpty(b)){return""}return b.sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){return Galaxy.currUser.get("tags_used")},_setUpBehaviors:function(){var b=this;this.$input().on("change",function(c){b.model.save({tags:c.val},{silent:true});if(c.added){b._addNewTagToTagsUsed(c.added.text+"")}})},_addNewTagToTagsUsed:function(b){var c=Galaxy.currUser.get("tags_used");if(!_.contains(c,b)){c.push(b);c.sort();Galaxy.currUser.set("tags_used",c)}},remove:function(){this.$input.off();this.stopListening(this.model);Backbone.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",this.model+"",")"].join("")}});return{TagsEditor:a}});
|
||||
define(["mvc/base-mvc"],function(a){var b=Backbone.View.extend(a.LoggableMixin).extend(a.HiddenUntilActivatedViewMixin).extend({tagName:"div",className:"tags-display",initialize:function(c){this.listenTo(this.model,"change:tags",function(){this.render()});this.hiddenUntilActivated(c.$activator,c)},render:function(){var c=this;this.$el.html(this._template());this.$input().select2({placeholder:"Add tags",width:"100%",tags:function(){return c._getTagsUsed()}});this._setUpBehaviors();return this},_template:function(){return['<label class="prompt">',_l("Tags"),"</label>",'<input class="tags-input" value="',this.tagsToCSV(),'" />'].join("")},tagsToCSV:function(){var c=this.model.get("tags");if(!_.isArray(c)||_.isEmpty(c)){return""}return c.sort().join(",")},$input:function(){return this.$el.find("input.tags-input")},_getTagsUsed:function(){return Galaxy.currUser.get("tags_used")},_setUpBehaviors:function(){var c=this;this.$input().on("change",function(d){c.model.save({tags:d.val},{silent:true});if(d.added){c._addNewTagToTagsUsed(d.added.text+"")}})},_addNewTagToTagsUsed:function(c){var d=Galaxy.currUser.get("tags_used");if(!_.contains(d,c)){d.push(c);d.sort();Galaxy.currUser.set("tags_used",d)}},remove:function(){this.$input.off();this.stopListening(this.model);Backbone.View.prototype.remove.call(this)},toString:function(){return["TagsEditor(",this.model+"",")"].join("")}});return{TagsEditor:b}});
|
||||
@@ -1 +1 @@
|
||||
var User=Backbone.Model.extend(LoggableMixin).extend({urlRoot:galaxy_config.root+"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null},initialize:function(a){this.log("User.initialize:",a);this.on("loaded",function(b,c){this.log(this+" has loaded:",b,c)});this.on("change",function(b,c){this.log(this+" has changed:",b,c.changes)})},isAnonymous:function(){return(!this.get("email"))},loadFromApi:function(d,b){d=d||User.CURRENT_ID_STR;b=b||{};var a=this,c=b.success;b.success=function(f,e){a.trigger("loaded",f,e);if(c){c(f,e)}};if(d===User.CURRENT_ID_STR){b.url=this.urlRoot+"/"+User.CURRENT_ID_STR}return Backbone.Model.prototype.fetch.call(this,b)},clearSessionStorage:function(){for(var a in sessionStorage){if(a.indexOf("history:")===0){sessionStorage.removeItem(a)}else{if(a==="history-panel"){sessionStorage.removeItem(a)}}}},toString:function(){var a=[this.get("username")];if(this.get("id")){a.unshift(this.get("id"));a.push(this.get("email"))}return"User("+a.join(":")+")"}});User.CURRENT_ID_STR="current";User.getCurrentUserFromApi=function(b){var a=new User();a.loadFromApi(User.CURRENT_ID_STR,b);return a};var UserCollection=Backbone.Collection.extend(LoggableMixin).extend({model:User,urlRoot:galaxy_config.root+"api/users"});
|
||||
define(["mvc/base-mvc"],function(a){var c=Backbone.Model.extend(a.LoggableMixin).extend({urlRoot:galaxy_config.root+"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null},initialize:function(d){this.log("User.initialize:",d);this.on("loaded",function(e,f){this.log(this+" has loaded:",e,f)});this.on("change",function(e,f){this.log(this+" has changed:",e,f.changes)})},isAnonymous:function(){return(!this.get("email"))},loadFromApi:function(g,e){g=g||c.CURRENT_ID_STR;e=e||{};var d=this,f=e.success;e.success=function(i,h){d.trigger("loaded",i,h);if(f){f(i,h)}};if(g===c.CURRENT_ID_STR){e.url=this.urlRoot+"/"+c.CURRENT_ID_STR}return Backbone.Model.prototype.fetch.call(this,e)},clearSessionStorage:function(){for(var d in sessionStorage){if(d.indexOf("history:")===0){sessionStorage.removeItem(d)}else{if(d==="history-panel"){sessionStorage.removeItem(d)}}}},toString:function(){var d=[this.get("username")];if(this.get("id")){d.unshift(this.get("id"));d.push(this.get("email"))}return"User("+d.join(":")+")"}});c.CURRENT_ID_STR="current";c.getCurrentUserFromApi=function(e){var d=new c();d.loadFromApi(c.CURRENT_ID_STR,e);return d};var b=Backbone.Collection.extend(a.LoggableMixin).extend({model:c,urlRoot:galaxy_config.root+"api/users"});return{User:c}});
|
||||
@@ -1 +1 @@
|
||||
var UserQuotaMeter=Backbone.View.extend(LoggableMixin).extend({options:{warnAtPercent:85,errorAtPercent:100},initialize:function(a){this.log(this+".initialize:",a);_.extend(this.options,a);this.model.bind("change:quota_percent change:total_disk_usage",this.render,this)},update:function(a){this.log(this+" updating user data...",a);this.model.loadFromApi(this.model.get("id"),a);return this},isOverQuota:function(){return(this.model.get("quota_percent")!==null&&this.model.get("quota_percent")>=this.options.errorAtPercent)},_render_quota:function(){var a=this.model.toJSON(),c=a.quota_percent,b=$(this._templateQuotaMeter(a)),d=b.find(".progress-bar");if(this.isOverQuota()){d.attr("class","progress-bar progress-bar-danger");b.find(".quota-meter-text").css("color","white");this.trigger("quota:over",a)}else{if(c>=this.options.warnAtPercent){d.attr("class","progress-bar progress-bar-warning");this.trigger("quota:under quota:under:approaching",a)}else{d.attr("class","progress-bar progress-bar-success");this.trigger("quota:under quota:under:ok",a)}}return b},_render_usage:function(){var a=$(this._templateUsage(this.model.toJSON()));this.log(this+".rendering usage:",a);return a},render:function(){var a=null;this.log(this+".model.quota_percent:",this.model.get("quota_percent"));if((this.model.get("quota_percent")===null)||(this.model.get("quota_percent")===undefined)){a=this._render_usage()}else{a=this._render_quota()}this.$el.html(a);this.$el.find(".quota-meter-text").tooltip();return this},_templateQuotaMeter:function(a){return['<div id="quota-meter" class="quota-meter progress">','<div class="progress-bar" style="width: ',a.quota_percent,'%"></div>','<div class="quota-meter-text" style="top: 6px"',((a.nice_total_disk_usage)?(' title="Using '+a.nice_total_disk_usage+'">'):(">")),_l("Using")," ",a.quota_percent,"%","</div>","</div>"].join("")},_templateUsage:function(a){return['<div id="quota-meter" class="quota-meter" style="background-color: transparent">','<div class="quota-meter-text" style="top: 6px; color: white">',((a.nice_total_disk_usage)?(_l("Using ")+a.nice_total_disk_usage):("")),"</div>","</div>"].join("")},toString:function(){return"UserQuotaMeter("+this.model+")"}});
|
||||
define(["mvc/base-mvc"],function(a){var b=Backbone.View.extend(a.LoggableMixin).extend({options:{warnAtPercent:85,errorAtPercent:100},initialize:function(c){this.log(this+".initialize:",c);_.extend(this.options,c);this.model.bind("change:quota_percent change:total_disk_usage",this.render,this)},update:function(c){this.log(this+" updating user data...",c);this.model.loadFromApi(this.model.get("id"),c);return this},isOverQuota:function(){return(this.model.get("quota_percent")!==null&&this.model.get("quota_percent")>=this.options.errorAtPercent)},_render_quota:function(){var c=this.model.toJSON(),e=c.quota_percent,d=$(this._templateQuotaMeter(c)),f=d.find(".progress-bar");if(this.isOverQuota()){f.attr("class","progress-bar progress-bar-danger");d.find(".quota-meter-text").css("color","white");this.trigger("quota:over",c)}else{if(e>=this.options.warnAtPercent){f.attr("class","progress-bar progress-bar-warning");this.trigger("quota:under quota:under:approaching",c)}else{f.attr("class","progress-bar progress-bar-success");this.trigger("quota:under quota:under:ok",c)}}return d},_render_usage:function(){var c=$(this._templateUsage(this.model.toJSON()));this.log(this+".rendering usage:",c);return c},render:function(){var c=null;this.log(this+".model.quota_percent:",this.model.get("quota_percent"));if((this.model.get("quota_percent")===null)||(this.model.get("quota_percent")===undefined)){c=this._render_usage()}else{c=this._render_quota()}this.$el.html(c);this.$el.find(".quota-meter-text").tooltip();return this},_templateQuotaMeter:function(c){return['<div id="quota-meter" class="quota-meter progress">','<div class="progress-bar" style="width: ',c.quota_percent,'%"></div>','<div class="quota-meter-text" style="top: 6px"',((c.nice_total_disk_usage)?(' title="Using '+c.nice_total_disk_usage+'">'):(">")),_l("Using")," ",c.quota_percent,"%","</div>","</div>"].join("")},_templateUsage:function(c){return['<div id="quota-meter" class="quota-meter" style="background-color: transparent">','<div class="quota-meter-text" style="top: 6px; color: white">',((c.nice_total_disk_usage)?(_l("Using ")+c.nice_total_disk_usage):("")),"</div>","</div>"].join("")},toString:function(){return"UserQuotaMeter("+this.model+")"}});return{UserQuotaMeter:b}});
|
||||
@@ -1 +1 @@
|
||||
var Visualization=Backbone.Model.extend(LoggableMixin).extend({defaults:{config:{}},urlRoot:function(){var a="/api/visualizations";return((window.galaxy_config&&galaxy_config.root)?(galaxy_config.root+a):(a))},initialize:function(a){this.log(this+".initialize",a,this.attributes);if(_.isObject(a.config)&&_.isObject(this.defaults.config)){_.defaults(a.config,this.defaults.config)}this._setUpListeners()},_setUpListeners:function(){},set:function(b,c){if(b==="config"){var a=this.get("config");if(_.isObject(a)){c=_.extend(_.clone(a),c)}}Backbone.Model.prototype.set.call(this,b,c);return this},toString:function(){var a=this.get("id")||"";if(this.get("title")){a+=":"+this.get("title")}return"Visualization("+a+")"}});var VisualizationCollection=Backbone.Collection.extend(LoggableMixin).extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(b,a){a=a||{}},set:function(c,a){var b=this;c=_.map(c,function(e){var f=b.get(e.id);if(!f){return e}var d=f.toJSON();_.extend(d,e);return d});Backbone.Collection.prototype.set.call(this,c,a)},toString:function(){return(["VisualizationCollection(",[this.historyId,this.length].join(),")"].join(""))}});
|
||||
var Visualization=Backbone.Model.extend({defaults:{config:{}},urlRoot:function(){var a="/api/visualizations";return((window.galaxy_config&&galaxy_config.root)?(galaxy_config.root+a):(a))},initialize:function(a){if(_.isObject(a.config)&&_.isObject(this.defaults.config)){_.defaults(a.config,this.defaults.config)}this._setUpListeners()},_setUpListeners:function(){},set:function(b,c){if(b==="config"){var a=this.get("config");if(_.isObject(a)){c=_.extend(_.clone(a),c)}}Backbone.Model.prototype.set.call(this,b,c);return this},toString:function(){var a=this.get("id")||"";if(this.get("title")){a+=":"+this.get("title")}return"Visualization("+a+")"}});var VisualizationCollection=Backbone.Collection.extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(b,a){a=a||{}},set:function(c,a){var b=this;c=_.map(c,function(e){var f=b.get(e.id);if(!f){return e}var d=f.toJSON();_.extend(d,e);return d});Backbone.Collection.prototype.set.call(this,c,a)},toString:function(){return(["VisualizationCollection(",[this.historyId,this.length].join(),")"].join(""))}});
|
||||
@@ -66,25 +66,28 @@
|
||||
}
|
||||
%>
|
||||
|
||||
${h.js( "mvc/base-mvc", "utils/localization", "mvc/user/user-model", "mvc/user/user-quotameter" )}
|
||||
##${h.js( "mvc/base-mvc", "utils/localization", "mvc/user/user-model", "mvc/user/user-quotameter" )}
|
||||
${h.js( "utils/localization" )}
|
||||
|
||||
## load the frame manager
|
||||
<script type="text/javascript">
|
||||
if( !window.Galaxy ){
|
||||
window.Galaxy = {};
|
||||
Galaxy = {};
|
||||
}
|
||||
## fetch the current user data from trans
|
||||
Galaxy.currUser = new User(${ h.to_json_string( get_user_json(), indent=2 ) });
|
||||
|
||||
## load additional style sheet
|
||||
if (window != window.top)
|
||||
$('<link href="' + galaxy_config.root + 'static/style/galaxy.frame.masthead.css" rel="stylesheet">').appendTo('head');
|
||||
if (window != window.top){
|
||||
$('<link href="' + galaxy_config.root + 'static/style/galaxy.frame.masthead.css" rel="stylesheet">')
|
||||
.appendTo('head');
|
||||
}
|
||||
|
||||
## load galaxy js-modules
|
||||
$(function() {
|
||||
require(['galaxy.masthead', 'galaxy.menu', 'mvc/ui/ui-modal', 'galaxy.frame', 'mvc/upload/upload-view'],
|
||||
function(mod_masthead, mod_menu, mod_modal, mod_frame, GalaxyUpload)
|
||||
{
|
||||
require([
|
||||
'galaxy.masthead', 'galaxy.menu', 'mvc/ui/ui-modal', 'galaxy.frame', 'mvc/upload/upload-view',
|
||||
'mvc/user/user-model',
|
||||
'mvc/user/user-quotameter'
|
||||
], function( mod_masthead, mod_menu, mod_modal, mod_frame, GalaxyUpload, user, quotameter ){
|
||||
$(function() {
|
||||
## check if masthead is available
|
||||
if (Galaxy.masthead)
|
||||
return;
|
||||
@@ -106,11 +109,14 @@
|
||||
## add upload plugin
|
||||
Galaxy.upload = new GalaxyUpload(masthead_config);
|
||||
|
||||
if( !Galaxy.currUser ){
|
||||
Galaxy.currUser = new user.User(${ h.to_json_string( get_user_json(), indent=2 ) });
|
||||
}
|
||||
## set up the quota meter (And fetch the current user data from trans)
|
||||
## add quota meter to masthead
|
||||
Galaxy.quotaMeter = new UserQuotaMeter({
|
||||
Galaxy.quotaMeter = new quotameter.UserQuotaMeter({
|
||||
model : Galaxy.currUser,
|
||||
el : $(Galaxy.masthead.el).find('.quota-meter-container')
|
||||
el : Galaxy.masthead.$('.quota-meter-container')
|
||||
}).render();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,8 @@ require([ "mvc/history/current-history-panel" ], function( historyPanel ){
|
||||
linkTarget : 'galaxy_main',
|
||||
onready : function loadAsCurrentHistoryPanel(){
|
||||
var panel = this;
|
||||
this.connectToQuotaMeter( Galaxy.quotaMeter ).connectToOptionsMenu( Galaxy.historyOptionsMenu );
|
||||
this.connectToQuotaMeter( Galaxy.quotaMeter )
|
||||
.connectToOptionsMenu( Galaxy.historyOptionsMenu );
|
||||
this.loadCurrentHistory()
|
||||
.fail( function(){
|
||||
panel.render();
|
||||
@@ -92,7 +93,6 @@ onhistoryready.done( function( historyPanel ){
|
||||
<%def name="history_panel_javascripts()">
|
||||
${h.js(
|
||||
"utils/localization",
|
||||
"mvc/base-mvc"
|
||||
)}
|
||||
|
||||
${localize_js_strings([
|
||||
|
||||
@@ -73,17 +73,11 @@ ${parent.javascripts()}
|
||||
${history_panel_javascripts()}
|
||||
|
||||
%if not use_panels:
|
||||
${h.js( 'mvc/user/user-model' )}
|
||||
<script type="text/javascript">
|
||||
window.Galaxy = {};
|
||||
</script>
|
||||
%endif
|
||||
|
||||
<script type="text/javascript">
|
||||
##TODO: remove when Galaxy is either ensured or removed from the history panel
|
||||
var using_panels = ${ 'false' if not use_panels else 'true' };
|
||||
%if not use_panels:
|
||||
window.Galaxy = {};
|
||||
Galaxy.currUser = new User(${h.to_json_string( get_user_json() )});
|
||||
%endif
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
## ----------------------------------------------------------------------------
|
||||
@@ -163,8 +157,12 @@ ${history_panel_javascripts()}
|
||||
|
||||
require.config({
|
||||
baseUrl : "${h.url_for( '/static/scripts' )}"
|
||||
})([ panelToUse.location ], function( panelMod ){
|
||||
})([ 'mvc/user/user-model', panelToUse.location ], function( user, panelMod ){
|
||||
$(function(){
|
||||
if( !Galaxy.currUser ){
|
||||
Galaxy.currUser = new user.User( ${h.to_json_string( get_user_json() )} );
|
||||
}
|
||||
|
||||
var panelClass = panelMod[ panelToUse.className ],
|
||||
// history module is already in the dpn chain from the panel. We can re-scope it here.
|
||||
historyModel = require( 'mvc/history/history-model' ),
|
||||
|
||||
@@ -22,47 +22,45 @@
|
||||
<%def name="javascripts()">
|
||||
${parent.javascripts()}
|
||||
${history_panel_javascripts()}
|
||||
${h.js(
|
||||
"mvc/user/user-model"
|
||||
)}
|
||||
|
||||
<script type="text/javascript">
|
||||
if( !window.Galaxy ){
|
||||
window.Galaxy = {};
|
||||
Galaxy.currUser = new User(${h.to_json_string( get_user_json() )});
|
||||
}
|
||||
if( !window.Galaxy ){
|
||||
window.Galaxy = {};
|
||||
}
|
||||
$(function(){
|
||||
$( 'body' ).addClass( 'historyPage' ).addClass( 'history-panel' );
|
||||
});
|
||||
|
||||
require([
|
||||
'mvc/user/user-model',
|
||||
'mvc/history/current-history-panel'
|
||||
], function( user, historyPanel ){
|
||||
$(function(){
|
||||
$( 'body' ).addClass( 'historyPage' ).addClass( 'history-panel' );
|
||||
});
|
||||
</script>
|
||||
Galaxy.currUser = new user.User( ${h.to_json_string( get_user_json() )} );
|
||||
// history module is already in the dpn chain from the panel. We can re-scope it here.
|
||||
var historyModel = require( 'mvc/history/history-model' ),
|
||||
debugging = JSON.parse( sessionStorage.getItem( 'debugging' ) ) || false,
|
||||
historyJSON = ${h.to_json_string( history )},
|
||||
hdaJSON = ${h.to_json_string( hdas )};
|
||||
|
||||
<script type="text/javascript">
|
||||
onhistoryready.done( function( historyPanel ){
|
||||
var history = new historyModel.History( historyJSON, hdaJSON, {
|
||||
logger: ( debugging )?( console ):( null )
|
||||
});
|
||||
|
||||
// history module is already in the dpn chain from the panel. We can re-scope it here.
|
||||
var historyModel = require( 'mvc/history/history-model' ),
|
||||
debugging = JSON.parse( sessionStorage.getItem( 'debugging' ) ) || false,
|
||||
historyJSON = ${h.to_json_string( history )},
|
||||
hdaJSON = ${h.to_json_string( hdas )};
|
||||
|
||||
var history = new historyModel.History( historyJSON, hdaJSON, {
|
||||
logger: ( debugging )?( console ):( null )
|
||||
});
|
||||
|
||||
var panel = new historyPanel.HistoryPanel({
|
||||
show_deleted : ${ 'true' if show_deleted == True else ( 'null' if show_deleted == None else 'false' ) },
|
||||
show_hidden : ${ 'true' if show_hidden == True else ( 'null' if show_hidden == None else 'false' ) },
|
||||
el : $( "body.historyPage" ),
|
||||
model : history,
|
||||
onready : function(){
|
||||
this.render();
|
||||
if( Galaxy ){
|
||||
Galaxy.currHistoryPanel = this;
|
||||
var panel = new historyPanel.CurrentHistoryPanel({
|
||||
show_deleted : ${ 'true' if show_deleted == True else ( 'null' if show_deleted == None else 'false' ) },
|
||||
show_hidden : ${ 'true' if show_hidden == True else ( 'null' if show_hidden == None else 'false' ) },
|
||||
el : $( "body.historyPage" ),
|
||||
model : history,
|
||||
onready : function(){
|
||||
this.render();
|
||||
if( Galaxy ){
|
||||
Galaxy.currHistoryPanel = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
</%def>
|
||||
|
||||
Reference in New Issue
Block a user