1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/4fcd087ac38c/ Changeset: 4fcd087ac38c User: guerler Date: 2015-01-29 16:56:56+00:00 Summary: Api: Rename ftp_files to remote_files Affected #: 9 files diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 client/galaxy/scripts/mvc/library/library-model.js --- a/client/galaxy/scripts/mvc/library/library-model.js +++ b/client/galaxy/scripts/mvc/library/library-model.js @@ -199,7 +199,7 @@ */ var Jstree = Backbone.Model.extend({ - urlRoot: '/api/ftp_files' + urlRoot: '/api/remote_files' }); return { diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 client/galaxy/scripts/mvc/upload/upload-ftp.js --- a/client/galaxy/scripts/mvc/upload/upload-ftp.js +++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js @@ -26,7 +26,7 @@ // load extension Utils.get({ - url : galaxy_config.root + 'api/ftp_files', + url : galaxy_config.root + 'api/remote_files', success : function(ftp_files) { self._fill(ftp_files); }, error : function() { self._fill(); } }); diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 lib/galaxy/webapps/galaxy/api/ftp_files.py --- a/lib/galaxy/webapps/galaxy/api/ftp_files.py +++ /dev/null @@ -1,147 +0,0 @@ -""" -API operations on remote files. -""" -import os -import time -import hashlib -from galaxy import web -from galaxy import exceptions -from galaxy.web import _future_expose_api as expose_api -from galaxy.util import jstree -from galaxy.web.base.controller import BaseAPIController, url_for -from operator import itemgetter - -import logging -log = logging.getLogger( __name__ ) - -class FTPFilesAPIController( BaseAPIController ): - - @expose_api - def index( self, trans, **kwd ): - """ - GET /api/ftp_files/ - - Displays remote files. - - :param target: target to load available datasets from, defaults to ftp - possible values: ftp, userdir - :type target: str - - :param format: requested format of data, defaults to flat - possible values: flat, jstree, ajax - - :returns: list of available files - :rtype: list - """ - target = kwd.get( 'target', None ) - format = kwd.get( 'format', None ) - - if target == 'userdir': - user_login = trans.user.email - user_base_dir = trans.app.config.user_library_import_dir - if user_base_dir is None: - raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow upload from user directories.' ) - full_import_dir = os.path.join( user_base_dir, user_login ) - if full_import_dir is not None: - if format == 'jstree': - disable = kwd.get( 'disable', 'folders') - try: - userdir_jstree = self.__create_jstree( full_import_dir, disable ) - response = userdir_jstree.jsonData() - except Exception, exception: - log.debug( str( exception ) ) - raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( full_import_dir ) ) - elif format == 'ajax': - raise exceptions.NotImplemented( 'Not implemented yet. Sorry.' ) - else: - try: - response = self.__load_all_filenames( full_import_dir ) - except Exception, exception: - log.error( 'Could not get user import files: %s', str( exception ), exc_info=True ) - raise exceptions.InternalServerError( 'Could not get the files from your user directory folder.' ) - else: - raise exceptions.InternalServerError( 'Could not get the files from your user directory folder.' ) - elif target == 'importdir': - base_dir = trans.app.config.library_import_dir - if base_dir is None: - raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow usage of import directory.' ) - if format == 'jstree': - disable = kwd.get( 'disable', 'folders') - try: - importdir_jstree = self.__create_jstree( base_dir, disable ) - response = importdir_jstree.jsonData() - except Exception, exception: - log.debug( str( exception ) ) - raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( base_dir ) ) - elif format == 'ajax': - raise exceptions.NotImplemented( 'Not implemented yet. Sorry.' ) - else: - try: - response = self.__load_all_filenames( base_dir ) - except Exception, exception: - log.error( 'Could not get user import files: %s', str( exception ), exc_info=True ) - raise exceptions.InternalServerError( 'Could not get the files from your import directory folder.' ) - else: - user_ftp_base_dir = trans.app.config.ftp_upload_dir - if user_ftp_base_dir is None: - raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow upload from FTP directories.' ) - try: - user_ftp_dir = None - identifier = trans.app.config.ftp_upload_dir_identifier - user_ftp_dir = os.path.join( user_ftp_base_dir, getattr(trans.user, identifier) ) - if user_ftp_dir is not None: - response = self.__load_all_filenames( user_ftp_dir ) - else: - raise exceptions.ConfigDoesNotAllowException( 'You do not have an FTP directory named as your login at this Galaxy instance.' ) - except Exception, exception: - log.error( 'Could not get ftp files: %s', str( exception ), exc_info=True ) - raise exceptions.InternalServerError( 'Could not get the files from your FTP folder.' ) - return response - - def __load_all_filenames( self, directory ): - """ - Loads recursively all files within the given folder and its - subfolders and returns a flat list. - """ - response = [] - if os.path.exists( directory ): - for ( dirpath, dirnames, filenames ) in os.walk( directory ): - for filename in filenames: - path = os.path.relpath( os.path.join( dirpath, filename ), directory ) - statinfo = os.lstat( os.path.join( dirpath, filename ) ) - response.append( dict( path = path, - size = statinfo.st_size, - ctime = time.strftime( "%m/%d/%Y %I:%M:%S %p", time.localtime( statinfo.st_ctime ) ) ) ) - else: - raise exceptions.ConfigDoesNotAllowException( 'The given directory does not exist.' ) - # sort by path - response = sorted(response, key=itemgetter("path")) - return response - - def __create_jstree( self, directory, disable='folders' ): - """ - Loads recursively all files and folders within the given folder - and its subfolders and returns jstree representation - of its structure. - """ - userdir_jstree = None - jstree_paths = [] - if os.path.exists( directory ): - for ( dirpath, dirnames, filenames ) in os.walk( directory ): - - for dirname in dirnames: - dir_path = os.path.relpath( os.path.join( dirpath, dirname ), directory ) - dir_path_hash = hashlib.sha1( dir_path ).hexdigest() - disabled = True if disable == 'folders' else False - jstree_paths.append( jstree.Path( dir_path, dir_path_hash, { 'type': 'folder', 'state': { 'disabled': disabled }, 'li_attr': { 'full_path': dir_path } } ) ) - - for filename in filenames: - file_path = os.path.relpath( os.path.join( dirpath, filename ), directory ) - file_path_hash = hashlib.sha1( file_path ).hexdigest() - disabled = True if disable == 'files' else False - jstree_paths.append( jstree.Path( file_path, file_path_hash, { 'type': 'file', 'state': { 'disabled': disabled }, 'li_attr': { 'full_path': file_path } } ) ) - else: - raise exceptions.ConfigDoesNotAllowException( 'The given directory does not exist.' ) - - userdir_jstree = jstree.JSTree( jstree_paths ) - return userdir_jstree diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 lib/galaxy/webapps/galaxy/api/remote_files.py --- /dev/null +++ b/lib/galaxy/webapps/galaxy/api/remote_files.py @@ -0,0 +1,147 @@ +""" +API operations on remote files. +""" +import os +import time +import hashlib +from galaxy import web +from galaxy import exceptions +from galaxy.web import _future_expose_api as expose_api +from galaxy.util import jstree +from galaxy.web.base.controller import BaseAPIController, url_for +from operator import itemgetter + +import logging +log = logging.getLogger( __name__ ) + +class RemoteFilesAPIController( BaseAPIController ): + + @expose_api + def index( self, trans, **kwd ): + """ + GET /api/remote_files/ + + Displays remote files. + + :param target: target to load available datasets from, defaults to ftp + possible values: ftp, userdir + :type target: str + + :param format: requested format of data, defaults to flat + possible values: flat, jstree, ajax + + :returns: list of available files + :rtype: list + """ + target = kwd.get( 'target', None ) + format = kwd.get( 'format', None ) + + if target == 'userdir': + user_login = trans.user.email + user_base_dir = trans.app.config.user_library_import_dir + if user_base_dir is None: + raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow upload from user directories.' ) + full_import_dir = os.path.join( user_base_dir, user_login ) + if full_import_dir is not None: + if format == 'jstree': + disable = kwd.get( 'disable', 'folders') + try: + userdir_jstree = self.__create_jstree( full_import_dir, disable ) + response = userdir_jstree.jsonData() + except Exception, exception: + log.debug( str( exception ) ) + raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( full_import_dir ) ) + elif format == 'ajax': + raise exceptions.NotImplemented( 'Not implemented yet. Sorry.' ) + else: + try: + response = self.__load_all_filenames( full_import_dir ) + except Exception, exception: + log.error( 'Could not get user import files: %s', str( exception ), exc_info=True ) + raise exceptions.InternalServerError( 'Could not get the files from your user directory folder.' ) + else: + raise exceptions.InternalServerError( 'Could not get the files from your user directory folder.' ) + elif target == 'importdir': + base_dir = trans.app.config.library_import_dir + if base_dir is None: + raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow usage of import directory.' ) + if format == 'jstree': + disable = kwd.get( 'disable', 'folders') + try: + importdir_jstree = self.__create_jstree( base_dir, disable ) + response = importdir_jstree.jsonData() + except Exception, exception: + log.debug( str( exception ) ) + raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( base_dir ) ) + elif format == 'ajax': + raise exceptions.NotImplemented( 'Not implemented yet. Sorry.' ) + else: + try: + response = self.__load_all_filenames( base_dir ) + except Exception, exception: + log.error( 'Could not get user import files: %s', str( exception ), exc_info=True ) + raise exceptions.InternalServerError( 'Could not get the files from your import directory folder.' ) + else: + user_ftp_base_dir = trans.app.config.ftp_upload_dir + if user_ftp_base_dir is None: + raise exceptions.ConfigDoesNotAllowException( 'The configuration of this Galaxy instance does not allow upload from FTP directories.' ) + try: + user_ftp_dir = None + identifier = trans.app.config.ftp_upload_dir_identifier + user_ftp_dir = os.path.join( user_ftp_base_dir, getattr(trans.user, identifier) ) + if user_ftp_dir is not None: + response = self.__load_all_filenames( user_ftp_dir ) + else: + raise exceptions.ConfigDoesNotAllowException( 'You do not have an FTP directory named as your login at this Galaxy instance.' ) + except Exception, exception: + log.error( 'Could not get ftp files: %s', str( exception ), exc_info=True ) + raise exceptions.InternalServerError( 'Could not get the files from your FTP folder.' ) + return response + + def __load_all_filenames( self, directory ): + """ + Loads recursively all files within the given folder and its + subfolders and returns a flat list. + """ + response = [] + if os.path.exists( directory ): + for ( dirpath, dirnames, filenames ) in os.walk( directory ): + for filename in filenames: + path = os.path.relpath( os.path.join( dirpath, filename ), directory ) + statinfo = os.lstat( os.path.join( dirpath, filename ) ) + response.append( dict( path = path, + size = statinfo.st_size, + ctime = time.strftime( "%m/%d/%Y %I:%M:%S %p", time.localtime( statinfo.st_ctime ) ) ) ) + else: + raise exceptions.ConfigDoesNotAllowException( 'The given directory does not exist.' ) + # sort by path + response = sorted(response, key=itemgetter("path")) + return response + + def __create_jstree( self, directory, disable='folders' ): + """ + Loads recursively all files and folders within the given folder + and its subfolders and returns jstree representation + of its structure. + """ + userdir_jstree = None + jstree_paths = [] + if os.path.exists( directory ): + for ( dirpath, dirnames, filenames ) in os.walk( directory ): + + for dirname in dirnames: + dir_path = os.path.relpath( os.path.join( dirpath, dirname ), directory ) + dir_path_hash = hashlib.sha1( dir_path ).hexdigest() + disabled = True if disable == 'folders' else False + jstree_paths.append( jstree.Path( dir_path, dir_path_hash, { 'type': 'folder', 'state': { 'disabled': disabled }, 'li_attr': { 'full_path': dir_path } } ) ) + + for filename in filenames: + file_path = os.path.relpath( os.path.join( dirpath, filename ), directory ) + file_path_hash = hashlib.sha1( file_path ).hexdigest() + disabled = True if disable == 'files' else False + jstree_paths.append( jstree.Path( file_path, file_path_hash, { 'type': 'file', 'state': { 'disabled': disabled }, 'li_attr': { 'full_path': file_path } } ) ) + else: + raise exceptions.ConfigDoesNotAllowException( 'The given directory does not exist.' ) + + userdir_jstree = jstree.JSTree( jstree_paths ) + return userdir_jstree diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -179,7 +179,7 @@ webapp.mapper.resource( 'form', 'forms', path_prefix='/api' ) webapp.mapper.resource( 'request_type', 'request_types', path_prefix='/api' ) webapp.mapper.resource( 'role', 'roles', path_prefix='/api' ) - webapp.mapper.resource( 'ftp_file', 'ftp_files', path_prefix='/api' ) + webapp.mapper.resource( 'remote_file', 'remote_files', path_prefix='/api' ) webapp.mapper.resource( 'group', 'groups', path_prefix='/api' ) webapp.mapper.resource_with_deleted( 'quota', 'quotas', path_prefix='/api' ) webapp.mapper.connect( '/api/tools/{id:.+?}/build', action='build', controller="tools" ) diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 static/scripts/mvc/library/library-model.js --- a/static/scripts/mvc/library/library-model.js +++ b/static/scripts/mvc/library/library-model.js @@ -199,7 +199,7 @@ */ var Jstree = Backbone.Model.extend({ - urlRoot: '/api/ftp_files' + urlRoot: '/api/remote_files' }); return { diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -26,7 +26,7 @@ // load extension Utils.get({ - url : galaxy_config.root + 'api/ftp_files', + url : galaxy_config.root + 'api/remote_files', success : function(ftp_files) { self._fill(ftp_files); }, error : function() { self._fill(); } }); diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 static/scripts/packed/mvc/library/library-model.js --- a/static/scripts/packed/mvc/library/library-model.js +++ b/static/scripts/packed/mvc/library/library-model.js @@ -1,1 +1,1 @@ -define([],function(){var f=Backbone.Model.extend({urlRoot:"/api/libraries/",isVisible:function(n){var m=true;if((!n)&&(this.get("deleted"))){m=false}return m}});var i=Backbone.Collection.extend({url:"/api/libraries",model:f,sort_key:"name",sort_order:null,initialize:function(m){m=m||{}},getVisible:function(n,o){o=o||[];var m=new i(this.filter(function(p){return p.isVisible(n)}));return m},sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0};this.sort();return this}});var g=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var l=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var a=Backbone.Model.extend({urlRoot:"/api/folders"});var c=Backbone.Collection.extend({model:g,sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this}});var e=Backbone.Model.extend({defaults:{folder:new c(),urlRoot:"/api/folders/",id:"unknown"},parse:function(m){this.get("folder").reset(m.folder_contents);return m}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var d=Backbone.Collection.extend({urlRoot:"/api/histories/",initialize:function(m){this.id=m.id},url:function(){return this.urlRoot+this.id+"/contents"},model:b});var h=Backbone.Model.extend({urlRoot:"/api/histories/"});var k=Backbone.Collection.extend({url:"/api/histories",model:h});var j=Backbone.Model.extend({urlRoot:"/api/ftp_files"});return{Library:f,FolderAsModel:a,Libraries:i,Item:g,Ldda:l,Folder:c,FolderContainer:e,HistoryItem:b,HistoryContents:d,GalaxyHistory:h,GalaxyHistories:k,Jstree:j}}); \ No newline at end of file +define([],function(){var f=Backbone.Model.extend({urlRoot:"/api/libraries/",isVisible:function(n){var m=true;if((!n)&&(this.get("deleted"))){m=false}return m}});var i=Backbone.Collection.extend({url:"/api/libraries",model:f,sort_key:"name",sort_order:null,initialize:function(m){m=m||{}},getVisible:function(n,o){o=o||[];var m=new i(this.filter(function(p){return p.isVisible(n)}));return m},sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0};this.sort();return this}});var g=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var l=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var a=Backbone.Model.extend({urlRoot:"/api/folders"});var c=Backbone.Collection.extend({model:g,sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this}});var e=Backbone.Model.extend({defaults:{folder:new c(),urlRoot:"/api/folders/",id:"unknown"},parse:function(m){this.get("folder").reset(m.folder_contents);return m}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var d=Backbone.Collection.extend({urlRoot:"/api/histories/",initialize:function(m){this.id=m.id},url:function(){return this.urlRoot+this.id+"/contents"},model:b});var h=Backbone.Model.extend({urlRoot:"/api/histories/"});var k=Backbone.Collection.extend({url:"/api/histories",model:h});var j=Backbone.Model.extend({urlRoot:"/api/remote_files"});return{Library:f,FolderAsModel:a,Libraries:i,Item:g,Ldda:l,Folder:c,FolderContainer:e,HistoryItem:b,HistoryContents:d,GalaxyHistory:h,GalaxyHistories:k,Jstree:j}}); \ No newline at end of file diff -r be28a5fda9ddbc05df0e545a3a85434630212433 -r 4fcd087ac38c5ff89e715b969de0210fd3c395e0 static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());this.rows=[];a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(d){if(d&&d.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var c=0;for(key in d){this.rows.push(this._add(d[key]));c+=d[key].size}this.$el.find("#upload-ftp-number").html(d.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(c,true));this.$select_all=$("#upload-selectall");this.$select_all.addClass(this.options.class_add);var b=this;this.$select_all.on("click",function(){var g=b.$select_all.hasClass(b.options.class_add);for(key in d){var f=d[key];var e=b._find(f);if(!e&&g||e&&!g){b.rows[key].trigger("click")}}});b._refresh()}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},_add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}d._refresh()});return e},_refresh:function(){var b=this.app.collection.where({file_mode:"ftp"});this.$select_all.removeClass();if(b.length==0){this.$select_all.addClass(this.options.class_add)}else{if(b.length==this.rows.length){this.$select_all.addClass(this.options.class_remove)}else{this.$select_all.addClass(this.options.class_partial)}}},_find:function(c){var b=this.app.collection.findWhere({file_path:c.path,status:"init",file_mode:"ftp"});if(b){return b.get("id")}return null},_templateRow:function(b){return'<tr class="upload-ftp-row"><td><div class="icon"/></td><td class="label"><p>'+b.path+'</p></td><td class="nonlabel">'+a.bytesToString(b.size)+'</td><td class="nonlabel">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="upload-selectall"></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());this.rows=[];a.get({url:galaxy_config.root+"api/remote_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(d){if(d&&d.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var c=0;for(key in d){this.rows.push(this._add(d[key]));c+=d[key].size}this.$el.find("#upload-ftp-number").html(d.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(c,true));this.$select_all=$("#upload-selectall");this.$select_all.addClass(this.options.class_add);var b=this;this.$select_all.on("click",function(){var g=b.$select_all.hasClass(b.options.class_add);for(key in d){var f=d[key];var e=b._find(f);if(!e&&g||e&&!g){b.rows[key].trigger("click")}}});b._refresh()}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},_add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}d._refresh()});return e},_refresh:function(){var b=this.app.collection.where({file_mode:"ftp"});this.$select_all.removeClass();if(b.length==0){this.$select_all.addClass(this.options.class_add)}else{if(b.length==this.rows.length){this.$select_all.addClass(this.options.class_remove)}else{this.$select_all.addClass(this.options.class_partial)}}},_find:function(c){var b=this.app.collection.findWhere({file_path:c.path,status:"init",file_mode:"ftp"});if(b){return b.get("id")}return null},_templateRow:function(b){return'<tr class="upload-ftp-row"><td><div class="icon"/></td><td class="label"><p>'+b.path+'</p></td><td class="nonlabel">'+a.bytesToString(b.size)+'</td><td class="nonlabel">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th><div id="upload-selectall"></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.