galaxy-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ed0e437ce0d6/
Changeset: ed0e437ce0d6
User: dannon
Date: 2013-10-25 06:43:55
Summary: Missing tempfile import in dataproviders/external.
Affected #: 1 file
diff -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c -r ed0e437ce0d6663ce247161a32287e2de977d226 lib/galaxy/datatypes/dataproviders/external.py
--- a/lib/galaxy/datatypes/dataproviders/external.py
+++ b/lib/galaxy/datatypes/dataproviders/external.py
@@ -3,12 +3,12 @@
or not in a file.
"""
+import base
+import gzip
+import line
import subprocess
+import tempfile
import urllib, urllib2
-import gzip
-
-import base
-import line
_TODO = """
YAGNI: ftp, image, cryptos, sockets
https://bitbucket.org/galaxy/galaxy-central/commits/d57971b60b8d/
Changeset: d57971b60b8d
User: dannon
Date: 2013-10-25 06:57:53
Summary: Bugfix/cleanup in reports/workflows module -- was using workflow_id instead of stored_workflow_id
Affected #: 1 file
diff -r ed0e437ce0d6663ce247161a32287e2de977d226 -r d57971b60b8d907c33bf4dfc1bba2432baaf96e9 lib/galaxy/webapps/reports/controllers/workflows.py
--- a/lib/galaxy/webapps/reports/controllers/workflows.py
+++ b/lib/galaxy/webapps/reports/controllers/workflows.py
@@ -1,34 +1,40 @@
-import calendar, operator, os, socket
-from datetime import datetime, date, timedelta
-from time import mktime, strftime, localtime
+import calendar
+from datetime import date, timedelta
+from galaxy import eggs
+from galaxy import model, util
+from galaxy.model.orm import and_
from galaxy.web.base.controller import BaseUIController, web
-from galaxy import model, util
-from galaxy.web.framework.helpers import time_ago, iff, grids
-from galaxy.model.orm import and_, not_, or_
-import pkg_resources
-pkg_resources.require( "SQLAlchemy >= 0.4" )
+from galaxy.web.framework.helpers import grids
+eggs.require( "SQLAlchemy >= 0.4" )
import sqlalchemy as sa
+
import logging
log = logging.getLogger( __name__ )
+
class SpecifiedDateListGrid( grids.Grid ):
+
class WorkflowNameColumn( grids.TextColumn ):
def get_value( self, trans, grid, stored_workflow ):
return stored_workflow.name
+
class CreateTimeColumn( grids.DateTimeColumn ):
def get_value( self, trans, grid, stored_workflow ):
return stored_workflow.create_time
+
class UserColumn( grids.TextColumn ):
def get_value( self, trans, grid, stored_workflow ):
if stored_workflow.user:
return stored_workflow.user.email
return 'unknown'
+
class EmailColumn( grids.GridColumn ):
def filter( self, trans, user, query, column_filter ):
if column_filter == 'All':
return query
return query.filter( and_( model.StoredWorkflow.table.c.user_id == model.User.table.c.id,
model.User.table.c.email == column_filter ) )
+
class SpecifiedDateColumn( grids.GridColumn ):
def filter( self, trans, user, query, column_filter ):
if column_filter == 'All':
@@ -94,6 +100,7 @@
.join( model.User ) \
.enable_eagerloads( False )
+
class Workflows( BaseUIController ):
specified_date_list_grid = SpecifiedDateListGrid()
@@ -120,7 +127,7 @@
**kwd ) )
elif operation == "user_per_month":
stored_workflow_id = kwd.get( 'id', None )
- workflow = get_workflow( trans, workflow_id )
+ workflow = get_workflow( trans, stored_workflow_id )
if workflow.user:
kwd[ 'email' ] = workflow.user.email
else:
@@ -129,9 +136,9 @@
action='user_per_month',
**kwd ) )
return self.specified_date_list_grid( trans, **kwd )
+
@web.expose
def per_month_all( self, trans, **kwd ):
- params = util.Params( kwd )
message = ''
q = sa.select( ( sa.func.date_trunc( 'month', sa.func.date( model.StoredWorkflow.table.c.create_time ) ).label( 'date' ),sa.func.count( model.StoredWorkflow.table.c.id ).label( 'total_workflows' ) ),
from_obj = [ sa.outerjoin( model.StoredWorkflow.table, model.User.table ) ],
@@ -146,9 +153,9 @@
return trans.fill_template( '/webapps/reports/workflows_per_month_all.mako',
workflows=workflows,
message=message )
+
@web.expose
def per_user( self, trans, **kwd ):
- params = util.Params( kwd )
message = ''
workflows = []
q = sa.select( ( model.User.table.c.email.label( 'user_email' ),
@@ -160,6 +167,7 @@
workflows.append( ( row.user_email,
row.total_workflows ) )
return trans.fill_template( '/webapps/reports/workflows_per_user.mako', workflows=workflows, message=message )
+
@web.expose
def user_per_month( self, trans, **kwd ):
params = util.Params( kwd )
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.
1
0
17 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/79fd1058b25d/
Changeset: 79fd1058b25d
User: dannon
Date: 2013-10-25 00:40:09
Summary: Clean up imports in util package base
Affected #: 1 file
diff -r 97cb7306dc345ce5e81861e421c5277701161802 -r 79fd1058b25dc43a5292843a01106e38dfd83994 lib/galaxy/util/__init__.py
--- a/lib/galaxy/util/__init__.py
+++ b/lib/galaxy/util/__init__.py
@@ -2,25 +2,30 @@
Utility functions used systemwide.
"""
-import logging, threading, random, string, re, binascii, pickle, time, datetime, math, re, os, sys, tempfile, stat, grp, smtplib, errno, shutil
+import binascii, errno, grp, logging, os, pickle, random, re, shutil, smtplib, stat, string, sys, tempfile, threading
from email.MIMEText import MIMEText
from os.path import relpath
from hashlib import md5
from galaxy import eggs
-import pkg_resources
-pkg_resources.require( 'docutils' )
+eggs.require( 'docutils' )
import docutils.core
import docutils.writers.html4css1
-pkg_resources.require( 'elementtree' )
+eggs.require( 'elementtree' )
from elementtree import ElementTree, ElementInclude
-pkg_resources.require( "wchartype" )
+eggs.require( "wchartype" )
import wchartype
+from inflection import Inflector, English
+inflector = Inflector(English)
+
+eggs.require( "simplejson" )
+import simplejson
+
log = logging.getLogger(__name__)
_lock = threading.RLock()
@@ -35,12 +40,6 @@
NULL_CHAR = '\000'
BINARY_CHARS = [ NULL_CHAR ]
-from inflection import Inflector, English
-inflector = Inflector(English)
-
-pkg_resources.require( "simplejson" )
-import simplejson
-
def is_multi_byte( chars ):
for char in chars:
try:
@@ -946,5 +945,5 @@
return os.path.abspath(galaxy_root_path)
if __name__ == '__main__':
- import doctest, sys
+ import doctest
doctest.testmod(sys.modules[__name__], verbose=False)
https://bitbucket.org/galaxy/galaxy-central/commits/a81f9cdc2035/
Changeset: a81f9cdc2035
User: dannon
Date: 2013-10-25 00:42:18
Summary: Correct errors in util's xml_to_dict
Affected #: 1 file
diff -r 79fd1058b25dc43a5292843a01106e38dfd83994 -r a81f9cdc2035e6c7ea2febeb0a1af7e10d2ef2a3 lib/galaxy/util/__init__.py
--- a/lib/galaxy/util/__init__.py
+++ b/lib/galaxy/util/__init__.py
@@ -176,9 +176,9 @@
sub_elem_dict[ key ].append( value )
for key, value in sub_elem_dict.iteritems():
if len( value ) == 1:
- rval[ elem.tag ][ k ] = value[0]
+ rval[ elem.tag ][ key ] = value[0]
else:
- rval[ elem.tag ][ k ] = value
+ rval[ elem.tag ][ key ] = value
if elem.attrib:
for key, value in elem.attrib.iteritems():
rval[ elem.tag ][ "@%s" % key ] = value
https://bitbucket.org/galaxy/galaxy-central/commits/8305d16cf154/
Changeset: 8305d16cf154
User: dannon
Date: 2013-10-25 00:43:05
Summary: Strip unused variables from util package
Affected #: 1 file
diff -r a81f9cdc2035e6c7ea2febeb0a1af7e10d2ef2a3 -r 8305d16cf1542166a8d1c2bd04abd8a0562ca438 lib/galaxy/util/__init__.py
--- a/lib/galaxy/util/__init__.py
+++ b/lib/galaxy/util/__init__.py
@@ -44,7 +44,7 @@
for char in chars:
try:
char = unicode( char )
- except UnicodeDecodeError, e:
+ except UnicodeDecodeError:
# Probably binary
return False
if wchartype.is_asian( char ) or \
@@ -736,7 +736,7 @@
name = names.next()
file = os.path.join(dir, prefix + name)
try:
- linked_path = os.link( src, file )
+ os.link( src, file )
return (os.path.abspath(file))
except OSError, e:
if e.errno == errno.EEXIST:
https://bitbucket.org/galaxy/galaxy-central/commits/02bbb394aa98/
Changeset: 02bbb394aa98
User: dannon
Date: 2013-10-25 00:59:49
Summary: Fix missing HTTPNotImplemented import in api/annotations; cleanup existing.
Affected #: 1 file
diff -r 8305d16cf1542166a8d1c2bd04abd8a0562ca438 -r 02bbb394aa9856c5a607a8e61e7dfea9a7241dfd lib/galaxy/webapps/galaxy/api/annotations.py
--- a/lib/galaxy/webapps/galaxy/api/annotations.py
+++ b/lib/galaxy/webapps/galaxy/api/annotations.py
@@ -1,21 +1,15 @@
"""
API operations on annotations.
"""
-import logging, os, string, shutil, urllib, re, socket
-from cgi import escape, FieldStorage
-from galaxy import util, datatypes, jobs, web, util
-from galaxy.web.base.controller import BaseAPIController, UsesHistoryMixin, UsesHistoryDatasetAssociationMixin, UsesStoredWorkflowMixin
+import logging
+from galaxy import web
from galaxy.model.item_attrs import UsesAnnotations
from galaxy.util.sanitize_html import sanitize_html
-import galaxy.datatypes
-from galaxy.util.bunch import Bunch
-
-import pkg_resources
-pkg_resources.require( "Routes" )
-import routes
+from galaxy.web.base.controller import BaseAPIController, HTTPNotImplemented, UsesHistoryDatasetAssociationMixin, UsesHistoryMixin, UsesStoredWorkflowMixin
log = logging.getLogger( __name__ )
+
class BaseAnnotationsController( BaseAPIController, UsesAnnotations, UsesHistoryMixin, UsesHistoryDatasetAssociationMixin, UsesStoredWorkflowMixin ):
@web.expose_api
@@ -25,7 +19,6 @@
if item is not None:
return self.get_item_annotation_str( trans.sa_session, trans.get_user(), item )
-
@web.expose_api
def create( self, trans, payload, **kwd ):
if "text" not in payload:
@@ -53,23 +46,29 @@
def undelete( self, trans, **kwd ):
raise HTTPNotImplemented()
+
class HistoryAnnotationsController(BaseAnnotationsController):
controller_name = "history_annotations"
tagged_item_id = "history_id"
+
def _get_item_from_id(self, trans, idstr):
hist = self.get_history( trans, idstr )
return hist
+
class HistoryContentAnnotationsController(BaseAnnotationsController):
controller_name = "history_content_annotations"
tagged_item_id = "history_content_id"
+
def _get_item_from_id(self, trans, idstr):
hda = self.get_dataset(trans, idstr)
return hda
+
class WorkflowAnnotationsController(BaseAnnotationsController):
controller_name = "workflow_annotations"
tagged_item_id = "workflow_id"
+
def _get_item_from_id(self, trans, idstr):
hda = self.get_stored_workflow(trans, idstr)
return hda
https://bitbucket.org/galaxy/galaxy-central/commits/a19245efea88/
Changeset: a19245efea88
User: dannon
Date: 2013-10-25 01:08:04
Summary: Fix broken string_as_bool in history_contents API
Affected #: 1 file
diff -r 02bbb394aa9856c5a607a8e61e7dfea9a7241dfd -r a19245efea8847b994e90602c33813554a50ce03 lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -2,15 +2,12 @@
API operations on the contents of a history.
"""
-from galaxy import web, util
-from galaxy import exceptions
-from galaxy.web.base.controller import BaseAPIController, url_for
-from galaxy.web.base.controller import UsesHistoryDatasetAssociationMixin, UsesHistoryMixin
-from galaxy.web.base.controller import UsesLibraryMixin, UsesLibraryMixinItems
-from galaxy.datatypes import sniff
+import logging
+from galaxy import exceptions, util, web
+from galaxy.web.base.controller import (BaseAPIController, url_for,
+ UsesHistoryDatasetAssociationMixin, UsesHistoryMixin, UsesLibraryMixin,
+ UsesLibraryMixinItems)
-import os
-import logging
log = logging.getLogger( __name__ )
class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociationMixin, UsesHistoryMixin,
@@ -354,7 +351,7 @@
# a request body is optional here
purge = False
if kwd.get( 'payload', None ):
- purge = string_as_bool( kwd['payload'].get( 'purge', False ) )
+ purge = util.string_as_bool( kwd['payload'].get( 'purge', False ) )
rval = { 'id' : id }
try:
@@ -389,7 +386,7 @@
log.exception( 'HDA API, delete: uncaught HTTPInternalServerError: %s, %s\n%s',
id, str( kwd ), str( http_server_err ) )
raise
- except exceptions.httpexceptions.HTTPException, http_exc:
+ except exceptions.httpexceptions.HTTPException:
raise
except Exception, exc:
log.exception( 'HDA API, delete: uncaught exception: %s, %s\n%s',
https://bitbucket.org/galaxy/galaxy-central/commits/28119d3941aa/
Changeset: 28119d3941aa
User: dannon
Date: 2013-10-25 01:10:39
Summary: Use standard spacing in history contents API, strip whitespace.
Affected #: 1 file
diff -r a19245efea8847b994e90602c33813554a50ce03 -r 28119d3941aae98156cdb4e07243ce7e3c4848a3 lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -10,8 +10,10 @@
log = logging.getLogger( __name__ )
+
class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociationMixin, UsesHistoryMixin,
UsesLibraryMixin, UsesLibraryMixinItems ):
+
@web.expose_api_anonymous
def index( self, trans, history_id, ids=None, **kwd ):
"""
@@ -44,11 +46,9 @@
and ( history_id == trans.security.encode_id( trans.history.id ) ) ):
#TODO:?? is secure?
history = trans.history
-
# otherwise, check permissions for the history first
else:
history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True )
-
# if ids, return _FULL_ data (as show) for each id passed
if ids:
ids = ids.split( ',' )
@@ -57,7 +57,6 @@
if encoded_hda_id in ids:
#TODO: share code with show
rval.append( self._detailed_hda_dict( trans, hda ) )
-
# if no ids passed, return a _SUMMARY_ of _all_ datasets in the history
else:
details = kwd.get( 'details', None ) or []
@@ -71,13 +70,11 @@
rval.append( self._detailed_hda_dict( trans, hda ) )
else:
rval.append( self._summary_hda_dict( trans, history_id, hda ) )
-
except Exception, e:
# for errors that are not specific to one hda (history lookup or summary list)
rval = "Error in history API at listing contents: " + str( e )
log.error( rval + ": %s, %s" % ( type( e ), str( e ) ), exc_info=True )
trans.response.status = 500
-
return rval
#TODO: move to model or Mixin
@@ -114,7 +111,6 @@
hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda )
hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda )
return hda_dict
-
except Exception, exc:
# catch error here - returning a briefer hda_dict with an error attribute
log.exception( "Error in history API at listing contents with history %s, hda %s: (%s) %s",
@@ -149,24 +145,20 @@
#TODO: dataset/hda by id (from history) OR check_ownership for anon user
hda = self.get_history_dataset_association( trans, history, id,
check_ownership=False, check_accessible=True )
-
else:
#TODO: do we really need the history?
history = self.get_history( trans, history_id,
check_ownership=True, check_accessible=True, deleted=False )
hda = self.get_history_dataset_association( trans, history, id,
check_ownership=True, check_accessible=True )
-
hda_dict = self.get_hda_dict( trans, hda )
hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda )
hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda )
-
except Exception, e:
msg = "Error in history API at listing dataset: %s" % ( str(e) )
log.error( msg, exc_info=True )
trans.response.status = 500
return msg
-
return hda_dict
@web.expose_api
@@ -183,28 +175,25 @@
copy from library:
'source' = 'library'
'content' = [the encoded id from the library dataset]
-
+
copy from HDA:
'source' = 'hda'
'content' = [the encoded id from the HDA]
..note:
Currently, a user can only copy an HDA from a history that the user owns.
-
+
:rtype: dict
:returns: dictionary containing detailed information for the new HDA
"""
-
#TODO: copy existing, accessible hda - dataset controller, copy_datasets
#TODO: convert existing, accessible hda - model.DatasetInstance(or hda.datatype).get_converter_types
-
# check parameters
source = payload.get('source', None)
content = payload.get('content', None)
if source not in ['library', 'hda'] or content is None:
trans.response.status = 400
return "Please define the source ('library' or 'hda') and the content."
-
# retrieve history
try:
history = self.get_history( trans, history_id, check_ownership=True, check_accessible=False )
@@ -212,10 +201,8 @@
# no way to tell if it failed bc of perms or other (all MessageExceptions)
trans.response.status = 500
return str( e )
-
# copy from library dataset
if source == 'library':
-
# get library data set
try:
ld = self.get_library_dataset( trans, content, check_ownership=False, check_accessible=False )
@@ -226,17 +213,14 @@
return str( e )
except Exception, e:
return str( e )
-
# insert into history
hda = ld.library_dataset_dataset_association.to_history_dataset_association( history, add_to_history=True )
trans.sa_session.flush()
return hda.to_dict()
-
elif source == 'hda':
try:
#NOTE: user currently only capable of copying one of their own datasets
hda = self.get_dataset( trans, content )
-
except ( exceptions.httpexceptions.HTTPRequestRangeNotSatisfiable,
exceptions.httpexceptions.HTTPBadRequest ), id_exc:
# wot...
@@ -250,12 +234,10 @@
trans.response.status = 500
log.exception( "history: %s, source: %s, content: %s", history_id, source, content )
return str( exc )
-
data_copy=hda.copy( copy_children=True )
result=history.add_dataset( data_copy )
trans.sa_session.flush()
return result.to_dict()
-
else:
# other options
trans.response.status = 501
@@ -291,27 +273,22 @@
if history_id != trans.security.encode_id( trans.history.id ):
trans.response.status = 401
return { 'error': 'Anonymous users cannot edit histories other than their current history' }
-
anon_allowed_payload = {}
if 'deleted' in payload:
anon_allowed_payload[ 'deleted' ] = payload[ 'deleted' ]
if 'visible' in payload:
anon_allowed_payload[ 'visible' ] = payload[ 'visible' ]
-
payload = self._validate_and_parse_update_payload( anon_allowed_payload )
hda = self.get_dataset( trans, id, check_ownership=False, check_accessible=False, check_state=True )
if hda.history != trans.history:
trans.response.status = 401
return { 'error': 'Anonymous users cannot edit datasets outside their current history' }
-
else:
payload = self._validate_and_parse_update_payload( payload )
hda = self.get_dataset( trans, id, check_ownership=True, check_accessible=True, check_state=True )
-
# get_dataset can return a string during an error
if hda and isinstance( hda, trans.model.HistoryDatasetAssociation ):
changed = self.set_hda_from_dict( trans, hda, payload )
-
except Exception, exception:
log.error( 'Update of history (%s), HDA (%s) failed: %s',
history_id, id, str( exception ), exc_info=True )
@@ -323,7 +300,6 @@
else:
trans.response.status = 500
return { 'error': str( exception ) }
-
return changed
@web.expose_api
@@ -352,22 +328,18 @@
purge = False
if kwd.get( 'payload', None ):
purge = util.string_as_bool( kwd['payload'].get( 'purge', False ) )
-
rval = { 'id' : id }
try:
hda = self.get_dataset( trans, id,
check_ownership=True, check_accessible=True, check_state=True )
hda.deleted = True
-
if purge:
if not trans.app.config.allow_user_dataset_purge:
raise exceptions.httpexceptions.HTTPForbidden(
detail='This instance does not allow user dataset purging' )
-
hda.purged = True
trans.sa_session.add( hda )
trans.sa_session.flush()
-
if hda.dataset.user_can_purge:
try:
hda.dataset.full_delete()
@@ -376,12 +348,9 @@
pass
# flush now to preserve deleted state in case of later interruption
trans.sa_session.flush()
-
rval[ 'purged' ] = True
-
trans.sa_session.flush()
rval[ 'deleted' ] = True
-
except exceptions.httpexceptions.HTTPInternalServerError, http_server_err:
log.exception( 'HDA API, delete: uncaught HTTPInternalServerError: %s, %s\n%s',
id, str( kwd ), str( http_server_err ) )
@@ -393,7 +362,6 @@
id, str( kwd ), str( exc ) )
trans.response.status = 500
rval.update({ 'error': str( exc ) })
-
return rval
def _validate_and_parse_update_payload( self, payload ):
@@ -416,7 +384,6 @@
'metadata_dbkey', 'metadata_column_names', 'metadata_column_types', 'metadata_columns',
'metadata_comment_lines', 'metadata_data_lines'
)
-
validated_payload = {}
for key, val in payload.items():
# TODO: lots of boilerplate here, but overhead on abstraction is equally onerous
https://bitbucket.org/galaxy/galaxy-central/commits/9fcd7759a210/
Changeset: 9fcd7759a210
User: dannon
Date: 2013-10-25 01:11:56
Summary: Irods objectstore: fix invalid rcCollCreate
Affected #: 1 file
diff -r 28119d3941aae98156cdb4e07243ce7e3c4848a3 -r 9fcd7759a210684ad2762340da7dbeab753c24c0 lib/galaxy/objectstore/rods.py
--- a/lib/galaxy/objectstore/rods.py
+++ b/lib/galaxy/objectstore/rods.py
@@ -6,16 +6,14 @@
import os
import time
-import errno
import logging
-#import traceback
from posixpath import join as path_join
from posixpath import basename as path_basename
from posixpath import dirname as path_dirname
from galaxy.objectstore import DiskObjectStore, ObjectStore, local_extra_dirs
-from galaxy.exceptions import ObjectNotFound, ObjectInvalid
+from galaxy.exceptions import ObjectNotFound
import galaxy.eggs
galaxy.eggs.require( 'PyRods' )
@@ -121,7 +119,7 @@
log.debug( 'Creating collection %s' % collname )
ci = irods.collInp_t()
ci.collName = collname
- status = rcCollCreate( self.rods_conn, ci )
+ status = irods.rcCollCreate( self.rods_conn, ci )
assert status == 0, '__mkcolls(): Failed to create collection: %s' % collname
@local_extra_dirs
https://bitbucket.org/galaxy/galaxy-central/commits/b9e78741f439/
Changeset: b9e78741f439
User: dannon
Date: 2013-10-25 01:25:28
Summary: Import cleanup in toolshed repositories API
Affected #: 1 file
diff -r 9fcd7759a210684ad2762340da7dbeab753c24c0 -r b9e78741f439f06c30b07d7d591c7c83183be6a6 lib/galaxy/webapps/tool_shed/api/repositories.py
--- a/lib/galaxy/webapps/tool_shed/api/repositories.py
+++ b/lib/galaxy/webapps/tool_shed/api/repositories.py
@@ -1,11 +1,12 @@
-import logging
+import logging, os
from time import strftime
-from galaxy.web.framework.helpers import time_ago
+
from galaxy import eggs
+from galaxy import util
from galaxy import web
-from galaxy import util
from galaxy.util import json
from galaxy.web.base.controller import BaseAPIController
+from galaxy.web.framework.helpers import time_ago
import tool_shed.repository_types.util as rt_util
import tool_shed.util.shed_util_common as suc
from tool_shed.galaxy_install import repository_util
@@ -14,9 +15,7 @@
eggs.require( 'mercurial' )
-from mercurial import commands
from mercurial import hg
-from mercurial import ui
log = logging.getLogger( __name__ )
https://bitbucket.org/galaxy/galaxy-central/commits/b154d93fb369/
Changeset: b154d93fb369
User: dannon
Date: 2013-10-25 01:26:06
Summary: Fix broken debug statements in toolshed repositories API -- would have caused Exception in reset_metadata
Affected #: 1 file
diff -r b9e78741f439f06c30b07d7d591c7c83183be6a6 -r b154d93fb369443a5979aa49e59c42fe27e7df53 lib/galaxy/webapps/tool_shed/api/repositories.py
--- a/lib/galaxy/webapps/tool_shed/api/repositories.py
+++ b/lib/galaxy/webapps/tool_shed/api/repositories.py
@@ -278,7 +278,7 @@
encoded_id = trans.security.encode_id( repository.id )
if encoded_id in encoded_ids_to_skip:
log.debug( "Skipping repository with id %s because it is in encoded_ids_to_skip %s" % \
- ( str( repository_id ), str( encoded_ids_to_skip ) ) )
+ ( str( repository.id ), str( encoded_ids_to_skip ) ) )
elif repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION and repository.id not in handled_repository_ids:
results = handle_repository( trans, repository, results )
# Now reset metadata on all remaining repositories.
@@ -286,7 +286,7 @@
encoded_id = trans.security.encode_id( repository.id )
if encoded_id in encoded_ids_to_skip:
log.debug( "Skipping repository with id %s because it is in encoded_ids_to_skip %s" % \
- ( str( repository_id ), str( encoded_ids_to_skip ) ) )
+ ( str( repository.id ), str( encoded_ids_to_skip ) ) )
elif repository.type != rt_util.TOOL_DEPENDENCY_DEFINITION and repository.id not in handled_repository_ids:
results = handle_repository( trans, repository, results )
stop_time = strftime( "%Y-%m-%d %H:%M:%S" )
https://bitbucket.org/galaxy/galaxy-central/commits/9de91cccfcf0/
Changeset: 9de91cccfcf0
User: dannon
Date: 2013-10-25 01:27:15
Summary: Remove unused encoded_repository_id from get_ordered_installable_revisions in toolshed repository API
Affected #: 1 file
diff -r b154d93fb369443a5979aa49e59c42fe27e7df53 -r 9de91cccfcf0b7fc5f1beac6209e0111fd5c4af2 lib/galaxy/webapps/tool_shed/api/repositories.py
--- a/lib/galaxy/webapps/tool_shed/api/repositories.py
+++ b/lib/galaxy/webapps/tool_shed/api/repositories.py
@@ -38,7 +38,6 @@
try:
# Get the repository information.
repository = suc.get_repository_by_name_and_owner( trans.app, name, owner )
- encoded_repository_id = trans.security.encode_id( repository.id )
repo_dir = repository.repo_path( trans.app )
repo = hg.repository( suc.get_configured_ui(), repo_dir )
ordered_installable_revisions = suc.get_ordered_metadata_changeset_revisions( repository, repo, downloadable=True )
https://bitbucket.org/galaxy/galaxy-central/commits/d0a805216378/
Changeset: d0a805216378
User: dannon
Date: 2013-10-25 01:28:02
Summary: Add missing import HTTPBadRequest to toolshed repository revisions API
Affected #: 1 file
diff -r 9de91cccfcf0b7fc5f1beac6209e0111fd5c4af2 -r d0a80521637842c250665010848e7eb749946cce lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -5,7 +5,7 @@
from galaxy import web
from galaxy import util
from galaxy.model.orm import and_, not_, select
-from galaxy.web.base.controller import BaseAPIController
+from galaxy.web.base.controller import BaseAPIController, HTTPBadRequest
from tool_shed.util import export_util
import tool_shed.util.shed_util_common as suc
https://bitbucket.org/galaxy/galaxy-central/commits/880f16259947/
Changeset: 880f16259947
User: dannon
Date: 2013-10-25 01:29:09
Summary: Remove unused code in toolshed repository revisions API; strip whitespace.
Affected #: 1 file
diff -r d0a80521637842c250665010848e7eb749946cce -r 880f162599472ce9316ccef0e0c56b4d16c11424 lib/galaxy/webapps/tool_shed/api/repository_revisions.py
--- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
+++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py
@@ -43,7 +43,6 @@
if not changeset_revision:
raise HTTPBadRequest( detail="Missing required parameter 'changeset_revision'." )
export_repository_dependencies = payload.get( 'export_repository_dependencies', False )
- download_dir = payload.get( 'download_dir', '/tmp' )
try:
# We'll currently support only gzip-compressed tar archives.
file_type = 'gz'
@@ -167,7 +166,6 @@
flush_needed = False
for key, new_value in payload.items():
if hasattr( repository_metadata, key ):
- old_value = getattr( repository_metadata, key )
setattr( repository_metadata, key, new_value )
if key in [ 'tools_functionally_correct', 'time_last_tested' ]:
# Automatically update repository_metadata.time_last_tested.
@@ -186,10 +184,10 @@
action='show',
id=trans.security.encode_id( repository_metadata.id ) )
return repository_metadata_dict
-
+
def __get_value_mapper( self, trans, repository_metadata ):
value_mapper = { 'id' : trans.security.encode_id,
'repository_id' : trans.security.encode_id }
if repository_metadata.time_last_tested is not None:
- value_mapper[ 'time_last_tested' ] = time_ago
+ value_mapper[ 'time_last_tested' ] = time_ago
return value_mapper
https://bitbucket.org/galaxy/galaxy-central/commits/3e5cbc50db38/
Changeset: 3e5cbc50db38
User: dannon
Date: 2013-10-25 01:31:10
Summary: Fix bug in galaxy's tool_shed_repositories API -- would cause exception if there was ever a shed_tool_conf.
Affected #: 1 file
diff -r 880f162599472ce9316ccef0e0c56b4d16c11424 -r 3e5cbc50db38f44d54ee0682d4320658ba6d4763 lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
--- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
+++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
@@ -267,8 +267,7 @@
if shed_tool_conf:
# Get the tool_path setting.
index, shed_conf_dict = suc.get_shed_tool_conf_dict( trans.app, shed_tool_conf )
- # BUG, FIXME: Shed config dict does not exist in this context
- tool_path = shed_config_dict[ 'tool_path' ]
+ tool_path = shed_conf_dict[ 'tool_path' ]
else:
# Pick a semi-random shed-related tool panel configuration file and get the tool_path setting.
for shed_config_dict in trans.app.toolbox.shed_tool_confs:
https://bitbucket.org/galaxy/galaxy-central/commits/31d16cab8447/
Changeset: 31d16cab8447
User: dannon
Date: 2013-10-25 01:32:30
Summary: Fix yet another missing import in tool_shed_repositories API
Affected #: 1 file
diff -r 3e5cbc50db38f44d54ee0682d4320658ba6d4763 -r 31d16cab8447c111e1de64575208db8d16063e17 lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
--- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
+++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
@@ -13,6 +13,8 @@
from tool_shed.util import encoding_util
from tool_shed.util import metadata_util
from tool_shed.util import workflow_util
+from tool_shed.util import tool_util
+
import tool_shed.util.shed_util_common as suc
log = logging.getLogger( __name__ )
https://bitbucket.org/galaxy/galaxy-central/commits/404f0c60e9bd/
Changeset: 404f0c60e9bd
User: dannon
Date: 2013-10-25 01:34:38
Summary: Complete cleanup of tool_shed_repositories API -- remove unused code and strip whitespace
Affected #: 1 file
diff -r 31d16cab8447c111e1de64575208db8d16063e17 -r 404f0c60e9bd45654bef1ea68bc64a26c0811bca lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
--- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
+++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py
@@ -34,6 +34,7 @@
message += 'Installing_Galaxy_tool_shed_repository_tools_into_a_local_Galaxy_instance.'
return message
+
class ToolShedRepositoriesController( BaseAPIController ):
"""RESTful controller for interactions with tool shed repositories."""
@@ -43,7 +44,7 @@
GET /api/tool_shed_repositories/{encoded_tool_shed_repository_id}/exported_workflows
Display a list of dictionaries containing information about this tool shed repository's exported workflows.
-
+
:param id: the encoded id of the ToolShedRepository object
"""
# Example URL: http://localhost:8763/api/tool_shed_repositories/f2db41e1fa331b3e/exported_…
@@ -74,10 +75,10 @@
POST /api/tool_shed_repositories/import_workflow
Import the specified exported workflow contained in the specified installed tool shed repository into Galaxy.
-
+
:param key: the API key of the Galaxy user with which the imported workflow will be associated.
:param id: the encoded id of the ToolShedRepository object
-
+
The following parameters are included in the payload.
:param index: the index location of the workflow tuple in the list of exported workflows stored in the metadata for the specified repository
"""
@@ -109,7 +110,7 @@
POST /api/tool_shed_repositories/import_workflow
Import all of the exported workflows contained in the specified installed tool shed repository into Galaxy.
-
+
:param key: the API key of the Galaxy user with which the imported workflows will be associated.
:param id: the encoded id of the ToolShedRepository object
"""
@@ -229,7 +230,6 @@
return dict( status='error', error=message )
if raw_text:
items = json.from_json_string( raw_text )
- repository_dict = items[ 0 ]
repository_revision_dict = items[ 1 ]
repo_info_dict = items[ 2 ]
else:
@@ -415,7 +415,6 @@
install_tool_dependencies = payload.get( 'install_tool_dependencies', False )
new_tool_panel_section_label = payload.get( 'new_tool_panel_section_label', '' )
shed_tool_conf = payload.get( 'shed_tool_conf', None )
- tool_path = payload.get( 'tool_path', None )
tool_panel_section_id = payload.get( 'tool_panel_section_id', '' )
all_installed_tool_shed_repositories = []
for index, tool_shed_url in enumerate( tool_shed_urls ):
@@ -451,7 +450,6 @@
:param owner (required): the owner of the Repository
:param changset_revision (required): the changset_revision of the RepositoryMetadata object associated with the Repository
"""
- api_key = kwd.get( 'key', None )
# Get the information about the repository to be installed from the payload.
tool_shed_url = payload.get( 'tool_shed_url', '' )
if not tool_shed_url:
@@ -471,7 +469,6 @@
ordered_tsr_ids = repair_dict.get( 'ordered_tsr_ids', [] )
ordered_repo_info_dicts = repair_dict.get( 'ordered_repo_info_dicts', [] )
if ordered_tsr_ids and ordered_repo_info_dicts:
- repositories_for_repair = []
for index, tsr_id in enumerate( ordered_tsr_ids ):
repository = trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( tsr_id ) )
repo_info_dict = ordered_repo_info_dicts[ index ]
@@ -496,7 +493,7 @@
PUT /api/tool_shed_repositories/reset_metadata_on_installed_repositories
Resets all metadata on all repositories installed into Galaxy in an "orderly fashion".
-
+
:param key: the API key of the Galaxy admin user.
"""
try:
https://bitbucket.org/galaxy/galaxy-central/commits/23c9b4736570/
Changeset: 23c9b4736570
User: dannon
Date: 2013-10-25 06:39:47
Summary: Simplify undelete_quota, there are no params.
Affected #: 2 files
diff -r 404f0c60e9bd45654bef1ea68bc64a26c0811bca -r 23c9b4736570957fd2d54bde163d99943efb2e1c lib/galaxy/actions/admin.py
--- a/lib/galaxy/actions/admin.py
+++ b/lib/galaxy/actions/admin.py
@@ -150,7 +150,7 @@
message += ', '.join( names )
return message
- def _undelete_quota( self, quota, params ):
+ def _undelete_quota( self, quota ):
quotas = util.listify( quota )
names = []
for q in quotas:
diff -r 404f0c60e9bd45654bef1ea68bc64a26c0811bca -r 23c9b4736570957fd2d54bde163d99943efb2e1c lib/galaxy/webapps/galaxy/api/quotas.py
--- a/lib/galaxy/webapps/galaxy/api/quotas.py
+++ b/lib/galaxy/webapps/galaxy/api/quotas.py
@@ -5,7 +5,6 @@
from galaxy.web.base.controller import BaseAPIController, UsesQuotaMixin, url_for
from galaxy.web.base.controllers.admin import Admin
from galaxy import web, util
-from elementtree.ElementTree import XML
from galaxy.web.params import QuotaParamParser
from galaxy.actions.admin import AdminActions
@@ -140,8 +139,7 @@
Undeletes a quota
"""
quota = self.get_quota( trans, id, deleted=True )
- params = self.get_quota_params( payload )
try:
- return self._undelete_quota( quota, params )
+ return self._undelete_quota( quota )
except ActionInputError, e:
raise HTTPBadRequest( detail=str( e ) )
https://bitbucket.org/galaxy/galaxy-central/commits/5a259fa8aabb/
Changeset: 5a259fa8aabb
User: dannon
Date: 2013-10-25 06:40:01
Summary: Merge with central
Affected #: 6 files
diff -r 23c9b4736570957fd2d54bde163d99943efb2e1c -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -119,14 +119,18 @@
return { "message": { "type": "error", "data" : vars[ 'errors' ] } }
# TODO: check for errors and ensure that output dataset(s) are available.
- output_datasets = vars.get( 'out_data', {} ).values()
+ output_datasets = vars.get( 'out_data', {} ).iteritems()
rval = {
"outputs": []
}
outputs = rval[ "outputs" ]
#TODO:?? poss. only return ids?
- for output in output_datasets:
+ for output_name, output in output_datasets:
output_dict = output.to_dict()
+ #add the output name back into the output data structure
+ #so it's possible to figure out which newly created elements
+ #correspond with which tool file outputs
+ output_dict['output_name'] = output_name
outputs.append( trans.security.encode_dict_ids( output_dict ) )
return rval
diff -r 23c9b4736570957fd2d54bde163d99943efb2e1c -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -341,10 +341,13 @@
elif action_type == 'setup_r_environment':
# setup an R environment
# <action type="setup_r_environment">
- # <r_base name="package_r_3_0_1" owner="bgruening" />
+ # <repository name="package_r_3_0_1" owner="bgruening">
+ # <package name="R" version="3.0.1" />
+ # </repository>
+ # <!-- allow installing an R packages -->
+ # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
# </action>
- # allow downloading and installing an R package
- # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
+
if action_dict.get( 'env_shell_file_paths', False ):
install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] )
else:
@@ -371,10 +374,73 @@
# R libraries are installed to $INSTALL_DIR (install_dir), we now set the R_LIBS path to that directory
# TODO: That code is used a lot for the different environments and should be refactored, once the environments are integrated
modify_env_command_dict = dict( name="R_LIBS", action="prepend_to", value=install_dir )
- modify_env_command = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
- return_code = handle_command( app, tool_dependency, install_dir, modify_env_command )
+ env_entry, env_file = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
+ return_code = file_append( env_entry, env_file, skip_if_contained=True, make_executable=True )
+
if return_code:
return
+ elif action_type == 'setup_ruby_environment':
+ # setup an Ruby environment
+ # <action type="setup_ruby_environment">
+ # <repository name="package_ruby_2_0" owner="bgruening">
+ # <package name="ruby" version="2.0" />
+ # </repository>
+ # <!-- allow downloading and installing an Ruby package from http://rubygems.org/ -->
+ # <package>protk</package>
+ # <package>protk=1.2.4</package>
+ # <package>http://url-to-some-gem-file.de/protk.gem</package>
+ # </action>
+ if action_dict.get( 'env_shell_file_paths', False ):
+ install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] )
+ else:
+ log.warning( 'Missing Ruby environment. Please check if your specified Ruby installation exists.' )
+ return
+
+ dir = os.path.curdir
+ current_dir = os.path.abspath( os.path.join( work_dir, dir ) )
+ with lcd( current_dir ):
+ with settings( warn_only=True ):
+ for (gem, gem_version) in action_dict[ 'ruby_packages' ]:
+ if os.path.isfile( gem ):
+ # we assume a local shipped gem file
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install --local %s''' % ( gem )
+ elif gem.find('://') != -1:
+ # we assume a URL to a gem file
+ url = gem
+ gem_name = url.split( '/' )[ -1 ]
+ td_common_util.url_download( work_dir, gem_name, url, extract=False )
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install --local %s ''' % ( gem_name )
+ else:
+ # gem file from rubygems.org with or without version number
+ if gem_version:
+ # version number was specified
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install %s --version "=%s"''' % ( gem, gem_version)
+ else:
+ # no version number given
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install %s''' % ( gem )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) )
+ return_code = handle_command( app, tool_dependency, install_dir, cmd )
+ if return_code:
+ return
+
+ # Ruby libraries are installed to $INSTALL_DIR (install_dir), we now set the GEM_PATH path to that directory
+ # TODO: That code is used a lot for the different environments and should be refactored, once the environments are integrated
+ modify_env_command_dict = dict( name="GEM_PATH", action="prepend_to", value=install_dir )
+ env_entry, env_file = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
+ return_code = file_append( env_entry, env_file, skip_if_contained=True, make_executable=True )
+ if return_code:
+ return
+
+ modify_env_command_dict = dict( name="PATH", action="prepend_to", value=os.path.join(install_dir, 'bin') )
+ env_entry, env_file = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
+ return_code = file_append( env_entry, env_file, skip_if_contained=True, make_executable=True )
+ if return_code:
+ return
+
else:
# We're handling a complex repository dependency where we only have a set_environment tag set.
# <action type="set_environment">
diff -r 23c9b4736570957fd2d54bde163d99943efb2e1c -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -613,10 +613,13 @@
action_dict[ 'configure_opts' ] = configure_opts
elif action_type == 'setup_r_environment':
# setup an R environment
- # <action type="setup_r_environment" name="package_r_3_0_1" owner="bgruening">
- # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
+ # <action type="setup_r_environment">
+ # <repository name="package_r_3_0_1" owner="bgruening">
+ # <package name="R" version="3.0.1" />
+ # </repository>
+ # <!-- allow installing an R packages -->
+ # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
# </action>
-
env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') )
all_env_shell_file_paths.extend( env_shell_file_paths )
@@ -631,6 +634,46 @@
action_dict[ 'r_packages' ] = r_packages
else:
continue
+ elif action_type == 'setup_ruby_environment':
+ # setup an Ruby environment
+ # <action type="setup_ruby_environment">
+ # <repository name="package_ruby_2_0" owner="bgruening">
+ # <package name="ruby" version="2.0" />
+ # </repository>
+ # <!-- allow downloading and installing an Ruby package from http://rubygems.org/ -->
+ # <package>protk</package>
+ # <package>protk=1.2.4</package>
+ # <package>http://url-to-some-gem-file.de/protk.gem</package>
+ # </action>
+
+ env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') )
+ all_env_shell_file_paths.extend( env_shell_file_paths )
+ if all_env_shell_file_paths:
+ action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths
+ ruby_packages = list()
+ for env_elem in action_elem:
+ if env_elem.tag == 'package':
+ """
+ A valid gem definition can be:
+ protk=1.2.4
+ protk
+ ftp://ftp.gruening.de/protk.gem
+ """
+ gem_token = env_elem.text.strip().split('=')
+ if len(gem_token) == 2:
+ # version string
+ gem_name = gem_token[0]
+ gem_version = gem_token[1]
+ ruby_packages.append( [gem_name, gem_version] )
+ else:
+ # gem name for rubygems.org without version number
+ gem = env_elem.text.strip()
+ ruby_packages.append( [gem, None] )
+
+ if ruby_packages:
+ action_dict[ 'ruby_packages' ] = ruby_packages
+ else:
+ continue
elif action_type == 'make_install':
# make; make install; allow providing make options
if action_elem.text:
diff -r 23c9b4736570957fd2d54bde163d99943efb2e1c -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c test-data/extract_genomic_dna_out2.fasta
--- a/test-data/extract_genomic_dna_out2.fasta
+++ b/test-data/extract_genomic_dna_out2.fasta
@@ -1,6 +1,6 @@
->droPer1_super_1_139823_139913_-
+>droPer1_super_1_139823_139913_- AK028861
CGTCGGCTTCTGCTTCTGCTGATGATGGTCGTTCTTCTTCCTTTACTTCT
TCCTATTTTTCTTCCTTCCCTTACACTATATCTTCCTTTA
->droPer1_super_1_156750_156844_-
+>droPer1_super_1_156750_156844_- BC126698
CCGGGCTGCGGCAAGGGATTCACCTGCTCCAAACAGCTCAAGGTGCACTC
CCGCACGCACACGGGCGAGAAGCCCTATCACTGCGACATCTGCT
diff -r 23c9b4736570957fd2d54bde163d99943efb2e1c -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c tools/extract/extract_genomic_dna.py
--- a/tools/extract/extract_genomic_dna.py
+++ b/tools/extract/extract_genomic_dna.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
usage: %prog $input $out_file1
- -1, --cols=N,N,N,N: Columns for start, end, strand in input file
+ -1, --cols=N,N,N,N,N: Columns for start, end, strand in input file
-d, --dbkey=N: Genome build of input file
-o, --output_format=N: the data type of the output file
-g, --GALAXY_DATA_INDEX_DIR=N: the directory containing alignseq.loc
@@ -54,7 +54,13 @@
#
options, args = doc_optparse.parse( __doc__ )
try:
- chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
+ if len(options.cols.split(',')) == 5:
+ # BED file
+ chrom_col, start_col, end_col, strand_col, name_col = parse_cols_arg( options.cols )
+ else:
+ # gff file
+ chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
+ name_col = False
dbkey = options.dbkey
output_format = options.output_format
gff_format = options.gff
@@ -136,7 +142,8 @@
if isinstance( feature, ( Header, Comment ) ):
line_count += 1
continue
-
+
+ name = ""
if gff_format and interpret_features:
# Processing features.
gff_util.convert_gff_coords_to_bed( feature )
@@ -153,6 +160,8 @@
chrom = fields[chrom_col]
start = int( fields[start_col] )
end = int( fields[end_col] )
+ if name_col:
+ name = fields[name_col]
if gff_format:
start, end = gff_util.convert_gff_coords_to_bed( [start, end] )
if includes_strand_col:
@@ -237,13 +246,16 @@
sequence = reverse_complement( sequence )
if output_format == "fasta" :
- l = len( sequence )
+ l = len( sequence )
c = 0
if gff_format:
start, end = gff_util.convert_bed_coords_to_gff( [ start, end ] )
fields = [dbkey, str( chrom ), str( start ), str( end ), strand]
meta_data = "_".join( fields )
- fout.write( ">%s\n" % meta_data )
+ if name.strip():
+ fout.write( ">%s %s\n" % (meta_data, name) )
+ else:
+ fout.write( ">%s\n" % meta_data )
while c < l:
b = min( c + 50, l )
fout.write( "%s\n" % str( sequence[c:b] ) )
diff -r 23c9b4736570957fd2d54bde163d99943efb2e1c -r 5a259fa8aabb4d977c5ed091d1658b9674d0e67c tools/extract/extract_genomic_dna.xml
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -1,4 +1,4 @@
-<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.2">
+<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.3"><description>using coordinates from assembled/unassembled genomes</description><command interpreter="python">
extract_genomic_dna.py $input $out_file1 -o $out_format -d $dbkey
@@ -11,9 +11,9 @@
#if isinstance( $input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__):
-1 1,4,5,7 --gff
#else:
- -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol}
+ -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol},${input.metadata.nameCol}
#end if
-
+
#if $seq_source.index_source == "cached":
## Genomic data from cache.
-g ${GALAXY_DATA_INDEX_DIR}
@@ -52,16 +52,30 @@
</data></outputs><requirements>
+ <requirement type="package">ucsc_tools</requirement><requirement type="binary">faToTwoBit</requirement>
- <requirement type="package">ucsc_tools</requirement></requirements><tests><test><param name="input" value="1.bed" dbkey="hg17" ftype="bed" /><param name="interpret_features" value="yes"/><param name="index_source" value="cached"/>
- <param name="out_format" value="fasta"/>
- <output name="out_file1" file="extract_genomic_dna_out1.fasta" />
+ <param name="out_format" value="fasta"/>
+ <output name="out_file1">
+ <assert_contents>
+ <!-- First few lines... -->
+ <has_text text=">hg17_chr1_147962192_147962580_- CCDS989.1_cds_0_0_chr1_147962193_r" />
+ <has_text text="ACTTGATCCTGCTCCCTCGGTGTCTGCATTGACTCCTCATGCTGGGACTG" />
+ <has_text text="GACCCGTCAACCCCCCTGCTCGCTGCTCACGTACCTTCATCACTTTTAGT" />
+ <has_text text="GATGATGCAACTTTCGAGGAATGGTTCCCCCAAGGGCGGCCCCCAAAAGT" />
+ <!-- Last few lines... -->
+ <has_text text="GCTGTGGCACAGAACATGGACTCTGTGTTTAAGGAGCTCTTGGGAAAGAC" />
+ <has_text text="CTCTGTCCGCCAGGGCCTTGGGCCAGCATCTACCACCTCTCCCAGTCCTG" />
+ <has_text text="GGCCCCGAAGCCCAAAGGCCCCGCCCAGCAGCCGCCTGGGCAGGAACAAA" />
+ <has_text text="GGCTTCTCCCGGGGCCCTGGGGCCCCAGCCTCACCCTCAGCTTCCCACCC" />
+ <has_text text="CCAGGGCCTAGACACGACCCCCAAGCCACACTGA" />
+ </assert_contents>
+ </output></test><test><param name="input" value="droPer1.bed" dbkey="droPer1" ftype="bed" />
@@ -152,14 +166,14 @@
Extracting sequences with **FASTA** output data type returns::
- >hg17_chr7_127475281_127475310_+
+ >hg17_chr7_127475281_127475310_+ NM_000230
GTAGGAATCGCAGCGCCAGCGGTTGCAAG
- >hg17_chr7_127485994_127486166_+
+ >hg17_chr7_127485994_127486166_+ NM_000230
GCCCAAGAAGCCCATCCTGGGAAGGAAAATGCATTGGGGAACCCTGTGCG
GATTCTTGTGGCTTTGGCCCTATCTTTTCTATGTCCAAGCTGTGCCCATC
CAAAAAGTCCAAGATGACACCAAAACCCTCATCAAGACAATTGTCACCAG
GATCAATGACATTTCACACACG
- >hg17_chr7_127486011_127486166_+
+ >hg17_chr7_127486011_127486166_+ D49487
TGGGAAGGAAAATGCATTGGGGAACCCTGTGCGGATTCTTGTGGCTTTGG
CCCTATCTTTTCTATGTCCAAGCTGTGCCCATCCAAAAAGTCCAAGATGA
CACCAAAACCCTCATCAAGACAATTGTCACCAGGATCAATGACATTTCAC
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.
1
0
6 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1ce68c239d0e/
Changeset: 1ce68c239d0e
Branch: extract_genomic_dna_tool_enhancements
User: BjoernGruening
Date: 2013-10-18 18:31:44
Summary: Add the value (nameCol) in a given BED file to the FASTA header.
Affected #: 2 files
diff -r febd7622924885dd0729ce00924289cc1f0eb741 -r 1ce68c239d0ee59bd469c4520bf754eaa80ac04c tools/extract/extract_genomic_dna.py
--- a/tools/extract/extract_genomic_dna.py
+++ b/tools/extract/extract_genomic_dna.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
usage: %prog $input $out_file1
- -1, --cols=N,N,N,N: Columns for start, end, strand in input file
+ -1, --cols=N,N,N,N,N: Columns for start, end, strand in input file
-d, --dbkey=N: Genome build of input file
-o, --output_format=N: the data type of the output file
-g, --GALAXY_DATA_INDEX_DIR=N: the directory containing alignseq.loc
@@ -54,7 +54,13 @@
#
options, args = doc_optparse.parse( __doc__ )
try:
- chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
+ if len(options.cols.split(',')) == 5:
+ # BED file
+ chrom_col, start_col, end_col, strand_col, name_col = parse_cols_arg( options.cols )
+ else:
+ # gff file
+ chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
+ name_col = False
dbkey = options.dbkey
output_format = options.output_format
gff_format = options.gff
@@ -144,6 +150,7 @@
start = feature.start
end = feature.end
strand = feature.strand
+ name = ""
else:
# Processing lines, either interval or GFF format.
line = feature.rstrip( '\r\n' )
@@ -153,6 +160,8 @@
chrom = fields[chrom_col]
start = int( fields[start_col] )
end = int( fields[end_col] )
+ if name_col:
+ name = fields[name_col]
if gff_format:
start, end = gff_util.convert_gff_coords_to_bed( [start, end] )
if includes_strand_col:
@@ -237,13 +246,16 @@
sequence = reverse_complement( sequence )
if output_format == "fasta" :
- l = len( sequence )
+ l = len( sequence )
c = 0
if gff_format:
start, end = gff_util.convert_bed_coords_to_gff( [ start, end ] )
fields = [dbkey, str( chrom ), str( start ), str( end ), strand]
meta_data = "_".join( fields )
- fout.write( ">%s\n" % meta_data )
+ if name.strip():
+ fout.write( ">%s %s\n" % (meta_data, name) )
+ else:
+ fout.write( ">%s\n" % meta_data )
while c < l:
b = min( c + 50, l )
fout.write( "%s\n" % str( sequence[c:b] ) )
diff -r febd7622924885dd0729ce00924289cc1f0eb741 -r 1ce68c239d0ee59bd469c4520bf754eaa80ac04c tools/extract/extract_genomic_dna.xml
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -11,9 +11,9 @@
#if isinstance( $input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__):
-1 1,4,5,7 --gff
#else:
- -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol}
+ -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol},${input.metadata.nameCol}
#end if
-
+
#if $seq_source.index_source == "cached":
## Genomic data from cache.
-g ${GALAXY_DATA_INDEX_DIR}
@@ -52,8 +52,8 @@
</data></outputs><requirements>
+ <requirement type="package">ucsc_tools</requirement><requirement type="binary">faToTwoBit</requirement>
- <requirement type="package">ucsc_tools</requirement></requirements><tests><test>
https://bitbucket.org/galaxy/galaxy-central/commits/9c6732931369/
Changeset: 9c6732931369
Branch: extract_genomic_dna_tool_enhancements
User: BjoernGruening
Date: 2013-10-24 18:13:18
Summary: bugfix and one test fix
Affected #: 3 files
diff -r 1ce68c239d0ee59bd469c4520bf754eaa80ac04c -r 9c67329313699a02108fe36dc0cee93fee362c70 test-data/extract_genomic_dna_out2.fasta
--- a/test-data/extract_genomic_dna_out2.fasta
+++ b/test-data/extract_genomic_dna_out2.fasta
@@ -1,6 +1,6 @@
->droPer1_super_1_139823_139913_-
+>droPer1_super_1_139823_139913_- AK028861
CGTCGGCTTCTGCTTCTGCTGATGATGGTCGTTCTTCTTCCTTTACTTCT
TCCTATTTTTCTTCCTTCCCTTACACTATATCTTCCTTTA
->droPer1_super_1_156750_156844_-
+>droPer1_super_1_156750_156844_- BC126698
CCGGGCTGCGGCAAGGGATTCACCTGCTCCAAACAGCTCAAGGTGCACTC
CCGCACGCACACGGGCGAGAAGCCCTATCACTGCGACATCTGCT
diff -r 1ce68c239d0ee59bd469c4520bf754eaa80ac04c -r 9c67329313699a02108fe36dc0cee93fee362c70 tools/extract/extract_genomic_dna.py
--- a/tools/extract/extract_genomic_dna.py
+++ b/tools/extract/extract_genomic_dna.py
@@ -142,7 +142,8 @@
if isinstance( feature, ( Header, Comment ) ):
line_count += 1
continue
-
+
+ name = ""
if gff_format and interpret_features:
# Processing features.
gff_util.convert_gff_coords_to_bed( feature )
@@ -150,7 +151,6 @@
start = feature.start
end = feature.end
strand = feature.strand
- name = ""
else:
# Processing lines, either interval or GFF format.
line = feature.rstrip( '\r\n' )
diff -r 1ce68c239d0ee59bd469c4520bf754eaa80ac04c -r 9c67329313699a02108fe36dc0cee93fee362c70 tools/extract/extract_genomic_dna.xml
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -60,7 +60,7 @@
<param name="input" value="1.bed" dbkey="hg17" ftype="bed" /><param name="interpret_features" value="yes"/><param name="index_source" value="cached"/>
- <param name="out_format" value="fasta"/>
+ <param name="out_format" value="fasta"/><output name="out_file1" file="extract_genomic_dna_out1.fasta" /></test><test>
https://bitbucket.org/galaxy/galaxy-central/commits/af3fc6046bd6/
Changeset: af3fc6046bd6
Branch: extract_genomic_dna_tool_enhancements
User: jmchilton
Date: 2013-10-25 06:03:57
Summary: Update hg17 test case for extract_genomic_dna.xml tor reflect recent changes.
Cannot delete or modify previous output file - it is used as input for another tool. Use assertion testing to weaken test case. As this tool is migrated to the tool shed the hg17 test cases should probably be eliminated completely.
Affected #: 1 file
diff -r 9c67329313699a02108fe36dc0cee93fee362c70 -r af3fc6046bd693fdbf1ec26d119bf387d7a92bc2 tools/extract/extract_genomic_dna.xml
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -61,7 +61,21 @@
<param name="interpret_features" value="yes"/><param name="index_source" value="cached"/><param name="out_format" value="fasta"/>
- <output name="out_file1" file="extract_genomic_dna_out1.fasta" />
+ <output name="out_file1">
+ <assert_contents>
+ <!-- First few lines... -->
+ <has_text text=">hg17_chr1_147962192_147962580_- CCDS989.1_cds_0_0_chr1_147962193_r" />
+ <has_text text="ACTTGATCCTGCTCCCTCGGTGTCTGCATTGACTCCTCATGCTGGGACTG" />
+ <has_text text="GACCCGTCAACCCCCCTGCTCGCTGCTCACGTACCTTCATCACTTTTAGT" />
+ <has_text text="GATGATGCAACTTTCGAGGAATGGTTCCCCCAAGGGCGGCCCCCAAAAGT" />
+ <!-- Last few lines... -->
+ <has_text text="GCTGTGGCACAGAACATGGACTCTGTGTTTAAGGAGCTCTTGGGAAAGAC" />
+ <has_text text="CTCTGTCCGCCAGGGCCTTGGGCCAGCATCTACCACCTCTCCCAGTCCTG" />
+ <has_text text="GGCCCCGAAGCCCAAAGGCCCCGCCCAGCAGCCGCCTGGGCAGGAACAAA" />
+ <has_text text="GGCTTCTCCCGGGGCCCTGGGGCCCCAGCCTCACCCTCAGCTTCCCACCC" />
+ <has_text text="CCAGGGCCTAGACACGACCCCCAAGCCACACTGA" />
+ </assert_contents>
+ </output></test><test><param name="input" value="droPer1.bed" dbkey="droPer1" ftype="bed" />
https://bitbucket.org/galaxy/galaxy-central/commits/7b014440dda1/
Changeset: 7b014440dda1
Branch: extract_genomic_dna_tool_enhancements
User: jmchilton
Date: 2013-10-25 06:06:14
Summary: Rev slightly the tool version of extract_genomic_dna.xml since output is slightly different.
Update tool help to reflect new output format.
Affected #: 1 file
diff -r af3fc6046bd693fdbf1ec26d119bf387d7a92bc2 -r 7b014440dda1d9dddb292598fb804510b5274438 tools/extract/extract_genomic_dna.xml
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -1,4 +1,4 @@
-<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.2">
+<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.3"><description>using coordinates from assembled/unassembled genomes</description><command interpreter="python">
extract_genomic_dna.py $input $out_file1 -o $out_format -d $dbkey
@@ -166,14 +166,14 @@
Extracting sequences with **FASTA** output data type returns::
- >hg17_chr7_127475281_127475310_+
+ >hg17_chr7_127475281_127475310_+ NM_000230
GTAGGAATCGCAGCGCCAGCGGTTGCAAG
- >hg17_chr7_127485994_127486166_+
+ >hg17_chr7_127485994_127486166_+ NM_000230
GCCCAAGAAGCCCATCCTGGGAAGGAAAATGCATTGGGGAACCCTGTGCG
GATTCTTGTGGCTTTGGCCCTATCTTTTCTATGTCCAAGCTGTGCCCATC
CAAAAAGTCCAAGATGACACCAAAACCCTCATCAAGACAATTGTCACCAG
GATCAATGACATTTCACACACG
- >hg17_chr7_127486011_127486166_+
+ >hg17_chr7_127486011_127486166_+ D49487
TGGGAAGGAAAATGCATTGGGGAACCCTGTGCGGATTCTTGTGGCTTTGG
CCCTATCTTTTCTATGTCCAAGCTGTGCCCATCCAAAAAGTCCAAGATGA
CACCAAAACCCTCATCAAGACAATTGTCACCAGGATCAATGACATTTCAC
https://bitbucket.org/galaxy/galaxy-central/commits/57e9ebe8ea6b/
Changeset: 57e9ebe8ea6b
User: jmchilton
Date: 2013-10-25 06:08:48
Summary: Merge pull request #239 changes into default.
Affected #: 3 files
diff -r d4e60067889e2bd8873010fa0fc887e725a4b695 -r 57e9ebe8ea6ba6686a489560cde62b309d2e5271 test-data/extract_genomic_dna_out2.fasta
--- a/test-data/extract_genomic_dna_out2.fasta
+++ b/test-data/extract_genomic_dna_out2.fasta
@@ -1,6 +1,6 @@
->droPer1_super_1_139823_139913_-
+>droPer1_super_1_139823_139913_- AK028861
CGTCGGCTTCTGCTTCTGCTGATGATGGTCGTTCTTCTTCCTTTACTTCT
TCCTATTTTTCTTCCTTCCCTTACACTATATCTTCCTTTA
->droPer1_super_1_156750_156844_-
+>droPer1_super_1_156750_156844_- BC126698
CCGGGCTGCGGCAAGGGATTCACCTGCTCCAAACAGCTCAAGGTGCACTC
CCGCACGCACACGGGCGAGAAGCCCTATCACTGCGACATCTGCT
diff -r d4e60067889e2bd8873010fa0fc887e725a4b695 -r 57e9ebe8ea6ba6686a489560cde62b309d2e5271 tools/extract/extract_genomic_dna.py
--- a/tools/extract/extract_genomic_dna.py
+++ b/tools/extract/extract_genomic_dna.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
usage: %prog $input $out_file1
- -1, --cols=N,N,N,N: Columns for start, end, strand in input file
+ -1, --cols=N,N,N,N,N: Columns for start, end, strand in input file
-d, --dbkey=N: Genome build of input file
-o, --output_format=N: the data type of the output file
-g, --GALAXY_DATA_INDEX_DIR=N: the directory containing alignseq.loc
@@ -54,7 +54,13 @@
#
options, args = doc_optparse.parse( __doc__ )
try:
- chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
+ if len(options.cols.split(',')) == 5:
+ # BED file
+ chrom_col, start_col, end_col, strand_col, name_col = parse_cols_arg( options.cols )
+ else:
+ # gff file
+ chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
+ name_col = False
dbkey = options.dbkey
output_format = options.output_format
gff_format = options.gff
@@ -136,7 +142,8 @@
if isinstance( feature, ( Header, Comment ) ):
line_count += 1
continue
-
+
+ name = ""
if gff_format and interpret_features:
# Processing features.
gff_util.convert_gff_coords_to_bed( feature )
@@ -153,6 +160,8 @@
chrom = fields[chrom_col]
start = int( fields[start_col] )
end = int( fields[end_col] )
+ if name_col:
+ name = fields[name_col]
if gff_format:
start, end = gff_util.convert_gff_coords_to_bed( [start, end] )
if includes_strand_col:
@@ -237,13 +246,16 @@
sequence = reverse_complement( sequence )
if output_format == "fasta" :
- l = len( sequence )
+ l = len( sequence )
c = 0
if gff_format:
start, end = gff_util.convert_bed_coords_to_gff( [ start, end ] )
fields = [dbkey, str( chrom ), str( start ), str( end ), strand]
meta_data = "_".join( fields )
- fout.write( ">%s\n" % meta_data )
+ if name.strip():
+ fout.write( ">%s %s\n" % (meta_data, name) )
+ else:
+ fout.write( ">%s\n" % meta_data )
while c < l:
b = min( c + 50, l )
fout.write( "%s\n" % str( sequence[c:b] ) )
diff -r d4e60067889e2bd8873010fa0fc887e725a4b695 -r 57e9ebe8ea6ba6686a489560cde62b309d2e5271 tools/extract/extract_genomic_dna.xml
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -1,4 +1,4 @@
-<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.2">
+<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.3"><description>using coordinates from assembled/unassembled genomes</description><command interpreter="python">
extract_genomic_dna.py $input $out_file1 -o $out_format -d $dbkey
@@ -11,9 +11,9 @@
#if isinstance( $input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__):
-1 1,4,5,7 --gff
#else:
- -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol}
+ -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol},${input.metadata.nameCol}
#end if
-
+
#if $seq_source.index_source == "cached":
## Genomic data from cache.
-g ${GALAXY_DATA_INDEX_DIR}
@@ -52,16 +52,30 @@
</data></outputs><requirements>
+ <requirement type="package">ucsc_tools</requirement><requirement type="binary">faToTwoBit</requirement>
- <requirement type="package">ucsc_tools</requirement></requirements><tests><test><param name="input" value="1.bed" dbkey="hg17" ftype="bed" /><param name="interpret_features" value="yes"/><param name="index_source" value="cached"/>
- <param name="out_format" value="fasta"/>
- <output name="out_file1" file="extract_genomic_dna_out1.fasta" />
+ <param name="out_format" value="fasta"/>
+ <output name="out_file1">
+ <assert_contents>
+ <!-- First few lines... -->
+ <has_text text=">hg17_chr1_147962192_147962580_- CCDS989.1_cds_0_0_chr1_147962193_r" />
+ <has_text text="ACTTGATCCTGCTCCCTCGGTGTCTGCATTGACTCCTCATGCTGGGACTG" />
+ <has_text text="GACCCGTCAACCCCCCTGCTCGCTGCTCACGTACCTTCATCACTTTTAGT" />
+ <has_text text="GATGATGCAACTTTCGAGGAATGGTTCCCCCAAGGGCGGCCCCCAAAAGT" />
+ <!-- Last few lines... -->
+ <has_text text="GCTGTGGCACAGAACATGGACTCTGTGTTTAAGGAGCTCTTGGGAAAGAC" />
+ <has_text text="CTCTGTCCGCCAGGGCCTTGGGCCAGCATCTACCACCTCTCCCAGTCCTG" />
+ <has_text text="GGCCCCGAAGCCCAAAGGCCCCGCCCAGCAGCCGCCTGGGCAGGAACAAA" />
+ <has_text text="GGCTTCTCCCGGGGCCCTGGGGCCCCAGCCTCACCCTCAGCTTCCCACCC" />
+ <has_text text="CCAGGGCCTAGACACGACCCCCAAGCCACACTGA" />
+ </assert_contents>
+ </output></test><test><param name="input" value="droPer1.bed" dbkey="droPer1" ftype="bed" />
@@ -152,14 +166,14 @@
Extracting sequences with **FASTA** output data type returns::
- >hg17_chr7_127475281_127475310_+
+ >hg17_chr7_127475281_127475310_+ NM_000230
GTAGGAATCGCAGCGCCAGCGGTTGCAAG
- >hg17_chr7_127485994_127486166_+
+ >hg17_chr7_127485994_127486166_+ NM_000230
GCCCAAGAAGCCCATCCTGGGAAGGAAAATGCATTGGGGAACCCTGTGCG
GATTCTTGTGGCTTTGGCCCTATCTTTTCTATGTCCAAGCTGTGCCCATC
CAAAAAGTCCAAGATGACACCAAAACCCTCATCAAGACAATTGTCACCAG
GATCAATGACATTTCACACACG
- >hg17_chr7_127486011_127486166_+
+ >hg17_chr7_127486011_127486166_+ D49487
TGGGAAGGAAAATGCATTGGGGAACCCTGTGCGGATTCTTGTGGCTTTGG
CCCTATCTTTTCTATGTCCAAGCTGTGCCCATCCAAAAAGTCCAAGATGA
CACCAAAACCCTCATCAAGACAATTGTCACCAGGATCAATGACATTTCAC
https://bitbucket.org/galaxy/galaxy-central/commits/7286338fd77e/
Changeset: 7286338fd77e
Branch: extract_genomic_dna_tool_enhancements
User: jmchilton
Date: 2013-10-25 06:09:25
Summary: Close branch extract_genomic_dna_tool_enhancements.
Affected #: 0 files
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/91399e1ae5fc/
Changeset: 91399e1ae5fc
User: BjoernGruening
Date: 2013-10-23 13:45:33
Summary: Add setup_ruby_environment action type
Affected #: 2 files
diff -r 115a6924dc4c459467ca162e10ee24ba04001a1e -r 91399e1ae5fc827ddc9b33702fe401a10d367539 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -375,6 +375,68 @@
return_code = handle_command( app, tool_dependency, install_dir, modify_env_command )
if return_code:
return
+ elif action_type == 'setup_ruby_environment':
+ # setup an Ruby environment
+ # <action type="setup_ruby_environment">
+ # <repository name="package_ruby_2_0" owner="bgruening">
+ # <package name="ruby" version="2.0" />
+ # </repository>
+ # <!-- allow downloading and installing an Ruby package from http://rubygems.org/ -->
+ # <package>protk</package>
+ # <package>protk=1.2.4</package>
+ # <package>http://url-to-some-gem-file.de/protk.gem</package>
+ # </action>
+ if action_dict.get( 'env_shell_file_paths', False ):
+ install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] )
+ else:
+ log.warning( 'Missing Ruby environment. Please check if your specified Ruby installation exists.' )
+ return
+
+ dir = os.path.curdir
+ current_dir = os.path.abspath( os.path.join( work_dir, dir ) )
+ with lcd( current_dir ):
+ with settings( warn_only=True ):
+ for (gem, gem_version) in action_dict[ 'ruby_packages' ]:
+ if os.path.isfile( gem ):
+ # we assume a local shipped gem file
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install --local %s''' % ( gem )
+ elif gem.find('://') != -1:
+ # we assume a URL to a gem file
+ url = gem
+ gem_name = url.split( '/' )[ -1 ]
+ td_common_util.url_download( work_dir, gem_name, url, extract=False )
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install --local %s ''' % ( gem_name )
+ else:
+ # gem file from rubygems.org with or without version number
+ if gem_version:
+ # version number was specified
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install %s --version "=%s"''' % ( gem, gem_version)
+ else:
+ # no version number given
+ cmd = '''export PATH=$PATH:$RUBY_HOME/bin && export GEM_HOME=$INSTALL_DIR &&
+ gem install %s''' % ( gem )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) )
+ return_code = handle_command( app, tool_dependency, install_dir, cmd )
+ if return_code:
+ return
+
+ # Ruby libraries are installed to $INSTALL_DIR (install_dir), we now set the GEM_PATH path to that directory
+ # TODO: That code is used a lot for the different environments and should be refactored, once the environments are integrated
+ modify_env_command_dict = dict( name="GEM_PATH", action="prepend_to", value=install_dir )
+ env_entry, env_file = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
+ return_code = file_append( env_entry, env_file, skip_if_contained=True, make_executable=True )
+ if return_code:
+ return
+
+ modify_env_command_dict = dict( name="PATH", action="prepend_to", value=os.path.join(install_dir, 'bin') )
+ env_entry, env_file = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
+ return_code = file_append( env_entry, env_file, skip_if_contained=True, make_executable=True )
+ if return_code:
+ return
+
else:
# We're handling a complex repository dependency where we only have a set_environment tag set.
# <action type="set_environment">
diff -r 115a6924dc4c459467ca162e10ee24ba04001a1e -r 91399e1ae5fc827ddc9b33702fe401a10d367539 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -631,6 +631,46 @@
action_dict[ 'r_packages' ] = r_packages
else:
continue
+ elif action_type == 'setup_ruby_environment':
+ # setup an Ruby environment
+ # <action type="setup_ruby_environment">
+ # <repository name="package_ruby_2_0" owner="bgruening">
+ # <package name="ruby" version="2.0" />
+ # </repository>
+ # <!-- allow downloading and installing an Ruby package from http://rubygems.org/ -->
+ # <package>protk</package>
+ # <package>protk=1.2.4</package>
+ # <package>http://url-to-some-gem-file.de/protk.gem</package>
+ # </action>
+
+ env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') )
+ all_env_shell_file_paths.extend( env_shell_file_paths )
+ if all_env_shell_file_paths:
+ action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths
+ ruby_packages = list()
+ for env_elem in action_elem:
+ if env_elem.tag == 'package':
+ """
+ A valid gem definition can be:
+ protk=1.2.4
+ protk
+ ftp://ftp.gruening.de/protk.gem
+ """
+ gem_token = env_elem.text.strip().split('=')
+ if len(gem_token) == 2:
+ # version string
+ gem_name = gem_token[0]
+ gem_version = gem_token[1]
+ ruby_packages.append( [gem_name, gem_version] )
+ else:
+ # gem name for rubygems.org without version number
+ gem = env_elem.text.strip()
+ ruby_packages.append( [gem, None] )
+
+ if ruby_packages:
+ action_dict[ 'ruby_packages' ] = ruby_packages
+ else:
+ continue
elif action_type == 'make_install':
# make; make install; allow providing make options
if action_elem.text:
https://bitbucket.org/galaxy/galaxy-central/commits/d4e60067889e/
Changeset: d4e60067889e
User: BjoernGruening
Date: 2013-10-23 14:39:49
Summary: cleanup & bugfix for R environment
Affected #: 2 files
diff -r 91399e1ae5fc827ddc9b33702fe401a10d367539 -r d4e60067889e2bd8873010fa0fc887e725a4b695 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -341,10 +341,13 @@
elif action_type == 'setup_r_environment':
# setup an R environment
# <action type="setup_r_environment">
- # <r_base name="package_r_3_0_1" owner="bgruening" />
+ # <repository name="package_r_3_0_1" owner="bgruening">
+ # <package name="R" version="3.0.1" />
+ # </repository>
+ # <!-- allow installing an R packages -->
+ # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
# </action>
- # allow downloading and installing an R package
- # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
+
if action_dict.get( 'env_shell_file_paths', False ):
install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] )
else:
@@ -371,8 +374,9 @@
# R libraries are installed to $INSTALL_DIR (install_dir), we now set the R_LIBS path to that directory
# TODO: That code is used a lot for the different environments and should be refactored, once the environments are integrated
modify_env_command_dict = dict( name="R_LIBS", action="prepend_to", value=install_dir )
- modify_env_command = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
- return_code = handle_command( app, tool_dependency, install_dir, modify_env_command )
+ env_entry, env_file = td_common_util.create_or_update_env_shell_file( install_dir, modify_env_command_dict )
+ return_code = file_append( env_entry, env_file, skip_if_contained=True, make_executable=True )
+
if return_code:
return
elif action_type == 'setup_ruby_environment':
diff -r 91399e1ae5fc827ddc9b33702fe401a10d367539 -r d4e60067889e2bd8873010fa0fc887e725a4b695 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -613,10 +613,13 @@
action_dict[ 'configure_opts' ] = configure_opts
elif action_type == 'setup_r_environment':
# setup an R environment
- # <action type="setup_r_environment" name="package_r_3_0_1" owner="bgruening">
- # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
+ # <action type="setup_r_environment">
+ # <repository name="package_r_3_0_1" owner="bgruening">
+ # <package name="R" version="3.0.1" />
+ # </repository>
+ # <!-- allow installing an R packages -->
+ # <package>https://github.com/bgruening/download_store/raw/master/DESeq2-1_0_18/BiocGe…</package>
# </action>
-
env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, action_elem.find('repository') )
all_env_shell_file_paths.extend( env_shell_file_paths )
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/21a13e4865b3/
Changeset: 21a13e4865b3
Branch: next-stable
User: jmchilton
Date: 2013-04-23 16:57:14
Summary: Add exception handling for Binary sniffers. Image sniffers can fail for large files because signed integers are used internally, this catches that and other potential problems.
Traceback (most recent call last):
File "/opt/galaxy/web/tools/data_source/upload.py", line 432, in <module>
__main__()
File "/opt/galaxy/web/tools/data_source/upload.py", line 421, in __main__
add_file( dataset, registry, json_file, output_path )
File "/opt/galaxy/web/tools/data_source/upload.py", line 155, in add_file
type_info = Binary.is_sniffable_binary( dataset.path )
File "/opt/galaxy/web/lib/galaxy/datatypes/binary.py", line 38, in is_sniffable_binary
if format["class"]().sniff(filename):
File "/opt/galaxy/web/lib/galaxy/datatypes/images.py", line 203, in sniff
headers = get_headers(filename, None, 1)
File "/opt/galaxy/web/lib/galaxy/datatypes/sniff.py", line 179, in get_headers
for idx, line in enumerate(file(fname)):
SystemError: Negative size passed to PyString_FromStringAndSize
Affected #: 1 file
diff -r 7266b5e09cb20cac801cddef87b0466ddc32d41e -r 21a13e4865b3f5d997dd34bc977eb5f998b43024 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -42,11 +42,20 @@
Binary.unsniffable_binary_formats.append(ext)
@staticmethod
- def is_sniffable_binary(filename):
+ def is_sniffable_binary( filename ):
+ format_information = None
for format in Binary.sniffable_binary_formats:
- if format["class"]().sniff(filename):
- return (format["type"], format["ext"])
- return None
+ format_instance = format[ "class" ]()
+ try:
+ if format_instance.sniff(filename):
+ format_information = ( format["type"], format[ "ext" ] )
+ break
+ except Exception:
+ # Sniffer raised exception, could be any number of
+ # reasons for this so there is not much to do besides
+ # trying next sniffer.
+ pass
+ return format_information
@staticmethod
def is_ext_unsniffable(ext):
https://bitbucket.org/galaxy/galaxy-central/commits/94aea2327373/
Changeset: 94aea2327373
Branch: next-stable
User: jmchilton
Date: 2013-04-23 19:24:16
Summary: Rework checking binary files. Why read in line by line if only going to check 100 characters? This approach to just read first 100 characters is cleaner, more efficient, and hopefully less error prone. Should avoid the following exception caused when checking large files:
Traceback (most recent call last):
File "/opt/galaxy/web/tools/data_source/upload.py", line 432, in <module>
__main__()
File "/opt/galaxy/web/tools/data_source/upload.py", line 421, in __main__
add_file( dataset, registry, json_file, output_path )
File "/opt/galaxy/web/tools/data_source/upload.py", line 283, in add_file
if check_binary( dataset.path ):
File "/opt/galaxy/web/lib/galaxy/datatypes/checkers.py", line 58, in check_binary
for chars in temp:
SystemError: Negative size passed to PyString_FromStringAndSize
Affected #: 1 file
diff -r 21a13e4865b3f5d997dd34bc977eb5f998b43024 -r 94aea2327373d4cb651e3db3fe5113a5b0c669f5 lib/galaxy/datatypes/checkers.py
--- a/lib/galaxy/datatypes/checkers.py
+++ b/lib/galaxy/datatypes/checkers.py
@@ -1,5 +1,6 @@
import os, gzip, re, gzip, zipfile, binascii, bz2, imghdr
from galaxy import util
+from StringIO import StringIO
try:
import Image as PIL
@@ -53,20 +54,15 @@
if file_path:
temp = open( name, "U" )
else:
- temp = name
+ temp = StringIO( name )
chars_read = 0
- for chars in temp:
- for char in chars:
- chars_read += 1
+ try:
+ for char in temp.read( 100 ):
if util.is_binary( char ):
is_binary = True
break
- if chars_read > 100:
- break
- if chars_read > 100:
- break
- if file_path:
- temp.close()
+ finally:
+ temp.close( )
return is_binary
def check_gzip( file_path ):
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/edab395a78b1/
Changeset: edab395a78b1
Branch: tool_api
User: Kyle Ellrott
Date: 2013-10-25 01:34:30
Summary: Adding output_name to /api/tool submit output. So files created by a tool can be mapped to the possible multiple output declaration it could have
Affected #: 1 file
diff -r bf0057b13f58f5c5438f1a6477b27bfceb14a2ce -r edab395a78b1f9d27bc2f2d233b2ded002b3080a lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -119,14 +119,18 @@
return { "message": { "type": "error", "data" : vars[ 'errors' ] } }
# TODO: check for errors and ensure that output dataset(s) are available.
- output_datasets = vars.get( 'out_data', {} ).values()
+ output_datasets = vars.get( 'out_data', {} ).iteritems()
rval = {
"outputs": []
}
outputs = rval[ "outputs" ]
#TODO:?? poss. only return ids?
- for output in output_datasets:
+ for output_name, output in output_datasets:
output_dict = output.to_dict()
+ #add the output name back into the output data structure
+ #so it's possible to figure out which newly created elements
+ #correspond with which tool file outputs
+ output_dict['output_name'] = output_name
outputs.append( trans.security.encode_dict_ids( output_dict ) )
return rval
https://bitbucket.org/galaxy/galaxy-central/commits/115a6924dc4c/
Changeset: 115a6924dc4c
User: jmchilton
Date: 2013-10-25 04:08:11
Summary: Merged in kellrott/galaxy-central/tool_api (pull request #243)
Adding output_name to /api/tool submit output
Matching client code added to blend4j: https://github.com/jmchilton/blend4j/commit/991ec2b30fd538c0b8e97aa55e681aa….
Thanks for the contribution Kyle!
Affected #: 1 file
diff -r 97cb7306dc345ce5e81861e421c5277701161802 -r 115a6924dc4c459467ca162e10ee24ba04001a1e lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -119,14 +119,18 @@
return { "message": { "type": "error", "data" : vars[ 'errors' ] } }
# TODO: check for errors and ensure that output dataset(s) are available.
- output_datasets = vars.get( 'out_data', {} ).values()
+ output_datasets = vars.get( 'out_data', {} ).iteritems()
rval = {
"outputs": []
}
outputs = rval[ "outputs" ]
#TODO:?? poss. only return ids?
- for output in output_datasets:
+ for output_name, output in output_datasets:
output_dict = output.to_dict()
+ #add the output name back into the output data structure
+ #so it's possible to figure out which newly created elements
+ #correspond with which tool file outputs
+ output_dict['output_name'] = output_name
outputs.append( trans.security.encode_dict_ids( output_dict ) )
return rval
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.
1
0
commit/galaxy-central: dannon: Re-close search feature branch.
by commits-noreply@bitbucket.org 25 Oct '13
by commits-noreply@bitbucket.org 25 Oct '13
25 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e19d39296919/
Changeset: e19d39296919
Branch: search
User: dannon
Date: 2013-10-25 00:12:50
Summary: Re-close search feature branch.
Affected #: 0 files
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.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/9da06a2f3db4/
Changeset: 9da06a2f3db4
Branch: search
User: Kyle Ellrott
Date: 2013-10-24 21:50:53
Summary: Default merge
Affected #: 45 files
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -42,11 +42,20 @@
Binary.unsniffable_binary_formats.append(ext)
@staticmethod
- def is_sniffable_binary(filename):
+ def is_sniffable_binary( filename ):
+ format_information = None
for format in Binary.sniffable_binary_formats:
- if format["class"]().sniff(filename):
- return (format["type"], format["ext"])
- return None
+ format_instance = format[ "class" ]()
+ try:
+ if format_instance.sniff(filename):
+ format_information = ( format["type"], format[ "ext" ] )
+ break
+ except Exception:
+ # Sniffer raised exception, could be any number of
+ # reasons for this so there is not much to do besides
+ # trying next sniffer.
+ pass
+ return format_information
@staticmethod
def is_ext_unsniffable(ext):
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/datatypes/checkers.py
--- a/lib/galaxy/datatypes/checkers.py
+++ b/lib/galaxy/datatypes/checkers.py
@@ -1,5 +1,6 @@
import os, gzip, re, gzip, zipfile, binascii, bz2, imghdr
from galaxy import util
+from StringIO import StringIO
try:
import Image as PIL
@@ -53,20 +54,15 @@
if file_path:
temp = open( name, "U" )
else:
- temp = name
+ temp = StringIO( name )
chars_read = 0
- for chars in temp:
- for char in chars:
- chars_read += 1
+ try:
+ for char in temp.read( 100 ):
if util.is_binary( char ):
is_binary = True
break
- if chars_read > 100:
- break
- if chars_read > 100:
- break
- if file_path:
- temp.close()
+ finally:
+ temp.close( )
return is_binary
def check_gzip( file_path ):
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/datatypes/metadata.py
--- a/lib/galaxy/datatypes/metadata.py
+++ b/lib/galaxy/datatypes/metadata.py
@@ -5,7 +5,6 @@
from galaxy import eggs
eggs.require("simplejson")
-
import copy
import cPickle
import logging
@@ -37,10 +36,12 @@
"""
def __init__( self, target ):
self.target = target
+
def __call__( self, *args, **kwargs ):
class_locals = sys._getframe( 1 ).f_locals #get the locals dictionary of the frame object one down in the call stack (i.e. the Datatype class calling MetadataElement)
statements = class_locals.setdefault( STATEMENTS, [] ) #get and set '__galaxy_statments__' to an empty list if not in locals dict
statements.append( ( self, args, kwargs ) ) #add Statement containing info to populate a MetadataElementSpec
+
@classmethod
def process( cls, element ):
for statement, args, kwargs in getattr( element, STATEMENTS, [] ):
@@ -59,29 +60,38 @@
#initialize dict if needed
if self.parent._metadata is None:
self.parent._metadata = {}
+
def get_parent( self ):
if "_parent" in self.__dict__:
return self.__dict__["_parent"]()
return None
+
def set_parent( self, parent ):
self.__dict__["_parent"] = weakref.ref( parent ) # use weakref to prevent a circular reference interfering with garbage collection: hda/lda (parent) <--> MetadataCollection (self) ; needs to be hashable, so cannot use proxy.
parent = property( get_parent, set_parent )
+
@property
def spec( self ):
return self.parent.datatype.metadata_spec
+
def __iter__( self ):
return self.parent._metadata.__iter__()
+
def get( self, key, default=None ):
try:
return self.__getattr__( key ) or default
except:
return default
+
def items(self):
return iter( [ ( k, self.get( k ) ) for k in self.spec.iterkeys() ] )
+
def __str__(self):
return dict( self.items() ).__str__()
+
def __nonzero__( self ):
return bool( self.parent._metadata )
+
def __getattr__( self, name ):
if name in self.spec:
if name in self.parent._metadata:
@@ -89,6 +99,7 @@
return self.spec[name].wrap( self.spec[name].default, object_session( self.parent ) )
if name in self.parent._metadata:
return self.parent._metadata[name]
+
def __setattr__( self, name, value ):
if name == "parent":
return self.set_parent( value )
@@ -97,14 +108,17 @@
self.parent._metadata[name] = self.spec[name].unwrap( value )
else:
self.parent._metadata[name] = value
+
def element_is_set( self, name ):
return bool( self.parent._metadata.get( name, False ) )
+
def get_html_by_name( self, name, **kwd ):
if name in self.spec:
rval = self.spec[name].param.get_html( value=getattr( self, name ), context=self, **kwd )
if rval is None:
return self.spec[name].no_value
return rval
+
def make_dict_copy( self, to_copy ):
"""Makes a deep copy of input iterable to_copy according to self.spec"""
rval = {}
@@ -112,6 +126,7 @@
if key in self.spec:
rval[key] = self.spec[key].param.make_copy( value, target_context=self, source_context=to_copy )
return rval
+
def from_JSON_dict( self, filename ):
dataset = self.parent
log.debug( 'loading metadata from file for: %s %s' % ( dataset.__class__.__name__, dataset.id ) )
@@ -123,6 +138,7 @@
#if the metadata value is not found in our externally set metadata but it has a value in the 'old'
#metadata associated with our dataset, we'll delete it from our dataset's metadata dict
del dataset._metadata[ name ]
+
def to_JSON_dict( self, filename ):
#galaxy.model.customtypes.json_encoder.encode()
meta_dict = {}
@@ -131,6 +147,7 @@
if name in dataset_meta_dict:
meta_dict[ name ] = spec.param.to_external_value( dataset_meta_dict[ name ] )
simplejson.dump( meta_dict, open( filename, 'wb+' ) )
+
def __getstate__( self ):
return None #cannot pickle a weakref item (self._parent), when data._metadata_collection is None, it will be recreated on demand
@@ -163,10 +180,12 @@
def __init__( self, spec ):
self.spec = spec
- def get_html_field( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return form_builder.TextField( self.spec.name, value=value )
- def get_html( self, value, context={}, other_values={}, **kwd ):
+ def get_html( self, value, context=None, other_values=None, **kwd ):
"""
The "context" is simply the metadata collection/bunch holding
this piece of metadata. This is passed in to allow for
@@ -175,6 +194,9 @@
example, a column assignment should validate against the
number of columns in the dataset.
"""
+ context = context or {}
+ other_values = other_values or {}
+
if self.spec.get("readonly"):
return value
if self.spec.get("optional"):
@@ -296,7 +318,10 @@
value = [value]
return ",".join( map( str, value ) )
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
field = form_builder.SelectField( self.spec.name, multiple=self.multiple, display=self.spec.get("display") )
if self.values:
value_list = self.values
@@ -316,7 +341,10 @@
field.add_option( val, label, selected=False )
return field
- def get_html( self, value, context={}, other_values={}, values=None, **kwd ):
+ def get_html( self, value, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if self.spec.get("readonly"):
if value in [ None, [] ]:
return str( self.spec.no_value )
@@ -338,21 +366,30 @@
if not isinstance( value, list ): return [value]
return value
+
class DBKeyParameter( SelectParameter ):
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd):
+
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd):
+ context = context or {}
+ other_values = other_values or {}
try:
values = kwd['trans'].db_builds
except KeyError:
pass
return super(DBKeyParameter, self).get_html_field( value, context, other_values, values, **kwd)
- def get_html( self, value=None, context={}, other_values={}, values=None, **kwd):
+
+ def get_html( self, value=None, context=None, other_values=None, values=None, **kwd):
+ context = context or {}
+ other_values = other_values or {}
try:
values = kwd['trans'].db_builds
except KeyError:
pass
return super(DBKeyParameter, self).get_html( value, context, other_values, values, **kwd)
+
class RangeParameter( SelectParameter ):
+
def __init__( self, spec ):
SelectParameter.__init__( self, spec )
# The spec must be set with min and max values
@@ -360,12 +397,18 @@
self.max = spec.get( "max" ) or 1
self.step = self.spec.get( "step" ) or 1
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None:
values = zip( range( self.min, self.max, self.step ), range( self.min, self.max, self.step ))
return SelectParameter.get_html_field( self, value=value, context=context, other_values=other_values, values=values, **kwd )
- def get_html( self, value, context={}, other_values={}, values=None, **kwd ):
+ def get_html( self, value, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None:
values = zip( range( self.min, self.max, self.step ), range( self.min, self.max, self.step ))
return SelectParameter.get_html( self, value, context=context, other_values=other_values, values=values, **kwd )
@@ -376,35 +419,46 @@
values = [ int(x) for x in value ]
return values
+
class ColumnParameter( RangeParameter ):
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None and context:
column_range = range( 1, ( context.columns or 0 ) + 1, 1 )
values = zip( column_range, column_range )
return RangeParameter.get_html_field( self, value=value, context=context, other_values=other_values, values=values, **kwd )
- def get_html( self, value, context={}, other_values={}, values=None, **kwd ):
+ def get_html( self, value, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None and context:
column_range = range( 1, ( context.columns or 0 ) + 1, 1 )
values = zip( column_range, column_range )
return RangeParameter.get_html( self, value, context=context, other_values=other_values, values=values, **kwd )
+
class ColumnTypesParameter( MetadataParameter ):
def to_string( self, value ):
return ",".join( map( str, value ) )
+
class ListParameter( MetadataParameter ):
def to_string( self, value ):
return ",".join( [str(x) for x in value] )
+
class DictParameter( MetadataParameter ):
def to_string( self, value ):
return simplejson.dumps( value )
+
class PythonObjectParameter( MetadataParameter ):
def to_string( self, value ):
@@ -412,16 +466,21 @@
return self.spec._to_string( self.spec.no_value )
return self.spec._to_string( value )
- def get_html_field( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return form_builder.TextField( self.spec.name, value=self._to_string( value ) )
- def get_html( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return str( self )
@classmethod
def marshal( cls, value ):
return value
+
class FileParameter( MetadataParameter ):
def to_string( self, value ):
@@ -429,10 +488,14 @@
return str( self.spec.no_value )
return value.file_name
- def get_html_field( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return form_builder.TextField( self.spec.name, value=str( value.id ) )
- def get_html( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return "<div>No display available for Metadata Files</div>"
def wrap( self, value, session ):
@@ -497,12 +560,15 @@
#we do not include 'dataset' in the kwds passed, as from_JSON_value() will handle this for us
return MetadataTempFile( **kwds )
+
#This class is used when a database file connection is not available
class MetadataTempFile( object ):
tmp_dir = 'database/tmp' #this should be overwritten as necessary in calling scripts
+
def __init__( self, **kwds ):
self.kwds = kwds
self._filename = None
+
@property
def file_name( self ):
if self._filename is None:
@@ -510,17 +576,21 @@
self._filename = abspath( tempfile.NamedTemporaryFile( dir = self.tmp_dir, prefix = "metadata_temp_file_" ).name )
open( self._filename, 'wb+' ) #create an empty file, so it can't be reused using tempfile
return self._filename
+
def to_JSON( self ):
return { '__class__':self.__class__.__name__, 'filename':self.file_name, 'kwds':self.kwds }
+
@classmethod
def from_JSON( cls, json_dict ):
#need to ensure our keywords are not unicode
rval = cls( **stringify_dictionary_keys( json_dict['kwds'] ) )
rval._filename = json_dict['filename']
return rval
+
@classmethod
def is_JSONified_value( cls, value ):
return ( isinstance( value, dict ) and value.get( '__class__', None ) == cls.__name__ )
+
@classmethod
def cleanup_from_JSON_dict_filename( cls, filename ):
try:
@@ -533,12 +603,15 @@
except Exception, e:
log.debug( 'Failed to cleanup MetadataTempFile temp files from %s: %s' % ( filename, e ) )
+
#Class with methods allowing set_meta() to be called externally to the Galaxy head
class JobExternalOutputMetadataWrapper( object ):
#this class allows access to external metadata filenames for all outputs associated with a job
#We will use JSON as the medium of exchange of information, except for the DatasetInstance object which will use pickle (in the future this could be JSONified as well)
+
def __init__( self, job ):
self.job_id = job.id
+
def get_output_filenames_by_dataset( self, dataset, sa_session ):
if isinstance( dataset, galaxy.model.HistoryDatasetAssociation ):
return sa_session.query( galaxy.model.JobExternalOutputMetadata ) \
@@ -549,12 +622,15 @@
.filter_by( job_id = self.job_id, library_dataset_dataset_association_id = dataset.id ) \
.first() #there should only be one or None
return None
+
def get_dataset_metadata_key( self, dataset ):
# Set meta can be called on library items and history items,
# need to make different keys for them, since ids can overlap
return "%s_%d" % ( dataset.__class__.__name__, dataset.id )
+
def setup_external_metadata( self, datasets, sa_session, exec_dir=None, tmp_dir=None, dataset_files_path=None,
- output_fnames=None, config_root=None, config_file=None, datatypes_config=None, job_metadata=None, kwds={} ):
+ output_fnames=None, config_root=None, config_file=None, datatypes_config=None, job_metadata=None, kwds=None ):
+ kwds = kwds or {}
#fill in metadata_files_dict and return the command with args required to set metadata
def __metadata_files_list_to_cmd_line( metadata_files ):
def __get_filename_override():
@@ -652,6 +728,7 @@
os.remove( fname )
except Exception, e:
log.debug( 'Failed to cleanup external metadata file (%s) for %s: %s' % ( key, dataset_key, e ) )
+
def set_job_runner_external_pid( self, pid, sa_session ):
for metadata_files in sa_session.query( galaxy.model.Job ).get( self.job_id ).external_output_metadata:
metadata_files.job_runner_external_pid = pid
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/datatypes/registry.py
--- a/lib/galaxy/datatypes/registry.py
+++ b/lib/galaxy/datatypes/registry.py
@@ -547,8 +547,11 @@
display_app.id = tool_dict[ 'guid' ]
break
if deactivate:
- del self.display_applications[ display_app.id ]
- del self.datatypes_by_extension[ extension ].display_applications[ display_app.id ]
+ if display_app.id in self.display_applications:
+ del self.display_applications[ display_app.id ]
+ if extension in self.datatypes_by_extension:
+ if display_app.id in self.datatypes_by_extension[ extension ].display_applications:
+ del self.datatypes_by_extension[ extension ].display_applications[ display_app.id ]
if inherit and ( self.datatypes_by_extension[ extension ], display_app ) in self.inherit_display_application_by_class:
self.inherit_display_application_by_class.remove( ( self.datatypes_by_extension[ extension ], display_app ) )
self.log.debug( "Deactivated display application '%s' for datatype '%s'." % ( display_app.id, extension ) )
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -311,8 +311,9 @@
payload = self._validate_and_parse_update_payload( payload )
hda = self.get_dataset( trans, id, check_ownership=True, check_accessible=True, check_state=True )
- # additional checks here (security, etc.)
- changed = self.set_hda_from_dict( trans, hda, payload )
+ # get_dataset can return a string during an error
+ if hda and isinstance( hda, trans.model.HistoryDatasetAssociation ):
+ changed = self.set_hda_from_dict( trans, hda, payload )
except Exception, exception:
log.error( 'Update of history (%s), HDA (%s) failed: %s',
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/webapps/galaxy/api/users.py
--- a/lib/galaxy/webapps/galaxy/api/users.py
+++ b/lib/galaxy/webapps/galaxy/api/users.py
@@ -4,7 +4,7 @@
import logging
from paste.httpexceptions import HTTPBadRequest, HTTPNotImplemented
from galaxy import util, web
-from galaxy.web.base.controller import BaseAPIController, url_for
+from galaxy.web.base.controller import BaseAPIController
log = logging.getLogger( __name__ )
@@ -22,27 +22,19 @@
query = trans.sa_session.query( trans.app.model.User )
deleted = util.string_as_bool( deleted )
if deleted:
- route = 'deleted_user'
query = query.filter( trans.app.model.User.table.c.deleted == True )
# only admins can see deleted users
if not trans.user_is_admin():
return []
-
else:
- route = 'user'
query = query.filter( trans.app.model.User.table.c.deleted == False )
# special case: user can see only their own user
if not trans.user_is_admin():
item = trans.user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
- item['url'] = url_for( route, id=item['id'] )
- item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
return [item]
-
for user in query:
item = user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
#TODO: move into api_values
- item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
- item['url'] = url_for( route, id=item['id'] )
rval.append( item )
return rval
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -2741,6 +2741,9 @@
changeset_revision = kwd.get( 'changeset_revision', None )
repository = suc.get_repository_by_name_and_owner( trans.app, name, owner )
if repository:
+ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans,
+ trans.security.encode_id( repository.id ),
+ changeset_revision )
repo_dir = repository.repo_path( trans.app )
repo = hg.repository( suc.get_configured_ui(), repo_dir )
tool_shed_status_dict = {}
@@ -2751,21 +2754,24 @@
tool_shed_status_dict[ 'latest_installable_revision' ] = 'True'
else:
next_installable_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision )
- if next_installable_revision:
- tool_shed_status_dict[ 'latest_installable_revision' ] = 'False'
+ if repository_metadata is None:
+ if next_installable_revision:
+ tool_shed_status_dict[ 'latest_installable_revision' ] = 'True'
+ else:
+ tool_shed_status_dict[ 'latest_installable_revision' ] = 'False'
else:
- tool_shed_status_dict[ 'latest_installable_revision' ] = 'True'
+ if next_installable_revision:
+ tool_shed_status_dict[ 'latest_installable_revision' ] = 'False'
+ else:
+ tool_shed_status_dict[ 'latest_installable_revision' ] = 'True'
# Handle revision updates.
if changeset_revision == repository.tip( trans.app ):
tool_shed_status_dict[ 'revision_update' ] = 'False'
else:
- repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans,
- trans.security.encode_id( repository.id ),
- changeset_revision )
- if repository_metadata:
+ if repository_metadata is None:
+ tool_shed_status_dict[ 'revision_update' ] = 'True'
+ else:
tool_shed_status_dict[ 'revision_update' ] = 'False'
- else:
- tool_shed_status_dict[ 'revision_update' ] = 'True'
# Handle revision upgrades.
ordered_metadata_changeset_revisions = suc.get_ordered_metadata_changeset_revisions( repository, repo, downloadable=True )
num_metadata_revisions = len( ordered_metadata_changeset_revisions )
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -502,7 +502,6 @@
pre_cmd = './configure %s && make && make install' % configure_opts
else:
pre_cmd = './configure prefix=$INSTALL_DIR %s && make && make install' % configure_opts
-
cmd = install_environment.build_command( td_common_util.evaluate_template( pre_cmd, install_dir ) )
return_code = handle_command( app, tool_dependency, install_dir, cmd )
if return_code:
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -318,22 +318,23 @@
error_message = 'Unable to locate repository with name %s and owner %s. ' % ( str( name ), str( owner ) )
return revised, elem, error_message
-def handle_set_environment_for_install( trans, package_altered, altered, actions_elem, action_index, action_elem, unpopulate=False ):
+def handle_repository_dependency_sub_elem( trans, package_altered, altered, actions_elem, action_index, action_elem, unpopulate=False ):
+ # This method populates the toolshed and changeset_revision attributes for each of the following.
# <action type="set_environment_for_install">
- # <repository name="package_eigen_2_0" owner="test" changeset_revision="09eb05087cd0">
- # <package name="eigen" version="2.0.17" />
- # </repository>
- # </action>
+ # <action type="setup_r_environment">
+ # <action type="setup_ruby_environment">
for repo_index, repo_elem in enumerate( action_elem ):
- revised, repository_elem, error_message = handle_repository_dependency_elem( trans, repo_elem, unpopulate=unpopulate )
- if error_message:
- exception_message = 'The tool_dependencies.xml file contains an invalid <repository> tag. %s' % error_message
- raise Exception( exception_message )
- if revised:
- action_elem[ repo_index ] = repository_elem
- package_altered = True
- if not altered:
- altered = True
+ # Make sure to skip comments and tags that are not <repository>.
+ if repo_elem.tag == 'repository':
+ revised, repository_elem, error_message = handle_repository_dependency_elem( trans, repo_elem, unpopulate=unpopulate )
+ if error_message:
+ exception_message = 'The tool_dependencies.xml file contains an invalid <repository> tag. %s' % error_message
+ raise Exception( exception_message )
+ if revised:
+ action_elem[ repo_index ] = repository_elem
+ package_altered = True
+ if not altered:
+ altered = True
if package_altered:
actions_elem[ action_index ] = action_elem
return package_altered, altered, actions_elem
@@ -402,29 +403,28 @@
last_actions_elem[ last_actions_elem_package_index ] = last_actions_elem_package_elem
actions_group_elem[ last_actions_index ] = last_actions_elem
else:
- last_actions_elem_action_type = last_actions_elem.get( 'type' )
- if last_actions_elem_action_type == 'set_environment_for_install':
- last_actions_package_altered, altered, last_actions_elem = \
- handle_set_environment_for_install( trans,
- last_actions_package_altered,
- altered,
- actions_group_elem,
- last_actions_index,
- last_actions_elem,
- unpopulate=unpopulate )
+ # Inspect the sub elements of last_actions_elem to locate all <repository> tags and
+ # populate them with toolshed and changeset_revision attributes if necessary.
+ last_actions_package_altered, altered, last_actions_elem = \
+ handle_repository_dependency_sub_elem( trans,
+ last_actions_package_altered,
+ altered,
+ actions_group_elem,
+ last_actions_index,
+ last_actions_elem,
+ unpopulate=unpopulate )
elif actions_elem.tag == 'actions':
# We are not in an <actions_group> tag set, so we must be in an <actions> tag set.
for action_index, action_elem in enumerate( actions_elem ):
-
- action_type = action_elem.get( 'type' )
- if action_type == 'set_environment_for_install':
- package_altered, altered, actions_elem = handle_set_environment_for_install( trans,
- package_altered,
- altered,
- actions_elem,
- action_index,
- action_elem,
- unpopulate=unpopulate )
+ # Inspect the sub elements of last_actions_elem to locate all <repository> tags and populate them with
+ # toolshed and changeset_revision attributes if necessary.
+ package_altered, altered, actions_elem = handle_repository_dependency_sub_elem( trans,
+ package_altered,
+ altered,
+ actions_elem,
+ action_index,
+ action_elem,
+ unpopulate=unpopulate )
if package_altered:
package_elem[ actions_index ] = actions_elem
if package_altered:
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -483,7 +483,7 @@
app.model.ToolDependency.installation_status.ERROR ]:
installed_tool_dependencies.append( tool_dependency )
elif elem.tag == 'set_environment':
- env_var_name = env_var_elem.get( 'name', None )
+ env_var_name = elem.get( 'name', None )
if env_var_name:
# Tool dependencies of type "set_environmnet" always have the version attribute set to None.
attr_tup = ( env_var_name, None, 'set_environment' )
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -278,7 +278,7 @@
sy.addClass(this.state.success);
// update galaxy history
- Galaxy.currHistoryPanel.refresh();
+ Galaxy.currHistoryPanel.refreshHdas();
},
// error
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 static/scripts/mvc/dataset/hda-base.js
--- a/static/scripts/mvc/dataset/hda-base.js
+++ b/static/scripts/mvc/dataset/hda-base.js
@@ -5,7 +5,7 @@
//==============================================================================
/** @class Read only view for HistoryDatasetAssociation.
* @name HDABaseView
- *
+ *
* @augments Backbone.View
* @borrows LoggableMixin#logger as #logger
* @borrows LoggableMixin#log as #log
@@ -23,7 +23,7 @@
fxSpeed : 'fast',
- // ......................................................................... SET UP
+ // ......................................................................... set up
/** Set up the view, cache url templates, bind listeners
* @param {Object} attributes
* @config {Object} urlTemplates nested object containing url templates for this view
@@ -44,16 +44,28 @@
this._setUpListeners();
},
+ /** event listeners */
_setUpListeners : function(){
+
// re-rendering on any model changes
- this.model.on( 'change', this.render, this );
+ this.model.on( 'change', function( model, options ){
+
+ // if the model moved into the ready state and is expanded without details, fetch those details now
+ if( this.model.changedAttributes().state && this.model.inReadyState()
+ && this.expanded && !this.model.hasDetails() ){
+ this.model.fetch(); // will render automatically (due to lines below)
+
+ } else {
+ this.render();
+ }
+ }, this );
//this.on( 'all', function( event ){
// this.log( event );
//}, this );
},
- // ......................................................................... RENDER MAIN
+ // ......................................................................... render main
/** Render this HDA, set up ui.
* @fires rendered:ready when rendered and NO running HDAs
* @fires rendered when rendered and running HDAs
@@ -114,7 +126,6 @@
_setUpBehaviors : function( $container ){
$container = $container || this.$el;
// set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)
- //TODO: we can potentially skip this step and call popupmenu directly on the download button
make_popup_menus( $container );
$container.find( '[title]' ).tooltip({ placement : 'bottom' });
},
@@ -205,13 +216,10 @@
* @returns {jQuery} rendered DOM
*/
_render_titleLink : function(){
- return $( jQuery.trim( HDABaseView.templates.titleLink(
- //TODO?? does this need urls?
- _.extend( this.model.toJSON(), { urls: this.urls } )
- )));
+ return $( jQuery.trim( HDABaseView.templates.titleLink( this.model.toJSON() )));
},
- // ......................................................................... RENDER BODY
+ // ......................................................................... body
/** Render the data/metadata summary (format, size, misc info, etc.).
* @returns {jQuery} rendered DOM
*/
@@ -275,7 +283,7 @@
/** Render links to external genome display applications (igb, gbrowse, etc.).
* @param {jQuery} $parent the jq node to search for .display-apps and render into to (defaults to this.$el)
*/
- //TODO: not a fan of the style on these
+//TODO: move into visualization button
_render_displayApps : function( $parent ){
$parent = $parent || this.$el;
var $displayAppsDiv = $parent.find( 'div.display-apps' ),
@@ -302,7 +310,6 @@
/** Render the data peek.
* @returns {jQuery} rendered DOM
*/
- //TODO: curr. pre-formatted into table on the server side - may not be ideal/flexible
_render_peek : function(){
var peek = this.model.get( 'peek' );
if( !peek ){ return null; }
@@ -318,74 +325,38 @@
/** Render the enclosing div of the hda body and, if expanded, the html in the body
* @returns {jQuery} rendered DOM
*/
- //TODO: only render these on expansion (or already expanded)
_render_body : function(){
- var body = $( '<div/>' )
+ var $body = $( '<div/>' )
.attr( 'id', 'info-' + this.model.get( 'id' ) )
.addClass( 'historyItemBody' )
.attr( 'style', 'display: none' );
if( this.expanded ){
// only render the body html if it's being shown
- this._render_body_html( body );
- //TODO: switch back when jq -> 1.9
- //body.show();
- body.css( 'display', 'block' );
+ this._render_body_html( $body );
+ $body.show();
}
- return body;
+ return $body;
},
/** Render the (expanded) body of an HDA, dispatching to other functions based on the HDA state
* @param {jQuery} body the body element to append the html to
*/
- //TODO: only render these on expansion (or already expanded)
- _render_body_html : function( body ){
+ _render_body_html : function( $body ){
//this.log( this + '_render_body' );
- body.html( '' );
- //TODO: not a fan of this dispatch
- switch( this.model.get( 'state' ) ){
- case hdaModel.HistoryDatasetAssociation.STATES.NEW :
- this._render_body_new( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.NOT_VIEWABLE :
- this._render_body_not_viewable( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.UPLOAD :
- this._render_body_uploading( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.PAUSED:
- this._render_body_paused( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.QUEUED :
- this._render_body_queued( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.RUNNING :
- this._render_body_running( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.ERROR :
- this._render_body_error( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.DISCARDED :
- this._render_body_discarded( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.SETTING_METADATA :
- this._render_body_setting_metadata( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.EMPTY :
- this._render_body_empty( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.FAILED_METADATA :
- this._render_body_failed_metadata( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.OK :
- this._render_body_ok( body );
- break;
- default:
- //??: no body?
- body.append( $( '<div>Error: unknown dataset state "' + this.model.get( 'state' ) + '".</div>' ) );
+ $body.empty();
+
+ var modelState = this.model.get( 'state' );
+ // cheesy get function by assumed matching name
+ var renderFnName = '_render_body_' + modelState,
+ renderFn = this[ renderFnName ];
+ if( _.isFunction( renderFn ) ){
+ this[ renderFnName ]( $body );
+ } else {
+ $body.append( $( '<div>Error: unknown dataset state "' + this.model.get( 'state' ) + '".</div>' ) );
}
- body.append( '<div style="clear: both"></div>' );
- this._setUpBehaviors( body );
+ $body.append( '<div style="clear: both"></div>' );
+ this._setUpBehaviors( $body );
},
/** Render a new dataset - this should be a transient state that's never shown
@@ -400,15 +371,14 @@
/** Render inaccessible, not-owned by curr user.
* @param {jQuery} parent DOM to which to append this body
*/
- _render_body_not_viewable : function( parent ){
- //TODO: revisit - still showing display, edit, delete (as common) - that CAN'T be right
- parent.append( $( '<div>' + _l( 'You do not have permission to view dataset' ) + '</div>' ) );
+ _render_body_noPermission : function( parent ){
+ parent.append( $( '<div>' + _l( 'You do not have permission to view this dataset' ) + '</div>' ) );
},
/** Render an HDA still being uploaded.
* @param {jQuery} parent DOM to which to append this body
*/
- _render_body_uploading : function( parent ){
+ _render_body_upload : function( parent ){
parent.append( $( '<div>' + _l( 'Dataset is uploading' ) + '</div>' ) );
},
@@ -424,7 +394,8 @@
* @param {jQuery} parent DOM to which to append this body
*/
_render_body_paused: function( parent ){
- parent.append( $( '<div>' + _l( 'Job is paused. Use the history menu to resume' ) + '</div>' ) );
+ parent.append( $( '<div>' + _l( 'Job is paused. '
+ + 'Use the "Resume Paused Jobs" in the history menu to resume' ) + '</div>' ) );
parent.append( this._render_primaryActionButtons( this.defaultPrimaryActionButtonRenderers ));
},
@@ -469,8 +440,6 @@
* @param {jQuery} parent DOM to which to append this body
*/
_render_body_empty : function( parent ){
- //TODO: replace i with dataset-misc-info class
- //?? why are we showing the file size when we know it's zero??
parent.append( $( '<div>' + _l( 'No data' ) + ': <i>' + this.model.get( 'misc_blurb' ) + '</i></div>' ) );
parent.append( this._render_primaryActionButtons( this.defaultPrimaryActionButtonRenderers ));
},
@@ -479,7 +448,6 @@
* @param {jQuery} parent DOM to which to append this body
*/
_render_body_failed_metadata : function( parent ){
- //TODO: the css for this box is broken (unlike the others)
// add a message box about the failure at the top of the body...
parent.append( $( HDABaseView.templates.failedMetadata(
_.extend( this.model.toJSON(), { urls: this.urls } )
@@ -496,7 +464,6 @@
parent.append( this._render_hdaSummary() );
// return shortened form if del'd
- //TODO: is this correct? maybe only on purged
if( this.model.isDeletedOrPurged() ){
parent.append( this._render_primaryActionButtons([
this._render_downloadButton,
@@ -517,44 +484,55 @@
parent.append( this._render_peek() );
},
- // ......................................................................... EVENTS
+ // ......................................................................... events
/** event map */
events : {
+ // expand the body when the title is clicked
'click .historyItemTitle' : 'toggleBodyVisibility'
},
- /** Render an HDA that's done running and where everything worked.
+ /** Show or hide the body/details of an HDA.
+ * note: if the model does not have detailed data, fetch that data before showing the body
* @param {Event} event the event that triggered this (@link HDABaseView#events)
* @param {Boolean} expanded if true, expand; if false, collapse
* @fires body-expanded when a body has been expanded
* @fires body-collapsed when a body has been collapsed
*/
toggleBodyVisibility : function( event, expand ){
- var hdaView = this;
expand = ( expand === undefined )?( !this.body.is( ':visible' ) ):( expand );
if( expand ){
- if( this.model.inReadyState() && !this.model.hasDetails() ){
- var xhr = this.model.fetch();
- xhr.done( function( model ){
- hdaView.expandBody();
- });
- } else {
- this.expandBody();
- }
+ this.expandBody();
} else {
this.collapseBody();
}
},
+ /** Render and show the full, detailed body of this view including extra data and controls.
+ * @fires body-expanded when a body has been expanded
+ */
expandBody : function(){
var hdaView = this;
- hdaView._render_body_html( hdaView.body );
- this.body.slideDown( hdaView.fxSpeed, function(){
- hdaView.expanded = true;
- hdaView.trigger( 'body-expanded', hdaView.model.get( 'id' ) );
- });
+
+ function _renderBodyAndExpand(){
+ hdaView._render_body_html( hdaView.body );
+ hdaView.body.slideDown( hdaView.fxSpeed, function(){
+ hdaView.expanded = true;
+ hdaView.trigger( 'body-expanded', hdaView.model.get( 'id' ) );
+ });
+ }
+ // fetch first if no details in the model
+ if( this.model.inReadyState() && !this.model.hasDetails() ){
+ this.model.fetch().done( function( model ){
+ _renderBodyAndExpand();
+ });
+ } else {
+ _renderBodyAndExpand();
+ }
},
+ /** Hide the body/details of an HDA.
+ * @fires body-collapsed when a body has been collapsed
+ */
collapseBody : function(){
var hdaView = this;
this.body.slideUp( hdaView.fxSpeed, function(){
@@ -563,7 +541,10 @@
});
},
- // ......................................................................... DELETION
+ // ......................................................................... removal
+ /** Remove this view's html from the DOM and remove all event listeners.
+ * @param {Function} callback an optional function called when removal is done
+ */
remove : function( callback ){
var hdaView = this;
this.$el.fadeOut( hdaView.fxSpeed, function(){
@@ -573,7 +554,8 @@
});
},
- // ......................................................................... MISC
+ // ......................................................................... misc
+ /** String representation */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
return 'HDABaseView(' + modelString + ')';
@@ -594,5 +576,5 @@
//==============================================================================
return {
- HDABaseView : HDABaseView,
+ HDABaseView : HDABaseView
};});
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 static/scripts/mvc/dataset/hda-edit.js
--- a/static/scripts/mvc/dataset/hda-edit.js
+++ b/static/scripts/mvc/dataset/hda-edit.js
@@ -14,7 +14,7 @@
var HDAEditView = hdaBase.HDABaseView.extend( LoggableMixin ).extend(
/** @lends HDAEditView.prototype */{
- // ......................................................................... SET UP
+ // ......................................................................... set up
/** Set up the view, cache url templates, bind listeners.
* Overrides HDABaseView.initialize to change default actions (adding re-run).
* @param {Object} attributes
@@ -43,7 +43,7 @@
//var hdaView = this;
},
- // ......................................................................... RENDER WARNINGS
+ // ......................................................................... render warnings
/** Render any hda warnings including: is deleted, is purged, is hidden.
* Overrides _render_warnings to include links to further actions (undelete, etc.)).
* @returns {Object} the templated urls
@@ -71,13 +71,14 @@
return buttonDiv;
},
+//TODO: move titleButtons into state renderers, remove state checks in the buttons
+
/** Render icon-button to edit the attributes (format, permissions, etc.) this hda.
* @returns {jQuery} rendered DOM
*/
_render_editButton : function(){
// don't show edit while uploading, in-accessible
// DO show if in error (ala previous history panel)
- //TODO??: not viewable/accessible are essentially the same (not viewable set from accessible)
if( ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NEW )
|| ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.UPLOAD )
|| ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NOT_VIEWABLE )
@@ -114,7 +115,6 @@
*/
_render_deleteButton : function(){
// don't show delete if...
- //TODO??: not viewable/accessible are essentially the same (not viewable set from accessible)
if( ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NEW )
|| ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NOT_VIEWABLE )
|| ( !this.model.get( 'accessible' ) ) ){
@@ -147,7 +147,7 @@
return this.deleteButton.render().$el;
},
- // ......................................................................... RENDER BODY
+ // ......................................................................... render body
/** Render the data/metadata summary (format, size, misc info, etc.).
* Overrides _render_hdaSummary to include edit link in dbkey.
* @see HDABaseView#_render_hdaSummary
@@ -158,7 +158,6 @@
// if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?'
if( this.model.get( 'metadata_dbkey' ) === '?'
&& !this.model.isDeletedOrPurged() ){
- //TODO: use HDABaseView and select/replace base on this switch
_.extend( modelData, { dbkey_unknown_and_editable : true });
}
return hdaBase.HDABaseView.templates.hdaSummary( modelData );
@@ -238,10 +237,8 @@
var $icon = this.visualizationsButton.render().$el;
$icon.addClass( 'visualize-icon' ); // needed?
- //TODO: make this more concise
// map a function to each visualization in the icon's attributes
// create a popupmenu from that map
-
/** @inner */
function create_viz_action( visualization ) {
switch( visualization ){
@@ -269,7 +266,6 @@
// >1: Populate menu dict with visualization fns, make the popupmenu
} else {
_.each( visualizations, function( visualization ) {
- //TODO: move to utils
var titleCaseVisualization = visualization.charAt( 0 ).toUpperCase() + visualization.slice( 1 );
popup_menu_dict[ _l( titleCaseVisualization ) ] = create_viz_action( visualization );
});
@@ -334,9 +330,7 @@
/** Render icon-button to load and display tagging html.
* @returns {jQuery} rendered DOM
*/
- //TODO: these should be a sub-MV
_render_tagButton : function(){
- //TODO: check for User
if( !this.hasUser || !this.urls.tags.get ){
this.tagButton = null;
return null;
@@ -354,9 +348,7 @@
/** Render icon-button to load and display annotation html.
* @returns {jQuery} rendered DOM
*/
- //TODO: these should be a sub-MV
_render_annotateButton : function(){
- //TODO: check for User
if( !this.hasUser || !this.urls.annotation.get ){
this.annotateButton = null;
return null;
@@ -370,33 +362,6 @@
return this.annotateButton.render().$el;
},
- // ......................................................................... other elements
- /** Render area to display tags.
- * @returns {jQuery} rendered DOM
- */
-//TODO: into sub-MV
-//TODO: check for User
- _render_tagArea : function(){
- if( !this.urls.tags.set ){ return null; }
- //TODO: move to mvc/tags.js
- return $( HDAEditView.templates.tagArea(
- _.extend( this.model.toJSON(), { urls: this.urls } )
- ).trim() );
- },
-
- /** Render area to display annotation.
- * @returns {jQuery} rendered DOM
- */
-//TODO: into sub-MV
-//TODO: check for User
- _render_annotationArea : function(){
- if( !this.urls.annotation.get ){ return null; }
- //TODO: move to mvc/annotations.js
- return $( HDAEditView.templates.annotationArea(
- _.extend( this.model.toJSON(), { urls: this.urls } )
- ).trim() );
- },
-
// ......................................................................... state body renderers
/** Render an HDA whose job has failed.
* Overrides _render_body_error to prepend error report button to primary actions strip.
@@ -415,7 +380,6 @@
* @see HDABaseView#_render_body_ok
*/
_render_body_ok : function( parent ){
- //TODO: should call super somehow and insert the needed...
// most common state renderer and the most complicated
parent.append( this._render_hdaSummary() );
@@ -451,7 +415,7 @@
parent.append( this._render_peek() );
},
- // ......................................................................... EVENTS
+ // ......................................................................... events
/** event map */
events : {
'click .historyItemTitle' : 'toggleBodyVisibility',
@@ -463,16 +427,28 @@
'click a.icon-button.annotate' : 'loadAndDisplayAnnotation'
},
- // ......................................................................... STATE CHANGES / MANIPULATION
+ /** listener for item purge */
confirmPurge : function _confirmPurge( ev ){
- //TODO: confirm dialog
+//TODO: confirm dialog
this.model.purge({ url: this.urls.purge });
return false;
},
+ // ......................................................................... tags
+ /** Render area to display tags.
+ * @returns {jQuery} rendered DOM
+ */
+//TODO: into sub-MV
+ _render_tagArea : function(){
+ if( !this.hasUser || !this.urls.tags.set ){ return null; }
+ return $( HDAEditView.templates.tagArea(
+ _.extend( this.model.toJSON(), { urls: this.urls } )
+ ).trim() );
+ },
+
/** Find the tag area and, if initial: load the html (via ajax) for displaying them; otherwise, unhide/hide
*/
- //TODO: into sub-MV
+//TODO: into sub-MV
loadAndDisplayTags : function( event ){
//BUG: broken with latest
//TODO: this is a drop in from history.mako - should use MV as well
@@ -508,6 +484,18 @@
}
return false;
},
+
+ // ......................................................................... annotations
+ /** Render area to display annotation.
+ * @returns {jQuery} rendered DOM
+ */
+//TODO: into sub-MV
+ _render_annotationArea : function(){
+ if( !this.hasUser || !this.urls.annotation.get ){ return null; }
+ return $( HDAEditView.templates.annotationArea(
+ _.extend( this.model.toJSON(), { urls: this.urls } )
+ ).trim() );
+ },
/** Find the annotation area and, if initial: load the html (via ajax) for displaying them; otherwise, unhide/hide
*/
@@ -555,7 +543,7 @@
return false;
},
- // ......................................................................... UTILTIY
+ // ......................................................................... misc
/** string rep */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
@@ -678,5 +666,5 @@
//==============================================================================
return {
- HDAEditView : HDAEditView,
+ HDAEditView : HDAEditView
};});
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 static/scripts/mvc/dataset/hda-model.js
--- a/static/scripts/mvc/dataset/hda-model.js
+++ b/static/scripts/mvc/dataset/hda-model.js
@@ -53,41 +53,42 @@
misc_info : ''
},
- /** fetch location of this history in the api */
+ /** fetch location of this HDA's history in the api */
urlRoot: 'api/histories/',
+ /** full url spec. for this HDA */
url : function(){
return this.urlRoot + this.get( 'history_id' ) + '/contents/' + this.get( 'id' );
},
+ /** controller urls assoc. with this HDA */
urls : function(){
var id = this.get( 'id' );
if( !id ){ return {}; }
var urls = {
- 'delete' : '/datasets/' + id + '/delete_async',
- 'purge' : '/datasets/' + id + '/purge_async',
- 'unhide' : '/datasets/' + id + '/unhide',
- 'undelete' : '/datasets/' + id + '/undelete',
+ 'purge' : galaxy_config.root + 'datasets/' + id + '/purge_async',
- 'display' : '/datasets/' + id + '/display/?preview=True',
- 'download' : '/datasets/' + id + '/display?to_ext=' + this.get( 'file_ext' ),
- 'edit' : '/datasets/' + id + '/edit',
- 'report_error': '/dataset/errors?id=' + id,
- 'rerun' : '/tool_runner/rerun?id=' + id,
- 'show_params': '/datasets/' + id + '/show_params',
- 'visualization': '/visualization',
+ 'display' : galaxy_config.root + 'datasets/' + id + '/display/?preview=True',
+ 'download' : galaxy_config.root + 'datasets/' + id + '/display?to_ext=' + this.get( 'file_ext' ),
+ 'edit' : galaxy_config.root + 'datasets/' + id + '/edit',
+ 'report_error' : galaxy_config.root + 'dataset/errors?id=' + id,
+ 'rerun' : galaxy_config.root + 'tool_runner/rerun?id=' + id,
+ 'show_params' : galaxy_config.root + 'datasets/' + id + '/show_params',
+ 'visualization' : galaxy_config.root + 'visualization',
- 'annotation': { 'get': '/dataset/get_annotation_async?id=' + id,
- 'set': '/dataset/annotate_async?id=' + id },
- 'tags' : { 'get': '/tag/get_tagging_elt_async?item_id=' + id + '&item_class=HistoryDatasetAssociation',
- 'set': '/tag/retag?item_id=' + id + '&item_class=HistoryDatasetAssociation' }
+ 'annotation': { 'get': galaxy_config.root + 'dataset/get_annotation_async?id=' + id,
+ 'set': galaxy_config.root + 'dataset/annotate_async?id=' + id },
+ 'tags' : { 'get': galaxy_config.root + 'tag/get_tagging_elt_async?item_id='
+ + id + '&item_class=HistoryDatasetAssociation',
+ 'set': galaxy_config.root + 'tag/retag?item_id='
+ + id + '&item_class=HistoryDatasetAssociation' }
};
- //'meta_download': '/dataset/get_metadata_file?hda_id=%3C%25%3D+id+%25%3E&metadata_name=%3C%25%3D+file_type+%25%3E',
+ // download links to assoc. metadata files (bam indeces, etc.)
var meta_files = this.get( 'meta_files' );
if( meta_files ){
urls.meta_download = _.map( meta_files, function( meta_file ){
return {
- //url : _.template( urlTemplate, { id: modelJson.id, file_type: meta_file.file_type }),
- url : '/dataset/get_metadata_file?hda_id=' + id + '&metadata_name=' + meta_file.file_type,
+ url : galaxy_config.root + 'dataset/get_metadata_file?hda_id='
+ + id + '&metadata_name=' + meta_file.file_type,
file_type : meta_file.file_type
};
});
@@ -110,6 +111,9 @@
this._setUpListeners();
},
+ /** set up any event listeners
+ * event: state:ready fired when this HDA moves into a ready state
+ */
_setUpListeners : function(){
// if the state has changed and the new state is a ready state, fire an event
this.on( 'change:state', function( currModel, newState ){
@@ -121,8 +125,7 @@
},
// ........................................................................ common queries
- /** Is this hda deleted or purged?
- */
+ /** Is this hda deleted or purged? */
isDeletedOrPurged : function(){
return ( this.get( 'deleted' ) || this.get( 'purged' ) );
},
@@ -132,7 +135,6 @@
* @param {Boolean} show_deleted are we showing deleted hdas?
* @param {Boolean} show_hidden are we showing hidden hdas?
*/
- //TODO: too many 'visible's
isVisible : function( show_deleted, show_hidden ){
var isVisible = true;
if( ( !show_deleted )
@@ -146,6 +148,7 @@
return isVisible;
},
+ /** the more common alias of visible */
hidden : function(){
return !this.get( 'visible' );
},
@@ -158,33 +161,37 @@
return ( this.isDeletedOrPurged() || ready );
},
+ /** Does this model already contain detailed data (as opposed to just summary level data)? */
hasDetails : function(){
//?? this may not be reliable
return _.has( this.attributes, 'genome_build' );
},
- /** Convenience function to match hda.has_data.
- */
+ /** Convenience function to match hda.has_data. */
hasData : function(){
- //TODO:?? is this equivalent to all possible hda.has_data calls?
return ( this.get( 'file_size' ) > 0 );
},
// ........................................................................ ajax
+ /** save this HDA, _Mark_ing it as deleted (just a flag) */
'delete' : function _delete( options ){
return this.save( { deleted: true }, options );
},
+ /** save this HDA, _Mark_ing it as undeleted */
undelete : function _undelete( options ){
return this.save( { deleted: false }, options );
},
+ /** save this HDA as not visible */
hide : function _hide( options ){
return this.save( { visible: false }, options );
},
+ /** save this HDA as visible */
unhide : function _uhide( options ){
return this.save( { visible: true }, options );
},
+ /** purge this HDA and remove the underlying dataset file from the server's fs */
purge : function _purge( options ){
//TODO: ideally this would be a DELETE call to the api
// using purge async for now
@@ -210,10 +217,15 @@
},
// ........................................................................ sorting/filtering
+ /** what attributes of an HDA will be used in a search */
searchKeys : [
'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'
],
+ /** search this HDA for the string searchFor
+ * @param {String} searchFor look for this string in all attributes listed in searchKeys (above) using indexOf
+ * @returns {Array} an array of attribute keys where searchFor was found
+ */
search : function( searchFor ){
var model = this;
searchFor = searchFor.toLowerCase();
@@ -223,13 +235,16 @@
});
},
+ /** alias of search, but returns a boolean
+ * @param {String} matchesWhat look for this string in all attributes listed in searchKeys (above) using indexOf
+ * @returns {Boolean} was matchesWhat found in any attributes
+ */
matches : function( matchesWhat ){
return !!this.search( matchesWhat ).length;
},
// ........................................................................ misc
- /** String representation
- */
+ /** String representation */
toString : function(){
var nameAndId = this.get( 'id' ) || '';
if( this.get( 'name' ) ){
@@ -274,6 +289,7 @@
ERROR : 'error'
};
+/** states that are in a final state (the underlying job is complete) */
HistoryDatasetAssociation.READY_STATES = [
HistoryDatasetAssociation.STATES.NEW,
HistoryDatasetAssociation.STATES.OK,
@@ -285,6 +301,7 @@
HistoryDatasetAssociation.STATES.ERROR
];
+/** states that will change (the underlying job is not finished) */
HistoryDatasetAssociation.NOT_READY_STATES = [
HistoryDatasetAssociation.STATES.UPLOAD,
HistoryDatasetAssociation.STATES.QUEUED,
@@ -306,7 +323,10 @@
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
//logger : console,
- urlRoot : '/api/histories',
+
+ /** root api url */
+ urlRoot : galaxy_config.root + 'api/histories',
+ /** complete api url */
url : function(){
return this.urlRoot + '/' + this.historyId + '/contents';
},
@@ -331,6 +351,9 @@
return this.map( function( hda ){ return hda.id; });
},
+ /** Get hdas that are not ready
+ * @returns array of HDAs
+ */
notReady : function(){
return this.filter( function( hda ){
return !hda.inReadyState();
@@ -370,11 +393,13 @@
},
// ........................................................................ ajax
+ /** fetch detailed model data for all HDAs in this collection */
fetchAllDetails : function(){
return this.fetch({ data : { details : 'all' } });
},
// ........................................................................ sorting/filtering
+ /** return a new collection of HDAs whose attributes contain the substring matchesWhat */
matches : function( matchesWhat ){
return this.filter( function( hda ){
return hda.matches( matchesWhat );
diff -r f82bbdc5c22b24d329a6710a20ce4c049f124064 -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 static/scripts/mvc/history/history-model.js
--- a/static/scripts/mvc/history/history-model.js
+++ b/static/scripts/mvc/history/history-model.js
@@ -13,7 +13,6 @@
*/
var History = Backbone.Model.extend( LoggableMixin ).extend(
/** @lends History.prototype */{
- //TODO: bind change events from items and collection to this (itemLengths, states)
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
@@ -31,29 +30,33 @@
},
// ........................................................................ urls
- urlRoot: 'api/histories',
+ urlRoot: galaxy_config.root + 'api/histories',
+ /** url for changing the name of the history */
renameUrl : function(){
//TODO: just use this.save()
var id = this.get( 'id' );
if( !id ){ return undefined; }
- return '/history/rename_async?id=' + this.get( 'id' );
+ return galaxy_config.root + 'history/rename_async?id=' + this.get( 'id' );
},
+ /** url for changing the annotation of the history */
annotateUrl : function(){
var id = this.get( 'id' );
if( !id ){ return undefined; }
- return '/history/annotate_async?id=' + this.get( 'id' );
+ return galaxy_config.root + 'history/annotate_async?id=' + this.get( 'id' );
},
+ /** url for changing the tags of the history */
tagUrl : function(){
var id = this.get( 'id' );
if( !id ){ return undefined; }
- return '/tag/get_tagging_elt_async?item_id=' + this.get( 'id' ) + '&item_class=History';
+ return galaxy_config.root + 'tag/get_tagging_elt_async?item_id=' + this.get( 'id' ) + '&item_class=History';
},
// ........................................................................ set up/tear down
- /** Set up the hdas collection
+ /** Set up the model
* @param {Object} historyJSON model data for this History
* @param {Object[]} hdaJSON array of model data for this History's HDAs
+ * @param {Object} options any extra settings including logger
* @see BaseModel#initialize
*/
initialize : function( historyJSON, hdaJSON, options ){
@@ -69,17 +72,24 @@
}
this._setUpListeners();
- this._installAjaxErrorHandler( this.ajaxErrorHandler );
+ /** cached timeout id for the HDA updater */
+ this.updateTimeoutId = null;
// set up update timeout if needed
this.checkForUpdates();
},
+ /** set up any event listeners for this history including those to the contained HDAs
+ * events: error:hdas if an error occurred with the HDA collection
+ */
_setUpListeners : function(){
+ this.on( 'error', function( model, xhr, options, msg, details ){
+ this.errorHandler( model, xhr, options, msg, details );
+ });
+
// hda collection listening
if( this.hdas ){
this.listenTo( this.hdas, 'error', function(){
- //this.ajaxErrorHandler.apply( this, arguments );
this.trigger.apply( this, [ 'error:hdas' ].concat( jQuery.makeArray( arguments ) ) );
});
}
@@ -105,34 +115,29 @@
// }
//},
+ /** event listener for errors. Generally errors are handled outside this model */
+ errorHandler : function( model, xhr, options, msg, details ){
+ // clear update timeout on model err
+ this.clearUpdateTimeout();
+ },
+
// ........................................................................ common queries
+ /** is this model already associated with a user? */
hasUser : function(){
var user = this.get( 'user' );
return !!( user && user.id );
},
// ........................................................................ ajax
- // override to add ajax error event
- //TODO: into mixin/base
- _installAjaxErrorHandler : function( handler ){
- this.sync = function _sync( method, model, options ){
- return Backbone.Model.prototype.sync.call( model, method, model, options )
- .fail( function( xhr, status, message ){
- handler.call( model, model, xhr, options, method );
- });
- };
- },
-
- ajaxErrorHandler : function( model, xhr, options, method ){
- },
-
- // get the history's state from it's cummulative ds states, delay + update if needed
- // events: ready
+ /** does the HDA collection indicate they're still running and need to be updated later? delay + update if needed
+ * @param {Function} onReadyCallback function to run when all HDAs are in the ready state
+ * events: ready
+ */
checkForUpdates : function( onReadyCallback ){
//console.info( 'checkForUpdates' )
// get overall History state from collection, run updater if History has running/queued hdas
- // boiling it down on the client to running/not
+ // boiling it down on the client to running/not
if( this.hdas.running().length ){
this.setUpdateTimeout();
@@ -145,8 +150,8 @@
return this;
},
+ /** create a timeout (after UPDATE_DELAY or delay ms) to refetch the HDA collection. Clear any prev. timeout */
setUpdateTimeout : function( delay ){
- //TODO: callbacks?
delay = delay || History.UPDATE_DELAY;
var history = this;
@@ -158,6 +163,7 @@
return this.updateTimeoutId;
},
+ /** clear the timeout and the cached timeout id */
clearUpdateTimeout : function(){
if( this.updateTimeoutId ){
clearTimeout( this.updateTimeoutId );
@@ -165,25 +171,26 @@
}
},
- // update this history, find any hda's running/queued, update ONLY those that have changed states,
- // set up to run this again in some interval of time
- // events: ready
+ /* update the HDA collection getting full detailed model data for any hda whose id is in detailIds
+ * set up to run this again in some interval of time
+ * @param {String[]} detailIds list of HDA ids to get detailed model data for
+ * @param {Object} options std. backbone fetch options map
+ */
refresh : function( detailIds, options ){
//console.info( 'refresh:', detailIds, this.hdas );
detailIds = detailIds || [];
options = options || {};
var history = this;
+ // add detailIds to options as CSV string
options.data = options.data || {};
if( detailIds.length ){
options.data.details = detailIds.join( ',' );
}
var xhr = this.hdas.fetch( options );
xhr.done( function( hdaModels ){
- //this.trigger( 'hdas-refreshed', this, hdaModels );
- history.checkForUpdates(function(){
- // fetch the history after an update in order to recalc history size
- //TODO: move to event?
+ history.checkForUpdates( function(){
+ // fetch the history inside onReadyCallback in order to recalc history size
this.fetch();
});
});
@@ -214,7 +221,7 @@
function getHistory( id ){
// get the history data
//return jQuery.ajax( '/generate_json_error' );
- return jQuery.ajax( '/api/histories/' + historyId );
+ return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyId );
}
function countHdasFromHistory( historyData ){
// get the number of hdas accrd. to the history
@@ -232,7 +239,7 @@
hdaDetailIds = hdaDetailIds( historyData );
}
var data = ( hdaDetailIds.length )?( { details : hdaDetailIds.join( ',' ) } ):( {} );
- return jQuery.ajax( '/api/histories/' + historyData.id + '/contents', { data: data });
+ return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyData.id + '/contents', { data: data });
//return jQuery.ajax( '/generate_json_error' );
}
@@ -283,7 +290,7 @@
var HistoryCollection = Backbone.Collection.extend( LoggableMixin ).extend(
/** @lends HistoryCollection.prototype */{
model : History,
- urlRoot : 'api/histories'
+ urlRoot : galaxy_config.root + 'api/histories'
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/35a847f0f33d/
Changeset: 35a847f0f33d
Branch: search
User: Kyle Ellrott
Date: 2013-10-25 00:04:33
Summary: Adding missing import
Affected #: 1 file
diff -r 9da06a2f3db4bf535cf179af6ba66b98741e7ea1 -r 35a847f0f33d2944b8033aefeb8d5ef0c734c8c6 lib/galaxy/model/search.py
--- a/lib/galaxy/model/search.py
+++ b/lib/galaxy/model/search.py
@@ -35,7 +35,7 @@
History, Library, LibraryFolder, LibraryDataset,StoredWorkflowTagAssociation,
StoredWorkflow, HistoryTagAssociation,HistoryDatasetAssociationTagAssociation,
ExtendedMetadata, ExtendedMetadataIndex, HistoryAnnotationAssociation, Job, JobParameter,
-JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion)
+JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion )
from galaxy.util.json import to_json_string
from sqlalchemy import and_
https://bitbucket.org/galaxy/galaxy-central/commits/97cb7306dc34/
Changeset: 97cb7306dc34
User: dannon
Date: 2013-10-25 00:10:01
Summary: Merged in kellrott/galaxy-central/search (pull request #241)
Fixing missing import in search.py
Affected #: 1 file
diff -r bf0057b13f58f5c5438f1a6477b27bfceb14a2ce -r 97cb7306dc345ce5e81861e421c5277701161802 lib/galaxy/model/search.py
--- a/lib/galaxy/model/search.py
+++ b/lib/galaxy/model/search.py
@@ -35,7 +35,7 @@
History, Library, LibraryFolder, LibraryDataset,StoredWorkflowTagAssociation,
StoredWorkflow, HistoryTagAssociation,HistoryDatasetAssociationTagAssociation,
ExtendedMetadata, ExtendedMetadataIndex, HistoryAnnotationAssociation, Job, JobParameter,
-JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion)
+JobToInputLibraryDatasetAssociation, JobToInputDatasetAssociation, JobToOutputDatasetAssociation, ToolVersion )
from galaxy.util.json import to_json_string
from sqlalchemy import and_
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.
1
0
commit/galaxy-central: dannon: Strip quota information and url from primary users collection -- not useful, and a ton of extra info that can be attained other ways. Issue deprecation warning with dist.
by commits-noreply@bitbucket.org 24 Oct '13
by commits-noreply@bitbucket.org 24 Oct '13
24 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/bf0057b13f58/
Changeset: bf0057b13f58
User: dannon
Date: 2013-10-24 21:18:51
Summary: Strip quota information and url from primary users collection -- not useful, and a ton of extra info that can be attained other ways. Issue deprecation warning with dist.
Affected #: 1 file
diff -r 05fb304579771af681eb1a89de633133364c5f7d -r bf0057b13f58f5c5438f1a6477b27bfceb14a2ce lib/galaxy/webapps/galaxy/api/users.py
--- a/lib/galaxy/webapps/galaxy/api/users.py
+++ b/lib/galaxy/webapps/galaxy/api/users.py
@@ -4,7 +4,7 @@
import logging
from paste.httpexceptions import HTTPBadRequest, HTTPNotImplemented
from galaxy import util, web
-from galaxy.web.base.controller import BaseAPIController, url_for
+from galaxy.web.base.controller import BaseAPIController
log = logging.getLogger( __name__ )
@@ -22,27 +22,19 @@
query = trans.sa_session.query( trans.app.model.User )
deleted = util.string_as_bool( deleted )
if deleted:
- route = 'deleted_user'
query = query.filter( trans.app.model.User.table.c.deleted == True )
# only admins can see deleted users
if not trans.user_is_admin():
return []
-
else:
- route = 'user'
query = query.filter( trans.app.model.User.table.c.deleted == False )
# special case: user can see only their own user
if not trans.user_is_admin():
item = trans.user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
- item['url'] = url_for( route, id=item['id'] )
- item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
return [item]
-
for user in query:
item = user.to_dict( value_mapper={ 'id': trans.security.encode_id } )
#TODO: move into api_values
- item['quota_percent'] = trans.app.quota_agent.get_percent( trans=trans )
- item['url'] = url_for( route, id=item['id'] )
rval.append( item )
return rval
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.
1
0
commit/galaxy-central: greg: Add a link to the repository from the repository dependency when displayed in the tool shed.
by commits-noreply@bitbucket.org 24 Oct '13
by commits-noreply@bitbucket.org 24 Oct '13
24 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/05fb30457977/
Changeset: 05fb30457977
User: greg
Date: 2013-10-24 20:13:09
Summary: Add a link to the repository from the repository dependency when displayed in the tool shed.
Affected #: 1 file
diff -r 99aa4cab1812998a767e3a26ce727a1ca50e03f8 -r 05fb304579771af681eb1a89de633133364c5f7d templates/webapps/tool_shed/repository/common.mako
--- a/templates/webapps/tool_shed/repository/common.mako
+++ b/templates/webapps/tool_shed/repository/common.mako
@@ -603,9 +603,9 @@
</%def><%def name="render_repository_dependency( repository_dependency, pad, parent, row_counter, row_is_header=False )">
-
<%
from galaxy.util import asbool
+ from tool_shed.util.shed_util_common import get_repository_by_name_and_owner
encoded_id = trans.security.encode_id( repository_dependency.id )
if trans.webapp.name == 'galaxy':
if repository_dependency.tool_shed_repository_id:
@@ -623,14 +623,15 @@
prior_installation_required_str = " <i>(prior install required)</i>"
else:
prior_installation_required_str = ""
-
if trans.webapp.name == 'galaxy':
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
else:
+ # We're in the tool shed.
cell_type = 'td'
+ rd = get_repository_by_name_and_owner( trans.app, repository_name, repository_owner )
%><tr class="datasetRow"
%if parent is not None:
@@ -658,7 +659,11 @@
</${cell_type}>
%else:
<td style="padding-left: ${pad+20}px;">
- Repository <b>${repository_name | h}</b> revision <b>${changeset_revision | h}</b> owned by <b>${repository_owner | h}</b>${prior_installation_required_str}
+ %if rd:
+ <a class="view-info" href="${h.url_for( controller='repository', action='view_or_manage_repository', id=trans.security.encode_id( rd.id ), changeset_revision=changeset_revision )}">Repository <b>${repository_name | h}</b> revision <b>${changeset_revision | h}</b> owned by <b>${repository_owner | h}</b></a>${prior_installation_required_str}
+ %else:
+ Repository <b>${repository_name | h}</b> revision <b>${changeset_revision | h}</b> owned by <b>${repository_owner | h}</b>${prior_installation_required_str}
+ %endif
</td>
%endif
</tr>
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7266b5e09cb2/
Changeset: 7266b5e09cb2
Branch: next-stable
User: greg
Date: 2013-10-24 16:48:48
Summary: Fix for handling set_environment when installing tool dependencies along with a tool shed repository.
Affected #: 1 file
diff -r 83bed9c7dbbc7fa5acfbced6491d63f8a50982b0 -r 7266b5e09cb20cac801cddef87b0466ddc32d41e lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -483,7 +483,7 @@
app.model.ToolDependency.installation_status.ERROR ]:
installed_tool_dependencies.append( tool_dependency )
elif elem.tag == 'set_environment':
- env_var_name = env_var_elem.get( 'name', None )
+ env_var_name = elem.get( 'name', None )
if env_var_name:
# Tool dependencies of type "set_environmnet" always have the version attribute set to None.
attr_tup = ( env_var_name, None, 'set_environment' )
https://bitbucket.org/galaxy/galaxy-central/commits/99aa4cab1812/
Changeset: 99aa4cab1812
User: greg
Date: 2013-10-24 16:49:15
Summary: Merged from next-stable
Affected #: 1 file
diff -r 30cedd7e894eea1f4ce9fc6fc36a697a13ea5dba -r 99aa4cab1812998a767e3a26ce727a1ca50e03f8 lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -483,7 +483,7 @@
app.model.ToolDependency.installation_status.ERROR ]:
installed_tool_dependencies.append( tool_dependency )
elif elem.tag == 'set_environment':
- env_var_name = env_var_elem.get( 'name', None )
+ env_var_name = elem.get( 'name', None )
if env_var_name:
# Tool dependencies of type "set_environmnet" always have the version attribute set to None.
attr_tup = ( env_var_name, None, 'set_environment' )
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.
1
0
commit/galaxy-central: jgoecks: Tool JS module: put template references into render() rather than model definition to allow for module loading when templates are not available.
by commits-noreply@bitbucket.org 24 Oct '13
by commits-noreply@bitbucket.org 24 Oct '13
24 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/30cedd7e894e/
Changeset: 30cedd7e894e
User: jgoecks
Date: 2013-10-24 16:47:36
Summary: Tool JS module: put template references into render() rather than model definition to allow for module loading when templates are not available.
Affected #: 1 file
diff -r 7f048ac9d878c59734a7272364e7e580a44576a5 -r 30cedd7e894eea1f4ce9fc6fc36a697a13ea5dba static/scripts/mvc/tools.js
--- a/static/scripts/mvc/tools.js
+++ b/static/scripts/mvc/tools.js
@@ -492,10 +492,9 @@
*/
var ToolLinkView = BaseView.extend({
tagName: 'div',
- template: Handlebars.templates.tool_link,
-
+
render: function() {
- this.$el.append( this.template(this.model.toJSON()) );
+ this.$el.append( Handlebars.templates.tool_link(this.model.toJSON()) );
return this;
}
});
@@ -519,14 +518,15 @@
var ToolSectionView = BaseView.extend({
tagName: 'div',
className: 'toolSectionWrapper',
- template: Handlebars.templates.panel_section,
+
initialize: function() {
BaseView.prototype.initialize.call(this);
this.model.on("change:open", this.update_open, this);
},
+
render: function() {
// Build using template.
- this.$el.append( this.template(this.model.toJSON()) );
+ this.$el.append( Handlebars.templates.panel_section(this.model.toJSON()) );
// Add tools to section.
var section_body = this.$el.find(".toolSectionBody");
@@ -574,7 +574,6 @@
tagName: 'div',
id: 'tool-search',
className: 'bar',
- template: Handlebars.templates.tool_search,
events: {
'click': 'focus_and_select',
@@ -583,7 +582,7 @@
},
render: function() {
- this.$el.append( this.template(this.model.toJSON()) );
+ this.$el.append( Handlebars.templates.tool_search(this.model.toJSON()) );
if (!this.model.is_visible()) {
this.$el.hide();
}
@@ -684,11 +683,10 @@
*/
var ToolFormView = Backbone.View.extend({
className: 'toolForm',
- template: Handlebars.templates.tool_form,
render: function() {
this.$el.children().remove();
- this.$el.append( this.template(this.model.toJSON()) );
+ this.$el.append( Handlebars.templates.tool_form(this.model.toJSON()) );
}
});
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/83bed9c7dbbc/
Changeset: 83bed9c7dbbc
Branch: next-stable
User: greg
Date: 2013-10-24 15:47:04
Summary: Eliminate restriction to repository owner (make it to anyone that has write permission on the repository) for resetting metadata on the repository in the tool shed.
Affected #: 1 file
diff -r 71c35dbde130994265d85c34a00d9f845eda28cc -r 83bed9c7dbbc7fa5acfbced6491d63f8a50982b0 templates/webapps/tool_shed/common/repository_actions_menu.mako
--- a/templates/webapps/tool_shed/common/repository_actions_menu.mako
+++ b/templates/webapps/tool_shed/common/repository_actions_menu.mako
@@ -54,7 +54,7 @@
else:
can_download = False
- if ( is_admin or ( trans.user and trans.user == repository.user ) ) and not repository.deleted and not repository.deprecated and not is_new:
+ if ( is_admin or can_push ) and not repository.deleted and not repository.deprecated and not is_new:
can_reset_all_metadata = True
else:
can_reset_all_metadata = False
https://bitbucket.org/galaxy/galaxy-central/commits/7f048ac9d878/
Changeset: 7f048ac9d878
User: greg
Date: 2013-10-24 15:47:35
Summary: Merged from next-stable
Affected #: 1 file
diff -r 319c21e395a32f66b783578e43a4da2daa0b375c -r 7f048ac9d878c59734a7272364e7e580a44576a5 templates/webapps/tool_shed/common/repository_actions_menu.mako
--- a/templates/webapps/tool_shed/common/repository_actions_menu.mako
+++ b/templates/webapps/tool_shed/common/repository_actions_menu.mako
@@ -54,7 +54,7 @@
else:
can_download = False
- if ( is_admin or ( trans.user and trans.user == repository.user ) ) and not repository.deleted and not repository.deprecated and not is_new:
+ if ( is_admin or can_push ) and not repository.deleted and not repository.deprecated and not is_new:
can_reset_all_metadata = True
else:
can_reset_all_metadata = False
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.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/200bd6479490/
Changeset: 200bd6479490
User: Dave Bouvier
Date: 2013-10-24 14:51:16
Summary: Check for the existence of a display application before attempting to delete it from the registry.
Affected #: 1 file
diff -r e5b91a357c909cb63b5bbb7fc922226f34255d31 -r 200bd6479490cb7c85e18e95beb5a1cb072af307 lib/galaxy/datatypes/registry.py
--- a/lib/galaxy/datatypes/registry.py
+++ b/lib/galaxy/datatypes/registry.py
@@ -547,8 +547,11 @@
display_app.id = tool_dict[ 'guid' ]
break
if deactivate:
- del self.display_applications[ display_app.id ]
- del self.datatypes_by_extension[ extension ].display_applications[ display_app.id ]
+ if display_app.id in self.display_applications:
+ del self.display_applications[ display_app.id ]
+ if extension in self.datatypes_by_extension:
+ if display_app.id in self.datatypes_by_extension[ extension ].display_applications:
+ del self.datatypes_by_extension[ extension ].display_applications[ display_app.id ]
if inherit and ( self.datatypes_by_extension[ extension ], display_app ) in self.inherit_display_application_by_class:
self.inherit_display_application_by_class.remove( ( self.datatypes_by_extension[ extension ], display_app ) )
self.log.debug( "Deactivated display application '%s' for datatype '%s'." % ( display_app.id, extension ) )
https://bitbucket.org/galaxy/galaxy-central/commits/71c35dbde130/
Changeset: 71c35dbde130
Branch: next-stable
User: Dave Bouvier
Date: 2013-10-24 14:51:16
Summary: Check for the existence of a display application before attempting to delete it from the registry.
Affected #: 1 file
diff -r 434254daaa091f4b9999e015ff090da518327a13 -r 71c35dbde130994265d85c34a00d9f845eda28cc lib/galaxy/datatypes/registry.py
--- a/lib/galaxy/datatypes/registry.py
+++ b/lib/galaxy/datatypes/registry.py
@@ -547,8 +547,11 @@
display_app.id = tool_dict[ 'guid' ]
break
if deactivate:
- del self.display_applications[ display_app.id ]
- del self.datatypes_by_extension[ extension ].display_applications[ display_app.id ]
+ if display_app.id in self.display_applications:
+ del self.display_applications[ display_app.id ]
+ if extension in self.datatypes_by_extension:
+ if display_app.id in self.datatypes_by_extension[ extension ].display_applications:
+ del self.datatypes_by_extension[ extension ].display_applications[ display_app.id ]
if inherit and ( self.datatypes_by_extension[ extension ], display_app ) in self.inherit_display_application_by_class:
self.inherit_display_application_by_class.remove( ( self.datatypes_by_extension[ extension ], display_app ) )
self.log.debug( "Deactivated display application '%s' for datatype '%s'." % ( display_app.id, extension ) )
https://bitbucket.org/galaxy/galaxy-central/commits/319c21e395a3/
Changeset: 319c21e395a3
User: Dave Bouvier
Date: 2013-10-24 14:55:55
Summary: Merge with next-stable.
Affected #: 0 files
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/cbfae86c6def/
Changeset: cbfae86c6def
User: jmchilton
Date: 2013-04-23 16:57:14
Summary: Add exception handling for Binary sniffers. Image sniffers can fail for large files because signed integers are used internally, this catches that and other potential problems.
Traceback (most recent call last):
File "/opt/galaxy/web/tools/data_source/upload.py", line 432, in <module>
__main__()
File "/opt/galaxy/web/tools/data_source/upload.py", line 421, in __main__
add_file( dataset, registry, json_file, output_path )
File "/opt/galaxy/web/tools/data_source/upload.py", line 155, in add_file
type_info = Binary.is_sniffable_binary( dataset.path )
File "/opt/galaxy/web/lib/galaxy/datatypes/binary.py", line 38, in is_sniffable_binary
if format["class"]().sniff(filename):
File "/opt/galaxy/web/lib/galaxy/datatypes/images.py", line 203, in sniff
headers = get_headers(filename, None, 1)
File "/opt/galaxy/web/lib/galaxy/datatypes/sniff.py", line 179, in get_headers
for idx, line in enumerate(file(fname)):
SystemError: Negative size passed to PyString_FromStringAndSize
Affected #: 1 file
diff -r 1e3d92ec22b2794bfa2294edb74695c580791406 -r cbfae86c6def520dff8d922066054ede3072ebfb lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -33,11 +33,20 @@
Binary.unsniffable_binary_formats.append(ext)
@staticmethod
- def is_sniffable_binary(filename):
+ def is_sniffable_binary( filename ):
+ format_information = None
for format in Binary.sniffable_binary_formats:
- if format["class"]().sniff(filename):
- return (format["type"], format["ext"])
- return None
+ format_instance = format[ "class" ]()
+ try:
+ if format_instance.sniff(filename):
+ format_information = ( format["type"], format[ "ext" ] )
+ break
+ except Exception:
+ # Sniffer raised exception, could be any number of
+ # reasons for this so there is not much to do besides
+ # trying next sniffer.
+ pass
+ return format_information
@staticmethod
def is_ext_unsniffable(ext):
https://bitbucket.org/galaxy/galaxy-central/commits/4f400cb23860/
Changeset: 4f400cb23860
User: jmchilton
Date: 2013-04-23 19:24:16
Summary: Rework checking binary files. Why read in line by line if only going to check 100 characters? This approach to just read first 100 characters is cleaner, more efficient, and hopefully less error prone. Should avoid the following exception caused when checking large files:
Traceback (most recent call last):
File "/opt/galaxy/web/tools/data_source/upload.py", line 432, in <module>
__main__()
File "/opt/galaxy/web/tools/data_source/upload.py", line 421, in __main__
add_file( dataset, registry, json_file, output_path )
File "/opt/galaxy/web/tools/data_source/upload.py", line 283, in add_file
if check_binary( dataset.path ):
File "/opt/galaxy/web/lib/galaxy/datatypes/checkers.py", line 58, in check_binary
for chars in temp:
SystemError: Negative size passed to PyString_FromStringAndSize
Affected #: 1 file
diff -r cbfae86c6def520dff8d922066054ede3072ebfb -r 4f400cb238607d7563a001ab0cf0d3b24bb10f17 lib/galaxy/datatypes/checkers.py
--- a/lib/galaxy/datatypes/checkers.py
+++ b/lib/galaxy/datatypes/checkers.py
@@ -1,5 +1,6 @@
import os, gzip, re, gzip, zipfile, binascii, bz2, imghdr
from galaxy import util
+from StringIO import StringIO
try:
import Image as PIL
@@ -53,20 +54,15 @@
if file_path:
temp = open( name, "U" )
else:
- temp = name
+ temp = StringIO( name )
chars_read = 0
- for chars in temp:
- for char in chars:
- chars_read += 1
+ try:
+ for char in temp.read( 100 ):
if ord( char ) > 128:
is_binary = True
break
- if chars_read > 100:
- break
- if chars_read > 100:
- break
- if file_path:
- temp.close()
+ finally:
+ temp.close( )
return is_binary
def check_gzip( file_path ):
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/434254daaa09/
Changeset: 434254daaa09
Branch: next-stable
User: greg
Date: 2013-10-23 22:30:35
Summary: Handle automatic population of the toolshed and changeset_revision attributes of <repository> tags defined as subelements of any actions tag type in tool dependency definitions.
Affected #: 2 files
diff -r 41b2bb55771864d5a70bcf1c10f82da22874a6f8 -r 434254daaa091f4b9999e015ff090da518327a13 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -502,7 +502,6 @@
pre_cmd = './configure %s && make && make install' % configure_opts
else:
pre_cmd = './configure prefix=$INSTALL_DIR %s && make && make install' % configure_opts
-
cmd = install_environment.build_command( td_common_util.evaluate_template( pre_cmd, install_dir ) )
return_code = handle_command( app, tool_dependency, install_dir, cmd )
if return_code:
diff -r 41b2bb55771864d5a70bcf1c10f82da22874a6f8 -r 434254daaa091f4b9999e015ff090da518327a13 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -318,22 +318,23 @@
error_message = 'Unable to locate repository with name %s and owner %s. ' % ( str( name ), str( owner ) )
return revised, elem, error_message
-def handle_set_environment_for_install( trans, package_altered, altered, actions_elem, action_index, action_elem, unpopulate=False ):
+def handle_repository_dependency_sub_elem( trans, package_altered, altered, actions_elem, action_index, action_elem, unpopulate=False ):
+ # This method populates the toolshed and changeset_revision attributes for each of the following.
# <action type="set_environment_for_install">
- # <repository name="package_eigen_2_0" owner="test" changeset_revision="09eb05087cd0">
- # <package name="eigen" version="2.0.17" />
- # </repository>
- # </action>
+ # <action type="setup_r_environment">
+ # <action type="setup_ruby_environment">
for repo_index, repo_elem in enumerate( action_elem ):
- revised, repository_elem, error_message = handle_repository_dependency_elem( trans, repo_elem, unpopulate=unpopulate )
- if error_message:
- exception_message = 'The tool_dependencies.xml file contains an invalid <repository> tag. %s' % error_message
- raise Exception( exception_message )
- if revised:
- action_elem[ repo_index ] = repository_elem
- package_altered = True
- if not altered:
- altered = True
+ # Make sure to skip comments and tags that are not <repository>.
+ if repo_elem.tag == 'repository':
+ revised, repository_elem, error_message = handle_repository_dependency_elem( trans, repo_elem, unpopulate=unpopulate )
+ if error_message:
+ exception_message = 'The tool_dependencies.xml file contains an invalid <repository> tag. %s' % error_message
+ raise Exception( exception_message )
+ if revised:
+ action_elem[ repo_index ] = repository_elem
+ package_altered = True
+ if not altered:
+ altered = True
if package_altered:
actions_elem[ action_index ] = action_elem
return package_altered, altered, actions_elem
@@ -402,29 +403,28 @@
last_actions_elem[ last_actions_elem_package_index ] = last_actions_elem_package_elem
actions_group_elem[ last_actions_index ] = last_actions_elem
else:
- last_actions_elem_action_type = last_actions_elem.get( 'type' )
- if last_actions_elem_action_type == 'set_environment_for_install':
- last_actions_package_altered, altered, last_actions_elem = \
- handle_set_environment_for_install( trans,
- last_actions_package_altered,
- altered,
- actions_group_elem,
- last_actions_index,
- last_actions_elem,
- unpopulate=unpopulate )
+ # Inspect the sub elements of last_actions_elem to locate all <repository> tags and
+ # populate them with toolshed and changeset_revision attributes if necessary.
+ last_actions_package_altered, altered, last_actions_elem = \
+ handle_repository_dependency_sub_elem( trans,
+ last_actions_package_altered,
+ altered,
+ actions_group_elem,
+ last_actions_index,
+ last_actions_elem,
+ unpopulate=unpopulate )
elif actions_elem.tag == 'actions':
# We are not in an <actions_group> tag set, so we must be in an <actions> tag set.
for action_index, action_elem in enumerate( actions_elem ):
-
- action_type = action_elem.get( 'type' )
- if action_type == 'set_environment_for_install':
- package_altered, altered, actions_elem = handle_set_environment_for_install( trans,
- package_altered,
- altered,
- actions_elem,
- action_index,
- action_elem,
- unpopulate=unpopulate )
+ # Inspect the sub elements of last_actions_elem to locate all <repository> tags and populate them with
+ # toolshed and changeset_revision attributes if necessary.
+ package_altered, altered, actions_elem = handle_repository_dependency_sub_elem( trans,
+ package_altered,
+ altered,
+ actions_elem,
+ action_index,
+ action_elem,
+ unpopulate=unpopulate )
if package_altered:
package_elem[ actions_index ] = actions_elem
if package_altered:
https://bitbucket.org/galaxy/galaxy-central/commits/aed8d5d9562f/
Changeset: aed8d5d9562f
User: greg
Date: 2013-10-23 22:31:03
Summary: Merged from next-stable
Affected #: 2 files
diff -r 7fd53ab921bc562abb96761e20bdc101df7126af -r aed8d5d9562f42596150ab086800b43bf463f270 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -502,7 +502,6 @@
pre_cmd = './configure %s && make && make install' % configure_opts
else:
pre_cmd = './configure prefix=$INSTALL_DIR %s && make && make install' % configure_opts
-
cmd = install_environment.build_command( td_common_util.evaluate_template( pre_cmd, install_dir ) )
return_code = handle_command( app, tool_dependency, install_dir, cmd )
if return_code:
diff -r 7fd53ab921bc562abb96761e20bdc101df7126af -r aed8d5d9562f42596150ab086800b43bf463f270 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -318,22 +318,23 @@
error_message = 'Unable to locate repository with name %s and owner %s. ' % ( str( name ), str( owner ) )
return revised, elem, error_message
-def handle_set_environment_for_install( trans, package_altered, altered, actions_elem, action_index, action_elem, unpopulate=False ):
+def handle_repository_dependency_sub_elem( trans, package_altered, altered, actions_elem, action_index, action_elem, unpopulate=False ):
+ # This method populates the toolshed and changeset_revision attributes for each of the following.
# <action type="set_environment_for_install">
- # <repository name="package_eigen_2_0" owner="test" changeset_revision="09eb05087cd0">
- # <package name="eigen" version="2.0.17" />
- # </repository>
- # </action>
+ # <action type="setup_r_environment">
+ # <action type="setup_ruby_environment">
for repo_index, repo_elem in enumerate( action_elem ):
- revised, repository_elem, error_message = handle_repository_dependency_elem( trans, repo_elem, unpopulate=unpopulate )
- if error_message:
- exception_message = 'The tool_dependencies.xml file contains an invalid <repository> tag. %s' % error_message
- raise Exception( exception_message )
- if revised:
- action_elem[ repo_index ] = repository_elem
- package_altered = True
- if not altered:
- altered = True
+ # Make sure to skip comments and tags that are not <repository>.
+ if repo_elem.tag == 'repository':
+ revised, repository_elem, error_message = handle_repository_dependency_elem( trans, repo_elem, unpopulate=unpopulate )
+ if error_message:
+ exception_message = 'The tool_dependencies.xml file contains an invalid <repository> tag. %s' % error_message
+ raise Exception( exception_message )
+ if revised:
+ action_elem[ repo_index ] = repository_elem
+ package_altered = True
+ if not altered:
+ altered = True
if package_altered:
actions_elem[ action_index ] = action_elem
return package_altered, altered, actions_elem
@@ -402,29 +403,28 @@
last_actions_elem[ last_actions_elem_package_index ] = last_actions_elem_package_elem
actions_group_elem[ last_actions_index ] = last_actions_elem
else:
- last_actions_elem_action_type = last_actions_elem.get( 'type' )
- if last_actions_elem_action_type == 'set_environment_for_install':
- last_actions_package_altered, altered, last_actions_elem = \
- handle_set_environment_for_install( trans,
- last_actions_package_altered,
- altered,
- actions_group_elem,
- last_actions_index,
- last_actions_elem,
- unpopulate=unpopulate )
+ # Inspect the sub elements of last_actions_elem to locate all <repository> tags and
+ # populate them with toolshed and changeset_revision attributes if necessary.
+ last_actions_package_altered, altered, last_actions_elem = \
+ handle_repository_dependency_sub_elem( trans,
+ last_actions_package_altered,
+ altered,
+ actions_group_elem,
+ last_actions_index,
+ last_actions_elem,
+ unpopulate=unpopulate )
elif actions_elem.tag == 'actions':
# We are not in an <actions_group> tag set, so we must be in an <actions> tag set.
for action_index, action_elem in enumerate( actions_elem ):
-
- action_type = action_elem.get( 'type' )
- if action_type == 'set_environment_for_install':
- package_altered, altered, actions_elem = handle_set_environment_for_install( trans,
- package_altered,
- altered,
- actions_elem,
- action_index,
- action_elem,
- unpopulate=unpopulate )
+ # Inspect the sub elements of last_actions_elem to locate all <repository> tags and populate them with
+ # toolshed and changeset_revision attributes if necessary.
+ package_altered, altered, actions_elem = handle_repository_dependency_sub_elem( trans,
+ package_altered,
+ altered,
+ actions_elem,
+ action_index,
+ action_elem,
+ unpopulate=unpopulate )
if package_altered:
package_elem[ actions_index ] = actions_elem
if package_altered:
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/41b2bb557718/
Changeset: 41b2bb557718
Branch: next-stable
User: jgoecks
Date: 2013-10-23 22:01:29
Summary: Fix type in b8482a0c41ae
Affected #: 1 file
diff -r 8d9ad9d07b83cf6f08ccfa5e44dfd01f875ca86d -r 41b2bb55771864d5a70bcf1c10f82da22874a6f8 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -4304,7 +4304,7 @@
// Add summary/sample labels if needed and not already included.
var sample_names = this.dataset.get_metadata('sample_names');
- if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names && samples_names.length > 1) {
+ if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names && sample_names.length > 1) {
var font_size;
// Add and/or style labels.
https://bitbucket.org/galaxy/galaxy-central/commits/7fd53ab921bc/
Changeset: 7fd53ab921bc
User: jgoecks
Date: 2013-10-23 22:02:13
Summary: Automated merge of next-stable
Affected #: 1 file
diff -r b8482a0c41aef74a879b496231340b679abffb62 -r 7fd53ab921bc562abb96761e20bdc101df7126af static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -4304,7 +4304,7 @@
// Add summary/sample labels if needed and not already included.
var sample_names = this.dataset.get_metadata('sample_names');
- if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names && samples_names.length > 1) {
+ if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names && sample_names.length > 1) {
var font_size;
// Add and/or style labels.
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.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/8d9ad9d07b83/
Changeset: 8d9ad9d07b83
Branch: next-stable
User: jgoecks
Date: 2013-10-23 21:50:39
Summary: Trackster: only show summary label if there are multiple samples.
Affected #: 1 file
diff -r 35328380ac82c471a942bd6f0b5a4e73413bf272 -r 8d9ad9d07b83cf6f08ccfa5e44dfd01f875ca86d static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -4304,7 +4304,7 @@
// Add summary/sample labels if needed and not already included.
var sample_names = this.dataset.get_metadata('sample_names');
- if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names) {
+ if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names && samples_names.length > 1) {
var font_size;
// Add and/or style labels.
https://bitbucket.org/galaxy/galaxy-central/commits/b8482a0c41ae/
Changeset: b8482a0c41ae
User: jgoecks
Date: 2013-10-23 21:51:00
Summary: Automated merge of next-stable
Affected #: 1 file
diff -r ff9603c007c78c5c256171592bbd0aed5e20cab1 -r b8482a0c41aef74a879b496231340b679abffb62 static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -4304,7 +4304,7 @@
// Add summary/sample labels if needed and not already included.
var sample_names = this.dataset.get_metadata('sample_names');
- if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names) {
+ if (line_track_tiles.length === 0 && this.prefs.show_labels && sample_names && samples_names.length > 1) {
var font_size;
// Add and/or style labels.
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.
1
0
commit/galaxy-central: carlfeberhard: QuotaMeter: remove handlebars templates, render within view, update for bootstrap 3.0; pack scripts
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ff9603c007c7/
Changeset: ff9603c007c7
User: carlfeberhard
Date: 2013-10-23 20:22:20
Summary: QuotaMeter: remove handlebars templates, render within view, update for bootstrap 3.0; pack scripts
Affected #: 9 files
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/mvc/user/user-quotameter.js
--- a/static/scripts/mvc/user/user-quotameter.js
+++ b/static/scripts/mvc/user/user-quotameter.js
@@ -57,31 +57,33 @@
var modelJson = this.model.toJSON(),
//prevPercent = this.model.previous( 'quota_percent' ),
percent = modelJson.quota_percent,
- meter = $( UserQuotaMeter.templates.quota( modelJson ) );
+ //meter = $( UserQuotaMeter.templates.quota( modelJson ) );
+ $meter = $( this._templateQuotaMeter( modelJson ) ),
+ $bar = $meter.find( '.progress-bar' );
//this.log( this + '.rendering quota, percent:', percent, 'meter:', meter );
// OVER QUOTA: color the quota bar and show the quota error message
if( this.isOverQuota() ){
//this.log( '\t over quota' );
- meter.addClass( 'progress-danger' );
- meter.find( '#quota-meter-text' ).css( 'color', 'white' );
+ $bar.attr( 'class', 'progress-bar progress-bar-danger' );
+ $meter.find( '.quota-meter-text' ).css( 'color', 'white' );
//TODO: only trigger event if state has changed
this.trigger( 'quota:over', modelJson );
// APPROACHING QUOTA: color the quota bar
} else if( percent >= this.options.warnAtPercent ){
//this.log( '\t approaching quota' );
- meter.addClass( 'progress-warning' );
+ $bar.attr( 'class', 'progress-bar progress-bar-warning' );
//TODO: only trigger event if state has changed
this.trigger( 'quota:under quota:under:approaching', modelJson );
// otherwise, hide/don't use the msg box
} else {
- meter.addClass( 'progress-success' );
+ $bar.attr( 'class', 'progress-bar progress-bar-success' );
//TODO: only trigger event if state has changed
this.trigger( 'quota:under quota:under:ok', modelJson );
}
- return meter;
+ return $meter;
},
/** Render the meter when the user has NO applicable quota. Will render as text
@@ -89,7 +91,8 @@
* @returns {jQuery} the rendered text
*/
_render_usage : function(){
- var usage = $( UserQuotaMeter.templates.usage( this.model.toJSON() ) );
+ //var usage = $( UserQuotaMeter.templates.usage( this.model.toJSON() ) );
+ var usage = $( this._templateUsage( this.model.toJSON() ) );
this.log( this + '.rendering usage:', usage );
return usage;
},
@@ -120,14 +123,29 @@
return this;
},
+ _templateQuotaMeter : function( data ){
+ return [
+ '<div id="quota-meter" class="quota-meter progress">',
+ '<div class="progress-bar" style="width: ', data.quota_percent, '%"></div>',
+ '<div class="quota-meter-text" style="top: 6px"',
+ (( data.nice_total_disk_usage )?( ' title="Using ' + data.nice_total_disk_usage + '">' ):( '>' )),
+ _l( 'Using' ), ' ', data.quota_percent, '%',
+ '</div>',
+ '</div>'
+ ].join( '' );
+ },
+
+ _templateUsage : function( data ){
+ return [
+ '<div id="quota-meter" class="quota-meter" style="background-color: transparent">',
+ '<div class="quota-meter-text" style="top: 6px; color: white">',
+ (( data.nice_total_disk_usage )?( _l( 'Using ' ) + data.nice_total_disk_usage ):( '' )),
+ '</div>',
+ '</div>'
+ ].join( '' );
+ },
+
toString : function(){
return 'UserQuotaMeter(' + this.model + ')';
}
});
-
-
-//------------------------------------------------------------------------------ TEMPLATES
-UserQuotaMeter.templates = {
- quota : Handlebars.templates[ 'template-user-quotaMeter-quota' ],
- usage : Handlebars.templates[ 'template-user-quotaMeter-usage' ]
-};
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/packed/mvc/user/user-quotameter.js
--- a/static/scripts/packed/mvc/user/user-quotameter.js
+++ b/static/scripts/packed/mvc/user/user-quotameter.js
@@ -1,1 +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(),b=a.quota_percent,c=$(UserQuotaMeter.templates.quota(a));if(this.isOverQuota()){c.addClass("progress-danger");c.find("#quota-meter-text").css("color","white");this.trigger("quota:over",a)}else{if(b>=this.options.warnAtPercent){c.addClass("progress-warning");this.trigger("quota:under quota:under:approaching",a)}else{c.addClass("progress-success");this.trigger("quota:under quota:under:ok",a)}}return c},_render_usage:function(){var a=$(UserQuotaMeter.templates.usage(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},toString:function(){return"UserQuotaMeter("+this.model+")"}});UserQuotaMeter.templates={quota:Handlebars.templates["template-user-quotaMeter-quota"],usage:Handlebars.templates["template-user-quotaMeter-usage"]};
\ No newline at end of file
+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+")"}});
\ No newline at end of file
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/packed/templates/compiled/template-user-quotaMeter-quota.js
--- a/static/scripts/packed/templates/compiled/template-user-quotaMeter-quota.js
+++ /dev/null
@@ -1,1 +0,0 @@
-(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-user-quotaMeter-quota"]=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",d,p,h="function",j=this.escapeExpression,o=this,n=f.blockHelperMissing;function e(t,s){var q="",r;q+=' title="Using ';if(r=f.nice_total_disk_usage){r=r.call(t,{hash:{},data:s})}else{r=t.nice_total_disk_usage;r=typeof r===h?r.apply(t):r}q+=j(r)+'"';return q}function c(r,q){return"Using"}i+='<div id="quota-meter" class="quota-meter progress">\n <div id="quota-meter-bar" class="quota-meter-bar bar" style="width: ';if(d=f.quota_percent){d=d.call(m,{hash:{},data:k})}else{d=m.quota_percent;d=typeof d===h?d.apply(m):d}i+=j(d)+'%"></div>\n \n <div id="quota-meter-text" class="quota-meter-text"\n style="top: 6px"';d=f["if"].call(m,m.nice_total_disk_usage,{hash:{},inverse:o.noop,fn:o.program(1,e,k),data:k});if(d||d===0){i+=d}i+=">\n ";p={hash:{},inverse:o.noop,fn:o.program(3,c,k),data:k};if(d=f.local){d=d.call(m,p)}else{d=m.local;d=typeof d===h?d.apply(m):d}if(!f.local){d=n.call(m,d,p)}if(d||d===0){i+=d}i+=" ";if(d=f.quota_percent){d=d.call(m,{hash:{},data:k})}else{d=m.quota_percent;d=typeof d===h?d.apply(m):d}i+=j(d)+"%\n </div>\n</div>";return i})})();
\ No newline at end of file
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/packed/templates/compiled/template-user-quotaMeter-usage.js
--- a/static/scripts/packed/templates/compiled/template-user-quotaMeter-usage.js
+++ /dev/null
@@ -1,1 +0,0 @@
-(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-user-quotaMeter-usage"]=b(function(g,m,f,l,k){this.compilerInfo=[4,">= 1.0.0"];f=this.merge(f,g.helpers);k=k||{};var i="",c,o=this,h="function",n=f.blockHelperMissing,j=this.escapeExpression;function e(t,s){var p="",r,q;q={hash:{},inverse:o.noop,fn:o.program(2,d,s),data:s};if(r=f.local){r=r.call(t,q)}else{r=t.local;r=typeof r===h?r.apply(t):r}if(!f.local){r=n.call(t,r,q)}if(r||r===0){p+=r}p+=" ";if(r=f.nice_total_disk_usage){r=r.call(t,{hash:{},data:s})}else{r=t.nice_total_disk_usage;r=typeof r===h?r.apply(t):r}p+=j(r);return p}function d(q,p){return"Using"}i+='<div id="quota-meter" class="quota-meter" style="background-color: transparent">\n <div id="quota-meter-text" class="quota-meter-text" style="top: 6px; color: white">\n ';c=f["if"].call(m,m.nice_total_disk_usage,{hash:{},inverse:o.noop,fn:o.program(1,e,k),data:k});if(c||c===0){i+=c}i+="\n </div>\n</div>";return i})})();
\ No newline at end of file
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/templates/compiled/template-user-quotaMeter-quota.js
--- a/static/scripts/templates/compiled/template-user-quotaMeter-quota.js
+++ /dev/null
@@ -1,46 +0,0 @@
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['template-user-quotaMeter-quota'] = template(function (Handlebars,depth0,helpers,partials,data) {
- this.compilerInfo = [4,'>= 1.0.0'];
-helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
- var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1;
- buffer += " title=\"Using ";
- if (stack1 = helpers.nice_total_disk_usage) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.nice_total_disk_usage; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1)
- + "\"";
- return buffer;
- }
-
-function program3(depth0,data) {
-
-
- return "Using";
- }
-
- buffer += "<div id=\"quota-meter\" class=\"quota-meter progress\">\n <div id=\"quota-meter-bar\" class=\"quota-meter-bar bar\" style=\"width: ";
- if (stack1 = helpers.quota_percent) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.quota_percent; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1)
- + "%\"></div>\n "
- + "\n <div id=\"quota-meter-text\" class=\"quota-meter-text\"\n style=\"top: 6px\"";
- stack1 = helpers['if'].call(depth0, depth0.nice_total_disk_usage, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += ">\n ";
- options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data};
- if (stack1 = helpers.local) { stack1 = stack1.call(depth0, options); }
- else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += " ";
- if (stack1 = helpers.quota_percent) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.quota_percent; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1)
- + "%\n </div>\n</div>";
- return buffer;
- });
-})();
\ No newline at end of file
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/templates/compiled/template-user-quotaMeter-usage.js
--- a/static/scripts/templates/compiled/template-user-quotaMeter-usage.js
+++ /dev/null
@@ -1,34 +0,0 @@
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['template-user-quotaMeter-usage'] = template(function (Handlebars,depth0,helpers,partials,data) {
- this.compilerInfo = [4,'>= 1.0.0'];
-helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
- var buffer = "", stack1, self=this, functionType="function", blockHelperMissing=helpers.blockHelperMissing, escapeExpression=this.escapeExpression;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1, options;
- options = {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data};
- if (stack1 = helpers.local) { stack1 = stack1.call(depth0, options); }
- else { stack1 = depth0.local; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- if (!helpers.local) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += " ";
- if (stack1 = helpers.nice_total_disk_usage) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.nice_total_disk_usage; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1);
- return buffer;
- }
-function program2(depth0,data) {
-
-
- return "Using";
- }
-
- buffer += "<div id=\"quota-meter\" class=\"quota-meter\" style=\"background-color: transparent\">\n <div id=\"quota-meter-text\" class=\"quota-meter-text\" style=\"top: 6px; color: white\">\n ";
- stack1 = helpers['if'].call(depth0, depth0.nice_total_disk_usage, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n </div>\n</div>";
- return buffer;
- });
-})();
\ No newline at end of file
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 static/scripts/templates/ui-templates.html
--- a/static/scripts/templates/ui-templates.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<script type="text/template" class="template-user" id="template-user-quotaMeter-quota">
-<div id="quota-meter" class="quota-meter progress">
- <div id="quota-meter-bar" class="quota-meter-bar bar" style="width: {{quota_percent}}%"></div>
- {{! TODO: remove the hardcoded style }}
- <div id="quota-meter-text" class="quota-meter-text"
- style="top: 6px"{{#if nice_total_disk_usage}} title="Using {{nice_total_disk_usage}}"{{/if}}>
- {{#local}}Using{{/local}} {{ quota_percent }}%
- </div>
-</div>
-</script>
-
-<!-- TODO: remove the hardcoded styles -->
-<script type="text/template" class="template-user" id="template-user-quotaMeter-usage">
-<div id="quota-meter" class="quota-meter" style="background-color: transparent">
- <div id="quota-meter-text" class="quota-meter-text" style="top: 6px; color: white">
- {{#if nice_total_disk_usage }}{{#local}}Using{{/local}} {{ nice_total_disk_usage }}{{/if}}
- </div>
-</div>
-</script>
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 templates/webapps/galaxy/base_panels.mako
--- a/templates/webapps/galaxy/base_panels.mako
+++ b/templates/webapps/galaxy/base_panels.mako
@@ -7,7 +7,7 @@
${parent.javascripts()}
<!-- quota meter -->
-${h.templates( "helpers-common-templates", "template-user-quotaMeter-quota", "template-user-quotaMeter-usage" )}
+${h.templates( "helpers-common-templates" )}
${h.js( "mvc/base-mvc", "utils/localization", "mvc/user/user-model", "mvc/user/user-quotameter" )}
</%def>
diff -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad -r ff9603c007c78c5c256171592bbd0aed5e20cab1 templates/webapps/galaxy/galaxy.masthead.mako
--- a/templates/webapps/galaxy/galaxy.masthead.mako
+++ b/templates/webapps/galaxy/galaxy.masthead.mako
@@ -232,7 +232,7 @@
<div class="quota-meter-container"></div><!-- quota meter -->
- ${h.templates( "helpers-common-templates", "template-user-quotaMeter-quota", "template-user-quotaMeter-usage" )}
+ ${h.templates( "helpers-common-templates" )}
${h.js( "mvc/base-mvc", "utils/localization", "mvc/user/user-model", "mvc/user/user-quotameter" )}
<script type="text/javascript">
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.
1
0
commit/galaxy-central: carlfeberhard: UI: remove template for popupmenu (inside view now)
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/bd89b1ef5a95/
Changeset: bd89b1ef5a95
User: carlfeberhard
Date: 2013-10-23 19:24:46
Summary: UI: remove template for popupmenu (inside view now)
Affected #: 5 files
diff -r c3179a238f97fdf7b1f159b32d276a4a596a7e9e -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad static/scripts/packed/templates/compiled/template-popupmenu-menu.js
--- a/static/scripts/packed/templates/compiled/template-popupmenu-menu.js
+++ /dev/null
@@ -1,1 +0,0 @@
-(function(){var b=Handlebars.template,a=Handlebars.templates=Handlebars.templates||{};a["template-popupmenu-menu"]=b(function(g,s,q,l,x){this.compilerInfo=[4,">= 1.0.0"];q=this.merge(q,g.helpers);x=x||{};var r="",i,f,d="function",c=this.escapeExpression,p=this;function o(B,A){var y="",z;y+="\n ";z=q.each.call(B,B.options,{hash:{},inverse:p.noop,fn:p.program(2,n,A),data:A});if(z||z===0){y+=z}y+="\n";return y}function n(B,A){var y="",z;y+="\n ";z=q["if"].call(B,B.divider,{hash:{},inverse:p.program(5,k,A),fn:p.program(3,m,A),data:A});if(z||z===0){y+=z}y+="\n ";return y}function m(z,y){return'\n <li class="divider"></li>\n '}function k(B,A){var y="",z;y+="\n ";z=q["if"].call(B,B.header,{hash:{},inverse:p.program(8,h,A),fn:p.program(6,j,A),data:A});if(z||z===0){y+=z}y+="\n ";return y}function j(B,A){var y="",z;y+='\n <li class="head"><a href=""javascript:void(0);">';if(z=q.html){z=z.call(B,{hash:{},data:A})}else{z=B.html;z=typeof z===d?z.apply(B):z}if(z||z===0){y+=z}y+="</a></li>\n ";return y}function h(B,A){var y="",z;y+='\n \n <li><a href="';z=q["if"].call(B,B.href,{hash:{},inverse:p.program(11,w,A),fn:p.program(9,e,A),data:A});if(z||z===0){y+=z}y+='"\n ';z=q["if"].call(B,B.href,{hash:{},inverse:p.noop,fn:p.program(13,v,A),data:A});if(z||z===0){y+=z}y+=' class="popupmenu-option">\n ';z=q["if"].call(B,B.checked,{hash:{},inverse:p.noop,fn:p.program(15,u,A),data:A});if(z||z===0){y+=z}y+="\n ";if(z=q.html){z=z.call(B,{hash:{},data:A})}else{z=B.html;z=typeof z===d?z.apply(B):z}if(z||z===0){y+=z}y+="\n </a></li>\n ";return y}function e(A,z){var y;if(y=q.href){y=y.call(A,{hash:{},data:z})}else{y=A.href;y=typeof y===d?y.apply(A):y}return c(y)}function w(z,y){return"javascript:void(0);"}function v(B,A){var y="",z;y+='target="';if(z=q.target){z=z.call(B,{hash:{},data:A})}else{z=B.target;z=typeof z===d?z.apply(B):z}y+=c(z)+'"';return y}function u(z,y){return'<span class="fa-icon-ok"></span>'}function t(z,y){return"\n <li>No Options.</li>\n"}r+='<ul id="';if(i=q.id){i=i.call(s,{hash:{},data:x})}else{i=s.id;i=typeof i===d?i.apply(s):i}r+=c(i)+'-menu" class="dropdown-menu">\n';f=q["if"].call(s,((i=s.options),i==null||i===false?i:i.length),{hash:{},inverse:p.program(17,t,x),fn:p.program(1,o,x),data:x});if(f||f===0){r+=f}r+="\n</ul>";return r})})();
\ No newline at end of file
diff -r c3179a238f97fdf7b1f159b32d276a4a596a7e9e -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad static/scripts/templates/compiled/template-popupmenu-menu.js
--- a/static/scripts/templates/compiled/template-popupmenu-menu.js
+++ /dev/null
@@ -1,119 +0,0 @@
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['template-popupmenu-menu'] = template(function (Handlebars,depth0,helpers,partials,data) {
- this.compilerInfo = [4,'>= 1.0.0'];
-helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
- var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this;
-
-function program1(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n ";
- stack1 = helpers.each.call(depth0, depth0.options, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n";
- return buffer;
- }
-function program2(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n ";
- stack1 = helpers['if'].call(depth0, depth0.divider, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- return buffer;
- }
-function program3(depth0,data) {
-
-
- return "\n <li class=\"divider\"></li>\n ";
- }
-
-function program5(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n ";
- stack1 = helpers['if'].call(depth0, depth0.header, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- return buffer;
- }
-function program6(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n <li class=\"head\"><a href=\"\"javascript:void(0);\">";
- if (stack1 = helpers.html) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.html; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "</a></li>\n ";
- return buffer;
- }
-
-function program8(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "\n "
- + "\n <li><a href=\"";
- stack1 = helpers['if'].call(depth0, depth0.href, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\"\n ";
- stack1 = helpers['if'].call(depth0, depth0.href, {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += " class=\"popupmenu-option\">\n ";
- stack1 = helpers['if'].call(depth0, depth0.checked, {hash:{},inverse:self.noop,fn:self.program(15, program15, data),data:data});
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n ";
- if (stack1 = helpers.html) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.html; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- if(stack1 || stack1 === 0) { buffer += stack1; }
- buffer += "\n </a></li>\n ";
- return buffer;
- }
-function program9(depth0,data) {
-
- var stack1;
- if (stack1 = helpers.href) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.href; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- return escapeExpression(stack1);
- }
-
-function program11(depth0,data) {
-
-
- return "javascript:void(0);";
- }
-
-function program13(depth0,data) {
-
- var buffer = "", stack1;
- buffer += "target=\"";
- if (stack1 = helpers.target) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.target; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1)
- + "\"";
- return buffer;
- }
-
-function program15(depth0,data) {
-
-
- return "<span class=\"fa-icon-ok\"></span>";
- }
-
-function program17(depth0,data) {
-
-
- return "\n <li>No Options.</li>\n";
- }
-
- buffer += "<ul id=\"";
- if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
- else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
- buffer += escapeExpression(stack1)
- + "-menu\" class=\"dropdown-menu\">\n";
- stack2 = helpers['if'].call(depth0, ((stack1 = depth0.options),stack1 == null || stack1 === false ? stack1 : stack1.length), {hash:{},inverse:self.program(17, program17, data),fn:self.program(1, program1, data),data:data});
- if(stack2 || stack2 === 0) { buffer += stack2; }
- buffer += "\n</ul>";
- return buffer;
- });
-})();
\ No newline at end of file
diff -r c3179a238f97fdf7b1f159b32d276a4a596a7e9e -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad static/scripts/templates/ui-templates.html
--- a/static/scripts/templates/ui-templates.html
+++ b/static/scripts/templates/ui-templates.html
@@ -17,28 +17,3 @@
</div></div></script>
-
-<script type="text/template" class="template-ui" id="template-popupmenu-menu">
-<ul id="{{ id }}-menu" class="dropdown-menu">
-{{#if options.length }}
- {{#each options }}
- {{#if divider }}
- <li class="divider"></li>
- {{else}}
- {{#if header }}
- <li class="head"><a href=""javascript:void(0);">{{{ html }}}</a></li>
- {{else}}
- {{!NOTE: changed from # to void fn }}
- <li><a href="{{#if href }}{{ href }}{{else}}javascript:void(0);{{/if}}"
- {{#if href }}target="{{ target }}"{{/if}} class="popupmenu-option">
- {{#if checked }}<span class="fa-icon-ok"></span>{{/if}}
- {{{ html }}}
- </a></li>
- {{/if}}
- {{/if}}
- {{/each}}
-{{else}}
- <li>No Options.</li>
-{{/if}}
-</ul>
-</script>
diff -r c3179a238f97fdf7b1f159b32d276a4a596a7e9e -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad templates/base.mako
--- a/templates/base.mako
+++ b/templates/base.mako
@@ -45,14 +45,7 @@
"libs/backbone/backbone",
"libs/backbone/backbone-relational",
"libs/handlebars.runtime",
- "galaxy.base"
- )}
-
- ${h.templates(
- "template-popupmenu-menu"
- )}
-
- ${h.js(
+ "galaxy.base",
"mvc/ui"
)}
diff -r c3179a238f97fdf7b1f159b32d276a4a596a7e9e -r bd89b1ef5a95cd9ca8de04a829043788e9dde0ad templates/base/base_panels.mako
--- a/templates/base/base_panels.mako
+++ b/templates/base/base_panels.mako
@@ -56,14 +56,7 @@
'libs/backbone/backbone-relational',
'libs/handlebars.runtime',
'galaxy.base',
- 'libs/require'
- )}
-
- ${h.templates(
- "template-popupmenu-menu"
- )}
-
- ${h.js(
+ 'libs/require',
"mvc/ui"
)}
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.
1
0
commit/galaxy-central: carlfeberhard: Datatypes: remove mutable defaults from function definitions
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c3179a238f97/
Changeset: c3179a238f97
User: carlfeberhard
Date: 2013-10-23 19:06:50
Summary: Datatypes: remove mutable defaults from function definitions
Affected #: 1 file
diff -r e66076ed4678c1ad15db09c1d220a624e2047a79 -r c3179a238f97fdf7b1f159b32d276a4a596a7e9e lib/galaxy/datatypes/metadata.py
--- a/lib/galaxy/datatypes/metadata.py
+++ b/lib/galaxy/datatypes/metadata.py
@@ -5,7 +5,6 @@
from galaxy import eggs
eggs.require("simplejson")
-
import copy
import cPickle
import logging
@@ -37,10 +36,12 @@
"""
def __init__( self, target ):
self.target = target
+
def __call__( self, *args, **kwargs ):
class_locals = sys._getframe( 1 ).f_locals #get the locals dictionary of the frame object one down in the call stack (i.e. the Datatype class calling MetadataElement)
statements = class_locals.setdefault( STATEMENTS, [] ) #get and set '__galaxy_statments__' to an empty list if not in locals dict
statements.append( ( self, args, kwargs ) ) #add Statement containing info to populate a MetadataElementSpec
+
@classmethod
def process( cls, element ):
for statement, args, kwargs in getattr( element, STATEMENTS, [] ):
@@ -59,29 +60,38 @@
#initialize dict if needed
if self.parent._metadata is None:
self.parent._metadata = {}
+
def get_parent( self ):
if "_parent" in self.__dict__:
return self.__dict__["_parent"]()
return None
+
def set_parent( self, parent ):
self.__dict__["_parent"] = weakref.ref( parent ) # use weakref to prevent a circular reference interfering with garbage collection: hda/lda (parent) <--> MetadataCollection (self) ; needs to be hashable, so cannot use proxy.
parent = property( get_parent, set_parent )
+
@property
def spec( self ):
return self.parent.datatype.metadata_spec
+
def __iter__( self ):
return self.parent._metadata.__iter__()
+
def get( self, key, default=None ):
try:
return self.__getattr__( key ) or default
except:
return default
+
def items(self):
return iter( [ ( k, self.get( k ) ) for k in self.spec.iterkeys() ] )
+
def __str__(self):
return dict( self.items() ).__str__()
+
def __nonzero__( self ):
return bool( self.parent._metadata )
+
def __getattr__( self, name ):
if name in self.spec:
if name in self.parent._metadata:
@@ -89,6 +99,7 @@
return self.spec[name].wrap( self.spec[name].default, object_session( self.parent ) )
if name in self.parent._metadata:
return self.parent._metadata[name]
+
def __setattr__( self, name, value ):
if name == "parent":
return self.set_parent( value )
@@ -97,14 +108,17 @@
self.parent._metadata[name] = self.spec[name].unwrap( value )
else:
self.parent._metadata[name] = value
+
def element_is_set( self, name ):
return bool( self.parent._metadata.get( name, False ) )
+
def get_html_by_name( self, name, **kwd ):
if name in self.spec:
rval = self.spec[name].param.get_html( value=getattr( self, name ), context=self, **kwd )
if rval is None:
return self.spec[name].no_value
return rval
+
def make_dict_copy( self, to_copy ):
"""Makes a deep copy of input iterable to_copy according to self.spec"""
rval = {}
@@ -112,6 +126,7 @@
if key in self.spec:
rval[key] = self.spec[key].param.make_copy( value, target_context=self, source_context=to_copy )
return rval
+
def from_JSON_dict( self, filename ):
dataset = self.parent
log.debug( 'loading metadata from file for: %s %s' % ( dataset.__class__.__name__, dataset.id ) )
@@ -123,6 +138,7 @@
#if the metadata value is not found in our externally set metadata but it has a value in the 'old'
#metadata associated with our dataset, we'll delete it from our dataset's metadata dict
del dataset._metadata[ name ]
+
def to_JSON_dict( self, filename ):
#galaxy.model.customtypes.json_encoder.encode()
meta_dict = {}
@@ -131,6 +147,7 @@
if name in dataset_meta_dict:
meta_dict[ name ] = spec.param.to_external_value( dataset_meta_dict[ name ] )
simplejson.dump( meta_dict, open( filename, 'wb+' ) )
+
def __getstate__( self ):
return None #cannot pickle a weakref item (self._parent), when data._metadata_collection is None, it will be recreated on demand
@@ -163,10 +180,12 @@
def __init__( self, spec ):
self.spec = spec
- def get_html_field( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return form_builder.TextField( self.spec.name, value=value )
- def get_html( self, value, context={}, other_values={}, **kwd ):
+ def get_html( self, value, context=None, other_values=None, **kwd ):
"""
The "context" is simply the metadata collection/bunch holding
this piece of metadata. This is passed in to allow for
@@ -175,6 +194,9 @@
example, a column assignment should validate against the
number of columns in the dataset.
"""
+ context = context or {}
+ other_values = other_values or {}
+
if self.spec.get("readonly"):
return value
if self.spec.get("optional"):
@@ -296,7 +318,10 @@
value = [value]
return ",".join( map( str, value ) )
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
field = form_builder.SelectField( self.spec.name, multiple=self.multiple, display=self.spec.get("display") )
if self.values:
value_list = self.values
@@ -316,7 +341,10 @@
field.add_option( val, label, selected=False )
return field
- def get_html( self, value, context={}, other_values={}, values=None, **kwd ):
+ def get_html( self, value, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if self.spec.get("readonly"):
if value in [ None, [] ]:
return str( self.spec.no_value )
@@ -338,21 +366,30 @@
if not isinstance( value, list ): return [value]
return value
+
class DBKeyParameter( SelectParameter ):
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd):
+
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd):
+ context = context or {}
+ other_values = other_values or {}
try:
values = kwd['trans'].db_builds
except KeyError:
pass
return super(DBKeyParameter, self).get_html_field( value, context, other_values, values, **kwd)
- def get_html( self, value=None, context={}, other_values={}, values=None, **kwd):
+
+ def get_html( self, value=None, context=None, other_values=None, values=None, **kwd):
+ context = context or {}
+ other_values = other_values or {}
try:
values = kwd['trans'].db_builds
except KeyError:
pass
return super(DBKeyParameter, self).get_html( value, context, other_values, values, **kwd)
+
class RangeParameter( SelectParameter ):
+
def __init__( self, spec ):
SelectParameter.__init__( self, spec )
# The spec must be set with min and max values
@@ -360,12 +397,18 @@
self.max = spec.get( "max" ) or 1
self.step = self.spec.get( "step" ) or 1
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None:
values = zip( range( self.min, self.max, self.step ), range( self.min, self.max, self.step ))
return SelectParameter.get_html_field( self, value=value, context=context, other_values=other_values, values=values, **kwd )
- def get_html( self, value, context={}, other_values={}, values=None, **kwd ):
+ def get_html( self, value, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None:
values = zip( range( self.min, self.max, self.step ), range( self.min, self.max, self.step ))
return SelectParameter.get_html( self, value, context=context, other_values=other_values, values=values, **kwd )
@@ -376,35 +419,46 @@
values = [ int(x) for x in value ]
return values
+
class ColumnParameter( RangeParameter ):
- def get_html_field( self, value=None, context={}, other_values={}, values=None, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None and context:
column_range = range( 1, ( context.columns or 0 ) + 1, 1 )
values = zip( column_range, column_range )
return RangeParameter.get_html_field( self, value=value, context=context, other_values=other_values, values=values, **kwd )
- def get_html( self, value, context={}, other_values={}, values=None, **kwd ):
+ def get_html( self, value, context=None, other_values=None, values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
+
if values is None and context:
column_range = range( 1, ( context.columns or 0 ) + 1, 1 )
values = zip( column_range, column_range )
return RangeParameter.get_html( self, value, context=context, other_values=other_values, values=values, **kwd )
+
class ColumnTypesParameter( MetadataParameter ):
def to_string( self, value ):
return ",".join( map( str, value ) )
+
class ListParameter( MetadataParameter ):
def to_string( self, value ):
return ",".join( [str(x) for x in value] )
+
class DictParameter( MetadataParameter ):
def to_string( self, value ):
return simplejson.dumps( value )
+
class PythonObjectParameter( MetadataParameter ):
def to_string( self, value ):
@@ -412,16 +466,21 @@
return self.spec._to_string( self.spec.no_value )
return self.spec._to_string( value )
- def get_html_field( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return form_builder.TextField( self.spec.name, value=self._to_string( value ) )
- def get_html( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return str( self )
@classmethod
def marshal( cls, value ):
return value
+
class FileParameter( MetadataParameter ):
def to_string( self, value ):
@@ -429,10 +488,14 @@
return str( self.spec.no_value )
return value.file_name
- def get_html_field( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html_field( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return form_builder.TextField( self.spec.name, value=str( value.id ) )
- def get_html( self, value=None, context={}, other_values={}, **kwd ):
+ def get_html( self, value=None, context=None, other_values=None, **kwd ):
+ context = context or {}
+ other_values = other_values or {}
return "<div>No display available for Metadata Files</div>"
def wrap( self, value, session ):
@@ -497,12 +560,15 @@
#we do not include 'dataset' in the kwds passed, as from_JSON_value() will handle this for us
return MetadataTempFile( **kwds )
+
#This class is used when a database file connection is not available
class MetadataTempFile( object ):
tmp_dir = 'database/tmp' #this should be overwritten as necessary in calling scripts
+
def __init__( self, **kwds ):
self.kwds = kwds
self._filename = None
+
@property
def file_name( self ):
if self._filename is None:
@@ -510,17 +576,21 @@
self._filename = abspath( tempfile.NamedTemporaryFile( dir = self.tmp_dir, prefix = "metadata_temp_file_" ).name )
open( self._filename, 'wb+' ) #create an empty file, so it can't be reused using tempfile
return self._filename
+
def to_JSON( self ):
return { '__class__':self.__class__.__name__, 'filename':self.file_name, 'kwds':self.kwds }
+
@classmethod
def from_JSON( cls, json_dict ):
#need to ensure our keywords are not unicode
rval = cls( **stringify_dictionary_keys( json_dict['kwds'] ) )
rval._filename = json_dict['filename']
return rval
+
@classmethod
def is_JSONified_value( cls, value ):
return ( isinstance( value, dict ) and value.get( '__class__', None ) == cls.__name__ )
+
@classmethod
def cleanup_from_JSON_dict_filename( cls, filename ):
try:
@@ -533,12 +603,15 @@
except Exception, e:
log.debug( 'Failed to cleanup MetadataTempFile temp files from %s: %s' % ( filename, e ) )
+
#Class with methods allowing set_meta() to be called externally to the Galaxy head
class JobExternalOutputMetadataWrapper( object ):
#this class allows access to external metadata filenames for all outputs associated with a job
#We will use JSON as the medium of exchange of information, except for the DatasetInstance object which will use pickle (in the future this could be JSONified as well)
+
def __init__( self, job ):
self.job_id = job.id
+
def get_output_filenames_by_dataset( self, dataset, sa_session ):
if isinstance( dataset, galaxy.model.HistoryDatasetAssociation ):
return sa_session.query( galaxy.model.JobExternalOutputMetadata ) \
@@ -549,12 +622,15 @@
.filter_by( job_id = self.job_id, library_dataset_dataset_association_id = dataset.id ) \
.first() #there should only be one or None
return None
+
def get_dataset_metadata_key( self, dataset ):
# Set meta can be called on library items and history items,
# need to make different keys for them, since ids can overlap
return "%s_%d" % ( dataset.__class__.__name__, dataset.id )
+
def setup_external_metadata( self, datasets, sa_session, exec_dir=None, tmp_dir=None, dataset_files_path=None,
- output_fnames=None, config_root=None, config_file=None, datatypes_config=None, job_metadata=None, kwds={} ):
+ output_fnames=None, config_root=None, config_file=None, datatypes_config=None, job_metadata=None, kwds=None ):
+ kwds = kwds or {}
#fill in metadata_files_dict and return the command with args required to set metadata
def __metadata_files_list_to_cmd_line( metadata_files ):
def __get_filename_override():
@@ -652,6 +728,7 @@
os.remove( fname )
except Exception, e:
log.debug( 'Failed to cleanup external metadata file (%s) for %s: %s' % ( key, dataset_key, e ) )
+
def set_job_runner_external_pid( self, pid, sa_session ):
for metadata_files in sa_session.query( galaxy.model.Job ).get( self.job_id ).external_output_metadata:
metadata_files.job_runner_external_pid = pid
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.
1
0
commit/galaxy-central: carlfeberhard: History panel: cleanup, todo list, docs; pack scripts
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e66076ed4678/
Changeset: e66076ed4678
User: carlfeberhard
Date: 2013-10-23 19:03:59
Summary: History panel: cleanup, todo list, docs; pack scripts
Affected #: 10 files
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/mvc/dataset/hda-base.js
--- a/static/scripts/mvc/dataset/hda-base.js
+++ b/static/scripts/mvc/dataset/hda-base.js
@@ -5,7 +5,7 @@
//==============================================================================
/** @class Read only view for HistoryDatasetAssociation.
* @name HDABaseView
- *
+ *
* @augments Backbone.View
* @borrows LoggableMixin#logger as #logger
* @borrows LoggableMixin#log as #log
@@ -23,7 +23,7 @@
fxSpeed : 'fast',
- // ......................................................................... SET UP
+ // ......................................................................... set up
/** Set up the view, cache url templates, bind listeners
* @param {Object} attributes
* @config {Object} urlTemplates nested object containing url templates for this view
@@ -44,13 +44,17 @@
this._setUpListeners();
},
+ /** event listeners */
_setUpListeners : function(){
+
// re-rendering on any model changes
this.model.on( 'change', function( model, options ){
- // if the model moved into the ready state and is expanded without details, fetch those details
+
+ // if the model moved into the ready state and is expanded without details, fetch those details now
if( this.model.changedAttributes().state && this.model.inReadyState()
&& this.expanded && !this.model.hasDetails() ){
this.model.fetch(); // will render automatically (due to lines below)
+
} else {
this.render();
}
@@ -61,7 +65,7 @@
//}, this );
},
- // ......................................................................... RENDER MAIN
+ // ......................................................................... render main
/** Render this HDA, set up ui.
* @fires rendered:ready when rendered and NO running HDAs
* @fires rendered when rendered and running HDAs
@@ -122,7 +126,6 @@
_setUpBehaviors : function( $container ){
$container = $container || this.$el;
// set up canned behavior on children (bootstrap, popupmenus, editable_text, etc.)
- //TODO: we can potentially skip this step and call popupmenu directly on the download button
make_popup_menus( $container );
$container.find( '[title]' ).tooltip({ placement : 'bottom' });
},
@@ -213,13 +216,10 @@
* @returns {jQuery} rendered DOM
*/
_render_titleLink : function(){
- return $( jQuery.trim( HDABaseView.templates.titleLink(
- //TODO?? does this need urls?
- _.extend( this.model.toJSON(), { urls: this.urls } )
- )));
+ return $( jQuery.trim( HDABaseView.templates.titleLink( this.model.toJSON() )));
},
- // ......................................................................... RENDER BODY
+ // ......................................................................... body
/** Render the data/metadata summary (format, size, misc info, etc.).
* @returns {jQuery} rendered DOM
*/
@@ -283,7 +283,7 @@
/** Render links to external genome display applications (igb, gbrowse, etc.).
* @param {jQuery} $parent the jq node to search for .display-apps and render into to (defaults to this.$el)
*/
- //TODO: not a fan of the style on these
+//TODO: move into visualization button
_render_displayApps : function( $parent ){
$parent = $parent || this.$el;
var $displayAppsDiv = $parent.find( 'div.display-apps' ),
@@ -310,7 +310,6 @@
/** Render the data peek.
* @returns {jQuery} rendered DOM
*/
- //TODO: curr. pre-formatted into table on the server side - may not be ideal/flexible
_render_peek : function(){
var peek = this.model.get( 'peek' );
if( !peek ){ return null; }
@@ -326,74 +325,38 @@
/** Render the enclosing div of the hda body and, if expanded, the html in the body
* @returns {jQuery} rendered DOM
*/
- //TODO: only render these on expansion (or already expanded)
_render_body : function(){
- var body = $( '<div/>' )
+ var $body = $( '<div/>' )
.attr( 'id', 'info-' + this.model.get( 'id' ) )
.addClass( 'historyItemBody' )
.attr( 'style', 'display: none' );
if( this.expanded ){
// only render the body html if it's being shown
- this._render_body_html( body );
- //TODO: switch back when jq -> 1.9
- //body.show();
- body.css( 'display', 'block' );
+ this._render_body_html( $body );
+ $body.show();
}
- return body;
+ return $body;
},
/** Render the (expanded) body of an HDA, dispatching to other functions based on the HDA state
* @param {jQuery} body the body element to append the html to
*/
- //TODO: only render these on expansion (or already expanded)
- _render_body_html : function( body ){
+ _render_body_html : function( $body ){
//this.log( this + '_render_body' );
- body.html( '' );
- //TODO: not a fan of this dispatch
- switch( this.model.get( 'state' ) ){
- case hdaModel.HistoryDatasetAssociation.STATES.NEW :
- this._render_body_new( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.NOT_VIEWABLE :
- this._render_body_not_viewable( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.UPLOAD :
- this._render_body_uploading( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.PAUSED:
- this._render_body_paused( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.QUEUED :
- this._render_body_queued( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.RUNNING :
- this._render_body_running( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.ERROR :
- this._render_body_error( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.DISCARDED :
- this._render_body_discarded( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.SETTING_METADATA :
- this._render_body_setting_metadata( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.EMPTY :
- this._render_body_empty( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.FAILED_METADATA :
- this._render_body_failed_metadata( body );
- break;
- case hdaModel.HistoryDatasetAssociation.STATES.OK :
- this._render_body_ok( body );
- break;
- default:
- //??: no body?
- body.append( $( '<div>Error: unknown dataset state "' + this.model.get( 'state' ) + '".</div>' ) );
+ $body.empty();
+
+ var modelState = this.model.get( 'state' );
+ // cheesy get function by assumed matching name
+ var renderFnName = '_render_body_' + modelState,
+ renderFn = this[ renderFnName ];
+ if( _.isFunction( renderFn ) ){
+ this[ renderFnName ]( $body );
+ } else {
+ $body.append( $( '<div>Error: unknown dataset state "' + this.model.get( 'state' ) + '".</div>' ) );
}
- body.append( '<div style="clear: both"></div>' );
- this._setUpBehaviors( body );
+ $body.append( '<div style="clear: both"></div>' );
+ this._setUpBehaviors( $body );
},
/** Render a new dataset - this should be a transient state that's never shown
@@ -408,15 +371,14 @@
/** Render inaccessible, not-owned by curr user.
* @param {jQuery} parent DOM to which to append this body
*/
- _render_body_not_viewable : function( parent ){
- //TODO: revisit - still showing display, edit, delete (as common) - that CAN'T be right
- parent.append( $( '<div>' + _l( 'You do not have permission to view dataset' ) + '</div>' ) );
+ _render_body_noPermission : function( parent ){
+ parent.append( $( '<div>' + _l( 'You do not have permission to view this dataset' ) + '</div>' ) );
},
/** Render an HDA still being uploaded.
* @param {jQuery} parent DOM to which to append this body
*/
- _render_body_uploading : function( parent ){
+ _render_body_upload : function( parent ){
parent.append( $( '<div>' + _l( 'Dataset is uploading' ) + '</div>' ) );
},
@@ -432,7 +394,8 @@
* @param {jQuery} parent DOM to which to append this body
*/
_render_body_paused: function( parent ){
- parent.append( $( '<div>' + _l( 'Job is paused. Use the history menu to resume' ) + '</div>' ) );
+ parent.append( $( '<div>' + _l( 'Job is paused. '
+ + 'Use the "Resume Paused Jobs" in the history menu to resume' ) + '</div>' ) );
parent.append( this._render_primaryActionButtons( this.defaultPrimaryActionButtonRenderers ));
},
@@ -477,8 +440,6 @@
* @param {jQuery} parent DOM to which to append this body
*/
_render_body_empty : function( parent ){
- //TODO: replace i with dataset-misc-info class
- //?? why are we showing the file size when we know it's zero??
parent.append( $( '<div>' + _l( 'No data' ) + ': <i>' + this.model.get( 'misc_blurb' ) + '</i></div>' ) );
parent.append( this._render_primaryActionButtons( this.defaultPrimaryActionButtonRenderers ));
},
@@ -487,7 +448,6 @@
* @param {jQuery} parent DOM to which to append this body
*/
_render_body_failed_metadata : function( parent ){
- //TODO: the css for this box is broken (unlike the others)
// add a message box about the failure at the top of the body...
parent.append( $( HDABaseView.templates.failedMetadata(
_.extend( this.model.toJSON(), { urls: this.urls } )
@@ -504,7 +464,6 @@
parent.append( this._render_hdaSummary() );
// return shortened form if del'd
- //TODO: is this correct? maybe only on purged
if( this.model.isDeletedOrPurged() ){
parent.append( this._render_primaryActionButtons([
this._render_downloadButton,
@@ -525,44 +484,55 @@
parent.append( this._render_peek() );
},
- // ......................................................................... EVENTS
+ // ......................................................................... events
/** event map */
events : {
+ // expand the body when the title is clicked
'click .historyItemTitle' : 'toggleBodyVisibility'
},
- /** Render an HDA that's done running and where everything worked.
+ /** Show or hide the body/details of an HDA.
+ * note: if the model does not have detailed data, fetch that data before showing the body
* @param {Event} event the event that triggered this (@link HDABaseView#events)
* @param {Boolean} expanded if true, expand; if false, collapse
* @fires body-expanded when a body has been expanded
* @fires body-collapsed when a body has been collapsed
*/
toggleBodyVisibility : function( event, expand ){
- var hdaView = this;
expand = ( expand === undefined )?( !this.body.is( ':visible' ) ):( expand );
if( expand ){
- if( this.model.inReadyState() && !this.model.hasDetails() ){
- var xhr = this.model.fetch();
- xhr.done( function( model ){
- hdaView.expandBody();
- });
- } else {
- this.expandBody();
- }
+ this.expandBody();
} else {
this.collapseBody();
}
},
+ /** Render and show the full, detailed body of this view including extra data and controls.
+ * @fires body-expanded when a body has been expanded
+ */
expandBody : function(){
var hdaView = this;
- hdaView._render_body_html( hdaView.body );
- this.body.slideDown( hdaView.fxSpeed, function(){
- hdaView.expanded = true;
- hdaView.trigger( 'body-expanded', hdaView.model.get( 'id' ) );
- });
+
+ function _renderBodyAndExpand(){
+ hdaView._render_body_html( hdaView.body );
+ hdaView.body.slideDown( hdaView.fxSpeed, function(){
+ hdaView.expanded = true;
+ hdaView.trigger( 'body-expanded', hdaView.model.get( 'id' ) );
+ });
+ }
+ // fetch first if no details in the model
+ if( this.model.inReadyState() && !this.model.hasDetails() ){
+ this.model.fetch().done( function( model ){
+ _renderBodyAndExpand();
+ });
+ } else {
+ _renderBodyAndExpand();
+ }
},
+ /** Hide the body/details of an HDA.
+ * @fires body-collapsed when a body has been collapsed
+ */
collapseBody : function(){
var hdaView = this;
this.body.slideUp( hdaView.fxSpeed, function(){
@@ -571,7 +541,10 @@
});
},
- // ......................................................................... DELETION
+ // ......................................................................... removal
+ /** Remove this view's html from the DOM and remove all event listeners.
+ * @param {Function} callback an optional function called when removal is done
+ */
remove : function( callback ){
var hdaView = this;
this.$el.fadeOut( hdaView.fxSpeed, function(){
@@ -581,7 +554,8 @@
});
},
- // ......................................................................... MISC
+ // ......................................................................... misc
+ /** String representation */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
return 'HDABaseView(' + modelString + ')';
@@ -602,5 +576,5 @@
//==============================================================================
return {
- HDABaseView : HDABaseView,
+ HDABaseView : HDABaseView
};});
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/mvc/dataset/hda-edit.js
--- a/static/scripts/mvc/dataset/hda-edit.js
+++ b/static/scripts/mvc/dataset/hda-edit.js
@@ -14,7 +14,7 @@
var HDAEditView = hdaBase.HDABaseView.extend( LoggableMixin ).extend(
/** @lends HDAEditView.prototype */{
- // ......................................................................... SET UP
+ // ......................................................................... set up
/** Set up the view, cache url templates, bind listeners.
* Overrides HDABaseView.initialize to change default actions (adding re-run).
* @param {Object} attributes
@@ -43,7 +43,7 @@
//var hdaView = this;
},
- // ......................................................................... RENDER WARNINGS
+ // ......................................................................... render warnings
/** Render any hda warnings including: is deleted, is purged, is hidden.
* Overrides _render_warnings to include links to further actions (undelete, etc.)).
* @returns {Object} the templated urls
@@ -71,13 +71,14 @@
return buttonDiv;
},
+//TODO: move titleButtons into state renderers, remove state checks in the buttons
+
/** Render icon-button to edit the attributes (format, permissions, etc.) this hda.
* @returns {jQuery} rendered DOM
*/
_render_editButton : function(){
// don't show edit while uploading, in-accessible
// DO show if in error (ala previous history panel)
- //TODO??: not viewable/accessible are essentially the same (not viewable set from accessible)
if( ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NEW )
|| ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.UPLOAD )
|| ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NOT_VIEWABLE )
@@ -114,7 +115,6 @@
*/
_render_deleteButton : function(){
// don't show delete if...
- //TODO??: not viewable/accessible are essentially the same (not viewable set from accessible)
if( ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NEW )
|| ( this.model.get( 'state' ) === hdaModel.HistoryDatasetAssociation.STATES.NOT_VIEWABLE )
|| ( !this.model.get( 'accessible' ) ) ){
@@ -147,7 +147,7 @@
return this.deleteButton.render().$el;
},
- // ......................................................................... RENDER BODY
+ // ......................................................................... render body
/** Render the data/metadata summary (format, size, misc info, etc.).
* Overrides _render_hdaSummary to include edit link in dbkey.
* @see HDABaseView#_render_hdaSummary
@@ -158,7 +158,6 @@
// if there's no dbkey and it's editable : pass a flag to the template to render a link to editing in the '?'
if( this.model.get( 'metadata_dbkey' ) === '?'
&& !this.model.isDeletedOrPurged() ){
- //TODO: use HDABaseView and select/replace base on this switch
_.extend( modelData, { dbkey_unknown_and_editable : true });
}
return hdaBase.HDABaseView.templates.hdaSummary( modelData );
@@ -238,10 +237,8 @@
var $icon = this.visualizationsButton.render().$el;
$icon.addClass( 'visualize-icon' ); // needed?
- //TODO: make this more concise
// map a function to each visualization in the icon's attributes
// create a popupmenu from that map
-
/** @inner */
function create_viz_action( visualization ) {
switch( visualization ){
@@ -269,7 +266,6 @@
// >1: Populate menu dict with visualization fns, make the popupmenu
} else {
_.each( visualizations, function( visualization ) {
- //TODO: move to utils
var titleCaseVisualization = visualization.charAt( 0 ).toUpperCase() + visualization.slice( 1 );
popup_menu_dict[ _l( titleCaseVisualization ) ] = create_viz_action( visualization );
});
@@ -334,9 +330,7 @@
/** Render icon-button to load and display tagging html.
* @returns {jQuery} rendered DOM
*/
- //TODO: these should be a sub-MV
_render_tagButton : function(){
- //TODO: check for User
if( !this.hasUser || !this.urls.tags.get ){
this.tagButton = null;
return null;
@@ -354,9 +348,7 @@
/** Render icon-button to load and display annotation html.
* @returns {jQuery} rendered DOM
*/
- //TODO: these should be a sub-MV
_render_annotateButton : function(){
- //TODO: check for User
if( !this.hasUser || !this.urls.annotation.get ){
this.annotateButton = null;
return null;
@@ -370,33 +362,6 @@
return this.annotateButton.render().$el;
},
- // ......................................................................... other elements
- /** Render area to display tags.
- * @returns {jQuery} rendered DOM
- */
-//TODO: into sub-MV
-//TODO: check for User
- _render_tagArea : function(){
- if( !this.urls.tags.set ){ return null; }
- //TODO: move to mvc/tags.js
- return $( HDAEditView.templates.tagArea(
- _.extend( this.model.toJSON(), { urls: this.urls } )
- ).trim() );
- },
-
- /** Render area to display annotation.
- * @returns {jQuery} rendered DOM
- */
-//TODO: into sub-MV
-//TODO: check for User
- _render_annotationArea : function(){
- if( !this.urls.annotation.get ){ return null; }
- //TODO: move to mvc/annotations.js
- return $( HDAEditView.templates.annotationArea(
- _.extend( this.model.toJSON(), { urls: this.urls } )
- ).trim() );
- },
-
// ......................................................................... state body renderers
/** Render an HDA whose job has failed.
* Overrides _render_body_error to prepend error report button to primary actions strip.
@@ -415,7 +380,6 @@
* @see HDABaseView#_render_body_ok
*/
_render_body_ok : function( parent ){
- //TODO: should call super somehow and insert the needed...
// most common state renderer and the most complicated
parent.append( this._render_hdaSummary() );
@@ -451,7 +415,7 @@
parent.append( this._render_peek() );
},
- // ......................................................................... EVENTS
+ // ......................................................................... events
/** event map */
events : {
'click .historyItemTitle' : 'toggleBodyVisibility',
@@ -463,16 +427,28 @@
'click a.icon-button.annotate' : 'loadAndDisplayAnnotation'
},
- // ......................................................................... STATE CHANGES / MANIPULATION
+ /** listener for item purge */
confirmPurge : function _confirmPurge( ev ){
- //TODO: confirm dialog
+//TODO: confirm dialog
this.model.purge({ url: this.urls.purge });
return false;
},
+ // ......................................................................... tags
+ /** Render area to display tags.
+ * @returns {jQuery} rendered DOM
+ */
+//TODO: into sub-MV
+ _render_tagArea : function(){
+ if( !this.hasUser || !this.urls.tags.set ){ return null; }
+ return $( HDAEditView.templates.tagArea(
+ _.extend( this.model.toJSON(), { urls: this.urls } )
+ ).trim() );
+ },
+
/** Find the tag area and, if initial: load the html (via ajax) for displaying them; otherwise, unhide/hide
*/
- //TODO: into sub-MV
+//TODO: into sub-MV
loadAndDisplayTags : function( event ){
//BUG: broken with latest
//TODO: this is a drop in from history.mako - should use MV as well
@@ -508,6 +484,18 @@
}
return false;
},
+
+ // ......................................................................... annotations
+ /** Render area to display annotation.
+ * @returns {jQuery} rendered DOM
+ */
+//TODO: into sub-MV
+ _render_annotationArea : function(){
+ if( !this.hasUser || !this.urls.annotation.get ){ return null; }
+ return $( HDAEditView.templates.annotationArea(
+ _.extend( this.model.toJSON(), { urls: this.urls } )
+ ).trim() );
+ },
/** Find the annotation area and, if initial: load the html (via ajax) for displaying them; otherwise, unhide/hide
*/
@@ -555,7 +543,7 @@
return false;
},
- // ......................................................................... UTILTIY
+ // ......................................................................... misc
/** string rep */
toString : function(){
var modelString = ( this.model )?( this.model + '' ):( '(no model)' );
@@ -678,5 +666,5 @@
//==============================================================================
return {
- HDAEditView : HDAEditView,
+ HDAEditView : HDAEditView
};});
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/mvc/dataset/hda-model.js
--- a/static/scripts/mvc/dataset/hda-model.js
+++ b/static/scripts/mvc/dataset/hda-model.js
@@ -53,41 +53,42 @@
misc_info : ''
},
- /** fetch location of this history in the api */
+ /** fetch location of this HDA's history in the api */
urlRoot: 'api/histories/',
+ /** full url spec. for this HDA */
url : function(){
return this.urlRoot + this.get( 'history_id' ) + '/contents/' + this.get( 'id' );
},
+ /** controller urls assoc. with this HDA */
urls : function(){
var id = this.get( 'id' );
if( !id ){ return {}; }
var urls = {
- 'delete' : galaxy_config.root + 'datasets/' + id + '/delete_async',
- 'purge' : galaxy_config.root + 'datasets/' + id + '/purge_async',
- 'unhide' : galaxy_config.root + 'datasets/' + id + '/unhide',
- 'undelete' : galaxy_config.root + 'datasets/' + id + '/undelete',
+ 'purge' : galaxy_config.root + 'datasets/' + id + '/purge_async',
- 'display' : galaxy_config.root + 'datasets/' + id + '/display/?preview=True',
- 'download' : galaxy_config.root + 'datasets/' + id + '/display?to_ext=' + this.get( 'file_ext' ),
- 'edit' : galaxy_config.root + 'datasets/' + id + '/edit',
- 'report_error': galaxy_config.root + 'dataset/errors?id=' + id,
- 'rerun' : galaxy_config.root + 'tool_runner/rerun?id=' + id,
- 'show_params': galaxy_config.root + 'datasets/' + id + '/show_params',
- 'visualization': galaxy_config.root + 'visualization',
+ 'display' : galaxy_config.root + 'datasets/' + id + '/display/?preview=True',
+ 'download' : galaxy_config.root + 'datasets/' + id + '/display?to_ext=' + this.get( 'file_ext' ),
+ 'edit' : galaxy_config.root + 'datasets/' + id + '/edit',
+ 'report_error' : galaxy_config.root + 'dataset/errors?id=' + id,
+ 'rerun' : galaxy_config.root + 'tool_runner/rerun?id=' + id,
+ 'show_params' : galaxy_config.root + 'datasets/' + id + '/show_params',
+ 'visualization' : galaxy_config.root + 'visualization',
'annotation': { 'get': galaxy_config.root + 'dataset/get_annotation_async?id=' + id,
'set': galaxy_config.root + 'dataset/annotate_async?id=' + id },
- 'tags' : { 'get': galaxy_config.root + 'tag/get_tagging_elt_async?item_id=' + id + '&item_class=HistoryDatasetAssociation',
- 'set': galaxy_config.root + 'tag/retag?item_id=' + id + '&item_class=HistoryDatasetAssociation' }
+ 'tags' : { 'get': galaxy_config.root + 'tag/get_tagging_elt_async?item_id='
+ + id + '&item_class=HistoryDatasetAssociation',
+ 'set': galaxy_config.root + 'tag/retag?item_id='
+ + id + '&item_class=HistoryDatasetAssociation' }
};
- //'meta_download': '/dataset/get_metadata_file?hda_id=%3C%25%3D+id+%25%3E&metadata_name=%3C%25%3D+file_type+%25%3E',
+ // download links to assoc. metadata files (bam indeces, etc.)
var meta_files = this.get( 'meta_files' );
if( meta_files ){
urls.meta_download = _.map( meta_files, function( meta_file ){
return {
- //url : _.template( urlTemplate, { id: modelJson.id, file_type: meta_file.file_type }),
- url : galaxy_config.root + 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name=' + meta_file.file_type,
+ url : galaxy_config.root + 'dataset/get_metadata_file?hda_id='
+ + id + '&metadata_name=' + meta_file.file_type,
file_type : meta_file.file_type
};
});
@@ -110,6 +111,9 @@
this._setUpListeners();
},
+ /** set up any event listeners
+ * event: state:ready fired when this HDA moves into a ready state
+ */
_setUpListeners : function(){
// if the state has changed and the new state is a ready state, fire an event
this.on( 'change:state', function( currModel, newState ){
@@ -121,8 +125,7 @@
},
// ........................................................................ common queries
- /** Is this hda deleted or purged?
- */
+ /** Is this hda deleted or purged? */
isDeletedOrPurged : function(){
return ( this.get( 'deleted' ) || this.get( 'purged' ) );
},
@@ -132,7 +135,6 @@
* @param {Boolean} show_deleted are we showing deleted hdas?
* @param {Boolean} show_hidden are we showing hidden hdas?
*/
- //TODO: too many 'visible's
isVisible : function( show_deleted, show_hidden ){
var isVisible = true;
if( ( !show_deleted )
@@ -146,6 +148,7 @@
return isVisible;
},
+ /** the more common alias of visible */
hidden : function(){
return !this.get( 'visible' );
},
@@ -158,33 +161,37 @@
return ( this.isDeletedOrPurged() || ready );
},
+ /** Does this model already contain detailed data (as opposed to just summary level data)? */
hasDetails : function(){
//?? this may not be reliable
return _.has( this.attributes, 'genome_build' );
},
- /** Convenience function to match hda.has_data.
- */
+ /** Convenience function to match hda.has_data. */
hasData : function(){
- //TODO:?? is this equivalent to all possible hda.has_data calls?
return ( this.get( 'file_size' ) > 0 );
},
// ........................................................................ ajax
+ /** save this HDA, _Mark_ing it as deleted (just a flag) */
'delete' : function _delete( options ){
return this.save( { deleted: true }, options );
},
+ /** save this HDA, _Mark_ing it as undeleted */
undelete : function _undelete( options ){
return this.save( { deleted: false }, options );
},
+ /** save this HDA as not visible */
hide : function _hide( options ){
return this.save( { visible: false }, options );
},
+ /** save this HDA as visible */
unhide : function _uhide( options ){
return this.save( { visible: true }, options );
},
+ /** purge this HDA and remove the underlying dataset file from the server's fs */
purge : function _purge( options ){
//TODO: ideally this would be a DELETE call to the api
// using purge async for now
@@ -210,10 +217,15 @@
},
// ........................................................................ sorting/filtering
+ /** what attributes of an HDA will be used in a search */
searchKeys : [
'name', 'file_ext', 'genome_build', 'misc_blurb', 'misc_info', 'annotation', 'tags'
],
+ /** search this HDA for the string searchFor
+ * @param {String} searchFor look for this string in all attributes listed in searchKeys (above) using indexOf
+ * @returns {Array} an array of attribute keys where searchFor was found
+ */
search : function( searchFor ){
var model = this;
searchFor = searchFor.toLowerCase();
@@ -223,13 +235,16 @@
});
},
+ /** alias of search, but returns a boolean
+ * @param {String} matchesWhat look for this string in all attributes listed in searchKeys (above) using indexOf
+ * @returns {Boolean} was matchesWhat found in any attributes
+ */
matches : function( matchesWhat ){
return !!this.search( matchesWhat ).length;
},
// ........................................................................ misc
- /** String representation
- */
+ /** String representation */
toString : function(){
var nameAndId = this.get( 'id' ) || '';
if( this.get( 'name' ) ){
@@ -274,6 +289,7 @@
ERROR : 'error'
};
+/** states that are in a final state (the underlying job is complete) */
HistoryDatasetAssociation.READY_STATES = [
HistoryDatasetAssociation.STATES.NEW,
HistoryDatasetAssociation.STATES.OK,
@@ -285,6 +301,7 @@
HistoryDatasetAssociation.STATES.ERROR
];
+/** states that will change (the underlying job is not finished) */
HistoryDatasetAssociation.NOT_READY_STATES = [
HistoryDatasetAssociation.STATES.UPLOAD,
HistoryDatasetAssociation.STATES.QUEUED,
@@ -306,7 +323,10 @@
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
//logger : console,
+
+ /** root api url */
urlRoot : galaxy_config.root + 'api/histories',
+ /** complete api url */
url : function(){
return this.urlRoot + '/' + this.historyId + '/contents';
},
@@ -331,6 +351,9 @@
return this.map( function( hda ){ return hda.id; });
},
+ /** Get hdas that are not ready
+ * @returns array of HDAs
+ */
notReady : function(){
return this.filter( function( hda ){
return !hda.inReadyState();
@@ -370,11 +393,13 @@
},
// ........................................................................ ajax
+ /** fetch detailed model data for all HDAs in this collection */
fetchAllDetails : function(){
return this.fetch({ data : { details : 'all' } });
},
// ........................................................................ sorting/filtering
+ /** return a new collection of HDAs whose attributes contain the substring matchesWhat */
matches : function( matchesWhat ){
return this.filter( function( hda ){
return hda.matches( matchesWhat );
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/mvc/history/history-model.js
--- a/static/scripts/mvc/history/history-model.js
+++ b/static/scripts/mvc/history/history-model.js
@@ -13,7 +13,6 @@
*/
var History = Backbone.Model.extend( LoggableMixin ).extend(
/** @lends History.prototype */{
- //TODO: bind change events from items and collection to this (itemLengths, states)
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
@@ -33,17 +32,20 @@
// ........................................................................ urls
urlRoot: galaxy_config.root + 'api/histories',
+ /** url for changing the name of the history */
renameUrl : function(){
//TODO: just use this.save()
var id = this.get( 'id' );
if( !id ){ return undefined; }
return galaxy_config.root + 'history/rename_async?id=' + this.get( 'id' );
},
+ /** url for changing the annotation of the history */
annotateUrl : function(){
var id = this.get( 'id' );
if( !id ){ return undefined; }
return galaxy_config.root + 'history/annotate_async?id=' + this.get( 'id' );
},
+ /** url for changing the tags of the history */
tagUrl : function(){
var id = this.get( 'id' );
if( !id ){ return undefined; }
@@ -51,9 +53,10 @@
},
// ........................................................................ set up/tear down
- /** Set up the hdas collection
+ /** Set up the model
* @param {Object} historyJSON model data for this History
* @param {Object[]} hdaJSON array of model data for this History's HDAs
+ * @param {Object} options any extra settings including logger
* @see BaseModel#initialize
*/
initialize : function( historyJSON, hdaJSON, options ){
@@ -70,10 +73,15 @@
this._setUpListeners();
+ /** cached timeout id for the HDA updater */
+ this.updateTimeoutId = null;
// set up update timeout if needed
this.checkForUpdates();
},
+ /** set up any event listeners for this history including those to the contained HDAs
+ * events: error:hdas if an error occurred with the HDA collection
+ */
_setUpListeners : function(){
this.on( 'error', function( model, xhr, options, msg, details ){
this.errorHandler( model, xhr, options, msg, details );
@@ -107,25 +115,29 @@
// }
//},
+ /** event listener for errors. Generally errors are handled outside this model */
errorHandler : function( model, xhr, options, msg, details ){
// clear update timeout on model err
this.clearUpdateTimeout();
},
// ........................................................................ common queries
+ /** is this model already associated with a user? */
hasUser : function(){
var user = this.get( 'user' );
return !!( user && user.id );
},
// ........................................................................ ajax
- // get the history's state from it's cummulative ds states, delay + update if needed
- // events: ready
+ /** does the HDA collection indicate they're still running and need to be updated later? delay + update if needed
+ * @param {Function} onReadyCallback function to run when all HDAs are in the ready state
+ * events: ready
+ */
checkForUpdates : function( onReadyCallback ){
//console.info( 'checkForUpdates' )
// get overall History state from collection, run updater if History has running/queued hdas
- // boiling it down on the client to running/not
+ // boiling it down on the client to running/not
if( this.hdas.running().length ){
this.setUpdateTimeout();
@@ -138,8 +150,8 @@
return this;
},
+ /** create a timeout (after UPDATE_DELAY or delay ms) to refetch the HDA collection. Clear any prev. timeout */
setUpdateTimeout : function( delay ){
- //TODO: callbacks?
delay = delay || History.UPDATE_DELAY;
var history = this;
@@ -151,6 +163,7 @@
return this.updateTimeoutId;
},
+ /** clear the timeout and the cached timeout id */
clearUpdateTimeout : function(){
if( this.updateTimeoutId ){
clearTimeout( this.updateTimeoutId );
@@ -158,25 +171,26 @@
}
},
- // update this history, find any hda's running/queued, update ONLY those that have changed states,
- // set up to run this again in some interval of time
- // events: ready
+ /* update the HDA collection getting full detailed model data for any hda whose id is in detailIds
+ * set up to run this again in some interval of time
+ * @param {String[]} detailIds list of HDA ids to get detailed model data for
+ * @param {Object} options std. backbone fetch options map
+ */
refresh : function( detailIds, options ){
//console.info( 'refresh:', detailIds, this.hdas );
detailIds = detailIds || [];
options = options || {};
var history = this;
+ // add detailIds to options as CSV string
options.data = options.data || {};
if( detailIds.length ){
options.data.details = detailIds.join( ',' );
}
var xhr = this.hdas.fetch( options );
xhr.done( function( hdaModels ){
- //this.trigger( 'hdas-refreshed', this, hdaModels );
- history.checkForUpdates(function(){
- // fetch the history after an update in order to recalc history size
- //TODO: move to event?
+ history.checkForUpdates( function(){
+ // fetch the history inside onReadyCallback in order to recalc history size
this.fetch();
});
});
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/mvc/history/history-panel.js
--- a/static/scripts/mvc/history/history-panel.js
+++ b/static/scripts/mvc/history/history-panel.js
@@ -16,20 +16,14 @@
meta:
css/html class/id 'item' -> hda
add classes, ids on empty divs
- events (local/ui and otherwise)
- list in docs as well
- require.js
convert function comments to jsDoc style, complete comments
move inline styles into base.less
- watch the magic strings
- watch your globals
feature creep:
lineage
hide button
show permissions in info
show shared/sharing status on ds, history
- maintain scroll position on refresh (storage?)
selection, multi-select (and actions common to selected (ugh))
searching
sorting, re-shuffling
@@ -58,13 +52,14 @@
tagName : 'div',
className : 'history-panel',
- //fxSpeed : 'fast',
+ /** (in ms) that jquery effects will use */
fxSpeed : 300,
- /** event map
- */
+ /** event map */
events : {
'click #history-tag' : 'loadAndDisplayTags',
+ // allow (error) messages to be clicked away
+//TODO: switch to common close (X) idiom
'click #message-container' : 'clearMessages'
},
@@ -107,6 +102,10 @@
}
},
+ /** create any event listeners for the panel
+ * @fires: rendered:initial on the first render
+ * @fires: empty-history when switching to a history with no HDAs or creating a new history
+ */
_setUpListeners : function(){
// ---- event handlers for self
this.on( 'error', function( model, xhr, options, msg, details ){
@@ -154,13 +153,24 @@
//},
// ........................................................................ error handling
+ /** Event listener to handle errors (from the panel, the history, or the history's HDAs)
+ * @param {Model or View} model the (Backbone) source of the error
+ * @param {XMLHTTPRequest} xhr any ajax obj. assoc. with the error
+ * @param {Object} options the options map commonly used with bbone ajax
+ * @param {String} msg optional message passed to ease error location
+ * @param {Object} msg optional object containing error details
+ */
errorHandler : function( model, xhr, options, msg, details ){
var parsed = this._parseErrorMessage( model, xhr, options, msg, details );
+ // interrupted ajax
if( xhr && xhr.status === 0 && xhr.readyState === 0 ){
+ // bad gateway
} else if( xhr && xhr.status === 502 ){
+//TODO: gmail style 'reconnecting in Ns'
+ // otherwise, show an error message inside the panel
} else {
// it's possible to have a triggered error before the message container is rendered - wait for it to show
if( !this.$el.find( '#message-container' ).is( ':visible' ) ){
@@ -173,6 +183,9 @@
}
},
+ /** Parse an error event into an Object usable by displayMessage based on the parameters
+ * note: see errorHandler for more info on params
+ */
_parseErrorMessage : function( model, xhr, options, msg, details ){
var user = Galaxy.currUser,
// add the args (w/ some extra info) into an obj
@@ -199,12 +212,92 @@
return parsed;
},
+ /** Modify an error message to be fancy and wear a monocle. */
_bePolite : function( msg ){
msg = msg || _l( 'An error occurred while getting updates from the server' );
return msg + '. ' + _l( 'Please contact a Galaxy administrator if the problem persists.' );
},
// ------------------------------------------------------------------------ loading history/hda models
+
+ //NOTE: all the following fns replace the existing history model with a new model
+ // (in the following 'details' refers to the full set of hda api data (urls, display_apps, misc_info, etc.)
+ // - hdas w/o details will have summary data only (name, hid, deleted, visible, state, etc.))
+
+ /** (re-)loads the user's current history & hdas w/ details */
+ // implemented as a 'fresh start' or for when there is no model (intial panel render)
+ loadCurrentHistory : function( attributes ){
+ var panel = this;
+ return this.loadHistoryWithHDADetails( 'current', attributes )
+ .then(function( historyData, hdaData ){
+ panel.trigger( 'current-history', panel );
+ });
+ },
+
+ /** loads a history & hdas w/ details and makes them the current history */
+ switchToHistory : function( historyId, attributes ){
+ //console.info( 'switchToHistory:', historyId, attributes );
+ var panel = this,
+ historyFn = function(){
+ // make this current and get history data with one call
+ return jQuery.post( galaxy_config.root + 'api/histories/' + historyId + '/set_as_current' );
+ };
+ return this.loadHistoryWithHDADetails( historyId, attributes, historyFn )
+ .then(function( historyData, hdaData ){
+ panel.trigger( 'switched-history', panel );
+ });
+ },
+
+ /** creates a new history on the server and sets it as the user's current history */
+ createNewHistory : function( attributes ){
+ var panel = this,
+ historyFn = function(){
+ // get history data from posting a new history (and setting it to current)
+ return jQuery.post( galaxy_config.root + 'api/histories', { current: true });
+ };
+ // id undefined bc there is no historyId yet - the server will provide
+ // (no need for details - nothing expanded in new history)
+ return this.loadHistory( undefined, attributes, historyFn )
+ .then(function( historyData, hdaData ){
+ panel.trigger( 'new-history', panel );
+ });
+ },
+
+ /** loads a history & hdas w/ details (but does not make them the current history) */
+ loadHistoryWithHDADetails : function( historyId, attributes, historyFn, hdaFn ){
+ //console.info( 'loadHistoryWithHDADetails:', historyId, attributes, historyFn, hdaFn );
+ var panel = this,
+ // will be called to get hda ids that need details from the api
+ hdaDetailIds = function( historyData ){
+ return panel.getExpandedHdaIds( historyData.id );
+ };
+ return this.loadHistory( historyId, attributes, historyFn, hdaFn, hdaDetailIds );
+ },
+
+ /** loads a history & hdas w/ NO details (but does not make them the current history) */
+ loadHistory : function( historyId, attributes, historyFn, hdaFn, hdaDetailIds ){
+ this.trigger( 'loading-history', this );
+ attributes = attributes || {};
+ var panel = this;
+ //console.info( 'loadHistory:', historyId, attributes, historyFn, hdaFn, hdaDetailIds );
+ var xhr = historyModel.History.getHistoryData( historyId, {
+ historyFn : historyFn,
+ hdaFn : hdaFn,
+ hdaDetailIds : attributes.initiallyExpanded || hdaDetailIds
+ });
+ //console.debug( 'xhr:', xhr );
+ return this._loadHistoryFromXHR( xhr, attributes )
+ .fail( function( xhr, where, history ){
+ // throw an error up for the error handler
+ panel.trigger( 'error', panel, xhr, attributes, _l( 'An error was encountered while ' + where ),
+ { historyId: historyId, history: history || {} });
+ })
+ .always( function(){
+ // bc hideLoadingIndicator relies on this firing
+ panel.trigger( 'loading-done', panel );
+ });
+ },
+
/** given an xhr that will provide both history and hda data, pass data to set model or handle xhr errors */
_loadHistoryFromXHR : function( xhr, attributes ){
var panel = this;
@@ -246,84 +339,6 @@
return this;
},
- //NOTE: all the following fns replace the existing history model with a new model
- // (in the following 'details' refers to the full set of hda api data (urls, display_apps, misc_info, etc.)
- // - hdas w/o details will have summary data only (name, hid, deleted, visible, state, etc.))
-
- /** loads a history & hdas w/ NO details (but does not make them the current history) */
- loadHistory : function( historyId, attributes, historyFn, hdaFn, hdaDetailIds ){
- this.trigger( 'loading-history', this );
- attributes = attributes || {};
- var panel = this;
- //console.info( 'loadHistory:', historyId, attributes, historyFn, hdaFn, hdaDetailIds );
- var xhr = historyModel.History.getHistoryData( historyId, {
- historyFn : historyFn,
- hdaFn : hdaFn,
- hdaDetailIds : attributes.initiallyExpanded || hdaDetailIds
- });
- //console.debug( 'xhr:', xhr );
- return this._loadHistoryFromXHR( xhr, attributes )
- .fail( function( xhr, where, history ){
- // throw an error up for the error handler
- panel.trigger( 'error', panel, xhr, attributes, _l( 'An error was encountered while ' + where ),
- { historyId: historyId, history: history || {} });
- })
- .always( function(){
- // bc hideLoadingIndicator relies on this firing
- panel.trigger( 'loading-done', panel );
- });
- },
-
- /** loads a history & hdas w/ details (but does not make them the current history) */
- loadHistoryWithHDADetails : function( historyId, attributes, historyFn, hdaFn ){
- //console.info( 'loadHistoryWithHDADetails:', historyId, attributes, historyFn, hdaFn );
- var panel = this,
- // will be called to get hda ids that need details from the api
- hdaDetailIds = function( historyData ){
- return panel.getExpandedHdaIds( historyData.id );
- };
- return this.loadHistory( historyId, attributes, historyFn, hdaFn, hdaDetailIds );
- },
-
- /** loads a history & hdas w/ details and makes them the current history */
- switchToHistory : function( historyId, attributes ){
- //console.info( 'switchToHistory:', historyId, attributes );
- var panel = this,
- historyFn = function(){
- // make this current and get history data with one call
- return jQuery.post( galaxy_config.root + 'api/histories/' + historyId + '/set_as_current' );
- };
- return this.loadHistoryWithHDADetails( historyId, attributes, historyFn )
- .then(function( historyData, hdaData ){
- panel.trigger( 'switched-history', panel );
- });
- },
-
- /** (re-)loads the user's current history & hdas w/ details */
- // implemented as a 'fresh start' or for when there is no model (intial panel render)
- loadCurrentHistory : function( attributes ){
- var panel = this;
- return this.loadHistoryWithHDADetails( 'current', attributes )
- .then(function( historyData, hdaData ){
- panel.trigger( 'current-history', panel );
- });
- },
-
- /** creates a new history on the server and sets it as the user's current history */
- createNewHistory : function( attributes ){
- var panel = this,
- historyFn = function(){
- // get history data from posting a new history (and setting it to current)
- return jQuery.post( galaxy_config.root + 'api/histories', { current: true });
- };
- // id undefined bc there is no historyId yet - the server will provide
- // (no need for details - nothing expanded in new history)
- return this.loadHistory( undefined, attributes, historyFn )
- .then(function( historyData, hdaData ){
- panel.trigger( 'new-history', panel );
- });
- },
-
// alias to the model. Updates the hda list only (not the history)
refreshHdas : function( detailIds, options ){
if( this.model ){
@@ -334,15 +349,7 @@
},
// ------------------------------------------------------------------------ browser stored prefs
- //TODO: simplify
-
- /** key string to store each histories settings under */
- _getStorageKey : function( id ){
- if( !id ){
- throw new Error( '_getStorageKey needs valid id: ' + id );
- }
- return ( 'history:' + id );
- },
+//TODO: simplify
/** Set up client side storage. Currently PersistanStorage keyed under 'HistoryPanel.<id>'
* @param {Object} initiallyExpanded
@@ -359,7 +366,6 @@
// data that needs to be persistent over page refreshes
// (note the key function which uses the history id as well)
this.storage = new PersistentStorage( this._getStorageKey( this.model.get( 'id' ) ), {
- //TODO: initiallyExpanded only works on first load right now
expandedHdas : {},
show_deleted : false,
show_hidden : false
@@ -393,6 +399,15 @@
this.log( this + ' (init\'d) storage:', this.storage.get() );
},
+ /** key string to store each histories settings under */
+ _getStorageKey : function( id ){
+ if( !id ){
+ throw new Error( '_getStorageKey needs valid id: ' + id );
+ }
+ return ( 'history:' + id );
+ },
+
+ /** clear all stored history panel data */
clearWebStorage : function(){
for( var key in sessionStorage ){
if( key.indexOf( 'HistoryView.' ) === 0 ){
@@ -401,6 +416,7 @@
}
},
+ /** get all stored data as an Object for a history with the given id */
getStoredOptions : function( historyId ){
if( !historyId || historyId === 'current' ){
return ( this.storage )?( this.storage.get() ):( {} );
@@ -410,12 +426,14 @@
return ( item === null )?( {} ):( JSON.parse( item ) );
},
+ /** get all the map of expaneded hda ids for the given history id */
getExpandedHdaIds : function( historyId ){
var expandedHdas = this.getStoredOptions( historyId ).expandedHdas;
return (( _.isEmpty( expandedHdas ) )?( [] ):( _.keys( expandedHdas ) ));
},
// ------------------------------------------------------------------------ history/hda event listening
+ /** listening for history and HDA events */
_setUpModelEventHandlers : function(){
// ---- history
// on a model error - bounce it up to the panel and remove it from the model
@@ -454,7 +472,7 @@
this.model.hdas.on( 'state:ready', function( hda, newState, oldState ){
if( ( !hda.get( 'visible' ) )
&& ( !this.storage.get( 'show_hidden' ) ) ){
- this.removeHdaView( hda.get( 'id' ) );
+ this.removeHdaView( this.hdaViews[ hda.id ] );
}
}, this );
@@ -491,7 +509,9 @@
]);
},
-//TODO: use this below in renderItems
+ /** Create an HDA view for the given HDA (but leave attachment for addHdaView above)
+ * @param {HistoryDatasetAssociation} hda
+ */
createHdaView : function( hda ){
var hdaId = hda.get( 'id' ),
expanded = this.storage.get( 'expandedHdas' ).get( hdaId ),
@@ -506,12 +526,31 @@
return hdaView.render();
},
+ /** Set up HistoryPanel listeners for HDAView events. Currently binds:
+ * HDAView#body-visible, HDAView#body-hidden to store expanded states
+ * @param {HDAView} hdaView HDAView (base or edit) to listen to
+ */
+ _setUpHdaListeners : function( hdaView ){
+ var historyView = this;
+ // maintain a list of hdas whose bodies are expanded
+ hdaView.on( 'body-expanded', function( id ){
+ historyView.storage.get( 'expandedHdas' ).set( id, true );
+ });
+ hdaView.on( 'body-collapsed', function( id ){
+ historyView.storage.get( 'expandedHdas' ).deleteKey( id );
+ });
+//TODO: remove?
+ hdaView.on( 'error', function( model, xhr, options, msg ){
+ historyView.errorHandler( model, xhr, options, msg );
+ });
+ },
+
/** If this hda is deleted and we're not showing deleted hdas, remove the view
* @param {HistoryDataAssociation} the hda to check
*/
handleHdaDeletionChange : function( hda ){
if( hda.get( 'deleted' ) && !this.storage.get( 'show_deleted' ) ){
- this.removeHdaView( hda.get( 'id' ) );
+ this.removeHdaView( this.hdaViews[ hda.id ] );
} // otherwise, the hdaView rendering should handle it
},
@@ -520,22 +559,21 @@
*/
handleHdaVisibleChange : function( hda ){
if( hda.hidden() && !this.storage.get( 'show_hidden' ) ){
- this.removeHdaView( hda.get( 'id' ) );
+ this.removeHdaView( this.hdaViews[ hda.id ] );
} // otherwise, the hdaView rendering should handle it
},
/** Remove a view from the panel and if the panel is now empty, re-render
* @param {Int} the id of the hdaView to remove
*/
- removeHdaView : function( id ){
- //console.debug( 'removeHdaView' );
- var panel = this,
- hdaView = this.hdaViews[ id ];
+ removeHdaView : function( hdaView ){
if( !hdaView ){ return; }
+ var panel = this;
hdaView.$el.fadeOut( panel.fxSpeed, function(){
+ hdaView.off();
hdaView.remove();
- delete panel.hdaViews[ id ];
+ delete panel.hdaViews[ hdaView.model.id ];
if( _.isEmpty( panel.hdaViews ) ){
panel.$el.find( '#emptyHistoryMessage' ).fadeIn( panel.fxSpeed );
}
@@ -544,10 +582,9 @@
// ------------------------------------------------------------------------ panel rendering
/** Render urls, historyPanel body, and hdas (if any are shown)
+ * @fires: rendered when the panel is attached and fully visible
* @see Backbone.View#render
*/
- /** event rendered triggered when the panel rendering is complete */
- /** event rendered:initial triggered when the FIRST panel rendering is complete */
render : function( callback ){
var panel = this,
$newRender;
@@ -579,11 +616,13 @@
//TODO: ideally, these would be set up before the fade in (can't because of async save text)
panel._setUpBehaviours();
if( callback ){ callback.call( this ); }
+ panel.trigger( 'rendered', this );
}
]);
return this;
},
+ /** render with history data */
renderModel : function( ){
var $newRender = $( '<div/>' );
// render the main template, tooltips
@@ -601,7 +640,9 @@
return $newRender;
},
+ /** render with no history data */
renderWithoutModel : function( ){
+ // we'll always need the message container
var $newRender = $( '<div/>' ),
$msgContainer = $( '<div/>' ).attr( 'id', 'message-container' )
.css({ 'margin-left': '4px', 'margin-right': '4px' });
@@ -624,44 +665,12 @@
);
_.each( visibleHdas, function( hda ){
- var hdaId = hda.get( 'id' ),
- expanded = historyView.storage.get( 'expandedHdas' ).get( hdaId );
-
- historyView.hdaViews[ hdaId ] = new historyView.HDAView({
- model : hda,
- expanded : expanded,
- hasUser : historyView.model.hasUser(),
- logger : historyView.logger
- });
- historyView._setUpHdaListeners( historyView.hdaViews[ hdaId ] );
-
// render it (NOTE: reverse order, newest on top (prepend))
- //TODO: by default send a reverse order list (although this may be more efficient - it's more confusing)
- $whereTo.prepend( historyView.hdaViews[ hdaId ].render().$el );
+ $whereTo.prepend( historyView.createHdaView( hda ).$el );
});
return visibleHdas.length;
},
- /** Set up HistoryPanel listeners for HDAView events. Currently binds:
- * HDAView#body-visible, HDAView#body-hidden to store expanded states
- * @param {HDAView} hdaView HDAView (base or edit) to listen to
- */
- _setUpHdaListeners : function( hdaView ){
- var historyView = this;
- // maintain a list of hdas whose bodies are expanded
- hdaView.on( 'body-expanded', function( id ){
- historyView.storage.get( 'expandedHdas' ).set( id, true );
- });
- hdaView.on( 'body-collapsed', function( id ){
- historyView.storage.get( 'expandedHdas' ).deleteKey( id );
- });
-//TODO: remove?
- hdaView.on( 'error', function( model, xhr, options, msg ){
-//TODO: change to modal?
- historyView.errorHandler( model, xhr, options, msg );
- });
- },
-
/** Set up HistoryPanel js/widget behaviours
*/
//TODO: these should be either sub-MVs, or handled by events
@@ -770,6 +779,7 @@
},
// ........................................................................ loading indicator
+ /** hide the panel and display a loading indicator (in the panel's parent) when history model's are switched */
showLoadingIndicator : function( msg, speed, callback ){
speed = ( speed !== undefined )?( speed ):( this.fxSpeed );
if( !this.indicator ){
@@ -783,6 +793,7 @@
}
},
+ /** hide the loading indicator */
hideLoadingIndicator : function( speed, callback ){
speed = ( speed !== undefined )?( speed ):( this.fxSpeed );
if( this.indicator ){
@@ -816,6 +827,7 @@
return $msgContainer.html( $msg );
},
+ /** convert msg and details into modal options usable by Galaxy.modal */
messageToModalOptions : function( type, msg, details ){
// only error is fleshed out here
var panel = this,
@@ -860,10 +872,12 @@
},
// ........................................................................ scrolling
+ /** get the current scroll position of the panel in its parent */
scrollPosition : function(){
return this.$el.parent().scrollTop();
},
+ /** set the current scroll position of the panel in its parent */
scrollTo : function( pos ){
this.$el.parent().scrollTop( pos );
},
@@ -925,6 +939,7 @@
// ........................................................................ external objects/MVC
//TODO: remove quota meter from panel and remove this
+ /** add listeners to an external quota meter (mvc/user/user-quotameter.js) */
connectToQuotaMeter : function( quotaMeter ){
if( !quotaMeter ){
return this;
@@ -942,25 +957,26 @@
return this;
},
+//TODO: this seems more like a per user message than a history message; IOW, this doesn't belong here
/** Show the over quota message (which happens to be in the history panel).
*/
-//TODO: this seems more like a per user message than a history message; IOW, this doesn't belong here
showQuotaMessage : function(){
var msg = this.$el.find( '#quota-message-container' );
//this.log( this + ' showing quota message:', msg, userData );
if( msg.is( ':hidden' ) ){ msg.slideDown( this.fxSpeed ); }
},
+//TODO: this seems more like a per user message than a history message
/** Hide the over quota message (which happens to be in the history panel).
*/
-//TODO: this seems more like a per user message than a history message
hideQuotaMessage : function(){
var msg = this.$el.find( '#quota-message-container' );
//this.log( this + ' hiding quota message:', msg, userData );
if( !msg.is( ':hidden' ) ){ msg.slideUp( this.fxSpeed ); }
},
- //TODO: move show_deleted/hidden into panel from opt menu and remove this
+//TODO: move show_deleted/hidden into panel from opt menu and remove this
+ /** add listeners to an external options menu (templates/webapps/galaxy/root/index.mako) */
connectToOptionsMenu : function( optionsMenu ){
if( !optionsMenu ){
return this;
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/packed/mvc/dataset/hda-base.js
--- a/static/scripts/packed/mvc/dataset/hda-base.js
+++ b/static/scripts/packed/mvc/dataset/hda-base.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model"],function(b){var a=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",fxSpeed:"fast",initialize:function(c){if(c.logger){this.logger=this.model.logger=c.logger}this.log(this+".initialize:",c);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.expanded=c.expanded||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(d,c){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(){var d=this,g=this.model.get("id"),e=this.model.get("state"),c=$("<div/>").attr("id","historyItem-"+g),f=(this.$el.children().size()===0);this.$el.attr("id","historyItemContainer-"+g);this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();c.addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+e);c.append(this._render_warnings());c.append(this._render_titleBar());this._setUpBehaviors(c);this.body=$(this._render_body());c.append(this.body);this.$el.fadeOut(this.fxSpeed,function(){d.$el.children().remove();d.$el.append(c).fadeIn(d.fxSpeed,function(){d.log(d+" rendered:",d.$el);var h="rendered";if(f){h+=":initial"}else{if(d.model.inReadyState()){h+=":ready"}}d.trigger(h)})});return this},_setUpBehaviors:function(c){c=c||this.$el;make_popup_menus(c);c.find("[title]").tooltip({placement:"bottom"})},_render_warnings:function(){return $(jQuery.trim(a.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var c=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');c.append(this._render_titleButtons());c.append('<span class="state-icon"></span>');c.append(this._render_titleLink());return c},_render_titleButtons:function(){var c=$('<div class="historyItemButtons"></div>');c.append(this._render_displayButton());return c},_render_displayButton:function(){if((this.model.get("state")===b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){this.displayButton=null;return null}var d={icon_class:"display",target:"galaxy_main"};if(this.model.get("purged")){d.enabled=false;d.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===b.HistoryDatasetAssociation.STATES.UPLOAD){d.enabled=false;d.title=_l("This dataset must finish uploading before it can be viewed")}else{d.title=_l("View data");d.href=this.urls.display;var c=this;d.on_click=function(){Galaxy.frame_manager.frame_new({title:"Data Viewer: "+c.model.get("name"),type:"url",location:"center",content:c.urls.display})}}}this.displayButton=new IconButtonView({model:new IconButton(d)});return this.displayButton.render().$el},_render_titleLink:function(){return $(jQuery.trim(a.templates.titleLink(_.extend(this.model.toJSON(),{urls:this.urls}))))},_render_hdaSummary:function(){var c=_.extend(this.model.toJSON(),{urls:this.urls});return a.templates.hdaSummary(c)},_render_primaryActionButtons:function(e){var c=this,d=$("<div/>").attr("id","primary-actions-"+this.model.get("id"));_.each(e,function(f){d.append(f.call(c))});return d},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var c=a.templates.downloadLinks(_.extend(this.model.toJSON(),{urls:this.urls}));return $(c.trim())},_render_showParamsButton:function(){this.showParamsButton=new IconButtonView({model:new IconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",icon_class:"information"})});return this.showParamsButton.render().$el},_render_displayAppArea:function(){return $("<div/>").addClass("display-apps")},_render_displayApps:function(e){e=e||this.$el;var f=e.find("div.display-apps"),c=this.model.get("display_types"),d=this.model.get("display_apps");if((!this.model.hasData())||(!e||!e.length)||(!f.length)){return}f.html(null);if(!_.isEmpty(c)){f.append(a.templates.displayApps({displayApps:c}))}if(!_.isEmpty(d)){f.append(a.templates.displayApps({displayApps:d}))}},_render_peek:function(){var c=this.model.get("peek");if(!c){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(c))},_render_body:function(){var c=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: none");if(this.expanded){this._render_body_html(c);c.css("display","block")}return c},_render_body_html:function(c){c.html("");switch(this.model.get("state")){case b.HistoryDatasetAssociation.STATES.NEW:this._render_body_new(c);break;case b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE:this._render_body_not_viewable(c);break;case b.HistoryDatasetAssociation.STATES.UPLOAD:this._render_body_uploading(c);break;case b.HistoryDatasetAssociation.STATES.PAUSED:this._render_body_paused(c);break;case b.HistoryDatasetAssociation.STATES.QUEUED:this._render_body_queued(c);break;case b.HistoryDatasetAssociation.STATES.RUNNING:this._render_body_running(c);break;case b.HistoryDatasetAssociation.STATES.ERROR:this._render_body_error(c);break;case b.HistoryDatasetAssociation.STATES.DISCARDED:this._render_body_discarded(c);break;case b.HistoryDatasetAssociation.STATES.SETTING_METADATA:this._render_body_setting_metadata(c);break;case b.HistoryDatasetAssociation.STATES.EMPTY:this._render_body_empty(c);break;case b.HistoryDatasetAssociation.STATES.FAILED_METADATA:this._render_body_failed_metadata(c);break;case b.HistoryDatasetAssociation.STATES.OK:this._render_body_ok(c);break;default:c.append($('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'))}c.append('<div style="clear: both"></div>');this._setUpBehaviors(c)},_render_body_new:function(d){var c=_l("This is a new dataset and not all of its data are available yet");d.append($("<div>"+_l(c)+"</div>"))},_render_body_not_viewable:function(c){c.append($("<div>"+_l("You do not have permission to view dataset")+"</div>"))},_render_body_uploading:function(c){c.append($("<div>"+_l("Dataset is uploading")+"</div>"))},_render_body_queued:function(c){c.append($("<div>"+_l("Job is waiting to run")+"</div>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_paused:function(c){c.append($("<div>"+_l("Job is paused. Use the history menu to resume")+"</div>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_running:function(c){c.append("<div>"+_l("Job is currently running")+"</div>");c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_error:function(c){if(!this.model.get("purged")){c.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}c.append((_l("An error occurred with this dataset")+": <i>"+$.trim(this.model.get("misc_info"))+"</i>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton])))},_render_body_discarded:function(c){c.append("<div>"+_l("The job creating this dataset was cancelled before completion")+".</div>");c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_setting_metadata:function(c){c.append($("<div>"+_l("Metadata is being auto-detected")+".</div>"))},_render_body_empty:function(c){c.append($("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_failed_metadata:function(c){c.append($(a.templates.failedMetadata(_.extend(this.model.toJSON(),{urls:this.urls}))));this._render_body_ok(c)},_render_body_ok:function(c){c.append(this._render_hdaSummary());if(this.model.isDeletedOrPurged()){c.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));return}c.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));c.append('<div class="clear"/>');c.append(this._render_displayAppArea());this._render_displayApps(c);c.append(this._render_peek())},events:{"click .historyItemTitle":"toggleBodyVisibility"},toggleBodyVisibility:function(e,c){var d=this;c=(c===undefined)?(!this.body.is(":visible")):(c);if(c){if(this.model.inReadyState()&&!this.model.hasDetails()){var f=this.model.fetch();f.done(function(g){d.expandBody()})}else{this.expandBody()}}else{this.collapseBody()}},expandBody:function(){var c=this;c._render_body_html(c.body);this.body.slideDown(c.fxSpeed,function(){c.expanded=true;c.trigger("body-expanded",c.model.get("id"))})},collapseBody:function(){var c=this;this.body.slideUp(c.fxSpeed,function(){c.expanded=false;c.trigger("body-collapsed",c.model.get("id"))})},remove:function(d){var c=this;this.$el.fadeOut(c.fxSpeed,function(){c.$el.remove();c.off();if(d){d()}})},toString:function(){var c=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+c+")"}});a.templates={warningMsg:Handlebars.templates["template-warningmessagesmall"],messages:Handlebars.templates["template-hda-warning-messages"],titleLink:Handlebars.templates["template-hda-titleLink"],hdaSummary:Handlebars.templates["template-hda-hdaSummary"],downloadLinks:Handlebars.templates["template-hda-downloadLinks"],failedMetadata:Handlebars.templates["template-hda-failedMetadata"],displayApps:Handlebars.templates["template-hda-displayApps"]};return{HDABaseView:a,}});
\ No newline at end of file
+define(["mvc/dataset/hda-model"],function(b){var a=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"historyItemContainer",fxSpeed:"fast",initialize:function(c){if(c.logger){this.logger=this.model.logger=c.logger}this.log(this+".initialize:",c);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.expanded=c.expanded||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(d,c){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(){var d=this,g=this.model.get("id"),e=this.model.get("state"),c=$("<div/>").attr("id","historyItem-"+g),f=(this.$el.children().size()===0);this.$el.attr("id","historyItemContainer-"+g);this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();c.addClass("historyItemWrapper").addClass("historyItem").addClass("historyItem-"+e);c.append(this._render_warnings());c.append(this._render_titleBar());this._setUpBehaviors(c);this.body=$(this._render_body());c.append(this.body);this.$el.fadeOut(this.fxSpeed,function(){d.$el.children().remove();d.$el.append(c).fadeIn(d.fxSpeed,function(){d.log(d+" rendered:",d.$el);var h="rendered";if(f){h+=":initial"}else{if(d.model.inReadyState()){h+=":ready"}}d.trigger(h)})});return this},_setUpBehaviors:function(c){c=c||this.$el;make_popup_menus(c);c.find("[title]").tooltip({placement:"bottom"})},_render_warnings:function(){return $(jQuery.trim(a.templates.messages(this.model.toJSON())))},_render_titleBar:function(){var c=$('<div class="historyItemTitleBar" style="overflow: hidden"></div>');c.append(this._render_titleButtons());c.append('<span class="state-icon"></span>');c.append(this._render_titleLink());return c},_render_titleButtons:function(){var c=$('<div class="historyItemButtons"></div>');c.append(this._render_displayButton());return c},_render_displayButton:function(){if((this.model.get("state")===b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){this.displayButton=null;return null}var d={icon_class:"display",target:"galaxy_main"};if(this.model.get("purged")){d.enabled=false;d.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===b.HistoryDatasetAssociation.STATES.UPLOAD){d.enabled=false;d.title=_l("This dataset must finish uploading before it can be viewed")}else{d.title=_l("View data");d.href=this.urls.display;var c=this;d.on_click=function(){Galaxy.frame_manager.frame_new({title:"Data Viewer: "+c.model.get("name"),type:"url",location:"center",content:c.urls.display})}}}this.displayButton=new IconButtonView({model:new IconButton(d)});return this.displayButton.render().$el},_render_titleLink:function(){return $(jQuery.trim(a.templates.titleLink(this.model.toJSON())))},_render_hdaSummary:function(){var c=_.extend(this.model.toJSON(),{urls:this.urls});return a.templates.hdaSummary(c)},_render_primaryActionButtons:function(e){var c=this,d=$("<div/>").attr("id","primary-actions-"+this.model.get("id"));_.each(e,function(f){d.append(f.call(c))});return d},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var c=a.templates.downloadLinks(_.extend(this.model.toJSON(),{urls:this.urls}));return $(c.trim())},_render_showParamsButton:function(){this.showParamsButton=new IconButtonView({model:new IconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",icon_class:"information"})});return this.showParamsButton.render().$el},_render_displayAppArea:function(){return $("<div/>").addClass("display-apps")},_render_displayApps:function(e){e=e||this.$el;var f=e.find("div.display-apps"),c=this.model.get("display_types"),d=this.model.get("display_apps");if((!this.model.hasData())||(!e||!e.length)||(!f.length)){return}f.html(null);if(!_.isEmpty(c)){f.append(a.templates.displayApps({displayApps:c}))}if(!_.isEmpty(d)){f.append(a.templates.displayApps({displayApps:d}))}},_render_peek:function(){var c=this.model.get("peek");if(!c){return null}return $("<div/>").append($("<pre/>").attr("id","peek"+this.model.get("id")).addClass("peek").append(c))},_render_body:function(){var c=$("<div/>").attr("id","info-"+this.model.get("id")).addClass("historyItemBody").attr("style","display: none");if(this.expanded){this._render_body_html(c);c.show()}return c},_render_body_html:function(e){e.empty();var c=this.model.get("state");var f="_render_body_"+c,d=this[f];if(_.isFunction(d)){this[f](e)}else{e.append($('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'))}e.append('<div style="clear: both"></div>');this._setUpBehaviors(e)},_render_body_new:function(d){var c=_l("This is a new dataset and not all of its data are available yet");d.append($("<div>"+_l(c)+"</div>"))},_render_body_noPermission:function(c){c.append($("<div>"+_l("You do not have permission to view this dataset")+"</div>"))},_render_body_upload:function(c){c.append($("<div>"+_l("Dataset is uploading")+"</div>"))},_render_body_queued:function(c){c.append($("<div>"+_l("Job is waiting to run")+"</div>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_paused:function(c){c.append($("<div>"+_l('Job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"</div>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_running:function(c){c.append("<div>"+_l("Job is currently running")+"</div>");c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_error:function(c){if(!this.model.get("purged")){c.append($("<div>"+this.model.get("misc_blurb")+"</div>"))}c.append((_l("An error occurred with this dataset")+": <i>"+$.trim(this.model.get("misc_info"))+"</i>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton])))},_render_body_discarded:function(c){c.append("<div>"+_l("The job creating this dataset was cancelled before completion")+".</div>");c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_setting_metadata:function(c){c.append($("<div>"+_l("Metadata is being auto-detected")+".</div>"))},_render_body_empty:function(c){c.append($("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>"));c.append(this._render_primaryActionButtons(this.defaultPrimaryActionButtonRenderers))},_render_body_failed_metadata:function(c){c.append($(a.templates.failedMetadata(_.extend(this.model.toJSON(),{urls:this.urls}))));this._render_body_ok(c)},_render_body_ok:function(c){c.append(this._render_hdaSummary());if(this.model.isDeletedOrPurged()){c.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));return}c.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton]));c.append('<div class="clear"/>');c.append(this._render_displayAppArea());this._render_displayApps(c);c.append(this._render_peek())},events:{"click .historyItemTitle":"toggleBodyVisibility"},toggleBodyVisibility:function(d,c){c=(c===undefined)?(!this.body.is(":visible")):(c);if(c){this.expandBody()}else{this.collapseBody()}},expandBody:function(){var c=this;function d(){c._render_body_html(c.body);c.body.slideDown(c.fxSpeed,function(){c.expanded=true;c.trigger("body-expanded",c.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch().done(function(e){d()})}else{d()}},collapseBody:function(){var c=this;this.body.slideUp(c.fxSpeed,function(){c.expanded=false;c.trigger("body-collapsed",c.model.get("id"))})},remove:function(d){var c=this;this.$el.fadeOut(c.fxSpeed,function(){c.$el.remove();c.off();if(d){d()}})},toString:function(){var c=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+c+")"}});a.templates={warningMsg:Handlebars.templates["template-warningmessagesmall"],messages:Handlebars.templates["template-hda-warning-messages"],titleLink:Handlebars.templates["template-hda-titleLink"],hdaSummary:Handlebars.templates["template-hda-hdaSummary"],downloadLinks:Handlebars.templates["template-hda-downloadLinks"],failedMetadata:Handlebars.templates["template-hda-failedMetadata"],displayApps:Handlebars.templates["template-hda-displayApps"]};return{HDABaseView:a}});
\ No newline at end of file
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/packed/mvc/dataset/hda-edit.js
--- a/static/scripts/packed/mvc/dataset/hda-edit.js
+++ b/static/scripts/packed/mvc/dataset/hda-edit.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_setUpBehaviors:function(g){a.HDABaseView.prototype._setUpBehaviors.call(this,g)},_render_warnings:function(){return $(jQuery.trim(a.HDABaseView.templates.messages(_.extend(this.model.toJSON(),{urls:this.urls}))))},_render_titleButtons:function(){var g=$('<div class="historyItemButtons"></div>');g.append(this._render_displayButton());g.append(this._render_editButton());g.append(this._render_deleteButton());return g},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){this.editButton=null;return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:"galaxy_main",icon_class:"edit"};if(g||i){h.enabled=false;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}this.editButton=new IconButtonView({model:new IconButton(h)});return this.editButton.render().$el},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){this.deleteButton=null;return null}var g=this,j="historyItemDeleter-"+g.model.get("id"),h=g.urls["delete"],i={title:_l("Delete"),href:h,id:j,icon_class:"delete",on_click:function(){g.$el.find(".menu-button.delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){i={title:_l("Dataset is already deleted"),icon_class:"delete",enabled:false}}this.deleteButton=new IconButtonView({model:new IconButton(i)});return this.deleteButton.render().$el},_render_hdaSummary:function(){var g=_.extend(this.model.toJSON(),{urls:this.urls});if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){_.extend(g,{dbkey_unknown_and_editable:true})}return a.HDABaseView.templates.hdaSummary(g)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){this.errButton=null;return null}this.errButton=new IconButtonView({model:new IconButton({title:_l("View or report this error"),href:this.urls.report_error,target:"galaxy_main",icon_class:"bug"})});return this.errButton.render().$el},_render_rerunButton:function(){this.rerunButton=new IconButtonView({model:new IconButton({title:_l("Run this job again"),href:this.urls.rerun,target:"galaxy_main",icon_class:"arrow-circle"})});return this.rerunButton.render().$el},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.model.hasData())||(_.isEmpty(g))){this.visualizationsButton=null;return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){this.visualizationsButton=null;return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}this.visualizationsButton=new IconButtonView({model:new IconButton({title:_l("Visualize"),href:this.urls.visualization,icon_class:"chart_curve"})});var h=this.visualizationsButton.render().$el;h.addClass("visualize-icon");function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame_manager.frame_new({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){this.visualizationsButton=null;return null}this.visualizationsButton=new IconButtonView({model:new IconButton({title:_l("Visualize"),icon_class:"chart_curve"})});var i=this.visualizationsButton.render().$el;i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_secondaryActionButtons:function(h){var i=$("<div/>"),g=this;i.attr("style","float: right;").attr("id","secondary-actions-"+this.model.get("id"));_.each(h,function(j){i.append(j.call(g))});return i},_render_tagButton:function(){if(!this.hasUser||!this.urls.tags.get){this.tagButton=null;return null}this.tagButton=new IconButtonView({model:new IconButton({title:_l("Edit dataset tags"),target:"galaxy_main",href:this.urls.tags.get,icon_class:"tags"})});return this.tagButton.render().$el},_render_annotateButton:function(){if(!this.hasUser||!this.urls.annotation.get){this.annotateButton=null;return null}this.annotateButton=new IconButtonView({model:new IconButton({title:_l("Edit dataset annotation"),target:"galaxy_main",icon_class:"annotate"})});return this.annotateButton.render().$el},_render_tagArea:function(){if(!this.urls.tags.set){return null}return $(f.templates.tagArea(_.extend(this.model.toJSON(),{urls:this.urls})).trim())},_render_annotationArea:function(){if(!this.urls.annotation.get){return null}return $(f.templates.annotationArea(_.extend(this.model.toJSON(),{urls:this.urls})).trim())},_render_body_error:function(g){a.HDABaseView.prototype._render_body_error.call(this,g);var h=g.find("#primary-actions-"+this.model.get("id"));h.prepend(this._render_errButton())},_render_body_ok:function(g){g.append(this._render_hdaSummary());if(this.model.isDeletedOrPurged()){g.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton,this._render_rerunButton]));return}g.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton,this._render_rerunButton,this._render_visualizationsButton]));g.append(this._render_secondaryActionButtons([this._render_tagButton,this._render_annotateButton]));g.append('<div class="clear"/>');g.append(this._render_tagArea());g.append(this._render_annotationArea());g.append(this._render_displayAppArea());this._render_displayApps(g);g.append(this._render_peek())},events:{"click .historyItemTitle":"toggleBodyVisibility","click .historyItemUndelete":function(g){this.model.undelete();return false},"click .historyItemUnhide":function(g){this.model.unhide();return false},"click .historyItemPurge":"confirmPurge","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},confirmPurge:function c(g){this.model.purge({url:this.urls.purge});return false},loadAndDisplayTags:function(i){this.log(this+".loadAndDisplayTags",i);var g=this,j=this.$el.find(".tag-area"),h=j.find(".tag-elt");if(j.is(":hidden")){if(!jQuery.trim(h.html())){$.ajax({url:this.urls.tags.get,error:function(m,k,l){g.log("Tagging failed",m,k,l);g.trigger("error",g,m,{},_l("Tagging failed"))},success:function(k){h.html(k);h.find("[title]").tooltip();j.slideDown(g.fxSpeed)}})}else{j.slideDown(g.fxSpeed)}}else{j.slideUp(g.fxSpeed)}return false},loadAndDisplayAnnotation:function(i){this.log(this+".loadAndDisplayAnnotation",i);var g=this,k=this.$el.find(".annotation-area"),j=k.find(".annotation-elt"),h=this.urls.annotation.set;if(k.is(":hidden")){if(!jQuery.trim(j.html())){$.ajax({url:this.urls.annotation.get,error:function(){g.log("Annotation failed",xhr,status,error);g.trigger("error",g,xhr,{},_l("Annotation failed"))},success:function(l){if(l===""){l="<em>"+_l("Describe or add notes to dataset")+"</em>"}j.html(l);k.find("[title]").tooltip();async_save_text(j.attr("id"),j.attr("id"),h,"new_annotation",18,true,4);k.slideDown(g.fxSpeed)}})}else{k.slideDown(g.fxSpeed)}}else{k.slideUp(g.fxSpeed)}return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});f.templates={tagArea:Handlebars.templates["template-hda-tagArea"],annotationArea:Handlebars.templates["template-hda-annotationArea"]};function e(g,h){action=function(){Galaxy.frame_manager.frame_new({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),location:"center"});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i)})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:m})}}})}});return false}}return{HDAEditView:f,}});
\ No newline at end of file
+define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_setUpBehaviors:function(g){a.HDABaseView.prototype._setUpBehaviors.call(this,g)},_render_warnings:function(){return $(jQuery.trim(a.HDABaseView.templates.messages(_.extend(this.model.toJSON(),{urls:this.urls}))))},_render_titleButtons:function(){var g=$('<div class="historyItemButtons"></div>');g.append(this._render_displayButton());g.append(this._render_editButton());g.append(this._render_deleteButton());return g},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){this.editButton=null;return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:"galaxy_main",icon_class:"edit"};if(g||i){h.enabled=false;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}this.editButton=new IconButtonView({model:new IconButton(h)});return this.editButton.render().$el},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){this.deleteButton=null;return null}var g=this,j="historyItemDeleter-"+g.model.get("id"),h=g.urls["delete"],i={title:_l("Delete"),href:h,id:j,icon_class:"delete",on_click:function(){g.$el.find(".menu-button.delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){i={title:_l("Dataset is already deleted"),icon_class:"delete",enabled:false}}this.deleteButton=new IconButtonView({model:new IconButton(i)});return this.deleteButton.render().$el},_render_hdaSummary:function(){var g=_.extend(this.model.toJSON(),{urls:this.urls});if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){_.extend(g,{dbkey_unknown_and_editable:true})}return a.HDABaseView.templates.hdaSummary(g)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){this.errButton=null;return null}this.errButton=new IconButtonView({model:new IconButton({title:_l("View or report this error"),href:this.urls.report_error,target:"galaxy_main",icon_class:"bug"})});return this.errButton.render().$el},_render_rerunButton:function(){this.rerunButton=new IconButtonView({model:new IconButton({title:_l("Run this job again"),href:this.urls.rerun,target:"galaxy_main",icon_class:"arrow-circle"})});return this.rerunButton.render().$el},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.model.hasData())||(_.isEmpty(g))){this.visualizationsButton=null;return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){this.visualizationsButton=null;return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}this.visualizationsButton=new IconButtonView({model:new IconButton({title:_l("Visualize"),href:this.urls.visualization,icon_class:"chart_curve"})});var h=this.visualizationsButton.render().$el;h.addClass("visualize-icon");function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame_manager.frame_new({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){this.visualizationsButton=null;return null}this.visualizationsButton=new IconButtonView({model:new IconButton({title:_l("Visualize"),icon_class:"chart_curve"})});var i=this.visualizationsButton.render().$el;i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_secondaryActionButtons:function(h){var i=$("<div/>"),g=this;i.attr("style","float: right;").attr("id","secondary-actions-"+this.model.get("id"));_.each(h,function(j){i.append(j.call(g))});return i},_render_tagButton:function(){if(!this.hasUser||!this.urls.tags.get){this.tagButton=null;return null}this.tagButton=new IconButtonView({model:new IconButton({title:_l("Edit dataset tags"),target:"galaxy_main",href:this.urls.tags.get,icon_class:"tags"})});return this.tagButton.render().$el},_render_annotateButton:function(){if(!this.hasUser||!this.urls.annotation.get){this.annotateButton=null;return null}this.annotateButton=new IconButtonView({model:new IconButton({title:_l("Edit dataset annotation"),target:"galaxy_main",icon_class:"annotate"})});return this.annotateButton.render().$el},_render_body_error:function(g){a.HDABaseView.prototype._render_body_error.call(this,g);var h=g.find("#primary-actions-"+this.model.get("id"));h.prepend(this._render_errButton())},_render_body_ok:function(g){g.append(this._render_hdaSummary());if(this.model.isDeletedOrPurged()){g.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton,this._render_rerunButton]));return}g.append(this._render_primaryActionButtons([this._render_downloadButton,this._render_showParamsButton,this._render_rerunButton,this._render_visualizationsButton]));g.append(this._render_secondaryActionButtons([this._render_tagButton,this._render_annotateButton]));g.append('<div class="clear"/>');g.append(this._render_tagArea());g.append(this._render_annotationArea());g.append(this._render_displayAppArea());this._render_displayApps(g);g.append(this._render_peek())},events:{"click .historyItemTitle":"toggleBodyVisibility","click .historyItemUndelete":function(g){this.model.undelete();return false},"click .historyItemUnhide":function(g){this.model.unhide();return false},"click .historyItemPurge":"confirmPurge","click a.icon-button.tags":"loadAndDisplayTags","click a.icon-button.annotate":"loadAndDisplayAnnotation"},confirmPurge:function c(g){this.model.purge({url:this.urls.purge});return false},_render_tagArea:function(){if(!this.hasUser||!this.urls.tags.set){return null}return $(f.templates.tagArea(_.extend(this.model.toJSON(),{urls:this.urls})).trim())},loadAndDisplayTags:function(i){this.log(this+".loadAndDisplayTags",i);var g=this,j=this.$el.find(".tag-area"),h=j.find(".tag-elt");if(j.is(":hidden")){if(!jQuery.trim(h.html())){$.ajax({url:this.urls.tags.get,error:function(m,k,l){g.log("Tagging failed",m,k,l);g.trigger("error",g,m,{},_l("Tagging failed"))},success:function(k){h.html(k);h.find("[title]").tooltip();j.slideDown(g.fxSpeed)}})}else{j.slideDown(g.fxSpeed)}}else{j.slideUp(g.fxSpeed)}return false},_render_annotationArea:function(){if(!this.hasUser||!this.urls.annotation.get){return null}return $(f.templates.annotationArea(_.extend(this.model.toJSON(),{urls:this.urls})).trim())},loadAndDisplayAnnotation:function(i){this.log(this+".loadAndDisplayAnnotation",i);var g=this,k=this.$el.find(".annotation-area"),j=k.find(".annotation-elt"),h=this.urls.annotation.set;if(k.is(":hidden")){if(!jQuery.trim(j.html())){$.ajax({url:this.urls.annotation.get,error:function(){g.log("Annotation failed",xhr,status,error);g.trigger("error",g,xhr,{},_l("Annotation failed"))},success:function(l){if(l===""){l="<em>"+_l("Describe or add notes to dataset")+"</em>"}j.html(l);k.find("[title]").tooltip();async_save_text(j.attr("id"),j.attr("id"),h,"new_annotation",18,true,4);k.slideDown(g.fxSpeed)}})}else{k.slideDown(g.fxSpeed)}}else{k.slideUp(g.fxSpeed)}return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});f.templates={tagArea:Handlebars.templates["template-hda-tagArea"],annotationArea:Handlebars.templates["template-hda-annotationArea"]};function e(g,h){action=function(){Galaxy.frame_manager.frame_new({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),location:"center"});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i)})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame_manager.frame_new({title:"Trackster",type:"url",content:m})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/packed/mvc/dataset/hda-model.js
--- a/static/scripts/packed/mvc/dataset/hda-model.js
+++ b/static/scripts/packed/mvc/dataset/hda-model.js
@@ -1,1 +1,1 @@
-define([],function(){var d=Backbone.Model.extend(LoggableMixin).extend({defaults:{history_id:null,model_class:"HistoryDatasetAssociation",hid:0,id:null,name:"(unnamed dataset)",state:"new",deleted:false,visible:true,accessible:true,purged:false,data_type:null,file_size:0,file_ext:"",meta_files:[],misc_blurb:"",misc_info:""},urlRoot:"api/histories/",url:function(){return this.urlRoot+this.get("history_id")+"/contents/"+this.get("id")},urls:function(){var j=this.get("id");if(!j){return{}}var h={"delete":"/datasets/"+j+"/delete_async",purge:"/datasets/"+j+"/purge_async",unhide:"/datasets/"+j+"/unhide",undelete:"/datasets/"+j+"/undelete",display:"/datasets/"+j+"/display/?preview=True",download:"/datasets/"+j+"/display?to_ext="+this.get("file_ext"),edit:"/datasets/"+j+"/edit",report_error:"/dataset/errors?id="+j,rerun:"/tool_runner/rerun?id="+j,show_params:"/datasets/"+j+"/show_params",visualization:"/visualization",annotation:{get:"/dataset/get_annotation_async?id="+j,set:"/dataset/annotate_async?id="+j},tags:{get:"/tag/get_tagging_elt_async?item_id="+j+"&item_class=HistoryDatasetAssociation",set:"/tag/retag?item_id="+j+"&item_class=HistoryDatasetAssociation"}};var i=this.get("meta_files");if(i){h.meta_download=_.map(i,function(k){return{url:"/dataset/get_metadata_file?hda_id="+j+"&metadata_name="+k.file_type,file_type:k.file_type}})}return h},initialize:function(h){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"));if(!this.get("accessible")){this.set("state",d.STATES.NOT_VIEWABLE)}this._setUpListeners()},_setUpListeners:function(){this.on("change:state",function(i,h){this.log(this+" has changed state:",i,h);if(this.inReadyState()){this.trigger("state:ready",i,h,this.previous("state"))}})},isDeletedOrPurged:function(){return(this.get("deleted")||this.get("purged"))},isVisible:function(i,j){var h=true;if((!i)&&(this.get("deleted")||this.get("purged"))){h=false}if((!j)&&(!this.get("visible"))){h=false}return h},hidden:function(){return !this.get("visible")},inReadyState:function(){var h=_.contains(d.READY_STATES,this.get("state"));return(this.isDeletedOrPurged()||h)},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return(this.get("file_size")>0)},"delete":function c(h){return this.save({deleted:true},h)},undelete:function a(h){return this.save({deleted:false},h)},hide:function b(h){return this.save({visible:false},h)},unhide:function g(h){return this.save({visible:true},h)},purge:function f(h){var i=this,j=jQuery.ajax(h);j.done(function(m,k,l){i.set("purged",true)});j.fail(function(o,k,n){var l=_l("Unable to purge this dataset");var m=("Removal of datasets by users is not allowed in this Galaxy instance");if(o.responseJSON&&o.responseJSON.error){l=o.responseJSON.error}else{if(o.responseText.indexOf(m)!==-1){l=m}}o.responseText=l;i.trigger("error",i,o,h,_l(l),{error:l})})},searchKeys:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],search:function(h){var i=this;h=h.toLowerCase();return _.filter(this.searchKeys,function(k){var j=i.get(k);return(_.isString(j)&&j.toLowerCase().indexOf(h)!==-1)})},matches:function(h){return !!this.search(h).length},toString:function(){var h=this.get("id")||"";if(this.get("name")){h=this.get("hid")+' :"'+this.get("name")+'",'+h}return"HDA("+h+")"}});d.STATES={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};d.READY_STATES=[d.STATES.NEW,d.STATES.OK,d.STATES.EMPTY,d.STATES.PAUSED,d.STATES.FAILED_METADATA,d.STATES.NOT_VIEWABLE,d.STATES.DISCARDED,d.STATES.ERROR];d.NOT_READY_STATES=[d.STATES.UPLOAD,d.STATES.QUEUED,d.STATES.RUNNING,d.STATES.SETTING_METADATA];var e=Backbone.Collection.extend(LoggableMixin).extend({model:d,urlRoot:"/api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(i,h){h=h||{};this.historyId=h.historyId;this._setUpListeners()},_setUpListeners:function(){},ids:function(){return this.map(function(h){return h.id})},notReady:function(){return this.filter(function(h){return !h.inReadyState()})},running:function(){var h=[];this.each(function(i){if(!i.inReadyState()){h.push(i.get("id"))}});return h},getByHid:function(h){return _.first(this.filter(function(i){return i.get("hid")===h}))},getVisible:function(h,i){return this.filter(function(j){return j.isVisible(h,i)})},fetchAllDetails:function(){return this.fetch({data:{details:"all"}})},matches:function(h){return this.filter(function(i){return i.matches(h)})},set:function(j,h){var i=this;j=_.map(j,function(l){var m=i.get(l.id);if(!m){return l}var k=m.toJSON();_.extend(k,l);return k});Backbone.Collection.prototype.set.call(this,j,h)},toString:function(){return("HDACollection()")}});return{HistoryDatasetAssociation:d,HDACollection:e}});
\ No newline at end of file
+define([],function(){var d=Backbone.Model.extend(LoggableMixin).extend({defaults:{history_id:null,model_class:"HistoryDatasetAssociation",hid:0,id:null,name:"(unnamed dataset)",state:"new",deleted:false,visible:true,accessible:true,purged:false,data_type:null,file_size:0,file_ext:"",meta_files:[],misc_blurb:"",misc_info:""},urlRoot:"api/histories/",url:function(){return this.urlRoot+this.get("history_id")+"/contents/"+this.get("id")},urls:function(){var j=this.get("id");if(!j){return{}}var h={purge:galaxy_config.root+"datasets/"+j+"/purge_async",display:galaxy_config.root+"datasets/"+j+"/display/?preview=True",download:galaxy_config.root+"datasets/"+j+"/display?to_ext="+this.get("file_ext"),edit:galaxy_config.root+"datasets/"+j+"/edit",report_error:galaxy_config.root+"dataset/errors?id="+j,rerun:galaxy_config.root+"tool_runner/rerun?id="+j,show_params:galaxy_config.root+"datasets/"+j+"/show_params",visualization:galaxy_config.root+"visualization",annotation:{get:galaxy_config.root+"dataset/get_annotation_async?id="+j,set:galaxy_config.root+"dataset/annotate_async?id="+j},tags:{get:galaxy_config.root+"tag/get_tagging_elt_async?item_id="+j+"&item_class=HistoryDatasetAssociation",set:galaxy_config.root+"tag/retag?item_id="+j+"&item_class=HistoryDatasetAssociation"}};var i=this.get("meta_files");if(i){h.meta_download=_.map(i,function(k){return{url:galaxy_config.root+"dataset/get_metadata_file?hda_id="+j+"&metadata_name="+k.file_type,file_type:k.file_type}})}return h},initialize:function(h){this.log(this+".initialize",this.attributes);this.log("\tparent history_id: "+this.get("history_id"));if(!this.get("accessible")){this.set("state",d.STATES.NOT_VIEWABLE)}this._setUpListeners()},_setUpListeners:function(){this.on("change:state",function(i,h){this.log(this+" has changed state:",i,h);if(this.inReadyState()){this.trigger("state:ready",i,h,this.previous("state"))}})},isDeletedOrPurged:function(){return(this.get("deleted")||this.get("purged"))},isVisible:function(i,j){var h=true;if((!i)&&(this.get("deleted")||this.get("purged"))){h=false}if((!j)&&(!this.get("visible"))){h=false}return h},hidden:function(){return !this.get("visible")},inReadyState:function(){var h=_.contains(d.READY_STATES,this.get("state"));return(this.isDeletedOrPurged()||h)},hasDetails:function(){return _.has(this.attributes,"genome_build")},hasData:function(){return(this.get("file_size")>0)},"delete":function c(h){return this.save({deleted:true},h)},undelete:function a(h){return this.save({deleted:false},h)},hide:function b(h){return this.save({visible:false},h)},unhide:function g(h){return this.save({visible:true},h)},purge:function f(h){var i=this,j=jQuery.ajax(h);j.done(function(m,k,l){i.set("purged",true)});j.fail(function(o,k,n){var l=_l("Unable to purge this dataset");var m=("Removal of datasets by users is not allowed in this Galaxy instance");if(o.responseJSON&&o.responseJSON.error){l=o.responseJSON.error}else{if(o.responseText.indexOf(m)!==-1){l=m}}o.responseText=l;i.trigger("error",i,o,h,_l(l),{error:l})})},searchKeys:["name","file_ext","genome_build","misc_blurb","misc_info","annotation","tags"],search:function(h){var i=this;h=h.toLowerCase();return _.filter(this.searchKeys,function(k){var j=i.get(k);return(_.isString(j)&&j.toLowerCase().indexOf(h)!==-1)})},matches:function(h){return !!this.search(h).length},toString:function(){var h=this.get("id")||"";if(this.get("name")){h=this.get("hid")+' :"'+this.get("name")+'",'+h}return"HDA("+h+")"}});d.STATES={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};d.READY_STATES=[d.STATES.NEW,d.STATES.OK,d.STATES.EMPTY,d.STATES.PAUSED,d.STATES.FAILED_METADATA,d.STATES.NOT_VIEWABLE,d.STATES.DISCARDED,d.STATES.ERROR];d.NOT_READY_STATES=[d.STATES.UPLOAD,d.STATES.QUEUED,d.STATES.RUNNING,d.STATES.SETTING_METADATA];var e=Backbone.Collection.extend(LoggableMixin).extend({model:d,urlRoot:galaxy_config.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},initialize:function(i,h){h=h||{};this.historyId=h.historyId;this._setUpListeners()},_setUpListeners:function(){},ids:function(){return this.map(function(h){return h.id})},notReady:function(){return this.filter(function(h){return !h.inReadyState()})},running:function(){var h=[];this.each(function(i){if(!i.inReadyState()){h.push(i.get("id"))}});return h},getByHid:function(h){return _.first(this.filter(function(i){return i.get("hid")===h}))},getVisible:function(h,i){return this.filter(function(j){return j.isVisible(h,i)})},fetchAllDetails:function(){return this.fetch({data:{details:"all"}})},matches:function(h){return this.filter(function(i){return i.matches(h)})},set:function(j,h){var i=this;j=_.map(j,function(l){var m=i.get(l.id);if(!m){return l}var k=m.toJSON();_.extend(k,l);return k});Backbone.Collection.prototype.set.call(this,j,h)},toString:function(){return("HDACollection()")}});return{HistoryDatasetAssociation:d,HDACollection:e}});
\ No newline at end of file
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/packed/mvc/history/history-model.js
--- a/static/scripts/packed/mvc/history/history-model.js
+++ b/static/scripts/packed/mvc/history/history-model.js
@@ -1,1 +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:"api/histories",renameUrl:function(){var e=this.get("id");if(!e){return undefined}return"/history/rename_async?id="+this.get("id")},annotateUrl:function(){var e=this.get("id");if(!e){return undefined}return"/history/annotate_async?id="+this.get("id")},tagUrl:function(){var e=this.get("id");if(!e){return undefined}return"/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.checkForUpdates()},_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)},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("/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("/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:"api/histories"});return{History:c,HistoryCollection:b}});
\ No newline at end of file
+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;this.checkForUpdates()},_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)},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}});
\ No newline at end of file
diff -r 7f70f02747d374ebf1804a1ae380cb27968043b0 -r e66076ed4678c1ad15db09c1d220a624e2047a79 static/scripts/packed/mvc/history/history-panel.js
--- a/static/scripts/packed/mvc/history/history-panel.js
+++ b/static/scripts/packed/mvc/history/history-panel.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-model","mvc/dataset/hda-base","mvc/dataset/hda-edit"],function(d,b,a){var c=Backbone.View.extend(LoggableMixin).extend({HDAView:a.HDAEditView,tagName:"div",className:"history-panel",fxSpeed:300,events:{"click #history-tag":"loadAndDisplayTags","click #message-container":"clearMessages"},initialize:function(e){e=e||{};if(e.logger){this.logger=e.logger}this.log(this+".initialize:",e);this._setUpListeners();this.hdaViews={};this.urls={};this.indicator=new LoadingIndicator(this.$el);if(this.model){this._setUpWebStorage(e.initiallyExpanded,e.show_deleted,e.show_hidden);this._setUpModelEventHandlers()}if(e.onready){e.onready.call(this)}},_setUpListeners:function(){this.on("error",function(f,i,e,h,g){this.errorHandler(f,i,e,h,g)});this.on("loading-history",function(){this.showLoadingIndicator()});this.on("loading-done",function(){this.hideLoadingIndicator()});this.once("rendered",function(){this.trigger("rendered:initial",this);return false});this.on("switched-history current-history new-history",function(){if(_.isEmpty(this.hdaViews)){this.trigger("empty-history",this)}});if(this.logger){this.on("all",function(e){this.log(this+"",arguments)},this)}},errorHandler:function(g,j,f,i,h){var e=this._parseErrorMessage(g,j,f,i,h);if(j&&j.status===0&&j.readyState===0){}else{if(j&&j.status===502){}else{if(!this.$el.find("#message-container").is(":visible")){this.once("rendered",function(){this.displayMessage("error",e.message,e.details)})}else{this.displayMessage("error",e.message,e.details)}}}},_parseErrorMessage:function(h,l,g,k,j){var f=Galaxy.currUser,e={message:this._bePolite(k),details:{user:(f instanceof User)?(f.toJSON()):(f+""),source:(h instanceof Backbone.Model)?(h.toJSON()):(h+""),xhr:l,options:(l)?(_.omit(g,"xhr")):(g)}};_.extend(e.details,j||{});if(l&&_.isFunction(l.getAllResponseHeaders)){var i=l.getAllResponseHeaders();i=_.compact(i.split("\n"));i=_.map(i,function(m){return m.split(": ")});e.details.xhr.responseHeaders=_.object(i)}return e},_bePolite:function(e){e=e||_l("An error occurred while getting updates from the server");return e+". "+_l("Please contact a Galaxy administrator if the problem persists.")},_loadHistoryFromXHR:function(g,f){var e=this;g.then(function(h,i){e.setModel(h,i,f)});g.fail(function(i,h){e.render()});return g},setModel:function(g,e,f){f=f||{};if(this.model){this.model.clearUpdateTimeout();this.stopListening(this.model);this.stopListening(this.model.hdas)}this.hdaViews={};if(Galaxy&&Galaxy.currUser){g.user=Galaxy.currUser.toJSON()}this.model=new d.History(g,e,f);this._setUpWebStorage(f.initiallyExpanded,f.show_deleted,f.show_hidden);this._setUpModelEventHandlers();this.trigger("new-model",this);this.render();return this},loadHistory:function(h,g,f,k,i){this.trigger("loading-history",this);g=g||{};var e=this;var j=d.History.getHistoryData(h,{historyFn:f,hdaFn:k,hdaDetailIds:g.initiallyExpanded||i});return this._loadHistoryFromXHR(j,g).fail(function(n,l,m){e.trigger("error",e,n,g,_l("An error was encountered while "+l),{historyId:h,history:m||{}})}).always(function(){e.trigger("loading-done",e)})},loadHistoryWithHDADetails:function(h,g,f,j){var e=this,i=function(k){return e.getExpandedHdaIds(k.id)};return this.loadHistory(h,g,f,j,i)},switchToHistory:function(h,g){var e=this,f=function(){return jQuery.post("/api/histories/"+h+"/set_as_current")};return this.loadHistoryWithHDADetails(h,g,f).then(function(j,i){e.trigger("switched-history",e)})},loadCurrentHistory:function(f){var e=this;return this.loadHistoryWithHDADetails("current",f).then(function(h,g){e.trigger("current-history",e)})},createNewHistory:function(g){var e=this,f=function(){return jQuery.post("/api/histories",{current:true})};return this.loadHistory(undefined,g,f).then(function(i,h){e.trigger("new-history",e)})},refreshHdas:function(f,e){if(this.model){return this.model.refresh(f,e)}return $.when()},_getStorageKey:function(e){if(!e){throw new Error("_getStorageKey needs valid id: "+e)}return("history:"+e)},_setUpWebStorage:function(f,e,g){this.storage=new PersistentStorage(this._getStorageKey(this.model.get("id")),{expandedHdas:{},show_deleted:false,show_hidden:false});this.log(this+" (prev) storage:",JSON.stringify(this.storage.get(),null,2));if(f){this.storage.set("exandedHdas",f)}if((e===true)||(e===false)){this.storage.set("show_deleted",e)}if((g===true)||(g===false)){this.storage.set("show_hidden",g)}this.show_deleted=this.storage.get("show_deleted");this.show_hidden=this.storage.get("show_hidden");this.trigger("new-storage",this.storage,this);this.log(this+" (init'd) storage:",this.storage.get())},clearWebStorage:function(){for(var e in sessionStorage){if(e.indexOf("HistoryView.")===0){sessionStorage.removeItem(e)}}},getStoredOptions:function(f){if(!f||f==="current"){return(this.storage)?(this.storage.get()):({})}var e=sessionStorage.getItem(this._getStorageKey(f));return(e===null)?({}):(JSON.parse(e))},getExpandedHdaIds:function(e){var f=this.getStoredOptions(e).expandedHdas;return((_.isEmpty(f))?([]):(_.keys(f)))},_setUpModelEventHandlers:function(){this.model.on("error error:hdas",function(f,h,e,g){this.errorHandler(f,h,e,g)},this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("add",this.addHdaView,this);this.model.hdas.on("change:deleted",this.handleHdaDeletionChange,this);this.model.hdas.on("change:visible",this.handleHdaVisibleChange,this);this.model.hdas.on("change:purged",function(e){this.model.fetch()},this);this.model.hdas.on("state:ready",function(f,g,e){if((!f.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(f.get("id"))}},this)},addHdaView:function(h){this.log("add."+this,h);var f=this;if(!h.isVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"))){return}$({}).queue([function g(j){var i=f.$el.find("#emptyHistoryMessage");if(i.is(":visible")){i.fadeOut(f.fxSpeed,j)}else{j()}},function e(j){f.scrollToTop();var i=f.$el.find("#"+f.model.get("id")+"-datasets");f.createHdaView(h).$el.hide().prependTo(i).slideDown(f.fxSpeed)}])},createHdaView:function(g){var f=g.get("id"),e=this.storage.get("expandedHdas").get(f),h=new this.HDAView({model:g,expanded:e,hasUser:this.model.hasUser(),logger:this.logger});this._setUpHdaListeners(h);this.hdaViews[f]=h;return h.render()},handleHdaDeletionChange:function(e){if(e.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(e.get("id"))}},handleHdaVisibleChange:function(e){if(e.hidden()&&!this.storage.get("show_hidden")){this.removeHdaView(e.get("id"))}},removeHdaView:function(g){var e=this,f=this.hdaViews[g];if(!f){return}f.$el.fadeOut(e.fxSpeed,function(){f.remove();delete e.hdaViews[g];if(_.isEmpty(e.hdaViews)){e.$el.find("#emptyHistoryMessage").fadeIn(e.fxSpeed)}})},render:function(g){var e=this,f;if(this.model){f=this.renderModel()}else{f=this.renderWithoutModel()}$(e).queue("fx",[function(h){if(e.$el.is(":visible")){e.$el.fadeOut(e.fxSpeed,h)}else{h()}},function(h){e.$el.empty();if(f){e.$el.append(f.children())}e.$el.fadeIn(e.fxSpeed,h)},function(h){e._setUpBehaviours();if(g){g.call(this)}}]);return this},renderModel:function(){var e=$("<div/>");e.append(c.templates.historyPanel(this.model.toJSON()));e.find("[title]").tooltip({placement:"bottom"});if(!this.model.hdas.length||!this.renderItems(e.find("#"+this.model.get("id")+"-datasets"))){e.find("#emptyHistoryMessage").show()}return e},renderWithoutModel:function(){var e=$("<div/>"),f=$("<div/>").attr("id","message-container").css({"margin-left":"4px","margin-right":"4px"});return e.append(f)},renderItems:function(f){this.hdaViews={};var e=this,g=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"));_.each(g,function(j){var i=j.get("id"),h=e.storage.get("expandedHdas").get(i);e.hdaViews[i]=new e.HDAView({model:j,expanded:h,hasUser:e.model.hasUser(),logger:e.logger});e._setUpHdaListeners(e.hdaViews[i]);f.prepend(e.hdaViews[i].render().$el)});return g.length},_setUpHdaListeners:function(f){var e=this;f.on("body-expanded",function(g){e.storage.get("expandedHdas").set(g,true)});f.on("body-collapsed",function(g){e.storage.get("expandedHdas").deleteKey(g)});f.on("error",function(h,j,g,i){e.errorHandler(h,j,g,i)})},_setUpBehaviours:function(){if(!this.model||!(this.model.get("user")&&this.model.get("user").email)){return}var e=this,f=this.$("#history-annotation-area");this.$("#history-annotate").click(function(){if(f.is(":hidden")){f.slideDown(e.fxSpeed)}else{f.slideUp(e.fxSpeed)}return false});async_save_text("history-name-container","history-name",this.model.renameUrl(),"new_name",18);async_save_text("history-annotation-container","history-annotation",this.model.annotateUrl(),"new_annotation",18,true,4)},updateHistoryDiskSize:function(){this.$el.find("#history-size").text(this.model.get("nice_size"))},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(e){e.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{})},toggleShowDeleted:function(){this.storage.set("show_deleted",!this.storage.get("show_deleted"));this.render();return this.storage.get("show_deleted")},toggleShowHidden:function(){this.storage.set("show_hidden",!this.storage.get("show_hidden"));this.render();return this.storage.get("show_hidden")},loadAndDisplayTags:function(g){this.log(this+".loadAndDisplayTags",g);var e=this,h=this.$el.find("#history-tag-area"),f=h.find(".tag-elt");this.log("\t tagArea",h," tagElt",f);if(h.is(":hidden")){if(!jQuery.trim(f.html())){$.ajax({url:e.model.tagUrl(),error:function(k,j,i){e.log("Error loading tag area html",k,j,i);e.trigger("error",e,k,null,_l("Error loading tags"))},success:function(i){f.html(i);f.find("[title]").tooltip();h.slideDown(e.fxSpeed)}})}else{h.slideDown(e.fxSpeed)}}else{h.slideUp(e.fxSpeed)}return false},showLoadingIndicator:function(f,e,g){e=(e!==undefined)?(e):(this.fxSpeed);if(!this.indicator){this.indicator=new LoadingIndicator(this.$el,this.$el.parent())}if(!this.$el.is(":visible")){this.indicator.show(0,g)}else{this.$el.fadeOut(e);this.indicator.show(e,g)}},hideLoadingIndicator:function(e,f){e=(e!==undefined)?(e):(this.fxSpeed);if(this.indicator){this.indicator.hide(e,f)}},displayMessage:function(j,k,i){var g=this;this.scrollToTop();var h=this.$el.find("#message-container"),e=$("<div/>").addClass(j+"message").html(k);if(!_.isEmpty(i)){var f=$('<a href="javascript:void(0)">Details</a>').click(function(){Galaxy.modal.show(g.messageToModalOptions(j,k,i));return false});e.append(" ",f)}return h.html(e)},messageToModalOptions:function(i,k,h){var e=this,j=$("<div/>"),g={title:"Details"};function f(l){l=_.omit(l,_.functions(l));return["<table>",_.map(l,function(n,m){n=(_.isObject(n))?(f(n)):(n);return'<tr><td style="vertical-align: top; color: grey">'+m+'</td><td style="padding-left: 8px">'+n+"</td></tr>"}).join(""),"</table>"].join("")}if(_.isObject(h)){g.body=j.append(f(h))}else{g.body=j.html(h)}g.buttons={Ok:function(){Galaxy.modal.hide();e.clearMessages()}};return g},clearMessages:function(){var e=this.$el.find("#message-container");e.empty()},scrollPosition:function(){return this.$el.parent().scrollTop()},scrollTo:function(e){this.$el.parent().scrollTop(e)},scrollToTop:function(){this.$el.parent().scrollTop(0);return this},scrollIntoView:function(f,g){if(!g){this.$el.parent().parent().scrollTop(f);return this}var e=window,h=this.$el.parent().parent(),j=$(e).innerHeight(),i=(j/2)-(g/2);$(h).scrollTop(f-i);return this},scrollToId:function(f){if((!f)||(!this.hdaViews[f])){return this}var e=this.hdaViews[f].$el;this.scrollIntoView(e.offset().top,e.outerHeight());return this},scrollToHid:function(e){var f=this.model.hdas.getByHid(e);if(!f){return this}return this.scrollToId(f.id)},connectToQuotaMeter:function(e){if(!e){return this}this.listenTo(e,"quota:over",this.showQuotaMessage);this.listenTo(e,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(e&&e.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var e=this.$el.find("#quota-message-container");if(e.is(":hidden")){e.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var e=this.$el.find("#quota-message-container");if(!e.is(":hidden")){e.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(e){if(!e){return this}this.on("new-storage",function(g,f){if(e&&g){e.findItemByHtml(_l("Include Deleted Datasets")).checked=g.get("show_deleted");e.findItemByHtml(_l("Include Hidden Datasets")).checked=g.get("show_hidden")}});return this},toString:function(){return"HistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});c.templates={historyPanel:Handlebars.templates["template-history-historyPanel"]};return{HistoryPanel:c}});
\ No newline at end of file
+define(["mvc/history/history-model","mvc/dataset/hda-base","mvc/dataset/hda-edit"],function(d,b,a){var c=Backbone.View.extend(LoggableMixin).extend({HDAView:a.HDAEditView,tagName:"div",className:"history-panel",fxSpeed:300,events:{"click #history-tag":"loadAndDisplayTags","click #message-container":"clearMessages"},initialize:function(e){e=e||{};if(e.logger){this.logger=e.logger}this.log(this+".initialize:",e);this._setUpListeners();this.hdaViews={};this.urls={};this.indicator=new LoadingIndicator(this.$el);if(this.model){this._setUpWebStorage(e.initiallyExpanded,e.show_deleted,e.show_hidden);this._setUpModelEventHandlers()}if(e.onready){e.onready.call(this)}},_setUpListeners:function(){this.on("error",function(f,i,e,h,g){this.errorHandler(f,i,e,h,g)});this.on("loading-history",function(){this.showLoadingIndicator()});this.on("loading-done",function(){this.hideLoadingIndicator()});this.once("rendered",function(){this.trigger("rendered:initial",this);return false});this.on("switched-history current-history new-history",function(){if(_.isEmpty(this.hdaViews)){this.trigger("empty-history",this)}});if(this.logger){this.on("all",function(e){this.log(this+"",arguments)},this)}},errorHandler:function(g,j,f,i,h){var e=this._parseErrorMessage(g,j,f,i,h);if(j&&j.status===0&&j.readyState===0){}else{if(j&&j.status===502){}else{if(!this.$el.find("#message-container").is(":visible")){this.once("rendered",function(){this.displayMessage("error",e.message,e.details)})}else{this.displayMessage("error",e.message,e.details)}}}},_parseErrorMessage:function(h,l,g,k,j){var f=Galaxy.currUser,e={message:this._bePolite(k),details:{user:(f instanceof User)?(f.toJSON()):(f+""),source:(h instanceof Backbone.Model)?(h.toJSON()):(h+""),xhr:l,options:(l)?(_.omit(g,"xhr")):(g)}};_.extend(e.details,j||{});if(l&&_.isFunction(l.getAllResponseHeaders)){var i=l.getAllResponseHeaders();i=_.compact(i.split("\n"));i=_.map(i,function(m){return m.split(": ")});e.details.xhr.responseHeaders=_.object(i)}return e},_bePolite:function(e){e=e||_l("An error occurred while getting updates from the server");return e+". "+_l("Please contact a Galaxy administrator if the problem persists.")},loadCurrentHistory:function(f){var e=this;return this.loadHistoryWithHDADetails("current",f).then(function(h,g){e.trigger("current-history",e)})},switchToHistory:function(h,g){var e=this,f=function(){return jQuery.post(galaxy_config.root+"api/histories/"+h+"/set_as_current")};return this.loadHistoryWithHDADetails(h,g,f).then(function(j,i){e.trigger("switched-history",e)})},createNewHistory:function(g){var e=this,f=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,g,f).then(function(i,h){e.trigger("new-history",e)})},loadHistoryWithHDADetails:function(h,g,f,j){var e=this,i=function(k){return e.getExpandedHdaIds(k.id)};return this.loadHistory(h,g,f,j,i)},loadHistory:function(h,g,f,k,i){this.trigger("loading-history",this);g=g||{};var e=this;var j=d.History.getHistoryData(h,{historyFn:f,hdaFn:k,hdaDetailIds:g.initiallyExpanded||i});return this._loadHistoryFromXHR(j,g).fail(function(n,l,m){e.trigger("error",e,n,g,_l("An error was encountered while "+l),{historyId:h,history:m||{}})}).always(function(){e.trigger("loading-done",e)})},_loadHistoryFromXHR:function(g,f){var e=this;g.then(function(h,i){e.setModel(h,i,f)});g.fail(function(i,h){e.render()});return g},setModel:function(g,e,f){f=f||{};if(this.model){this.model.clearUpdateTimeout();this.stopListening(this.model);this.stopListening(this.model.hdas)}this.hdaViews={};if(Galaxy&&Galaxy.currUser){g.user=Galaxy.currUser.toJSON()}this.model=new d.History(g,e,f);this._setUpWebStorage(f.initiallyExpanded,f.show_deleted,f.show_hidden);this._setUpModelEventHandlers();this.trigger("new-model",this);this.render();return this},refreshHdas:function(f,e){if(this.model){return this.model.refresh(f,e)}return $.when()},_setUpWebStorage:function(f,e,g){this.storage=new PersistentStorage(this._getStorageKey(this.model.get("id")),{expandedHdas:{},show_deleted:false,show_hidden:false});this.log(this+" (prev) storage:",JSON.stringify(this.storage.get(),null,2));if(f){this.storage.set("exandedHdas",f)}if((e===true)||(e===false)){this.storage.set("show_deleted",e)}if((g===true)||(g===false)){this.storage.set("show_hidden",g)}this.show_deleted=this.storage.get("show_deleted");this.show_hidden=this.storage.get("show_hidden");this.trigger("new-storage",this.storage,this);this.log(this+" (init'd) storage:",this.storage.get())},_getStorageKey:function(e){if(!e){throw new Error("_getStorageKey needs valid id: "+e)}return("history:"+e)},clearWebStorage:function(){for(var e in sessionStorage){if(e.indexOf("HistoryView.")===0){sessionStorage.removeItem(e)}}},getStoredOptions:function(f){if(!f||f==="current"){return(this.storage)?(this.storage.get()):({})}var e=sessionStorage.getItem(this._getStorageKey(f));return(e===null)?({}):(JSON.parse(e))},getExpandedHdaIds:function(e){var f=this.getStoredOptions(e).expandedHdas;return((_.isEmpty(f))?([]):(_.keys(f)))},_setUpModelEventHandlers:function(){this.model.on("error error:hdas",function(f,h,e,g){this.errorHandler(f,h,e,g)},this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("add",this.addHdaView,this);this.model.hdas.on("change:deleted",this.handleHdaDeletionChange,this);this.model.hdas.on("change:visible",this.handleHdaVisibleChange,this);this.model.hdas.on("change:purged",function(e){this.model.fetch()},this);this.model.hdas.on("state:ready",function(f,g,e){if((!f.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[f.id])}},this)},addHdaView:function(h){this.log("add."+this,h);var f=this;if(!h.isVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"))){return}$({}).queue([function g(j){var i=f.$el.find("#emptyHistoryMessage");if(i.is(":visible")){i.fadeOut(f.fxSpeed,j)}else{j()}},function e(j){f.scrollToTop();var i=f.$el.find("#"+f.model.get("id")+"-datasets");f.createHdaView(h).$el.hide().prependTo(i).slideDown(f.fxSpeed)}])},createHdaView:function(g){var f=g.get("id"),e=this.storage.get("expandedHdas").get(f),h=new this.HDAView({model:g,expanded:e,hasUser:this.model.hasUser(),logger:this.logger});this._setUpHdaListeners(h);this.hdaViews[f]=h;return h.render()},_setUpHdaListeners:function(f){var e=this;f.on("body-expanded",function(g){e.storage.get("expandedHdas").set(g,true)});f.on("body-collapsed",function(g){e.storage.get("expandedHdas").deleteKey(g)});f.on("error",function(h,j,g,i){e.errorHandler(h,j,g,i)})},handleHdaDeletionChange:function(e){if(e.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(this.hdaViews[e.id])}},handleHdaVisibleChange:function(e){if(e.hidden()&&!this.storage.get("show_hidden")){this.removeHdaView(this.hdaViews[e.id])}},removeHdaView:function(f){if(!f){return}var e=this;f.$el.fadeOut(e.fxSpeed,function(){f.off();f.remove();delete e.hdaViews[f.model.id];if(_.isEmpty(e.hdaViews)){e.$el.find("#emptyHistoryMessage").fadeIn(e.fxSpeed)}})},render:function(g){var e=this,f;if(this.model){f=this.renderModel()}else{f=this.renderWithoutModel()}$(e).queue("fx",[function(h){if(e.$el.is(":visible")){e.$el.fadeOut(e.fxSpeed,h)}else{h()}},function(h){e.$el.empty();if(f){e.$el.append(f.children())}e.$el.fadeIn(e.fxSpeed,h)},function(h){e._setUpBehaviours();if(g){g.call(this)}e.trigger("rendered",this)}]);return this},renderModel:function(){var e=$("<div/>");e.append(c.templates.historyPanel(this.model.toJSON()));e.find("[title]").tooltip({placement:"bottom"});if(!this.model.hdas.length||!this.renderItems(e.find("#"+this.model.get("id")+"-datasets"))){e.find("#emptyHistoryMessage").show()}return e},renderWithoutModel:function(){var e=$("<div/>"),f=$("<div/>").attr("id","message-container").css({"margin-left":"4px","margin-right":"4px"});return e.append(f)},renderItems:function(f){this.hdaViews={};var e=this,g=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"));_.each(g,function(h){f.prepend(e.createHdaView(h).$el)});return g.length},_setUpBehaviours:function(){if(!this.model||!(this.model.get("user")&&this.model.get("user").email)){return}var e=this,f=this.$("#history-annotation-area");this.$("#history-annotate").click(function(){if(f.is(":hidden")){f.slideDown(e.fxSpeed)}else{f.slideUp(e.fxSpeed)}return false});async_save_text("history-name-container","history-name",this.model.renameUrl(),"new_name",18);async_save_text("history-annotation-container","history-annotation",this.model.annotateUrl(),"new_annotation",18,true,4)},updateHistoryDiskSize:function(){this.$el.find("#history-size").text(this.model.get("nice_size"))},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(e){e.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{})},toggleShowDeleted:function(){this.storage.set("show_deleted",!this.storage.get("show_deleted"));this.render();return this.storage.get("show_deleted")},toggleShowHidden:function(){this.storage.set("show_hidden",!this.storage.get("show_hidden"));this.render();return this.storage.get("show_hidden")},loadAndDisplayTags:function(g){this.log(this+".loadAndDisplayTags",g);var e=this,h=this.$el.find("#history-tag-area"),f=h.find(".tag-elt");this.log("\t tagArea",h," tagElt",f);if(h.is(":hidden")){if(!jQuery.trim(f.html())){$.ajax({url:e.model.tagUrl(),error:function(k,j,i){e.log("Error loading tag area html",k,j,i);e.trigger("error",e,k,null,_l("Error loading tags"))},success:function(i){f.html(i);f.find("[title]").tooltip();h.slideDown(e.fxSpeed)}})}else{h.slideDown(e.fxSpeed)}}else{h.slideUp(e.fxSpeed)}return false},showLoadingIndicator:function(f,e,g){e=(e!==undefined)?(e):(this.fxSpeed);if(!this.indicator){this.indicator=new LoadingIndicator(this.$el,this.$el.parent())}if(!this.$el.is(":visible")){this.indicator.show(0,g)}else{this.$el.fadeOut(e);this.indicator.show(e,g)}},hideLoadingIndicator:function(e,f){e=(e!==undefined)?(e):(this.fxSpeed);if(this.indicator){this.indicator.hide(e,f)}},displayMessage:function(j,k,i){var g=this;this.scrollToTop();var h=this.$el.find("#message-container"),e=$("<div/>").addClass(j+"message").html(k);if(!_.isEmpty(i)){var f=$('<a href="javascript:void(0)">Details</a>').click(function(){Galaxy.modal.show(g.messageToModalOptions(j,k,i));return false});e.append(" ",f)}return h.html(e)},messageToModalOptions:function(i,k,h){var e=this,j=$("<div/>"),g={title:"Details"};function f(l){l=_.omit(l,_.functions(l));return["<table>",_.map(l,function(n,m){n=(_.isObject(n))?(f(n)):(n);return'<tr><td style="vertical-align: top; color: grey">'+m+'</td><td style="padding-left: 8px">'+n+"</td></tr>"}).join(""),"</table>"].join("")}if(_.isObject(h)){g.body=j.append(f(h))}else{g.body=j.html(h)}g.buttons={Ok:function(){Galaxy.modal.hide();e.clearMessages()}};return g},clearMessages:function(){var e=this.$el.find("#message-container");e.empty()},scrollPosition:function(){return this.$el.parent().scrollTop()},scrollTo:function(e){this.$el.parent().scrollTop(e)},scrollToTop:function(){this.$el.parent().scrollTop(0);return this},scrollIntoView:function(f,g){if(!g){this.$el.parent().parent().scrollTop(f);return this}var e=window,h=this.$el.parent().parent(),j=$(e).innerHeight(),i=(j/2)-(g/2);$(h).scrollTop(f-i);return this},scrollToId:function(f){if((!f)||(!this.hdaViews[f])){return this}var e=this.hdaViews[f].$el;this.scrollIntoView(e.offset().top,e.outerHeight());return this},scrollToHid:function(e){var f=this.model.hdas.getByHid(e);if(!f){return this}return this.scrollToId(f.id)},connectToQuotaMeter:function(e){if(!e){return this}this.listenTo(e,"quota:over",this.showQuotaMessage);this.listenTo(e,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(e&&e.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var e=this.$el.find("#quota-message-container");if(e.is(":hidden")){e.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var e=this.$el.find("#quota-message-container");if(!e.is(":hidden")){e.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(e){if(!e){return this}this.on("new-storage",function(g,f){if(e&&g){e.findItemByHtml(_l("Include Deleted Datasets")).checked=g.get("show_deleted");e.findItemByHtml(_l("Include Hidden Datasets")).checked=g.get("show_hidden")}});return this},toString:function(){return"HistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});c.templates={historyPanel:Handlebars.templates["template-history-historyPanel"]};return{HistoryPanel:c}});
\ 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.
1
0
commit/galaxy-central: jgoecks: Use galaxy_config.root for HDA URLs to support URL rewriting.
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7f70f02747d3/
Changeset: 7f70f02747d3
User: jgoecks
Date: 2013-10-23 18:31:52
Summary: Use galaxy_config.root for HDA URLs to support URL rewriting.
Affected #: 1 file
diff -r d3cc9a975d0e9aa1a91fc19ef33c5d3fa53d19fd -r 7f70f02747d374ebf1804a1ae380cb27968043b0 static/scripts/mvc/dataset/hda-model.js
--- a/static/scripts/mvc/dataset/hda-model.js
+++ b/static/scripts/mvc/dataset/hda-model.js
@@ -63,23 +63,23 @@
var id = this.get( 'id' );
if( !id ){ return {}; }
var urls = {
- 'delete' : '/datasets/' + id + '/delete_async',
- 'purge' : '/datasets/' + id + '/purge_async',
- 'unhide' : '/datasets/' + id + '/unhide',
- 'undelete' : '/datasets/' + id + '/undelete',
+ 'delete' : galaxy_config.root + 'datasets/' + id + '/delete_async',
+ 'purge' : galaxy_config.root + 'datasets/' + id + '/purge_async',
+ 'unhide' : galaxy_config.root + 'datasets/' + id + '/unhide',
+ 'undelete' : galaxy_config.root + 'datasets/' + id + '/undelete',
- 'display' : '/datasets/' + id + '/display/?preview=True',
- 'download' : '/datasets/' + id + '/display?to_ext=' + this.get( 'file_ext' ),
- 'edit' : '/datasets/' + id + '/edit',
- 'report_error': '/dataset/errors?id=' + id,
- 'rerun' : '/tool_runner/rerun?id=' + id,
- 'show_params': '/datasets/' + id + '/show_params',
- 'visualization': '/visualization',
+ 'display' : galaxy_config.root + 'datasets/' + id + '/display/?preview=True',
+ 'download' : galaxy_config.root + 'datasets/' + id + '/display?to_ext=' + this.get( 'file_ext' ),
+ 'edit' : galaxy_config.root + 'datasets/' + id + '/edit',
+ 'report_error': galaxy_config.root + 'dataset/errors?id=' + id,
+ 'rerun' : galaxy_config.root + 'tool_runner/rerun?id=' + id,
+ 'show_params': galaxy_config.root + 'datasets/' + id + '/show_params',
+ 'visualization': galaxy_config.root + 'visualization',
- 'annotation': { 'get': '/dataset/get_annotation_async?id=' + id,
- 'set': '/dataset/annotate_async?id=' + id },
- 'tags' : { 'get': '/tag/get_tagging_elt_async?item_id=' + id + '&item_class=HistoryDatasetAssociation',
- 'set': '/tag/retag?item_id=' + id + '&item_class=HistoryDatasetAssociation' }
+ 'annotation': { 'get': galaxy_config.root + 'dataset/get_annotation_async?id=' + id,
+ 'set': galaxy_config.root + 'dataset/annotate_async?id=' + id },
+ 'tags' : { 'get': galaxy_config.root + 'tag/get_tagging_elt_async?item_id=' + id + '&item_class=HistoryDatasetAssociation',
+ 'set': galaxy_config.root + 'tag/retag?item_id=' + id + '&item_class=HistoryDatasetAssociation' }
};
//'meta_download': '/dataset/get_metadata_file?hda_id=%3C%25%3D+id+%25%3E&metadata_name=%3C%25%3D+file_type+%25%3E',
var meta_files = this.get( 'meta_files' );
@@ -87,7 +87,7 @@
urls.meta_download = _.map( meta_files, function( meta_file ){
return {
//url : _.template( urlTemplate, { id: modelJson.id, file_type: meta_file.file_type }),
- url : '/dataset/get_metadata_file?hda_id=' + id + '&metadata_name=' + meta_file.file_type,
+ url : galaxy_config.root + 'dataset/get_metadata_file?hda_id=' + id + '&metadata_name=' + meta_file.file_type,
file_type : meta_file.file_type
};
});
@@ -306,7 +306,7 @@
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
//logger : console,
- urlRoot : '/api/histories',
+ urlRoot : galaxy_config.root + 'api/histories',
url : function(){
return this.urlRoot + '/' + this.historyId + '/contents';
},
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.
1
0
commit/galaxy-central: jgoecks: Use galaxy_config.root for history URLs to support URL rewriting.
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d3cc9a975d0e/
Changeset: d3cc9a975d0e
User: jgoecks
Date: 2013-10-23 18:22:43
Summary: Use galaxy_config.root for history URLs to support URL rewriting.
Affected #: 2 files
diff -r 5d138db3d1e52e364fd3c69c321ea44bac8373eb -r d3cc9a975d0e9aa1a91fc19ef33c5d3fa53d19fd static/scripts/mvc/history/history-model.js
--- a/static/scripts/mvc/history/history-model.js
+++ b/static/scripts/mvc/history/history-model.js
@@ -207,7 +207,7 @@
function getHistory( id ){
// get the history data
//return jQuery.ajax( '/generate_json_error' );
- return jQuery.ajax( '/api/histories/' + historyId );
+ return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyId );
}
function countHdasFromHistory( historyData ){
// get the number of hdas accrd. to the history
@@ -225,7 +225,7 @@
hdaDetailIds = hdaDetailIds( historyData );
}
var data = ( hdaDetailIds.length )?( { details : hdaDetailIds.join( ',' ) } ):( {} );
- return jQuery.ajax( '/api/histories/' + historyData.id + '/contents', { data: data });
+ return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyData.id + '/contents', { data: data });
//return jQuery.ajax( '/generate_json_error' );
}
diff -r 5d138db3d1e52e364fd3c69c321ea44bac8373eb -r d3cc9a975d0e9aa1a91fc19ef33c5d3fa53d19fd static/scripts/mvc/history/history-panel.js
--- a/static/scripts/mvc/history/history-panel.js
+++ b/static/scripts/mvc/history/history-panel.js
@@ -291,7 +291,7 @@
var panel = this,
historyFn = function(){
// make this current and get history data with one call
- return jQuery.post( '/api/histories/' + historyId + '/set_as_current' );
+ return jQuery.post( galaxy_config.root + 'api/histories/' + historyId + '/set_as_current' );
};
return this.loadHistoryWithHDADetails( historyId, attributes, historyFn )
.then(function( historyData, hdaData ){
@@ -314,7 +314,7 @@
var panel = this,
historyFn = function(){
// get history data from posting a new history (and setting it to current)
- return jQuery.post( '/api/histories', { current: true });
+ return jQuery.post( galaxy_config.root + 'api/histories', { current: true });
};
// id undefined bc there is no historyId yet - the server will provide
// (no need for details - nothing expanded in new history)
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.
1
0
commit/galaxy-central: jgoecks: Use galaxy_config.root for history URLs to support URL rewriting.
by commits-noreply@bitbucket.org 23 Oct '13
by commits-noreply@bitbucket.org 23 Oct '13
23 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5d138db3d1e5/
Changeset: 5d138db3d1e5
User: jgoecks
Date: 2013-10-23 18:11:58
Summary: Use galaxy_config.root for history URLs to support URL rewriting.
Affected #: 1 file
diff -r 06d5abc6d40748a41493d2beac87fc1cb81f5bf6 -r 5d138db3d1e52e364fd3c69c321ea44bac8373eb static/scripts/mvc/history/history-model.js
--- a/static/scripts/mvc/history/history-model.js
+++ b/static/scripts/mvc/history/history-model.js
@@ -31,23 +31,23 @@
},
// ........................................................................ urls
- urlRoot: 'api/histories',
+ urlRoot: galaxy_config.root + 'api/histories',
renameUrl : function(){
//TODO: just use this.save()
var id = this.get( 'id' );
if( !id ){ return undefined; }
- return '/history/rename_async?id=' + this.get( 'id' );
+ return galaxy_config.root + 'history/rename_async?id=' + this.get( 'id' );
},
annotateUrl : function(){
var id = this.get( 'id' );
if( !id ){ return undefined; }
- return '/history/annotate_async?id=' + this.get( 'id' );
+ return galaxy_config.root + 'history/annotate_async?id=' + this.get( 'id' );
},
tagUrl : function(){
var id = this.get( 'id' );
if( !id ){ return undefined; }
- return '/tag/get_tagging_elt_async?item_id=' + this.get( 'id' ) + '&item_class=History';
+ return galaxy_config.root + 'tag/get_tagging_elt_async?item_id=' + this.get( 'id' ) + '&item_class=History';
},
// ........................................................................ set up/tear down
@@ -276,7 +276,7 @@
var HistoryCollection = Backbone.Collection.extend( LoggableMixin ).extend(
/** @lends HistoryCollection.prototype */{
model : History,
- urlRoot : 'api/histories'
+ urlRoot : galaxy_config.root + 'api/histories'
///** logger used to record this.log messages, commonly set to console */
//// comment this out to suppress log output
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.
1
0