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
13 Oct '14
Branch: refs/heads/master
Home: https://github.com/galaxyproject/usegalaxy-playbook
Commit: 3088f2a4163a7c00ea95a2b79fddb13140514c53
https://github.com/galaxyproject/usegalaxy-playbook/commit/3088f2a4163a7c00…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-10-13 (Mon, 13 Oct 2014)
Changed paths:
M files/galaxy/usegalaxy.org/dynamic_rules/reserved.py
M templates/galaxy/usegalaxy.org/config/job_conf.xml.j2
Log Message:
-----------
Job conf updates for Rodeo.
Commit: 1425812883a708f6b5db52424877131d778057c6
https://github.com/galaxyproject/usegalaxy-playbook/commit/1425812883a708f6…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-10-13 (Mon, 13 Oct 2014)
Changed paths:
M stage/group_vars/all.yml
Log Message:
-----------
Update Test.
Commit: 288841a0899cd5840877343c2236658352a61160
https://github.com/galaxyproject/usegalaxy-playbook/commit/288841a0899cd584…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-10-13 (Mon, 13 Oct 2014)
Changed paths:
M templates/galaxy/usegalaxy.org/config/job_conf.xml.j2
Log Message:
-----------
Fix job conf (there were some unfinished changes in there).
Commit: bf815e533408071a72c328b777d823f3eb9e0b67
https://github.com/galaxyproject/usegalaxy-playbook/commit/bf815e533408071a…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-10-13 (Mon, 13 Oct 2014)
Changed paths:
M templates/galaxy/usegalaxy.org/config/job_conf.xml.j2
Log Message:
-----------
Fix concurrency.
Commit: 563afb451eb64a90d303867434159534b16b88fb
https://github.com/galaxyproject/usegalaxy-playbook/commit/563afb451eb64a90…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-10-13 (Mon, 13 Oct 2014)
Changed paths:
M production/group_vars/all.yml
Log Message:
-----------
Update Main.
Compare: https://github.com/galaxyproject/usegalaxy-playbook/compare/6f878bbac19e...…
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1744b7d8e9ab/
Changeset: 1744b7d8e9ab
Branch: stable
User: natefoo
Date: 2014-10-14 00:48:30+00:00
Summary: Merge closed duplicate stable head with current stable.
Affected #: 2 files
diff -r 4a550ab8a4b2c0a45b48732edde703010a7c7509 -r 1744b7d8e9ab619d78c0516f9ccb093b0a814163 lib/galaxy/webapps/reports/buildapp.py
--- a/lib/galaxy/webapps/reports/buildapp.py
+++ b/lib/galaxy/webapps/reports/buildapp.py
@@ -3,22 +3,19 @@
"""
import logging, atexit
-import os, os.path, sys
+import os, os.path
from inspect import isclass
-from paste.request import parse_formvars
-from paste.util import import_string
from paste import httpexceptions
import pkg_resources
from galaxy.util import asbool
-import config
import galaxy.model
import galaxy.model.mapping
-import galaxy.web.framework
+import galaxy.web.framework.webapp
log = logging.getLogger( __name__ )
@@ -31,7 +28,6 @@
them to the webapp.
"""
from galaxy.web.base.controller import BaseUIController
- from galaxy.web.base.controller import ControllerUnavailable
import galaxy.webapps.reports.controllers
controller_dir = galaxy.webapps.reports.controllers.__path__[0]
for fname in os.listdir( controller_dir ):
https://bitbucket.org/galaxy/galaxy-central/commits/dbee027f7410/
Changeset: dbee027f7410
User: natefoo
Date: 2014-10-14 00:49:02+00:00
Summary: Merge stable.
Affected #: 2 files
diff -r 3f42dfab2cee4706551c9ca0211e7cd08e35058b -r dbee027f74101741533851ce2634b60adca4c454 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac latest_2014.10.06
+cb0c2ea402e4c82c7872177e874ce59de29c9c13 latest_2014.10.06
diff -r 3f42dfab2cee4706551c9ca0211e7cd08e35058b -r dbee027f74101741533851ce2634b60adca4c454 lib/galaxy/webapps/reports/buildapp.py
--- a/lib/galaxy/webapps/reports/buildapp.py
+++ b/lib/galaxy/webapps/reports/buildapp.py
@@ -3,22 +3,19 @@
"""
import logging, atexit
-import os, os.path, sys
+import os, os.path
from inspect import isclass
-from paste.request import parse_formvars
-from paste.util import import_string
from paste import httpexceptions
import pkg_resources
from galaxy.util import asbool
-import config
import galaxy.model
import galaxy.model.mapping
-import galaxy.web.framework
+import galaxy.web.framework.webapp
log = logging.getLogger( __name__ )
@@ -31,7 +28,6 @@
them to the webapp.
"""
from galaxy.web.base.controller import BaseUIController
- from galaxy.web.base.controller import ControllerUnavailable
import galaxy.webapps.reports.controllers
controller_dir = galaxy.webapps.reports.controllers.__path__[0]
for fname in os.listdir( controller_dir ):
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: davebgx: Additional fixes for install and test framework.
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3f42dfab2cee/
Changeset: 3f42dfab2cee
User: davebgx
Date: 2014-10-13 20:07:29+00:00
Summary: Additional fixes for install and test framework.
Affected #: 2 files
diff -r 67050bf7b3cff0e482bd6ed15b286864ffc77ae5 -r 3f42dfab2cee4706551c9ca0211e7cd08e35058b test/install_and_test_tool_shed_repositories/base/util.py
--- a/test/install_and_test_tool_shed_repositories/base/util.py
+++ b/test/install_and_test_tool_shed_repositories/base/util.py
@@ -118,7 +118,8 @@
tool_data_table_conf = None
# Set up default tool data tables. If a non-sample version is in config/, use that. Otherwise iterate through lower
# priority versions.
-for conf in [ 'config/tool_data_table_conf.xml',
+for conf in [ 'tool_data_table_conf.test.xml',
+ 'config/tool_data_table_conf.xml',
'config/tool_data_table_conf.xml.sample',
'tool_data_table_conf.xml',
'tool_data_table_conf.xml.sample' ]:
diff -r 67050bf7b3cff0e482bd6ed15b286864ffc77ae5 -r 3f42dfab2cee4706551c9ca0211e7cd08e35058b test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py
--- a/test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py
@@ -332,13 +332,14 @@
template_path = "templates",
tool_config_file = ','.join( [ galaxy_tool_conf_file, galaxy_shed_tool_conf_file ] ),
tool_data_path = tool_data_path,
- tool_data_table_config_path = galaxy_tool_data_table_conf_file,
tool_dependency_dir = tool_dependency_dir,
tool_path = tool_path,
tool_parse_help = False,
tool_sheds_config_file = galaxy_tool_sheds_conf_file,
update_integrated_tool_panel = False,
use_heartbeat = False )
+ if os.path.exists( galaxy_tool_data_table_conf_file ):
+ kwargs[ 'tool_data_table_config_path' ] = galaxy_tool_data_table_conf_file
galaxy_config_file = os.environ.get( 'GALAXY_INSTALL_TEST_INI_FILE', None )
# If the user has passed in a path for the .ini file, do not overwrite it.
if not galaxy_config_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: natefoo: Update tag latest_2014.10.06 for changeset cb0c2ea402e4
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4a550ab8a4b2/
Changeset: 4a550ab8a4b2
Branch: stable
User: natefoo
Date: 2014-10-13 19:00:25+00:00
Summary: Update tag latest_2014.10.06 for changeset cb0c2ea402e4
Affected #: 1 file
diff -r cb0c2ea402e4c82c7872177e874ce59de29c9c13 -r 4a550ab8a4b2c0a45b48732edde703010a7c7509 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac latest_2014.10.06
+cb0c2ea402e4c82c7872177e874ce59de29c9c13 latest_2014.10.06
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: Merged in dannon/galaxy-central-prmaker/stable (pull request #527)
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/67050bf7b3cf/
Changeset: 67050bf7b3cf
User: dannon
Date: 2014-10-13 18:01:54+00:00
Summary: Merged in dannon/galaxy-central-prmaker/stable (pull request #527)
[STABLE] Relocate job_lock from the queue to the JobManager itself. This fixes NoopQueue not having a job_lock errors seen in Admin->Jobs
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/cb0c2ea402e4/
Changeset: cb0c2ea402e4
Branch: stable
User: dannon
Date: 2014-10-13 14:19:32+00:00
Summary: Relocate job_lock from the queue to the JobManager itself. This fixes NoopQueue not having a job_lock errors seen in Admin->Jobs
Affected #: 4 files
diff -r 7436bde1f7850762bcceb3a30fb4a3eceac42523 -r cb0c2ea402e4c82c7872177e874ce59de29c9c13 lib/galaxy/jobs/handler.py
--- a/lib/galaxy/jobs/handler.py
+++ b/lib/galaxy/jobs/handler.py
@@ -53,7 +53,6 @@
"""Start the job manager"""
self.app = app
self.dispatcher = dispatcher
- self.job_lock = False
self.sa_session = app.model.context
self.track_jobs_in_database = self.app.config.track_jobs_in_database
@@ -174,7 +173,7 @@
try:
# If jobs are locked, there's nothing to monitor and we skip
# to the sleep.
- if not self.job_lock:
+ if not self.app.job_manager.job_lock:
self.__monitor_step()
except:
log.exception( "Exception in monitor_step" )
diff -r 7436bde1f7850762bcceb3a30fb4a3eceac42523 -r cb0c2ea402e4c82c7872177e874ce59de29c9c13 lib/galaxy/jobs/manager.py
--- a/lib/galaxy/jobs/manager.py
+++ b/lib/galaxy/jobs/manager.py
@@ -26,6 +26,7 @@
else:
self.job_handler = NoopHandler()
self.job_queue = self.job_stop_queue = NoopQueue()
+ self.job_lock = False
self.job_handler.start()
def shutdown( self ):
diff -r 7436bde1f7850762bcceb3a30fb4a3eceac42523 -r cb0c2ea402e4c82c7872177e874ce59de29c9c13 lib/galaxy/queue_worker.py
--- a/lib/galaxy/queue_worker.py
+++ b/lib/galaxy/queue_worker.py
@@ -110,7 +110,7 @@
job_lock = kwargs.get('job_lock', False)
# job_queue is exposed in the root app, but this will be 'fixed' at some
# point, so we're using the reference from the handler.
- app.job_manager.job_handler.job_queue.job_lock = job_lock
+ app.job_manager.job_lock = job_lock
log.info("Administrative Job Lock is now set to %s. Jobs will %s dispatch."
% (job_lock, "not" if job_lock else "now"))
diff -r 7436bde1f7850762bcceb3a30fb4a3eceac42523 -r cb0c2ea402e4c82c7872177e874ce59de29c9c13 lib/galaxy/web/base/controllers/admin.py
--- a/lib/galaxy/web/base/controllers/admin.py
+++ b/lib/galaxy/web/base/controllers/admin.py
@@ -1107,7 +1107,7 @@
kwargs={'job_lock': False } )
job_lock = False
else:
- job_lock = trans.app.job_manager.job_handler.job_queue.job_lock
+ job_lock = trans.app.job_manager.job_lock
cutoff_time = datetime.utcnow() - timedelta( seconds=int( cutoff ) )
jobs = trans.sa_session.query( trans.app.model.Job ) \
.filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time,
https://bitbucket.org/galaxy/galaxy-central/commits/67050bf7b3cf/
Changeset: 67050bf7b3cf
User: dannon
Date: 2014-10-13 18:01:54+00:00
Summary: Merged in dannon/galaxy-central-prmaker/stable (pull request #527)
[STABLE] Relocate job_lock from the queue to the JobManager itself. This fixes NoopQueue not having a job_lock errors seen in Admin->Jobs
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
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/85ca6ed4af00/
Changeset: 85ca6ed4af00
Branch: stable
User: dan
Date: 2014-10-13 17:54:05+00:00
Summary: Close branch 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
commit/galaxy-central: nsoranzo: Fix import bug for run_reports.sh . Remove unused imports.
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ea936c90b939/
Changeset: ea936c90b939
Branch: stable
User: nsoranzo
Date: 2014-10-13 16:27:45+00:00
Summary: Fix import bug for run_reports.sh . Remove unused imports.
Import bug:
File "/opt/galaxy-central/lib/galaxy/webapps/reports/buildapp.py", line 25, in <module>
class ReportsWebApplication( galaxy.web.framework.webapp.WebApplication ):
AttributeError: 'module' object has no attribute 'webapp'
The bug was introduced by commit d57655849ac4 .
Affected #: 1 file
diff -r 0215d23d79717f46e7715e209048606975693dd7 -r ea936c90b93933326dc3b163aaca361b5cafb5b7 lib/galaxy/webapps/reports/buildapp.py
--- a/lib/galaxy/webapps/reports/buildapp.py
+++ b/lib/galaxy/webapps/reports/buildapp.py
@@ -3,22 +3,19 @@
"""
import logging, atexit
-import os, os.path, sys
+import os, os.path
from inspect import isclass
-from paste.request import parse_formvars
-from paste.util import import_string
from paste import httpexceptions
import pkg_resources
from galaxy.util import asbool
-import config
import galaxy.model
import galaxy.model.mapping
-import galaxy.web.framework
+import galaxy.web.framework.webapp
log = logging.getLogger( __name__ )
@@ -31,7 +28,6 @@
them to the webapp.
"""
from galaxy.web.base.controller import BaseUIController
- from galaxy.web.base.controller import ControllerUnavailable
import galaxy.webapps.reports.controllers
controller_dir = galaxy.webapps.reports.controllers.__path__[0]
for fname in os.listdir( controller_dir ):
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: Fix Xslx binary (bad merge?).
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/861fd5d6c459/
Changeset: 861fd5d6c459
User: dannon
Date: 2014-10-13 16:55:31+00:00
Summary: Fix Xslx binary (bad merge?).
Affected #: 1 file
diff -r be638dd2f087e895bb611a132999ec8309db0c03 -r 861fd5d6c459284aed91a2c92a01e5cd09064c18 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -281,22 +281,6 @@
return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) )
-class Xlsx(Binary):
- """Class for Excel 2007 (xlsx) files"""
- file_ext="xlsx"
- def sniff( self, filename ):
- # Xlsx is compressed in zip format and must not be uncompressed in Galaxy.
- try:
- if zipfile.is_zipfile( filename ):
- tempzip = zipfile.ZipFile( filename )
- if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1:
- return True
- return False
- except:
- return False
-
-Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx)
-
# ------------- Dataproviders
# pipe through samtools view
@@ -639,3 +623,19 @@
Binary.register_sniffable_binary_format("sqlite", "sqlite", SQlite)
+class Xlsx(Binary):
+ """Class for Excel 2007 (xlsx) files"""
+ file_ext="xlsx"
+ def sniff( self, filename ):
+ # Xlsx is compressed in zip format and must not be uncompressed in Galaxy.
+ try:
+ if zipfile.is_zipfile( filename ):
+ tempzip = zipfile.ZipFile( filename )
+ if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1:
+ return True
+ return False
+ except:
+ return False
+
+Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx)
+
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/701c01f794e2/
Changeset: 701c01f794e2
User: dannon
Date: 2014-10-13 14:44:11+00:00
Summary: Simplify to_json_string/from_json_string; without the extra logging there's no reason to wrap the functions and pass args
Affected #: 1 file
diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 701c01f794e2fc6cf5586fde68a0d7a33a161790 lib/galaxy/util/json.py
--- a/lib/galaxy/util/json.py
+++ b/lib/galaxy/util/json.py
@@ -15,13 +15,8 @@
log = logging.getLogger( __name__ )
-
-def to_json_string(*args, **kwargs):
- return json.dumps(*args, **kwargs)
-
-
-def from_json_string(*args, **kwargs):
- return json.loads(*args, **kwargs)
+to_json_string = dumps
+from_json_string = loads
def json_fix( val ):
https://bitbucket.org/galaxy/galaxy-central/commits/cce814e5b0fe/
Changeset: cce814e5b0fe
Branch: docker-work
User: dannon
Date: 2014-10-13 15:24:21+00:00
Summary: Branch prune.
Affected #: 0 files
https://bitbucket.org/galaxy/galaxy-central/commits/be638dd2f087/
Changeset: be638dd2f087
User: dannon
Date: 2014-10-13 15:24:36+00:00
Summary: Merge.
Affected #: 1 file
diff -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 -r be638dd2f087e895bb611a132999ec8309db0c03 lib/galaxy/util/json.py
--- a/lib/galaxy/util/json.py
+++ b/lib/galaxy/util/json.py
@@ -15,13 +15,8 @@
log = logging.getLogger( __name__ )
-
-def to_json_string(*args, **kwargs):
- return json.dumps(*args, **kwargs)
-
-
-def from_json_string(*args, **kwargs):
- return json.loads(*args, **kwargs)
+to_json_string = dumps
+from_json_string = loads
def json_fix( val ):
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: Merged in kellrott/galaxy-farm/docker-work (pull request #525)
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/82ce88b096ff/
Changeset: 82ce88b096ff
User: dannon
Date: 2014-10-13 15:23:42+00:00
Summary: Merged in kellrott/galaxy-farm/docker-work (pull request #525)
Adding 'set user' flag to docker calls
Affected #: 3 files
diff -r 16425b81c25e3d806a9e5594773612599e68b785 -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 config/job_conf.xml.sample_advanced
--- a/config/job_conf.xml.sample_advanced
+++ b/config/job_conf.xml.sample_advanced
@@ -196,7 +196,8 @@
adding the '\-\-rm' flag to the command line, the container
will be removed automatically after the program is complete.
-->
- <!-- <param id="docker_auto_rm">false</param> -->
+ <!-- <param id="docker_auto_rm">true</param> -->
+ <!-- <param id="docker_set_user">true</param> --><!-- Following command can be used to tweak docker command. --><!-- <param id="docker_cmd">/usr/local/custom_docker/docker</param> --><!-- Following can be used to connect to docke server in different
diff -r 16425b81c25e3d806a9e5594773612599e68b785 -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 lib/galaxy/tools/deps/containers.py
--- a/lib/galaxy/tools/deps/containers.py
+++ b/lib/galaxy/tools/deps/containers.py
@@ -243,7 +243,8 @@
env_directives=env_directives,
working_directory=working_directory,
net=prop("net", "none"), # By default, docker instance has networking disabled
- auto_rm=prop("auto_rm", docker_util.DEFAULT_AUTO_REMOVE),
+ auto_rm=asbool(prop("auto_rm", docker_util.DEFAULT_AUTO_REMOVE)),
+ set_user=asbool(prop("set_user", docker_util.DEFAULT_SET_USER)),
**docker_host_props
)
return "%s\n%s" % (cache_command, run_command)
diff -r 16425b81c25e3d806a9e5594773612599e68b785 -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 lib/galaxy/tools/deps/docker_util.py
--- a/lib/galaxy/tools/deps/docker_util.py
+++ b/lib/galaxy/tools/deps/docker_util.py
@@ -10,6 +10,7 @@
DEFAULT_MEMORY = None
DEFAULT_VOLUMES_FROM = None
DEFAULT_AUTO_REMOVE = True
+DEFAULT_SET_USER = True
class DockerVolume(object):
@@ -119,6 +120,7 @@
sudo=DEFAULT_SUDO,
sudo_cmd=DEFAULT_SUDO_COMMAND,
auto_rm=DEFAULT_AUTO_REMOVE,
+ set_user=DEFAULT_SET_USER,
host=DEFAULT_HOST,
):
command_parts = __docker_prefix(
@@ -146,6 +148,8 @@
command_parts.extend(["--net", net])
if auto_rm:
command_parts.append("--rm")
+ if set_user:
+ command_parts.extend(["-u", str(os.geteuid())])
full_image = image
if tag:
full_image = "%s:%s" % (full_image, tag)
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/7fa4a243b126/
Changeset: 7fa4a243b126
Branch: docker-work
User: kell...(a)gmail.com
Date: 2014-10-12 04:40:15+00:00
Summary: Adding docker_set_user option so that docker jobs will be run with the '-u <current user>' flag so docker container commands don't run as root.
Affected #: 3 files
diff -r db93990f8def9e20c979337dbca0ef1e7e06f400 -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 config/job_conf.xml.sample_advanced
--- a/config/job_conf.xml.sample_advanced
+++ b/config/job_conf.xml.sample_advanced
@@ -196,7 +196,8 @@
adding the '--rm' flag to the command line, the container
will be removed automatically after the program is complete.
-->
- <!-- <param id="docker_auto_rm">false</param> -->
+ <!-- <param id="docker_auto_rm">true</param> -->
+ <!-- <param id="docker_set_user">true</param> --><!-- Following command can be used to tweak docker command. --><!-- <param id="docker_cmd">/usr/local/custom_docker/docker</param> --><!-- Following can be used to connect to docke server in different
diff -r db93990f8def9e20c979337dbca0ef1e7e06f400 -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 lib/galaxy/tools/deps/containers.py
--- a/lib/galaxy/tools/deps/containers.py
+++ b/lib/galaxy/tools/deps/containers.py
@@ -208,7 +208,8 @@
env_directives=env_directives,
working_directory=working_directory,
net=prop("net", "none"), # By default, docker instance has networking disabled
- auto_rm=prop("auto_rm", docker_util.DEFAULT_AUTO_REMOVE),
+ auto_rm=asbool(prop("auto_rm", docker_util.DEFAULT_AUTO_REMOVE)),
+ set_user=asbool(prop("set_user", docker_util.DEFAULT_SET_USER)),
**docker_host_props
)
return "%s\n%s" % (cache_command, run_command)
diff -r db93990f8def9e20c979337dbca0ef1e7e06f400 -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 lib/galaxy/tools/deps/docker_util.py
--- a/lib/galaxy/tools/deps/docker_util.py
+++ b/lib/galaxy/tools/deps/docker_util.py
@@ -1,3 +1,5 @@
+
+import os
DEFAULT_DOCKER_COMMAND = "docker"
DEFAULT_SUDO = True
@@ -9,6 +11,7 @@
DEFAULT_MEMORY = None
DEFAULT_VOLUMES_FROM = None
DEFAULT_AUTO_REMOVE = True
+DEFAULT_SET_USER = True
class DockerVolume(object):
@@ -84,6 +87,7 @@
sudo=DEFAULT_SUDO,
sudo_cmd=DEFAULT_SUDO_COMMAND,
auto_rm=DEFAULT_AUTO_REMOVE,
+ set_user=DEFAULT_SET_USER,
host=DEFAULT_HOST,
):
command_parts = __docker_prefix(docker_cmd, sudo, sudo_cmd, host)
@@ -104,6 +108,8 @@
command_parts.extend(["--net", net])
if auto_rm:
command_parts.append("--rm")
+ if set_user:
+ command_parts.extend(["-u", str(os.geteuid())])
full_image = image
if tag:
full_image = "%s:%s" % (full_image, tag)
https://bitbucket.org/galaxy/galaxy-central/commits/ba656141a2d7/
Changeset: ba656141a2d7
Branch: docker-work
User: kell...(a)gmail.com
Date: 2014-10-12 04:48:02+00:00
Summary: Merging default
Affected #: 89 files
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -19,3 +19,5 @@
2a756ca2cb1826db7796018e77d12e2dd7b67603 latest_2014.02.10
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
+2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
+0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac latest_2014.10.06
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/galaxy.library.js
--- a/client/galaxy/scripts/galaxy.library.js
+++ b/client/galaxy/scripts/galaxy.library.js
@@ -16,19 +16,19 @@
"mvc/library/library-library-view",
"mvc/library/library-folder-view"
],
-function(mod_masthead,
- mod_utils,
- mod_toastr,
- mod_baseMVC,
- mod_library_model,
- mod_folderlist_view,
- mod_librarylist_view,
- mod_librarytoolbar_view,
- mod_foldertoolbar_view,
- mod_library_dataset_view,
- mod_library_library_view,
- mod_library_folder_view
- ) {
+ function(mod_masthead,
+ mod_utils,
+ mod_toastr,
+ mod_baseMVC,
+ mod_library_model,
+ mod_folderlist_view,
+ mod_librarylist_view,
+ mod_librarytoolbar_view,
+ mod_foldertoolbar_view,
+ mod_library_dataset_view,
+ mod_library_library_view,
+ mod_library_folder_view
+ ) {
// ============================================================================
// ROUTER
@@ -37,10 +37,11 @@
this.routesHit = 0;
//keep count of number of routes handled by the application
Backbone.history.on('route', function() { this.routesHit++; }, this);
- },
+},
- routes: {
+routes: {
"" : "libraries",
+ "page/:show_page" : "libraries_page",
"library/:library_id/permissions" : "library_permissions",
"folders/:folder_id/permissions" : "folder_permissions",
"folders/:id" : "folder_content",
@@ -49,27 +50,28 @@
"folders/:folder_id/datasets/:dataset_id/versions/:ldda_id" : "dataset_version",
"folders/:folder_id/download/:format" : "download",
"folders/:folder_id/import/:source" : "import_datasets"
- },
+},
- back: function() {
+back: function() {
if(this.routesHit > 1) {
//more than one route hit -> user did not land to current page directly
window.history.back();
- } else {
+ } else {
//otherwise go to the home page. Use replaceState if available so
//the navigation doesn't create an extra history entry
this.navigate('#', {trigger:true, replace:true});
- }
}
+}
});
// ============================================================================
/** session storage for library preferences */
var LibraryPrefs = mod_baseMVC.SessionStorageModel.extend({
defaults : {
- with_deleted : false,
- sort_order : 'asc',
- sort_by : 'name'
+ with_deleted : false,
+ sort_order : 'asc',
+ sort_by : 'name',
+ library_page_size : 20
}
});
@@ -88,77 +90,86 @@
initialize : function(){
Galaxy.libraries = this;
- this.preferences = new LibraryPrefs( {id: 'global-lib-prefs'} );
+ this.preferences = new LibraryPrefs( { id: 'global-lib-prefs' } );
this.library_router = new LibraryRouter();
this.library_router.on('route:libraries', function() {
Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView();
+ });
+
+ this.library_router.on('route:libraries_page', function( show_page ) {
+ if ( Galaxy.libraries.libraryToolbarView === null ){
+ Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
+ Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView( { show_page: show_page } );
+ } else {
+ Galaxy.libraries.libraryListView.render( { show_page: show_page } )
+ }
});
this.library_router.on('route:folder_content', function(id) {
if (Galaxy.libraries.folderToolbarView){
Galaxy.libraries.folderToolbarView.$el.unbind('click');
- }
- Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: id});
- Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: id});
- });
+ }
+ Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: id});
+ Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: id});
+ });
- this.library_router.on('route:download', function(folder_id, format) {
+ this.library_router.on('route:download', function(folder_id, format) {
if ($('#folder_list_body').find(':checked').length === 0) {
mod_toastr.info( 'You must select at least one dataset to download' );
Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: true, replace: true});
- } else {
+ } else {
Galaxy.libraries.folderToolbarView.download(folder_id, format);
Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: false, replace: true});
- }
- });
+ }
+ });
- this.library_router.on('route:dataset_detail', function(folder_id, dataset_id){
+ this.library_router.on('route:dataset_detail', function(folder_id, dataset_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id});
- });
- this.library_router.on('route:dataset_version', function(folder_id, dataset_id, ldda_id){
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id});
+ });
+ this.library_router.on('route:dataset_version', function(folder_id, dataset_id, ldda_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, ldda_id: ldda_id, show_version: true});
- });
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, ldda_id: ldda_id, show_version: true});
+ });
- this.library_router.on('route:dataset_permissions', function(folder_id, dataset_id){
+ this.library_router.on('route:dataset_permissions', function(folder_id, dataset_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, show_permissions: true});
- });
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, show_permissions: true});
+ });
- this.library_router.on('route:library_permissions', function(library_id){
+ this.library_router.on('route:library_permissions', function(library_id){
if (Galaxy.libraries.libraryView){
Galaxy.libraries.libraryView.$el.unbind('click');
- }
- Galaxy.libraries.libraryView = new mod_library_library_view.LibraryView({id: library_id, show_permissions: true});
- });
+ }
+ Galaxy.libraries.libraryView = new mod_library_library_view.LibraryView({id: library_id, show_permissions: true});
+ });
- this.library_router.on('route:folder_permissions', function(folder_id){
+ this.library_router.on('route:folder_permissions', function(folder_id){
if (Galaxy.libraries.folderView){
Galaxy.libraries.folderView.$el.unbind('click');
- }
- Galaxy.libraries.folderView = new mod_library_folder_view.FolderView({id: folder_id, show_permissions: true});
- });
- this.library_router.on('route:import_datasets', function(folder_id, source){
+ }
+ Galaxy.libraries.folderView = new mod_library_folder_view.FolderView({id: folder_id, show_permissions: true});
+ });
+ this.library_router.on('route:import_datasets', function(folder_id, source){
if (Galaxy.libraries.folderToolbarView && Galaxy.libraries.folderListView){
Galaxy.libraries.folderToolbarView.showImportModal({source:source});
- } else {
+ } else {
Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: folder_id});
Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: folder_id});
Galaxy.libraries.folderToolbarView.showImportModal({source: source});
- }
- });
+ }
+ });
- Backbone.history.start({pushState: false});
+ Backbone.history.start({pushState: false});
}
});
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
--- a/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
@@ -72,7 +72,7 @@
},
render: function(options){
- this.options = _.extend(this.options, options);
+ this.options = _.extend( this.options, options );
var toolbar_template = this.templateToolBar();
var template_defaults = {
id: this.options.id,
@@ -346,18 +346,18 @@
this.modal = Galaxy.modal;
var template_modal = this.templateImportPathModal();
this.modal.show({
- closing_events : true,
- title : 'Please enter paths to import',
- body : template_modal({}),
- buttons : {
- 'Import' : function() {that.importFromPathsClicked(that);},
- 'Close' : function() {Galaxy.modal.hide();}
- },
- closing_callback: function(){
- // TODO: should not trigger routes outside of the router
- Galaxy.libraries.library_router.navigate('folders/' + that.id, {trigger: true});
- }
- });
+ closing_events : true,
+ title : 'Please enter paths to import',
+ body : template_modal({}),
+ buttons : {
+ 'Import' : function() { that.importFromPathsClicked(that); },
+ 'Close' : function() { Galaxy.modal.hide(); }
+ },
+ closing_callback: function(){
+ // TODO: should not trigger routes outside of the router
+ Galaxy.libraries.library_router.navigate( 'folders/' + that.id, { trigger: true } );
+ }
+ });
this.renderSelectBoxes();
},
@@ -367,34 +367,37 @@
*/
fetchExtAndGenomes: function(){
var that = this;
- mod_utils.get(galaxy_config.root + "api/datatypes?extension_only=False",
- function(datatypes) {
- for (key in datatypes) {
- that.list_extensions.push({
- id : datatypes[key].extension,
- text : datatypes[key].extension,
- description : datatypes[key].description,
- description_url : datatypes[key].description_url
- });
- }
- that.list_extensions.sort(function(a, b) {
- return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
- });
- that.list_extensions.unshift(that.auto);
-
- });
- mod_utils.get(galaxy_config.root + "api/genomes",
- function(genomes) {
- for (key in genomes) {
- that.list_genomes.push({
- id : genomes[key][1],
- text : genomes[key][0]
- });
- }
- that.list_genomes.sort(function(a, b) {
- return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
- });
- });
+ mod_utils.get({
+ url : galaxy_config.root + "api/datatypes?extension_only=False",
+ success : function( datatypes ) {
+ for (key in datatypes) {
+ that.list_extensions.push({
+ id : datatypes[key].extension,
+ text : datatypes[key].extension,
+ description : datatypes[key].description,
+ description_url : datatypes[key].description_url
+ });
+ }
+ that.list_extensions.sort(function(a, b) {
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
+ });
+ that.list_extensions.unshift(that.auto);
+ }
+ });
+ mod_utils.get({
+ url: galaxy_config.root + "api/genomes",
+ success: function( genomes ) {
+ for ( key in genomes ) {
+ that.list_genomes.push({
+ id : genomes[key][1],
+ text : genomes[key][0]
+ });
+ }
+ that.list_genomes.sort(function(a, b) {
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
+ });
+ }
+ });
},
renderSelectBoxes: function(){
@@ -1027,7 +1030,7 @@
tmpl_array.push(' </div>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');
tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');
- tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
+ tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
tmpl_array.push(' </div>');
// TOOLBAR END
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/library/library-librarylist-view.js
--- a/client/galaxy/scripts/mvc/library/library-librarylist-view.js
+++ b/client/galaxy/scripts/mvc/library/library-librarylist-view.js
@@ -4,13 +4,15 @@
"utils/utils",
"libs/toastr",
"mvc/library/library-model",
- "mvc/library/library-libraryrow-view"],
-function(mod_masthead,
- mod_baseMVC,
- mod_utils,
- mod_toastr,
- mod_library_model,
- mod_library_libraryrow_view) {
+ "mvc/library/library-libraryrow-view"
+], function(
+ mod_masthead,
+ mod_baseMVC,
+ mod_utils,
+ mod_toastr,
+ mod_library_model,
+ mod_library_libraryrow_view
+){
var LibraryListView = Backbone.View.extend({
el: '#libraries_element',
@@ -19,104 +21,135 @@
'click .sort-libraries-link' : 'sort_clicked'
},
- modal: null,
+ /**
+ * Initialize and fetch the libraries from server.
+ * Async render afterwards.
+ * @param {object} options an options object
+ */
+ defaults: {
+ page_count: null,
+ show_page: null
+ },
- // collection of {Item}s
- collection: null,
+ initialize : function( options ){
+ this.options = _.defaults( this.options || {}, this.defaults, options );
- // map of library model ids to library views = cache
- rowViews: {},
-
- initialize : function(options){
- this.options = _.defaults(this.options || {}, options);
- var that = this;
+ var that = this;
+ this.modal = null;
+ // map of library model ids to library views = cache
this.rowViews = {};
+ // collection of {Item}s
this.collection = new mod_library_model.Libraries();
this.collection.fetch({
success: function(){
that.render();
},
- error: function(model, response){
- if (typeof response.responseJSON !== "undefined"){
- mod_toastr.error(response.responseJSON.err_msg);
+ error: function( model, response ){
+ if ( typeof response.responseJSON !== "undefined" ){
+ mod_toastr.error( response.responseJSON.err_msg );
} else {
- mod_toastr.error('An error ocurred.');
+ mod_toastr.error( 'An error ocurred.' );
}
}
});
},
- /** Renders the libraries table either from the object's own collection,
- * or from a given array of library models,
- * or renders an empty list in case no data is given. */
- render: function (options) {
- $(".tooltip").hide();
+ /**
+ * Render the libraries table either from the object's own collection,
+ * or from a given array of library models,
+ * or render an empty list in case no data is given.
+ */
+ render: function ( options ) {
+ this.options = _.extend( this.options, options );
+
+ if ( ( this.options.page_size != null ) && ( this.options.page_size == parseInt( this.options.page_size ) ) ) {
+ Galaxy.libraries.preferences.set( { 'library_page_size': parseInt( this.options.page_size ) } );
+ }
+
+ $( ".tooltip" ).hide();
+ // this.options.show_page = this.options.show_page || 1;
var template = this.templateLibraryList();
var libraries_to_render = null;
- var include_deleted = Galaxy.libraries.preferences.get('with_deleted');
var models = null;
- if (typeof options !== 'undefined'){
- include_deleted = typeof options.with_deleted !== 'undefined' ? options.with_deleted : false;
+ if ( this.options.show_page === null || this.options.show_page < 1 ){
+ this.options.show_page = 1;
+ }
+ if ( typeof options !== 'undefined' ){
models = typeof options.models !== 'undefined' ? options.models : null;
}
-
- if (this.collection !== null && models === null){
+ if ( this.collection !== null && models === null ){
this.sortLibraries();
- if (include_deleted){ // show all the libraries
+ if ( Galaxy.libraries.preferences.get( 'with_deleted' ) ){
libraries_to_render = this.collection.models;
- } else{ // show only undeleted libraries
- libraries_to_render = this.collection.where({deleted: false});
+ } else {
+ libraries_to_render = this.collection.where( { deleted: false } );
}
- } else if (models !== null){
+ } else if ( models !== null ){
libraries_to_render = models;
} else {
libraries_to_render = [];
+ }
+ this.options.total_libraries_count = libraries_to_render.length
+ var page_start = ( Galaxy.libraries.preferences.get( 'library_page_size' ) * ( this.options.show_page - 1 ) );
+ this.options.page_count = Math.ceil( this.options.total_libraries_count / Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ if ( this.options.total_libraries_count > 0 && ( page_start < this.options.total_libraries_count ) ){
+ libraries_to_render = libraries_to_render.slice( page_start, page_start + Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ this.options.libraries_shown = libraries_to_render.length;
+ // User requests page with no libraries
+ if ( Galaxy.libraries.preferences.get( 'library_page_size' ) * this.options.show_page > ( this.options.total_libraries_count + Galaxy.libraries.preferences.get( 'library_page_size' ) ) ){
+ libraries_to_render = [];
}
-
- this.$el.html(template({length: libraries_to_render.length, order: Galaxy.libraries.preferences.get('sort_order') }));
-
- if (libraries_to_render.length > 0){
- this.renderRows(libraries_to_render);
+ this.$el.html( template({
+ length: 1,
+ order: Galaxy.libraries.preferences.get( 'sort_order' )
+ }));
+ Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
+ this.renderRows( libraries_to_render );
+ } else {
+ this.$el.html( template({
+ length: 0,
+ order: Galaxy.libraries.preferences.get( 'sort_order' )
+ }));
+ Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
}
- // initialize the library tooltips
- $("#center [data-toggle]").tooltip();
- // modification of upper DOM element to show scrollbars due
- // to the #center element inheritance
- $("#center").css('overflow','auto');
+ $( "#center [data-toggle]" ).tooltip();
+ $( "#center" ).css( 'overflow','auto' );
},
- /** Renders all given models as rows in the library list */
- renderRows: function(libraries_to_render){
- for (var i = 0; i < libraries_to_render.length; i++) {
+ /**
+ * Render all given models as rows in the library list
+ * @param {array} libraries_to_render array of library models to render
+ */
+ renderRows: function( libraries_to_render ){
+ for ( var i = 0; i < libraries_to_render.length; i++ ) {
var library = libraries_to_render[i];
- var cachedView = _.findWhere(this.rowViews, {id: library.get('id')});
- if (cachedView !== undefined && this instanceof Backbone.View){
+ // search whether we have the item cached
+ var cachedView = _.findWhere( this.rowViews, { id: library.get( 'id' ) } );
+ if ( cachedView !== undefined && this instanceof Backbone.View ){
cachedView.delegateEvents();
- this.$el.find('#library_list_body').append(cachedView.el);
+ this.$el.find( '#library_list_body' ).append( cachedView.el );
} else {
- this.renderOne({library:library})
+ this.renderOne( { library: library } )
}
}
},
/**
- * Creates a view for the given model and adds it to the libraries view.
+ * Create a view for the given model and add it to the libraries view.
* @param {Library} model of the view that will be rendered
*/
- renderOne: function(options){
+ renderOne: function( options ){
var library = options.library;
- var rowView = new mod_library_libraryrow_view.LibraryRowView(library);
- // we want to prepend new item
- if (options.prepend){
- this.$el.find('#library_list_body').prepend(rowView.el);
- } else {
- this.$el.find('#library_list_body').append(rowView.el);
- }
+ var rowView = new mod_library_libraryrow_view.LibraryRowView( library );
+ this.$el.find( '#library_list_body' ).append( rowView.el );
// save new rowView to cache
- this.rowViews[library.get('id')] = rowView;
+ this.rowViews[ library.get( 'id' ) ] = rowView;
},
- /** Table heading was clicked, update sorting preferences and re-render */
+ /**
+ * Table heading was clicked, update sorting preferences and re-render.
+ * @return {[type]} [description]
+ */
sort_clicked : function(){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
Galaxy.libraries.preferences.set({'sort_order': 'desc'});
@@ -126,8 +159,10 @@
this.render();
},
- /** Sorts the underlying collection according to the parameters received.
- Currently supports only sorting by name. */
+ /**
+ * Sort the underlying collection according to the parameters received.
+ * Currently supports only sorting by name.
+ */
sortLibraries: function(){
if (Galaxy.libraries.preferences.get('sort_by') === 'name'){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
@@ -138,6 +173,13 @@
}
},
+ redirectToHome: function(){
+ window.location = '../';
+ },
+ redirectToLogin: function(){
+ window.location = '/user/login';
+ },
+
// MMMMMMMMMMMMMMMMMM
// === TEMPLATES ====
// MMMMMMMMMMMMMMMMMM
@@ -147,14 +189,14 @@
tmpl_array.push('<div class="library_container table-responsive">');
tmpl_array.push('<% if(length === 0) { %>');
- tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');
+ tmpl_array.push('<div>There are no libraries visible to you here. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');
tmpl_array.push('<% } else{ %>');
tmpl_array.push('<table class="grid table table-condensed">');
tmpl_array.push(' <thead>');
tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');
tmpl_array.push(' <th style="width:22%;">description</th>');
tmpl_array.push(' <th style="width:22%;">synopsis</th> ');
- tmpl_array.push(' <th style="width:26%;"></th> ');
+ tmpl_array.push(' <th style="width:26%;"></th>');
tmpl_array.push(' </thead>');
tmpl_array.push(' <tbody id="library_list_body">');
// library item views will attach here
@@ -166,14 +208,6 @@
return _.template(tmpl_array.join(''));
},
-
- redirectToHome: function(){
- window.location = '../';
- },
- redirectToLogin: function(){
- window.location = '/user/login';
- },
-
});
return {
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
--- a/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
@@ -11,11 +11,13 @@
el: '#center',
events: {
- 'click #create_new_library_btn' : 'show_library_modal',
- 'click #include_deleted_chk' : 'check_include_deleted'
+ 'click #create_new_library_btn' : 'showLibraryModal',
+ 'click #include_deleted_chk' : 'includeDeletedChecked',
+ 'click #page_size_prompt' : 'showPageSizePrompt'
},
- initialize: function(){
+ initialize: function( options ){
+ this.options = _.defaults( this.options || {}, options );
this.render();
},
@@ -23,21 +25,34 @@
var toolbar_template = this.templateToolBar();
var is_admin = false;
var is_anonym = true;
- if (Galaxy.currUser){
+ if ( Galaxy.currUser ){
is_admin = Galaxy.currUser.isAdmin();
is_anonym = Galaxy.currUser.isAnonymous();
}
- this.$el.html(toolbar_template({admin_user: is_admin, anon_user: is_anonym}));
- if (is_admin){
- this.$el.find('#include_deleted_chk')[0].checked = Galaxy.libraries.preferences.get('with_deleted');
+ this.$el.html(toolbar_template( { admin_user: is_admin, anon_user: is_anonym } ) );
+ if ( is_admin ){
+ this.$el.find( '#include_deleted_chk' )[0].checked = Galaxy.libraries.preferences.get( 'with_deleted' );
}
},
- show_library_modal : function (event){
+ /**
+ * Called from LibraryListView when needed.
+ * @param {object} options common options
+ */
+ renderPaginator: function( options ){
+ this.options = _.extend( this.options, options );
+ var paginator_template = this.templatePaginator();
+ this.$el.find( '#library_paginator' ).html( paginator_template({
+ show_page: parseInt( this.options.show_page ),
+ page_count: parseInt( this.options.page_count ),
+ total_libraries_count: this.options.total_libraries_count,
+ libraries_shown: this.options.libraries_shown
+ }));
+ },
+
+ showLibraryModal : function (event){
event.preventDefault();
event.stopPropagation();
-
- // create modal
var self = this;
this.modal = Galaxy.modal;
this.modal.show({
@@ -45,22 +60,22 @@
title : 'Create New Library',
body : this.templateNewLibraryInModal(),
buttons : {
- 'Create' : function() {self.create_new_library_event();},
- 'Close' : function() {self.modal.hide();}
+ 'Create' : function() { self.createNewLibrary(); },
+ 'Close' : function() { self.modal.hide(); }
}
});
},
- create_new_library_event: function(){
- var libraryDetails = this.serialize_new_library();
- if (this.validate_new_library(libraryDetails)){
+ createNewLibrary: function(){
+ var libraryDetails = this.serializeNewLibrary();
+ if (this.valdiateNewLibrary(libraryDetails)){
var library = new mod_library_model.Library();
var self = this;
library.save(libraryDetails, {
success: function (library) {
Galaxy.libraries.libraryListView.collection.add(library);
self.modal.hide();
- self.clear_library_modal();
+ self.clearLibraryModal();
Galaxy.libraries.libraryListView.render();
mod_toastr.success('Library created.');
},
@@ -78,15 +93,22 @@
return false;
},
+ showPageSizePrompt: function(){
+ var library_page_size = prompt( 'How many libraries per page do you want to see?', Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ if ( ( library_page_size != null ) && ( library_page_size == parseInt( library_page_size ) ) ) {
+ Galaxy.libraries.preferences.set( { 'library_page_size': parseInt( library_page_size ) } );
+ Galaxy.libraries.libraryListView.render();
+ }
+ },
+
// clear the library modal once saved
- clear_library_modal : function(){
+ clearLibraryModal : function(){
$("input[name='Name']").val('');
$("input[name='Description']").val('');
$("input[name='Synopsis']").val('');
},
- // serialize data from the new library form
- serialize_new_library : function(){
+ serializeNewLibrary : function(){
return {
name: $("input[name='Name']").val(),
description: $("input[name='Description']").val(),
@@ -94,18 +116,20 @@
};
},
- // validate new library info
- validate_new_library: function(libraryDetails){
+ valdiateNewLibrary: function( libraryDetails ){
return libraryDetails.name !== '';
},
- // include or exclude deleted libraries from the view
- check_include_deleted: function(event){
+ /**
+ * Include or exclude deleted libraries in the view.
+ * @param {object} event common event
+ */
+ includeDeletedChecked: function( event ){
if (event.target.checked){
- Galaxy.libraries.preferences.set({'with_deleted': true});
+ Galaxy.libraries.preferences.set( { 'with_deleted': true } );
Galaxy.libraries.libraryListView.render();
} else{
- Galaxy.libraries.preferences.set({'with_deleted': false});
+ Galaxy.libraries.preferences.set( { 'with_deleted': false } );
Galaxy.libraries.libraryListView.render();
}
},
@@ -113,22 +137,26 @@
templateToolBar: function(){
tmpl_array = [];
+
tmpl_array.push('<div class="library_style_container">');
- // TOOLBAR
tmpl_array.push(' <div id="toolbar_form">');
tmpl_array.push(' <div id="library_toolbar">');
- tmpl_array.push(' <span><strong>DATA LIBRARIES</strong></span>');
- tmpl_array.push(' <% if(admin_user === true) { %>');
- tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');
- tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
- tmpl_array.push(' <% } %>');
- tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
- tmpl_array.push(' </div>');
-
- tmpl_array.push(' <div>');
- tmpl_array.push(' ');
- tmpl_array.push(' </div>');
-
+ tmpl_array.push(' <form class="form-inline" role="form">');
+ tmpl_array.push(' <span><strong><a href="#" title="Go to first page">DATA LIBRARIES</a></strong></span>');
+ tmpl_array.push(' <% if(admin_user === true) { %>');
+ tmpl_array.push(' <div class="checkbox" style="height: 20px;">');
+ tmpl_array.push(' <label>');
+ tmpl_array.push(' <input id="include_deleted_chk" type="checkbox"> include deleted </input>');
+ tmpl_array.push(' </label>');
+ tmpl_array.push(' </div>');
+ tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
+ tmpl_array.push(' <span id="library_paginator" class="library-paginator">');
+ // paginator will append here
+ tmpl_array.push(' </span>');
+ tmpl_array.push(' </form>');
+ tmpl_array.push(' </div>');
tmpl_array.push(' </div>');
tmpl_array.push(' <div id="libraries_element">');
// table with libraries will append here
@@ -138,6 +166,39 @@
return _.template(tmpl_array.join(''));
},
+ templatePaginator: function(){
+ tmpl_array = [];
+
+ tmpl_array.push(' <ul class="pagination pagination-sm">');
+ tmpl_array.push(' <% if ( ( show_page - 1 ) > 0 ) { %>');
+ tmpl_array.push(' <% if ( ( show_page - 1 ) > page_count ) { %>'); // we are on higher page than total page count
+ tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } else { %>');
+ tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li><a href="#page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <% } else { %>'); // we are on the first page
+ tmpl_array.push(' <li class="disabled"><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <li class="active">');
+ tmpl_array.push(' <a href="#page/<% print( show_page ) %>"><% print( show_page ) %></a>');
+ tmpl_array.push(' </li>');
+ tmpl_array.push(' <% if ( ( show_page ) < page_count ) { %>');
+ tmpl_array.push(' <li><a href="#page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');
+ tmpl_array.push(' <li><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');
+ tmpl_array.push(' <% } else { %>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' </ul>');
+ tmpl_array.push(' <span>');
+ tmpl_array.push(' showing <a data-toggle="tooltip" data-placement="top" title="Click to change the number of libraries on page" id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
+ tmpl_array.push(' </span>');
+
+ return _.template(tmpl_array.join(''));
+ },
templateNewLibraryInModal: function(){
tmpl_array = [];
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/tools/tools-content.js
--- /dev/null
+++ b/client/galaxy/scripts/mvc/tools/tools-content.js
@@ -0,0 +1,142 @@
+define(['utils/utils'], function(Utils){
+ return Backbone.Model.extend({
+ // initialize
+ initialize: function(options) {
+ // backup basic url
+ this.base_url = galaxy_config.root + 'api/histories/' + options.history_id + '/contents';
+
+ // prepare content obects
+ this.datatypes = {};
+ this.summary = {};
+
+ // link this
+ var self = this;
+
+ // request datatypes
+ Utils.get({
+ url : galaxy_config.root + 'api/datatypes/mapping',
+ cache : true,
+ success : function(response) {
+ // backup datatype dictionary
+ self.datatypes = response;
+
+ // get history summary
+ Utils.get({
+ url : self.base_url + '?deleted=false',
+ success : function(response) {
+ // backup summary
+ self.summary = response;
+
+ // log
+ console.debug('tools-content::initialize() - Completed.');
+
+ // callback
+ options.success && options.success();
+ },
+ error : function(response) {
+ // log request failure
+ console.debug('tools-content::initialize() - Ajax request for summary failed.');
+ console.debug(response);
+ }
+ });
+ },
+ error : function(response) {
+ // log request failure
+ console.debug('tools-content::initialize() - Ajax request for datatypes failed.');
+ console.debug(response);
+ }
+ });
+ },
+
+ /**
+ * Filters contents by data type.
+ */
+ filterType: function(options) {
+ // initialize parameters
+ options = options || {};
+ var result = [];
+
+ // identify content type
+ var history_content_type = 'dataset';
+ if (options.src== 'hdca') {
+ history_content_type = 'dataset_collection';
+ }
+
+ // search in summary
+ for (var i in this.summary) {
+ var content = this.summary[i];
+
+ // match datatypes
+ var found = false;
+ for (var i in options.extensions) {
+ if (this._matchType(options.extensions[i], content.extension)) {
+ found = true;
+ break;
+ }
+ }
+
+ // final match result
+ if ((content.history_content_type === history_content_type) && (found || !options.extensions)) {
+ result.push(content);
+ }
+ }
+ return result;
+ },
+
+ /** Get details of a content by id.
+ */
+ getDetails: function(options) {
+ // check id
+ if (!options.id || options.id === 'null') {
+ options.success && options.success();
+ return;
+ }
+
+ // create url
+ var api_url = this.base_url + '/datasets/' + options.id;
+ if (options.src == 'hdca') {
+ api_url = this.base_url + '/dataset_collections/' + options.id;
+ }
+
+ // request details
+ Utils.get({
+ url : api_url,
+ success : function(response) {
+ options.success && options.success(response);
+ },
+ error : function(response) {
+ options.success && options.success();
+ console.debug('tools-content::getDetails() - Ajax request for content failed.');
+ console.debug(response);
+ }
+ });
+ },
+
+ /** Check if datatypes match
+ */
+ _matchType: function(target, reference) {
+ // check if target class is available
+ var target_class = this.datatypes.ext_to_class_name[target];
+ if (!target_class) {
+ console.debug('tools-content::_matchType() - Specific target class unavailable. Accepting all formats.');
+ return true;
+ }
+
+ // check if reference class is available
+ var reference_class = this.datatypes.ext_to_class_name[reference];
+ if (!reference_class) {
+ console.debug('tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.');
+ return true;
+ }
+
+ // check reference group
+ var reference_group = this.datatypes.class_to_classes[reference_class];
+ if (reference_group[target_class]) {
+ return true;
+ }
+
+ // classes do not match
+ return false;
+ }
+ });
+});
\ No newline at end of file
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/tools/tools-datasets.js
--- a/client/galaxy/scripts/mvc/tools/tools-datasets.js
+++ /dev/null
@@ -1,117 +0,0 @@
-define(['utils/utils'], function(Utils){
- return Backbone.Model.extend({
- // initialize
- initialize: function(options) {
- // prepare datasets obects
- this.datatypes = {};
- this.summary = {};
-
- // link this
- var self = this;
-
- // request datatypes
- Utils.get({
- url : galaxy_config.root + 'api/datatypes/mapping',
- cache : true,
- success : function(response) {
- // backup datatype dictionary
- self.datatypes = response;
-
- // get history summary
- Utils.get({
- url : galaxy_config.root + 'api/histories/' + options.history_id + '/contents?deleted=false',
- success : function(response) {
- // backup summary
- self.summary = response;
-
- // log
- console.debug('tools-datasets::initialize() - Completed.');
-
- // callback
- options.success && options.success();
- },
- error : function(response) {
- // log request failure
- console.debug('tools-datasets::initialize() - Ajax request for summary failed.');
- console.debug(response);
- }
- });
- },
- error : function(response) {
- // log request failure
- console.debug('tools-datasets::initialize() - Ajax request for datatypes failed.');
- console.debug(response);
- }
- });
- },
-
- /**
- * Filters datasets by data type.
- */
- filterType: function(options) {
- options = options || {};
- var result = [];
- for (var i in this.summary) {
- var dataset = this.summary[i];
-
- // match datatypes
- var found = false;
- for (var i in options.data_types) {
- if (this._matchType(options.data_types[i], dataset.extension)) {
- found = true;
- break;
- }
- }
-
- // final match result
- if ((dataset.history_content_type === options.content_type || !options.content_type) && (found || !options.data_types)) {
- result.push(dataset);
- }
- }
- return result;
- },
-
- /** Get details of a dataset by id.
- * @param{String} Dataset id
- */
- getDetails: function(dataset_id, callback) {
- Utils.get({
- url : galaxy_config.root + 'api/datasets/' + dataset_id,
- success : function(response) {
- callback && callback(response);
- },
- error : function(response) {
- console.debug('tools-datasets::getDetails() - Ajax request for dataset failed.');
- console.debug(response);
- }
- });
- },
-
- /** Check if datatypes match
- */
- _matchType: function(target, reference) {
- // check if target class is available
- var target_class = this.datatypes.ext_to_class_name[target];
- if (!target_class) {
- console.debug('tools-datasets::_matchType() - Specific target class unavailable. Accepting all formats.');
- return true;
- }
-
- // check if reference class is available
- var reference_class = this.datatypes.ext_to_class_name[reference];
- if (!reference_class) {
- console.debug('tools-datasets::_matchType() - Specific reference class unavailable. Accepting all formats.');
- return true;
- }
-
- // check reference group
- var reference_group = this.datatypes.class_to_classes[reference_class];
- if (reference_group[target_class]) {
- return true;
- }
-
- // classes do not match
- return false;
- }
- });
-});
\ No newline at end of file
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -1,11 +1,11 @@
/**
This is the main class of the tool form plugin. It is referenced as 'app' in all lower level modules.
*/
-define(['mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
+define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
'mvc/citation/citation-model', 'mvc/citation/citation-view',
- 'mvc/tools', 'mvc/tools/tools-template', 'mvc/tools/tools-datasets', 'mvc/tools/tools-section', 'mvc/tools/tools-tree', 'mvc/tools/tools-jobs'],
- function(Portlet, Ui, CitationModel, CitationView,
- Tools, ToolTemplate, ToolDatasets, ToolSection, ToolTree, ToolJobs) {
+ 'mvc/tools', 'mvc/tools/tools-template', 'mvc/tools/tools-content', 'mvc/tools/tools-section', 'mvc/tools/tools-tree', 'mvc/tools/tools-jobs'],
+ function(Utils, Portlet, Ui, CitationModel, CitationView,
+ Tools, ToolTemplate, ToolContent, ToolSection, ToolTree, ToolJobs) {
// create tool model
var Model = Backbone.Model.extend({
@@ -42,7 +42,7 @@
// load tool model
this.model = new Model({
- id : options.id
+ id : options.id
});
// creates a tree/json structure from the input form
@@ -60,8 +60,8 @@
// reset input element list, which contains the dom elements of each input element (includes also the input field)
this.element_list = {};
- // initialize datasets
- this.datasets = new ToolDatasets({
+ // initialize contents
+ this.content = new ToolContent({
history_id : this.options.history_id,
success : function() {
self._initializeToolForm();
@@ -93,7 +93,7 @@
}
// log
- console.debug('tools-form::refresh() - Recreated tree structure. Refresh.');
+ console.debug('tools-form::refresh() - Recreated data structure. Refresh.');
},
// initialize tool form
@@ -101,6 +101,37 @@
// link this
var self = this;
+ // fetch model and render form
+ this.model.fetch({
+ error: function(response) {
+ console.debug('tools-form::_initializeToolForm() : Attempt to fetch tool model failed.');
+ },
+ success: function() {
+ // backup inputs
+ self.inputs = self.model.get('inputs');
+
+ // update inputs with job parameters
+ if (self.options.job_id) {
+ Utils.get({
+ url: galaxy_config.root + 'api/jobs/' + self.options.job_id,
+ success: function(parameters) {
+ // TODO: Update input parameters
+ //self._updateInputs(self.inputs, parameters);
+ self._buildForm();
+ }
+ });
+ } else {
+ self._buildForm();
+ }
+ }
+ });
+ },
+
+ // builds the tool form
+ _buildForm: function() {
+ // link this
+ var self = this;
+
// create question button
var button_question = new Ui.ButtonIcon({
icon : 'fa-question-circle',
@@ -127,89 +158,94 @@
title : 'Share',
tooltip : 'Share this tool',
onclick : function() {
- prompt('Copy to clipboard: Ctrl+C, Enter', galaxy_config.root + 'root?tool_id=' + self.options.id);
+ prompt('Copy to clipboard: Ctrl+C, Enter', window.location.origin + galaxy_config.root + 'root?tool_id=' + self.options.id);
}
});
- // fetch model and render form
- this.model.fetch({
- error: function(response) {
- console.debug('tools-form::_initializeToolForm() : Attempt to fetch tool model failed.');
- },
- success: function() {
- // create tool form section
- self.section = new ToolSection.View(self, {
- inputs : self.model.get('inputs'),
- cls : 'ui-table-plain'
- });
-
- // TEMPORARY SWITCH
- // switch to classic tool form mako if the form definition is incompatible
- if (self.incompatible) {
- self.$el.hide();
- $('#tool-form-classic').show();
- return;
+ // default operations
+ var operations = {
+ button_question: button_question,
+ button_search: button_search,
+ button_share: button_share
+ }
+
+ // add admin operations
+ if (Galaxy.currUser.get('is_admin')) {
+ // create download button
+ operations['button_download'] = new Ui.ButtonIcon({
+ icon : 'fa-download',
+ title : 'Download',
+ tooltip : 'Download this tool',
+ onclick : function() {
+ window.location.href = galaxy_config.root + 'api/tools/' + self.options.id + '/download';
}
-
- // create portlet
- self.portlet = new Portlet.View({
- icon : 'fa-wrench',
- title: '<b>' + self.model.get('name') + '</b> ' + self.model.get('description'),
- buttons: {
- execute: new Ui.ButtonIcon({
- icon : 'fa-check',
- tooltip : 'Execute the tool',
- title : 'Execute',
- floating : 'clear',
- onclick : function() {
- self.job_handler.submit();
- }
- })
- },
- operations: {
- button_question: button_question,
- button_search: button_search,
- button_share: button_share
+ });
+ }
+
+ // create tool form section
+ this.section = new ToolSection.View(self, {
+ inputs : this.inputs,
+ cls : 'ui-table-plain'
+ });
+
+ // switch to classic tool form mako if the form definition is incompatible
+ if (this.incompatible) {
+ this.$el.hide();
+ $('#tool-form-classic').show();
+ return;
+ }
+
+ // create portlet
+ this.portlet = new Portlet.View({
+ icon : 'fa-wrench',
+ title: '<b>' + this.model.get('name') + '</b> ' + this.model.get('description'),
+ operations: operations,
+ buttons: {
+ execute: new Ui.Button({
+ icon : 'fa-check',
+ tooltip : 'Execute the tool',
+ title : 'Execute',
+ cls : 'btn btn-primary',
+ floating : 'clear',
+ onclick : function() {
+ self.job_handler.submit();
}
- });
-
- // configure button selection
- if(!self.options.biostar_url) {
- button_question.$el.hide();
- button_search.$el.hide();
- }
-
- // append form
- self.$el.append(self.portlet.$el);
-
- // append help
- if (self.options.help != '') {
- self.$el.append(ToolTemplate.help(self.options.help));
- }
-
- // append citations
- if (self.options.citations) {
- // append html
- self.$el.append(ToolTemplate.citations());
-
- // fetch citations
- var citations = new CitationModel.ToolCitationCollection();
- citations.tool_id = self.options.id;
- var citation_list_view = new CitationView.CitationListView({ collection: citations } );
- citation_list_view.render();
- citations.fetch();
- }
-
- // configure portlet and form table
- self.setElement(self.portlet.content());
-
- // append tool section
- self.portlet.append(self.section.$el);
-
- // trigger refresh
- self.refresh();
+ })
}
});
+
+ // configure button selection
+ if(!this.options.biostar_url) {
+ button_question.$el.hide();
+ button_search.$el.hide();
+ }
+
+ // append form
+ this.$el.append(this.portlet.$el);
+
+ // append help
+ if (this.options.help != '') {
+ this.$el.append(ToolTemplate.help(this.options.help));
+ }
+
+ // append citations
+ if (this.options.citations) {
+ // append html
+ this.$el.append(ToolTemplate.citations());
+
+ // fetch citations
+ var citations = new CitationModel.ToolCitationCollection();
+ citations.tool_id = this.options.id;
+ var citation_list_view = new CitationView.CitationListView({ collection: citations } );
+ citation_list_view.render();
+ citations.fetch();
+ }
+
+ // append tool section
+ this.portlet.append(this.section.$el);
+
+ // trigger refresh
+ this.refresh();
}
});
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/tools/tools-input.js
--- /dev/null
+++ b/client/galaxy/scripts/mvc/tools/tools-input.js
@@ -0,0 +1,108 @@
+/**
+ This class creates a tool form input element wrapper
+*/
+define([], function() {
+
+ // input field element wrapper
+ return Backbone.View.extend({
+ // initialize input wrapper
+ initialize: function(options) {
+ // link field
+ this.field = options.field;
+
+ // set element
+ this.setElement(this._template(options));
+
+ // link elements
+ this.$field = this.$el.find('.ui-table-form-field');
+ this.$title_optional = this.$el.find('.ui-table-form-title-optional');
+ this.$error_text = this.$el.find('.ui-table-form-error-text');
+ this.$error = this.$el.find('.ui-table-form-error');
+
+ // add field element
+ this.$field.prepend(this.field.$el);
+
+ // hide optional field on initialization
+ if (options.optional) {
+ this.field.skip = true;
+ } else {
+ this.field.skip = false;
+ }
+
+ // refresh view
+ this._refresh();
+
+ // add optional hide/show
+ var self = this;
+ this.$title_optional.on('click', function() {
+ // flip flag
+ self.field.skip = !self.field.skip;
+
+ // refresh view
+ self._refresh();
+ });
+ },
+
+ /** Set error text
+ */
+ error: function(text) {
+ this.$error_text.html(text);
+ this.$error.fadeIn();
+ this.$el.addClass('ui-error');
+ },
+
+ /** Reset this view
+ */
+ reset: function() {
+ this.$error.hide();
+ this.$el.removeClass('ui-error');
+ },
+
+ /** Refresh element
+ */
+ _refresh: function() {
+ // show/hide field element
+ if (!this.field.skip) {
+ this.$field.fadeIn('fast');
+ this.$title_optional.html('Disable');
+ } else {
+ this.$field.hide();
+ this.$title_optional.html('Enable');
+ }
+ },
+
+ /** Main Template
+ */
+ _template: function(options) {
+ // create table element
+ var tmp = '<div class="ui-table-form-element">' +
+ '<div class="ui-table-form-error ui-error">' +
+ '<span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"/>' +
+ '</div>' +
+ '<div class="ui-table-form-title-strong">';
+
+ // is optional
+ if (options.optional) {
+ tmp += 'Optional: ' + options.label +
+ '<span> [<span class="ui-table-form-title-optional"/>]</span>';
+ } else {
+ tmp += options.label;
+ }
+
+ // finalize title
+ tmp += '</div>' +
+ '<div class="ui-table-form-field">';
+ // add help
+ if (options.help) {
+ tmp += '<div class="ui-table-form-info">' + options.help + '</div>';
+ }
+
+ // finalize
+ tmp += '</div>' +
+ '</div>';
+
+ // return input element
+ return tmp;
+ }
+ });
+});
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/tools/tools-jobs.js
--- a/client/galaxy/scripts/mvc/tools/tools-jobs.js
+++ b/client/galaxy/scripts/mvc/tools/tools-jobs.js
@@ -37,7 +37,7 @@
console.debug(job_def);
// show progress modal
- this.app.modal.show({title: 'Please wait...', body: 'progress'});
+ this.app.modal.show({title: 'Please wait...', body: 'progress', buttons: { 'Close' : function () {self.app.modal.hide();} }});
// post job
Utils.request({
@@ -57,17 +57,9 @@
self._foundError(input_id, error_messages[input_id]);
}
} else {
- // show modal with error message
- self.app.modal.show({
- title: response_full.statusText,
- body: ToolTemplate.error(job_def),
- closing_events: true,
- buttons: {
- 'Close': function() {
- self.app.modal.hide();
- }
- }
- });
+ // show error message with details
+ console.debug(job_def);
+ console.debug(response);
}
}
});
@@ -81,17 +73,11 @@
// mark error
input_element.error(message || 'Please verify this parameter.');
-
- // set flag
- if (this.valid) {
- // scroll to first input element
- $(this.app.container).animate({
- scrollTop: input_element.$el.offset().top - 20
- }, 500);
-
- // set error flag
- this.valid = false;
- }
+
+ // scroll to first input element
+ $(this.app.container).animate({
+ scrollTop: input_element.$el.offset().top - 20
+ }, 500);
},
/** Validate job definition
@@ -100,9 +86,6 @@
// get input parameters
var job_inputs = job_def.inputs;
- // validation flag
- this.valid = true;
-
// counter for values declared in batch mode
var n_values = -1;
@@ -115,10 +98,11 @@
var input_id = this.app.tree.match(job_input_id);
var input_field = this.app.field_list[input_id];
var input_def = this.app.input_list[input_id];
-
+
// check basic field validation
- if (input_def && !input_def.optional && input_field && input_field.validate && !input_field.validate()) {
+ if (input_def && input_field && input_field.validate && !input_field.validate()) {
this._foundError(input_id);
+ return false;
}
// check if input field is in batch mode
@@ -129,6 +113,7 @@
} else {
if (n_values !== n) {
this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + n_values + '</b>.');
+ return false;
}
}
}
@@ -136,7 +121,7 @@
}
// return validation result
- return this.valid;
+ return true;
},
/** Refreshes the history panel
diff -r 7fa4a243b126c4a1d5dbbfc600899763b55a6d82 -r ba656141a2d7db82b9ed060cb5bbb06d9d071bf7 client/galaxy/scripts/mvc/tools/tools-section.js
--- a/client/galaxy/scripts/mvc/tools/tools-section.js
+++ b/client/galaxy/scripts/mvc/tools/tools-section.js
@@ -1,58 +1,8 @@
/**
This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections. New input elements can be plugged in by adding cases to the switch block defined in the _addRow() function.
*/
-define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-dataset'],
- function(Utils, Table, Ui, Repeat, SelectDataset) {
-
- // input field element wrapper
- var InputElement = Backbone.View.extend({
- // initialize input wrapper
- initialize: function(options) {
- this.setElement(this._template(options));
- },
-
- /** Set error text
- */
- error: function(text) {
- // set text
- this.$el.find('.ui-table-form-error-text').html(text);
- this.$el.find('.ui-table-form-error').fadeIn();
- this.$el.addClass('ui-error');
- },
-
- /** Reset this view
- */
- reset: function() {
- this.$el.find('.ui-table-form-error').hide();
- this.$el.removeClass('ui-error');
- },
-
- /** Main Template
- */
- _template: function(options) {
- // create table element
- var $input = $('<div class="ui-table-element"/>');
-
- // add error
- $input.append('<div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>');
-
- // add label
- if (options.label) {
- $input.append('<div class="ui-table-form-title-strong">' + options.label + '</div>');
- }
-
- // add input element
- $input.append(options.$el);
-
- // add help
- if (options.help) {
- $input.append('<div class="ui-table-form-info">' + options.help + '</div>');
- }
-
- // return input element
- return $input;
- }
- });
+define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
+ function(Utils, Table, Ui, Repeat, SelectContent, InputElement) {
// create form view
var View = Backbone.View.extend({
@@ -234,7 +184,7 @@
var input_element = new InputElement({
label : input_def.title,
help : input_def.help,
- $el : repeat.$el
+ field : repeat
});
// displays as grouped subsection
@@ -268,13 +218,14 @@
field = this._fieldSelect(input_def);
break;
- // dataset
+ // data selector
case 'data':
field = this._fieldData(input_def);
break;
- // dataset column
+ // data column
case 'data_column':
+ input_def.is_dynamic = false;
field = this._fieldSelect(input_def);
break;
@@ -308,7 +259,7 @@
field = this._fieldSelect(input_def);
break;
- // flag as incompatible
+ // field not found
default:
// flag
this.app.incompatible = true;
@@ -336,9 +287,10 @@
// create input field wrapper
var input_element = new InputElement({
- label : input_def.label,
- help : input_def.help,
- $el : field.$el
+ label : input_def.label,
+ optional : input_def.optional,
+ help : input_def.help,
+ field : field
});
// add to element list
@@ -417,13 +369,15 @@
var id = input_def.id;
// select field
- return new SelectDataset.View(this.app, {
+ return new SelectContent.View(this.app, {
id : 'field-' + id,
extensions : input_def.extensions,
multiple : input_def.multiple,
onchange : function(dict) {
- // pick the first dataset only (todo: maybe collect multiple meta information)
- var value = dict.values[0].id;
+ // pick the first content only (todo: maybe collect multiple meta information)
+ var content_def = dict.values[0];
+ var content_id = content_def.id;
+ var content_src = content_def.src;
// get referenced columns
var column_list = self.app.tree.references(id, 'data_column');
@@ -440,71 +394,80 @@
column_field.wait && column_field.wait();
}
- // find selected dataset
- self.app.datasets.getDetails(value, function(dataset) {
- // meta data
- var meta = null;
-
- // check dataset
- if (dataset) {
- // log selection
- console.debug('tool-form::field_data() - Selected dataset ' + value + '.');
-
- // get meta data
- meta = dataset.metadata_column_types;
-
- // check meta data
- if (!meta) {
- console.debug('tool-form::field_data() - FAILED: Could not find metadata for dataset ' + value + '.');
+ // find selected content
+ self.app.content.getDetails({
+ id : content_id,
+ src : content_src,
+ success : function(content) {
+ // meta data
+ var meta = null;
+
+ // check content
+ if (content) {
+ // log selection
+ console.debug('tool-form::field_data() - Selected content ' + content_id + '.');
+
+ // select the first dataset to represent collections
+ if (content_src == 'hdca' && content.elements && content.elements.length > 0) {
+ content = content.elements[0].object;
+ }
+
+ // get meta data
+ meta = content.metadata_column_types;
+
+ // check meta data
+ if (!meta) {
+ console.debug('tool-form::field_data() - FAILED: Could not find metadata for content ' + content_id + '.');
+ }
+ } else {
+ console.debug('tool-form::field_data() - FAILED: Could not find content ' + content_id + '.');
}
- } else {
- console.debug('tool-form::field_data() - FAILED: Could not find dataset ' + value + '.');
- }
-
- // update referenced columns
- for (var i in column_list) {
- // get column input/field
- var column_input = self.app.input_list[column_list[i]];
- var column_field = self.app.field_list[column_list[i]];
- if (!column_input || !column_field) {
- console.debug('tool-form::field_data() - FAILED: Column not found.');
- }
-
- // is numerical?
- var numerical = column_input.numerical;
- // identify column options
- var columns = [];
- for (var key in meta) {
- // get column type
- var column_type = meta[key];
+ // update referenced columns
+ for (var i in column_list) {
+ // get column input/field
+ var column_input = self.app.input_list[column_list[i]];
+ var column_field = self.app.field_list[column_list[i]];
+ if (!column_input || !column_field) {
+ console.debug('tool-form::field_data() - FAILED: Column not found.');
+ }
+
+ // is numerical?
+ var numerical = column_input.numerical;
- // column index
- var column_index = (parseInt(key) + 1);
-
- // column type label
- var column_label = 'Text';
- if (column_type == 'int' || column_type == 'float') {
- column_label = 'Number';
+ // identify column options
+ var columns = [];
+ for (var key in meta) {
+ // get column type
+ var column_type = meta[key];
+
+ // column index
+ var column_index = (parseInt(key) + 1);
+
+ // column type label
+ var column_label = 'Text';
+ if (column_type == 'int' || column_type == 'float') {
+ column_label = 'Number';
+ }
+
+ // add to selection
+ if (column_type == 'int' || column_type == 'float' || !numerical) {
+ columns.push({
+ 'label' : 'Column: ' + column_index + ' [' + column_label + ']',
+ 'value' : column_index
+ });
+ }
}
- // add to selection
- if (column_type == 'int' || column_type == 'float' || !numerical) {
- columns.push({
- 'label' : 'Column: ' + column_index + ' [' + column_label + ']',
- 'value' : column_index
- });
+ // update field
+ if (column_field) {
+ column_field.update(columns);
+ if (!column_field.exists(column_field.value())) {
+ column_field.value(column_field.first());
+ }
+ column_field.show();
}
}
-
- // update field
- if (column_field) {
- column_field.update(columns);
- if (!column_field.exists(column_field.value())) {
- column_field.value(column_field.first());
- }
- column_field.show();
- }
}
});
}
@@ -514,6 +477,11 @@
/** Select/Checkbox/Radio options field
*/
_fieldSelect : function (input_def) {
+ // check compatibility
+ if (input_def.is_dynamic) {
+ this.app.incompatible = true;
+ }
+
// configure options fields
var options = [];
for (var i in input_def.options) {
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/82ce88b096ff/
Changeset: 82ce88b096ff
User: dannon
Date: 2014-10-13 15:23:42+00:00
Summary: Merged in kellrott/galaxy-farm/docker-work (pull request #525)
Adding 'set user' flag to docker calls
Affected #: 3 files
diff -r 16425b81c25e3d806a9e5594773612599e68b785 -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 config/job_conf.xml.sample_advanced
--- a/config/job_conf.xml.sample_advanced
+++ b/config/job_conf.xml.sample_advanced
@@ -196,7 +196,8 @@
adding the '\-\-rm' flag to the command line, the container
will be removed automatically after the program is complete.
-->
- <!-- <param id="docker_auto_rm">false</param> -->
+ <!-- <param id="docker_auto_rm">true</param> -->
+ <!-- <param id="docker_set_user">true</param> --><!-- Following command can be used to tweak docker command. --><!-- <param id="docker_cmd">/usr/local/custom_docker/docker</param> --><!-- Following can be used to connect to docke server in different
diff -r 16425b81c25e3d806a9e5594773612599e68b785 -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 lib/galaxy/tools/deps/containers.py
--- a/lib/galaxy/tools/deps/containers.py
+++ b/lib/galaxy/tools/deps/containers.py
@@ -243,7 +243,8 @@
env_directives=env_directives,
working_directory=working_directory,
net=prop("net", "none"), # By default, docker instance has networking disabled
- auto_rm=prop("auto_rm", docker_util.DEFAULT_AUTO_REMOVE),
+ auto_rm=asbool(prop("auto_rm", docker_util.DEFAULT_AUTO_REMOVE)),
+ set_user=asbool(prop("set_user", docker_util.DEFAULT_SET_USER)),
**docker_host_props
)
return "%s\n%s" % (cache_command, run_command)
diff -r 16425b81c25e3d806a9e5594773612599e68b785 -r 82ce88b096ffb95246e2b6832454ef64b1b2f477 lib/galaxy/tools/deps/docker_util.py
--- a/lib/galaxy/tools/deps/docker_util.py
+++ b/lib/galaxy/tools/deps/docker_util.py
@@ -10,6 +10,7 @@
DEFAULT_MEMORY = None
DEFAULT_VOLUMES_FROM = None
DEFAULT_AUTO_REMOVE = True
+DEFAULT_SET_USER = True
class DockerVolume(object):
@@ -119,6 +120,7 @@
sudo=DEFAULT_SUDO,
sudo_cmd=DEFAULT_SUDO_COMMAND,
auto_rm=DEFAULT_AUTO_REMOVE,
+ set_user=DEFAULT_SET_USER,
host=DEFAULT_HOST,
):
command_parts = __docker_prefix(
@@ -146,6 +148,8 @@
command_parts.extend(["--net", net])
if auto_rm:
command_parts.append("--rm")
+ if set_user:
+ command_parts.extend(["-u", str(os.geteuid())])
full_image = image
if tag:
full_image = "%s:%s" % (full_image, tag)
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: Merged in hunter_moseley/galaxy-central (pull request #526)
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/16425b81c25e/
Changeset: 16425b81c25e
User: dannon
Date: 2014-10-13 15:23:01+00:00
Summary: Merged in hunter_moseley/galaxy-central (pull request #526)
Added an Xlsx(Binary) datatype that allows Upload File to properly detect the file and upload it.
Affected #: 2 files
diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 16425b81c25e3d806a9e5594773612599e68b785 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -253,6 +253,8 @@
<datatype extension="xgmml" type="galaxy.datatypes.graph:Xgmml" display_in_upload="true"/><datatype extension="sif" type="galaxy.datatypes.graph:Sif" display_in_upload="true"/><datatype extension="rdf" type="galaxy.datatypes.graph:Rdf" display_in_upload="true"/>
+ <!-- Excel datatypes -->
+ <datatype extension="xlsx" type="galaxy.datatypes.binary:Xlsx" display_in_upload="true" /></registration><sniffers><!--
diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 16425b81c25e3d806a9e5594773612599e68b785 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -12,6 +12,7 @@
import subprocess
import tempfile
import re
+import zipfile
from galaxy import eggs
eggs.require( "bx-python" )
@@ -279,6 +280,24 @@
except:
return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+class Xlsx(Binary):
+ """Class for Excel 2007 (xlsx) files"""
+ file_ext="xlsx"
+ def sniff( self, filename ):
+ # Xlsx is compressed in zip format and must not be uncompressed in Galaxy.
+ try:
+ if zipfile.is_zipfile( filename ):
+ tempzip = zipfile.ZipFile( filename )
+ if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1:
+ return True
+ return False
+ except:
+ return False
+
+Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx)
+
+
# ------------- Dataproviders
# pipe through samtools view
#ALSO: (as Sam)
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/7111e4f6a3d1/
Changeset: 7111e4f6a3d1
User: Hunter Moseley
Date: 2014-10-12 15:34:05+00:00
Summary: Added an Xlsx(Binary) datatype that properly sniffs the file and allows Upload File to properly detect the file and upload it.
Affected #: 2 files
diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 7111e4f6a3d1d95dac9f5f0e194c020e22ca4dbc config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -253,6 +253,8 @@
<datatype extension="xgmml" type="galaxy.datatypes.graph:Xgmml" display_in_upload="true"/><datatype extension="sif" type="galaxy.datatypes.graph:Sif" display_in_upload="true"/><datatype extension="rdf" type="galaxy.datatypes.graph:Rdf" display_in_upload="true"/>
+ <!-- Excel datatypes -->
+ <datatype extension="xlsx" type="galaxy.datatypes.binary:Xlsx" display_in_upload="true" /></registration><sniffers><!--
diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 7111e4f6a3d1d95dac9f5f0e194c020e22ca4dbc lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -12,6 +12,7 @@
import subprocess
import tempfile
import re
+import zipfile
from galaxy import eggs
eggs.require( "bx-python" )
@@ -279,6 +280,24 @@
except:
return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+class Xlsx(Binary):
+ """Class for Excel 2007 (xlsx) files"""
+ file_ext="xlsx"
+ def sniff( self, filename ):
+ # Xlsx is compressed in zip format and must not be uncompressed in Galaxy.
+ try:
+ if zipfile.is_zipfile( filename ):
+ tempzip = zipfile.ZipFile( filename )
+ if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1:
+ return True
+ return False
+ except:
+ return False
+
+Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx)
+
+
# ------------- Dataproviders
# pipe through samtools view
#ALSO: (as Sam)
https://bitbucket.org/galaxy/galaxy-central/commits/16425b81c25e/
Changeset: 16425b81c25e
User: dannon
Date: 2014-10-13 15:23:01+00:00
Summary: Merged in hunter_moseley/galaxy-central (pull request #526)
Added an Xlsx(Binary) datatype that allows Upload File to properly detect the file and upload it.
Affected #: 2 files
diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 16425b81c25e3d806a9e5594773612599e68b785 config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -253,6 +253,8 @@
<datatype extension="xgmml" type="galaxy.datatypes.graph:Xgmml" display_in_upload="true"/><datatype extension="sif" type="galaxy.datatypes.graph:Sif" display_in_upload="true"/><datatype extension="rdf" type="galaxy.datatypes.graph:Rdf" display_in_upload="true"/>
+ <!-- Excel datatypes -->
+ <datatype extension="xlsx" type="galaxy.datatypes.binary:Xlsx" display_in_upload="true" /></registration><sniffers><!--
diff -r 738cdb119ce34e570224eb87ee7a270caa53f39b -r 16425b81c25e3d806a9e5594773612599e68b785 lib/galaxy/datatypes/binary.py
--- a/lib/galaxy/datatypes/binary.py
+++ b/lib/galaxy/datatypes/binary.py
@@ -12,6 +12,7 @@
import subprocess
import tempfile
import re
+import zipfile
from galaxy import eggs
eggs.require( "bx-python" )
@@ -279,6 +280,24 @@
except:
return "Binary bam alignments file (%s)" % ( data.nice_size( dataset.get_size() ) )
+
+class Xlsx(Binary):
+ """Class for Excel 2007 (xlsx) files"""
+ file_ext="xlsx"
+ def sniff( self, filename ):
+ # Xlsx is compressed in zip format and must not be uncompressed in Galaxy.
+ try:
+ if zipfile.is_zipfile( filename ):
+ tempzip = zipfile.ZipFile( filename )
+ if "[Content_Types].xml" in tempzip.namelist() and tempzip.read("[Content_Types].xml").find(b'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml') != -1:
+ return True
+ return False
+ except:
+ return False
+
+Binary.register_sniffable_binary_format("xlsx", "xlsx", Xlsx)
+
+
# ------------- Dataproviders
# pipe through samtools view
#ALSO: (as Sam)
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: Update comments in job handler to refer to the correct classes (historical, copied from JobQueue etc circa 2010) and functionality.
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/738cdb119ce3/
Changeset: 738cdb119ce3
User: dannon
Date: 2014-10-13 14:34:44+00:00
Summary: Update comments in job handler to refer to the correct classes (historical, copied from JobQueue etc circa 2010) and functionality.
Affected #: 1 file
diff -r 5454f62f54df718c61ef4bf5f5446249f6525024 -r 738cdb119ce34e570224eb87ee7a270caa53f39b lib/galaxy/jobs/handler.py
--- a/lib/galaxy/jobs/handler.py
+++ b/lib/galaxy/jobs/handler.py
@@ -44,13 +44,13 @@
class JobHandlerQueue( object ):
"""
- Job manager, waits for jobs to be runnable and then dispatches to
- a JobRunner.
+ Job Handler's Internal Queue, this is what actually implements waiting for
+ jobs to be runnable and dispatching to a JobRunner.
"""
STOP_SIGNAL = object()
def __init__( self, app, dispatcher ):
- """Start the job manager"""
+ """Initializes the Job Handler Queue, creates (unstarted) monitoring thread"""
self.app = app
self.dispatcher = dispatcher
@@ -77,7 +77,7 @@
def start( self ):
"""
- The JobManager should start, and then start its Handler, if it has one.
+ Starts the JobHandler's thread after checking for any unhandled jobs.
"""
# Recover jobs at startup
self.__check_jobs_at_startup()
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: Relocate job_lock from the queue to the JobManager itself. This fixes NoopQueue not having a job_lock errors seen in Admin->Jobs
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5454f62f54df/
Changeset: 5454f62f54df
User: dannon
Date: 2014-10-13 14:19:32+00:00
Summary: Relocate job_lock from the queue to the JobManager itself. This fixes NoopQueue not having a job_lock errors seen in Admin->Jobs
Affected #: 4 files
diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 5454f62f54df718c61ef4bf5f5446249f6525024 lib/galaxy/jobs/handler.py
--- a/lib/galaxy/jobs/handler.py
+++ b/lib/galaxy/jobs/handler.py
@@ -53,7 +53,6 @@
"""Start the job manager"""
self.app = app
self.dispatcher = dispatcher
- self.job_lock = False
self.sa_session = app.model.context
self.track_jobs_in_database = self.app.config.track_jobs_in_database
@@ -174,7 +173,7 @@
try:
# If jobs are locked, there's nothing to monitor and we skip
# to the sleep.
- if not self.job_lock:
+ if not self.app.job_manager.job_lock:
self.__monitor_step()
except:
log.exception( "Exception in monitor_step" )
diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 5454f62f54df718c61ef4bf5f5446249f6525024 lib/galaxy/jobs/manager.py
--- a/lib/galaxy/jobs/manager.py
+++ b/lib/galaxy/jobs/manager.py
@@ -26,6 +26,7 @@
else:
self.job_handler = NoopHandler()
self.job_queue = self.job_stop_queue = NoopQueue()
+ self.job_lock = False
self.job_handler.start()
def shutdown( self ):
diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 5454f62f54df718c61ef4bf5f5446249f6525024 lib/galaxy/queue_worker.py
--- a/lib/galaxy/queue_worker.py
+++ b/lib/galaxy/queue_worker.py
@@ -110,7 +110,7 @@
job_lock = kwargs.get('job_lock', False)
# job_queue is exposed in the root app, but this will be 'fixed' at some
# point, so we're using the reference from the handler.
- app.job_manager.job_handler.job_queue.job_lock = job_lock
+ app.job_manager.job_lock = job_lock
log.info("Administrative Job Lock is now set to %s. Jobs will %s dispatch."
% (job_lock, "not" if job_lock else "now"))
diff -r 04015a2bc7375f1179950a3f698353d033fc3a5d -r 5454f62f54df718c61ef4bf5f5446249f6525024 lib/galaxy/web/base/controllers/admin.py
--- a/lib/galaxy/web/base/controllers/admin.py
+++ b/lib/galaxy/web/base/controllers/admin.py
@@ -1107,7 +1107,7 @@
kwargs={'job_lock': False } )
job_lock = False
else:
- job_lock = trans.app.job_manager.job_handler.job_queue.job_lock
+ job_lock = trans.app.job_manager.job_lock
cutoff_time = datetime.utcnow() - timedelta( seconds=int( cutoff ) )
jobs = trans.sa_session.query( trans.app.model.Job ) \
.filter( and_( trans.app.model.Job.table.c.update_time < cutoff_time,
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: natefoo: Update tag latest_2014.10.06 for changeset 7436bde1f785
by commits-noreply@bitbucket.org 13 Oct '14
by commits-noreply@bitbucket.org 13 Oct '14
13 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/0215d23d7971/
Changeset: 0215d23d7971
Branch: stable
User: natefoo
Date: 2014-10-13 14:00:19+00:00
Summary: Update tag latest_2014.10.06 for changeset 7436bde1f785
Affected #: 1 file
diff -r 7436bde1f7850762bcceb3a30fb4a3eceac42523 -r 0215d23d79717f46e7715e209048606975693dd7 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac latest_2014.10.06
+7436bde1f7850762bcceb3a30fb4a3eceac42523 latest_2014.10.06
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: jmchilton: Small fixes to advanced job_conf.xml sample.
by commits-noreply@bitbucket.org 10 Oct '14
by commits-noreply@bitbucket.org 10 Oct '14
10 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/04015a2bc737/
Changeset: 04015a2bc737
User: jmchilton
Date: 2014-10-10 21:07:09+00:00
Summary: Small fixes to advanced job_conf.xml sample.
Thanks to Eric for the catch.
Affected #: 1 file
diff -r 2811a26c5446706b27699fabb48a6ba3e60667d2 -r 04015a2bc7375f1179950a3f698353d033fc3a5d config/job_conf.xml.sample_advanced
--- a/config/job_conf.xml.sample_advanced
+++ b/config/job_conf.xml.sample_advanced
@@ -193,7 +193,7 @@
--><!-- <param id="docker_net">bridge</param> --><!-- By default, a container will live on past its run. By
- adding the '--rm' flag to the command line, the container
+ adding the '\-\-rm' flag to the command line, the container
will be removed automatically after the program is complete.
--><!-- <param id="docker_auto_rm">false</param> -->
@@ -344,7 +344,7 @@
--><!-- <param id="rewrite_parameters">false</params> --></destination>
- <destination id="pulsar_mq_dest" runner="amqp_pulsar" >
+ <destination id="pulsar_mq_dest" runner="pulsar_mq" ><!-- The RESTful Pulsar client sends a request to Pulsar
to populate various system properties. This
extra step can be disabled and these calculated here
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: martenson: added tooltip for changing the number of items per page link
by commits-noreply@bitbucket.org 10 Oct '14
by commits-noreply@bitbucket.org 10 Oct '14
10 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/2811a26c5446/
Changeset: 2811a26c5446
User: martenson
Date: 2014-10-10 20:38:06+00:00
Summary: added tooltip for changing the number of items per page link
Affected #: 3 files
diff -r c86a489a597657c769848d2781af631ca668a279 -r 2811a26c5446706b27699fabb48a6ba3e60667d2 client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
--- a/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
@@ -194,7 +194,7 @@
tmpl_array.push(' <% } %>');
tmpl_array.push(' </ul>');
tmpl_array.push(' <span>');
- tmpl_array.push(' showing <a id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
+ tmpl_array.push(' showing <a data-toggle="tooltip" data-placement="top" title="Click to change the number of libraries on page" id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
tmpl_array.push(' </span>');
return _.template(tmpl_array.join(''));
diff -r c86a489a597657c769848d2781af631ca668a279 -r 2811a26c5446706b27699fabb48a6ba3e60667d2 static/scripts/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/mvc/library/library-librarytoolbar-view.js
@@ -194,7 +194,7 @@
tmpl_array.push(' <% } %>');
tmpl_array.push(' </ul>');
tmpl_array.push(' <span>');
- tmpl_array.push(' showing <a id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
+ tmpl_array.push(' showing <a data-toggle="tooltip" data-placement="top" title="Click to change the number of libraries on page" id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
tmpl_array.push(' </span>');
return _.template(tmpl_array.join(''));
diff -r c86a489a597657c769848d2781af631ca668a279 -r 2811a26c5446706b27699fabb48a6ba3e60667d2 static/scripts/packed/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
@@ -1,1 +1,1 @@
-define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"showLibraryModal","click #include_deleted_chk":"includeDeletedChecked","click #page_size_prompt":"showPageSizePrompt"},initialize:function(d){this.options=_.defaults(this.options||{},d);this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},renderPaginator:function(e){this.options=_.extend(this.options,e);var d=this.templatePaginator();this.$el.find("#library_paginator").html(d({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown}))},showLibraryModal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.createNewLibrary()},Close:function(){d.modal.hide()}}})},createNewLibrary:function(){var f=this.serializeNewLibrary();if(this.valdiateNewLibrary(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clearLibraryModal();Galaxy.libraries.libraryListView.render();b.success("Library created.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured.")}}})}else{b.error("Library's name is missing.")}return false},showPageSizePrompt:function(){var d=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));if((d!=null)&&(d==parseInt(d))){Galaxy.libraries.preferences.set({library_page_size:parseInt(d)});Galaxy.libraries.libraryListView.render()}},clearLibraryModal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},valdiateNewLibrary:function(d){return d.name!==""},includeDeletedChecked:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <form class="form-inline" role="form">');tmpl_array.push(' <span><strong><a href="#" title="Go to first page">DATA LIBRARIES</a></strong></span>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div class="checkbox" style="height: 20px;">');tmpl_array.push(" <label>");tmpl_array.push(' <input id="include_deleted_chk" type="checkbox"> include deleted </input>');tmpl_array.push(" </label>");tmpl_array.push(" </div>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(' <span id="library_paginator" class="library-paginator">');tmpl_array.push(" </span>");tmpl_array.push(" </form>");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templatePaginator:function(){tmpl_array=[];tmpl_array.push(' <ul class="pagination pagination-sm">');tmpl_array.push(" <% if ( ( show_page - 1 ) > 0 ) { %>");tmpl_array.push(" <% if ( ( show_page - 1 ) > page_count ) { %>");tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li><a href="#page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(' <li class="active">');tmpl_array.push(' <a href="#page/<% print( show_page ) %>"><% print( show_page ) %></a>');tmpl_array.push(" </li>");tmpl_array.push(" <% if ( ( show_page ) < page_count ) { %>");tmpl_array.push(' <li><a href="#page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" <span>");tmpl_array.push(' showing <a id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');tmpl_array.push(" </span>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
+define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"showLibraryModal","click #include_deleted_chk":"includeDeletedChecked","click #page_size_prompt":"showPageSizePrompt"},initialize:function(d){this.options=_.defaults(this.options||{},d);this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},renderPaginator:function(e){this.options=_.extend(this.options,e);var d=this.templatePaginator();this.$el.find("#library_paginator").html(d({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown}))},showLibraryModal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.createNewLibrary()},Close:function(){d.modal.hide()}}})},createNewLibrary:function(){var f=this.serializeNewLibrary();if(this.valdiateNewLibrary(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clearLibraryModal();Galaxy.libraries.libraryListView.render();b.success("Library created.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured.")}}})}else{b.error("Library's name is missing.")}return false},showPageSizePrompt:function(){var d=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));if((d!=null)&&(d==parseInt(d))){Galaxy.libraries.preferences.set({library_page_size:parseInt(d)});Galaxy.libraries.libraryListView.render()}},clearLibraryModal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},valdiateNewLibrary:function(d){return d.name!==""},includeDeletedChecked:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <form class="form-inline" role="form">');tmpl_array.push(' <span><strong><a href="#" title="Go to first page">DATA LIBRARIES</a></strong></span>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div class="checkbox" style="height: 20px;">');tmpl_array.push(" <label>");tmpl_array.push(' <input id="include_deleted_chk" type="checkbox"> include deleted </input>');tmpl_array.push(" </label>");tmpl_array.push(" </div>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(' <span id="library_paginator" class="library-paginator">');tmpl_array.push(" </span>");tmpl_array.push(" </form>");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templatePaginator:function(){tmpl_array=[];tmpl_array.push(' <ul class="pagination pagination-sm">');tmpl_array.push(" <% if ( ( show_page - 1 ) > 0 ) { %>");tmpl_array.push(" <% if ( ( show_page - 1 ) > page_count ) { %>");tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li><a href="#page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(' <li class="active">');tmpl_array.push(' <a href="#page/<% print( show_page ) %>"><% print( show_page ) %></a>');tmpl_array.push(" </li>");tmpl_array.push(" <% if ( ( show_page ) < page_count ) { %>");tmpl_array.push(' <li><a href="#page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" <span>");tmpl_array.push(' showing <a data-toggle="tooltip" data-placement="top" title="Click to change the number of libraries on page" id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');tmpl_array.push(" </span>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView: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: martenson: first version of data libraries pagination, including some bugfixes and docs
by commits-noreply@bitbucket.org 10 Oct '14
by commits-noreply@bitbucket.org 10 Oct '14
10 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c86a489a5976/
Changeset: c86a489a5976
User: martenson
Date: 2014-10-10 20:33:51+00:00
Summary: first version of data libraries pagination, including some bugfixes and docs
Affected #: 17 files
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 client/galaxy/scripts/galaxy.library.js
--- a/client/galaxy/scripts/galaxy.library.js
+++ b/client/galaxy/scripts/galaxy.library.js
@@ -16,19 +16,19 @@
"mvc/library/library-library-view",
"mvc/library/library-folder-view"
],
-function(mod_masthead,
- mod_utils,
- mod_toastr,
- mod_baseMVC,
- mod_library_model,
- mod_folderlist_view,
- mod_librarylist_view,
- mod_librarytoolbar_view,
- mod_foldertoolbar_view,
- mod_library_dataset_view,
- mod_library_library_view,
- mod_library_folder_view
- ) {
+ function(mod_masthead,
+ mod_utils,
+ mod_toastr,
+ mod_baseMVC,
+ mod_library_model,
+ mod_folderlist_view,
+ mod_librarylist_view,
+ mod_librarytoolbar_view,
+ mod_foldertoolbar_view,
+ mod_library_dataset_view,
+ mod_library_library_view,
+ mod_library_folder_view
+ ) {
// ============================================================================
// ROUTER
@@ -37,10 +37,11 @@
this.routesHit = 0;
//keep count of number of routes handled by the application
Backbone.history.on('route', function() { this.routesHit++; }, this);
- },
+},
- routes: {
+routes: {
"" : "libraries",
+ "page/:show_page" : "libraries_page",
"library/:library_id/permissions" : "library_permissions",
"folders/:folder_id/permissions" : "folder_permissions",
"folders/:id" : "folder_content",
@@ -49,27 +50,28 @@
"folders/:folder_id/datasets/:dataset_id/versions/:ldda_id" : "dataset_version",
"folders/:folder_id/download/:format" : "download",
"folders/:folder_id/import/:source" : "import_datasets"
- },
+},
- back: function() {
+back: function() {
if(this.routesHit > 1) {
//more than one route hit -> user did not land to current page directly
window.history.back();
- } else {
+ } else {
//otherwise go to the home page. Use replaceState if available so
//the navigation doesn't create an extra history entry
this.navigate('#', {trigger:true, replace:true});
- }
}
+}
});
// ============================================================================
/** session storage for library preferences */
var LibraryPrefs = mod_baseMVC.SessionStorageModel.extend({
defaults : {
- with_deleted : false,
- sort_order : 'asc',
- sort_by : 'name'
+ with_deleted : false,
+ sort_order : 'asc',
+ sort_by : 'name',
+ library_page_size : 20
}
});
@@ -88,77 +90,86 @@
initialize : function(){
Galaxy.libraries = this;
- this.preferences = new LibraryPrefs( {id: 'global-lib-prefs'} );
+ this.preferences = new LibraryPrefs( { id: 'global-lib-prefs' } );
this.library_router = new LibraryRouter();
this.library_router.on('route:libraries', function() {
Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView();
+ });
+
+ this.library_router.on('route:libraries_page', function( show_page ) {
+ if ( Galaxy.libraries.libraryToolbarView === null ){
+ Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
+ Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView( { show_page: show_page } );
+ } else {
+ Galaxy.libraries.libraryListView.render( { show_page: show_page } )
+ }
});
this.library_router.on('route:folder_content', function(id) {
if (Galaxy.libraries.folderToolbarView){
Galaxy.libraries.folderToolbarView.$el.unbind('click');
- }
- Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: id});
- Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: id});
- });
+ }
+ Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: id});
+ Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: id});
+ });
- this.library_router.on('route:download', function(folder_id, format) {
+ this.library_router.on('route:download', function(folder_id, format) {
if ($('#folder_list_body').find(':checked').length === 0) {
mod_toastr.info( 'You must select at least one dataset to download' );
Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: true, replace: true});
- } else {
+ } else {
Galaxy.libraries.folderToolbarView.download(folder_id, format);
Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: false, replace: true});
- }
- });
+ }
+ });
- this.library_router.on('route:dataset_detail', function(folder_id, dataset_id){
+ this.library_router.on('route:dataset_detail', function(folder_id, dataset_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id});
- });
- this.library_router.on('route:dataset_version', function(folder_id, dataset_id, ldda_id){
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id});
+ });
+ this.library_router.on('route:dataset_version', function(folder_id, dataset_id, ldda_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, ldda_id: ldda_id, show_version: true});
- });
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, ldda_id: ldda_id, show_version: true});
+ });
- this.library_router.on('route:dataset_permissions', function(folder_id, dataset_id){
+ this.library_router.on('route:dataset_permissions', function(folder_id, dataset_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, show_permissions: true});
- });
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, show_permissions: true});
+ });
- this.library_router.on('route:library_permissions', function(library_id){
+ this.library_router.on('route:library_permissions', function(library_id){
if (Galaxy.libraries.libraryView){
Galaxy.libraries.libraryView.$el.unbind('click');
- }
- Galaxy.libraries.libraryView = new mod_library_library_view.LibraryView({id: library_id, show_permissions: true});
- });
+ }
+ Galaxy.libraries.libraryView = new mod_library_library_view.LibraryView({id: library_id, show_permissions: true});
+ });
- this.library_router.on('route:folder_permissions', function(folder_id){
+ this.library_router.on('route:folder_permissions', function(folder_id){
if (Galaxy.libraries.folderView){
Galaxy.libraries.folderView.$el.unbind('click');
- }
- Galaxy.libraries.folderView = new mod_library_folder_view.FolderView({id: folder_id, show_permissions: true});
- });
- this.library_router.on('route:import_datasets', function(folder_id, source){
+ }
+ Galaxy.libraries.folderView = new mod_library_folder_view.FolderView({id: folder_id, show_permissions: true});
+ });
+ this.library_router.on('route:import_datasets', function(folder_id, source){
if (Galaxy.libraries.folderToolbarView && Galaxy.libraries.folderListView){
Galaxy.libraries.folderToolbarView.showImportModal({source:source});
- } else {
+ } else {
Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: folder_id});
Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: folder_id});
Galaxy.libraries.folderToolbarView.showImportModal({source: source});
- }
- });
+ }
+ });
- Backbone.history.start({pushState: false});
+ Backbone.history.start({pushState: false});
}
});
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
--- a/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
@@ -72,7 +72,7 @@
},
render: function(options){
- this.options = _.extend(this.options, options);
+ this.options = _.extend( this.options, options );
var toolbar_template = this.templateToolBar();
var template_defaults = {
id: this.options.id,
@@ -346,18 +346,18 @@
this.modal = Galaxy.modal;
var template_modal = this.templateImportPathModal();
this.modal.show({
- closing_events : true,
- title : 'Please enter paths to import',
- body : template_modal({}),
- buttons : {
- 'Import' : function() {that.importFromPathsClicked(that);},
- 'Close' : function() {Galaxy.modal.hide();}
- },
- closing_callback: function(){
- // TODO: should not trigger routes outside of the router
- Galaxy.libraries.library_router.navigate('folders/' + that.id, {trigger: true});
- }
- });
+ closing_events : true,
+ title : 'Please enter paths to import',
+ body : template_modal({}),
+ buttons : {
+ 'Import' : function() { that.importFromPathsClicked(that); },
+ 'Close' : function() { Galaxy.modal.hide(); }
+ },
+ closing_callback: function(){
+ // TODO: should not trigger routes outside of the router
+ Galaxy.libraries.library_router.navigate( 'folders/' + that.id, { trigger: true } );
+ }
+ });
this.renderSelectBoxes();
},
@@ -367,34 +367,37 @@
*/
fetchExtAndGenomes: function(){
var that = this;
- mod_utils.get(galaxy_config.root + "api/datatypes?extension_only=False",
- function(datatypes) {
- for (key in datatypes) {
- that.list_extensions.push({
- id : datatypes[key].extension,
- text : datatypes[key].extension,
- description : datatypes[key].description,
- description_url : datatypes[key].description_url
- });
- }
- that.list_extensions.sort(function(a, b) {
- return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
- });
- that.list_extensions.unshift(that.auto);
-
- });
- mod_utils.get(galaxy_config.root + "api/genomes",
- function(genomes) {
- for (key in genomes) {
- that.list_genomes.push({
- id : genomes[key][1],
- text : genomes[key][0]
- });
- }
- that.list_genomes.sort(function(a, b) {
- return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
- });
- });
+ mod_utils.get({
+ url : galaxy_config.root + "api/datatypes?extension_only=False",
+ success : function( datatypes ) {
+ for (key in datatypes) {
+ that.list_extensions.push({
+ id : datatypes[key].extension,
+ text : datatypes[key].extension,
+ description : datatypes[key].description,
+ description_url : datatypes[key].description_url
+ });
+ }
+ that.list_extensions.sort(function(a, b) {
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
+ });
+ that.list_extensions.unshift(that.auto);
+ }
+ });
+ mod_utils.get({
+ url: galaxy_config.root + "api/genomes",
+ success: function( genomes ) {
+ for ( key in genomes ) {
+ that.list_genomes.push({
+ id : genomes[key][1],
+ text : genomes[key][0]
+ });
+ }
+ that.list_genomes.sort(function(a, b) {
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
+ });
+ }
+ });
},
renderSelectBoxes: function(){
@@ -1027,7 +1030,7 @@
tmpl_array.push(' </div>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');
tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');
- tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
+ tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
tmpl_array.push(' </div>');
// TOOLBAR END
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 client/galaxy/scripts/mvc/library/library-librarylist-view.js
--- a/client/galaxy/scripts/mvc/library/library-librarylist-view.js
+++ b/client/galaxy/scripts/mvc/library/library-librarylist-view.js
@@ -4,13 +4,15 @@
"utils/utils",
"libs/toastr",
"mvc/library/library-model",
- "mvc/library/library-libraryrow-view"],
-function(mod_masthead,
- mod_baseMVC,
- mod_utils,
- mod_toastr,
- mod_library_model,
- mod_library_libraryrow_view) {
+ "mvc/library/library-libraryrow-view"
+], function(
+ mod_masthead,
+ mod_baseMVC,
+ mod_utils,
+ mod_toastr,
+ mod_library_model,
+ mod_library_libraryrow_view
+){
var LibraryListView = Backbone.View.extend({
el: '#libraries_element',
@@ -19,104 +21,135 @@
'click .sort-libraries-link' : 'sort_clicked'
},
- modal: null,
+ /**
+ * Initialize and fetch the libraries from server.
+ * Async render afterwards.
+ * @param {object} options an options object
+ */
+ defaults: {
+ page_count: null,
+ show_page: null
+ },
- // collection of {Item}s
- collection: null,
+ initialize : function( options ){
+ this.options = _.defaults( this.options || {}, this.defaults, options );
- // map of library model ids to library views = cache
- rowViews: {},
-
- initialize : function(options){
- this.options = _.defaults(this.options || {}, options);
- var that = this;
+ var that = this;
+ this.modal = null;
+ // map of library model ids to library views = cache
this.rowViews = {};
+ // collection of {Item}s
this.collection = new mod_library_model.Libraries();
this.collection.fetch({
success: function(){
that.render();
},
- error: function(model, response){
- if (typeof response.responseJSON !== "undefined"){
- mod_toastr.error(response.responseJSON.err_msg);
+ error: function( model, response ){
+ if ( typeof response.responseJSON !== "undefined" ){
+ mod_toastr.error( response.responseJSON.err_msg );
} else {
- mod_toastr.error('An error ocurred.');
+ mod_toastr.error( 'An error ocurred.' );
}
}
});
},
- /** Renders the libraries table either from the object's own collection,
- * or from a given array of library models,
- * or renders an empty list in case no data is given. */
- render: function (options) {
- $(".tooltip").hide();
+ /**
+ * Render the libraries table either from the object's own collection,
+ * or from a given array of library models,
+ * or render an empty list in case no data is given.
+ */
+ render: function ( options ) {
+ this.options = _.extend( this.options, options );
+
+ if ( ( this.options.page_size != null ) && ( this.options.page_size == parseInt( this.options.page_size ) ) ) {
+ Galaxy.libraries.preferences.set( { 'library_page_size': parseInt( this.options.page_size ) } );
+ }
+
+ $( ".tooltip" ).hide();
+ // this.options.show_page = this.options.show_page || 1;
var template = this.templateLibraryList();
var libraries_to_render = null;
- var include_deleted = Galaxy.libraries.preferences.get('with_deleted');
var models = null;
- if (typeof options !== 'undefined'){
- include_deleted = typeof options.with_deleted !== 'undefined' ? options.with_deleted : false;
+ if ( this.options.show_page === null || this.options.show_page < 1 ){
+ this.options.show_page = 1;
+ }
+ if ( typeof options !== 'undefined' ){
models = typeof options.models !== 'undefined' ? options.models : null;
}
-
- if (this.collection !== null && models === null){
+ if ( this.collection !== null && models === null ){
this.sortLibraries();
- if (include_deleted){ // show all the libraries
+ if ( Galaxy.libraries.preferences.get( 'with_deleted' ) ){
libraries_to_render = this.collection.models;
- } else{ // show only undeleted libraries
- libraries_to_render = this.collection.where({deleted: false});
+ } else {
+ libraries_to_render = this.collection.where( { deleted: false } );
}
- } else if (models !== null){
+ } else if ( models !== null ){
libraries_to_render = models;
} else {
libraries_to_render = [];
+ }
+ this.options.total_libraries_count = libraries_to_render.length
+ var page_start = ( Galaxy.libraries.preferences.get( 'library_page_size' ) * ( this.options.show_page - 1 ) );
+ this.options.page_count = Math.ceil( this.options.total_libraries_count / Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ if ( this.options.total_libraries_count > 0 && ( page_start < this.options.total_libraries_count ) ){
+ libraries_to_render = libraries_to_render.slice( page_start, page_start + Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ this.options.libraries_shown = libraries_to_render.length;
+ // User requests page with no libraries
+ if ( Galaxy.libraries.preferences.get( 'library_page_size' ) * this.options.show_page > ( this.options.total_libraries_count + Galaxy.libraries.preferences.get( 'library_page_size' ) ) ){
+ libraries_to_render = [];
}
-
- this.$el.html(template({length: libraries_to_render.length, order: Galaxy.libraries.preferences.get('sort_order') }));
-
- if (libraries_to_render.length > 0){
- this.renderRows(libraries_to_render);
+ this.$el.html( template({
+ length: 1,
+ order: Galaxy.libraries.preferences.get( 'sort_order' )
+ }));
+ Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
+ this.renderRows( libraries_to_render );
+ } else {
+ this.$el.html( template({
+ length: 0,
+ order: Galaxy.libraries.preferences.get( 'sort_order' )
+ }));
+ Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
}
- // initialize the library tooltips
- $("#center [data-toggle]").tooltip();
- // modification of upper DOM element to show scrollbars due
- // to the #center element inheritance
- $("#center").css('overflow','auto');
+ $( "#center [data-toggle]" ).tooltip();
+ $( "#center" ).css( 'overflow','auto' );
},
- /** Renders all given models as rows in the library list */
- renderRows: function(libraries_to_render){
- for (var i = 0; i < libraries_to_render.length; i++) {
+ /**
+ * Render all given models as rows in the library list
+ * @param {array} libraries_to_render array of library models to render
+ */
+ renderRows: function( libraries_to_render ){
+ for ( var i = 0; i < libraries_to_render.length; i++ ) {
var library = libraries_to_render[i];
- var cachedView = _.findWhere(this.rowViews, {id: library.get('id')});
- if (cachedView !== undefined && this instanceof Backbone.View){
+ // search whether we have the item cached
+ var cachedView = _.findWhere( this.rowViews, { id: library.get( 'id' ) } );
+ if ( cachedView !== undefined && this instanceof Backbone.View ){
cachedView.delegateEvents();
- this.$el.find('#library_list_body').append(cachedView.el);
+ this.$el.find( '#library_list_body' ).append( cachedView.el );
} else {
- this.renderOne({library:library})
+ this.renderOne( { library: library } )
}
}
},
/**
- * Creates a view for the given model and adds it to the libraries view.
+ * Create a view for the given model and add it to the libraries view.
* @param {Library} model of the view that will be rendered
*/
- renderOne: function(options){
+ renderOne: function( options ){
var library = options.library;
- var rowView = new mod_library_libraryrow_view.LibraryRowView(library);
- // we want to prepend new item
- if (options.prepend){
- this.$el.find('#library_list_body').prepend(rowView.el);
- } else {
- this.$el.find('#library_list_body').append(rowView.el);
- }
+ var rowView = new mod_library_libraryrow_view.LibraryRowView( library );
+ this.$el.find( '#library_list_body' ).append( rowView.el );
// save new rowView to cache
- this.rowViews[library.get('id')] = rowView;
+ this.rowViews[ library.get( 'id' ) ] = rowView;
},
- /** Table heading was clicked, update sorting preferences and re-render */
+ /**
+ * Table heading was clicked, update sorting preferences and re-render.
+ * @return {[type]} [description]
+ */
sort_clicked : function(){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
Galaxy.libraries.preferences.set({'sort_order': 'desc'});
@@ -126,8 +159,10 @@
this.render();
},
- /** Sorts the underlying collection according to the parameters received.
- Currently supports only sorting by name. */
+ /**
+ * Sort the underlying collection according to the parameters received.
+ * Currently supports only sorting by name.
+ */
sortLibraries: function(){
if (Galaxy.libraries.preferences.get('sort_by') === 'name'){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
@@ -138,6 +173,13 @@
}
},
+ redirectToHome: function(){
+ window.location = '../';
+ },
+ redirectToLogin: function(){
+ window.location = '/user/login';
+ },
+
// MMMMMMMMMMMMMMMMMM
// === TEMPLATES ====
// MMMMMMMMMMMMMMMMMM
@@ -147,14 +189,14 @@
tmpl_array.push('<div class="library_container table-responsive">');
tmpl_array.push('<% if(length === 0) { %>');
- tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');
+ tmpl_array.push('<div>There are no libraries visible to you here. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');
tmpl_array.push('<% } else{ %>');
tmpl_array.push('<table class="grid table table-condensed">');
tmpl_array.push(' <thead>');
tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');
tmpl_array.push(' <th style="width:22%;">description</th>');
tmpl_array.push(' <th style="width:22%;">synopsis</th> ');
- tmpl_array.push(' <th style="width:26%;"></th> ');
+ tmpl_array.push(' <th style="width:26%;"></th>');
tmpl_array.push(' </thead>');
tmpl_array.push(' <tbody id="library_list_body">');
// library item views will attach here
@@ -166,14 +208,6 @@
return _.template(tmpl_array.join(''));
},
-
- redirectToHome: function(){
- window.location = '../';
- },
- redirectToLogin: function(){
- window.location = '/user/login';
- },
-
});
return {
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
--- a/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/client/galaxy/scripts/mvc/library/library-librarytoolbar-view.js
@@ -11,11 +11,13 @@
el: '#center',
events: {
- 'click #create_new_library_btn' : 'show_library_modal',
- 'click #include_deleted_chk' : 'check_include_deleted'
+ 'click #create_new_library_btn' : 'showLibraryModal',
+ 'click #include_deleted_chk' : 'includeDeletedChecked',
+ 'click #page_size_prompt' : 'showPageSizePrompt'
},
- initialize: function(){
+ initialize: function( options ){
+ this.options = _.defaults( this.options || {}, options );
this.render();
},
@@ -23,21 +25,34 @@
var toolbar_template = this.templateToolBar();
var is_admin = false;
var is_anonym = true;
- if (Galaxy.currUser){
+ if ( Galaxy.currUser ){
is_admin = Galaxy.currUser.isAdmin();
is_anonym = Galaxy.currUser.isAnonymous();
}
- this.$el.html(toolbar_template({admin_user: is_admin, anon_user: is_anonym}));
- if (is_admin){
- this.$el.find('#include_deleted_chk')[0].checked = Galaxy.libraries.preferences.get('with_deleted');
+ this.$el.html(toolbar_template( { admin_user: is_admin, anon_user: is_anonym } ) );
+ if ( is_admin ){
+ this.$el.find( '#include_deleted_chk' )[0].checked = Galaxy.libraries.preferences.get( 'with_deleted' );
}
},
- show_library_modal : function (event){
+ /**
+ * Called from LibraryListView when needed.
+ * @param {object} options common options
+ */
+ renderPaginator: function( options ){
+ this.options = _.extend( this.options, options );
+ var paginator_template = this.templatePaginator();
+ this.$el.find( '#library_paginator' ).html( paginator_template({
+ show_page: parseInt( this.options.show_page ),
+ page_count: parseInt( this.options.page_count ),
+ total_libraries_count: this.options.total_libraries_count,
+ libraries_shown: this.options.libraries_shown
+ }));
+ },
+
+ showLibraryModal : function (event){
event.preventDefault();
event.stopPropagation();
-
- // create modal
var self = this;
this.modal = Galaxy.modal;
this.modal.show({
@@ -45,22 +60,22 @@
title : 'Create New Library',
body : this.templateNewLibraryInModal(),
buttons : {
- 'Create' : function() {self.create_new_library_event();},
- 'Close' : function() {self.modal.hide();}
+ 'Create' : function() { self.createNewLibrary(); },
+ 'Close' : function() { self.modal.hide(); }
}
});
},
- create_new_library_event: function(){
- var libraryDetails = this.serialize_new_library();
- if (this.validate_new_library(libraryDetails)){
+ createNewLibrary: function(){
+ var libraryDetails = this.serializeNewLibrary();
+ if (this.valdiateNewLibrary(libraryDetails)){
var library = new mod_library_model.Library();
var self = this;
library.save(libraryDetails, {
success: function (library) {
Galaxy.libraries.libraryListView.collection.add(library);
self.modal.hide();
- self.clear_library_modal();
+ self.clearLibraryModal();
Galaxy.libraries.libraryListView.render();
mod_toastr.success('Library created.');
},
@@ -78,15 +93,22 @@
return false;
},
+ showPageSizePrompt: function(){
+ var library_page_size = prompt( 'How many libraries per page do you want to see?', Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ if ( ( library_page_size != null ) && ( library_page_size == parseInt( library_page_size ) ) ) {
+ Galaxy.libraries.preferences.set( { 'library_page_size': parseInt( library_page_size ) } );
+ Galaxy.libraries.libraryListView.render();
+ }
+ },
+
// clear the library modal once saved
- clear_library_modal : function(){
+ clearLibraryModal : function(){
$("input[name='Name']").val('');
$("input[name='Description']").val('');
$("input[name='Synopsis']").val('');
},
- // serialize data from the new library form
- serialize_new_library : function(){
+ serializeNewLibrary : function(){
return {
name: $("input[name='Name']").val(),
description: $("input[name='Description']").val(),
@@ -94,18 +116,20 @@
};
},
- // validate new library info
- validate_new_library: function(libraryDetails){
+ valdiateNewLibrary: function( libraryDetails ){
return libraryDetails.name !== '';
},
- // include or exclude deleted libraries from the view
- check_include_deleted: function(event){
+ /**
+ * Include or exclude deleted libraries in the view.
+ * @param {object} event common event
+ */
+ includeDeletedChecked: function( event ){
if (event.target.checked){
- Galaxy.libraries.preferences.set({'with_deleted': true});
+ Galaxy.libraries.preferences.set( { 'with_deleted': true } );
Galaxy.libraries.libraryListView.render();
} else{
- Galaxy.libraries.preferences.set({'with_deleted': false});
+ Galaxy.libraries.preferences.set( { 'with_deleted': false } );
Galaxy.libraries.libraryListView.render();
}
},
@@ -113,22 +137,26 @@
templateToolBar: function(){
tmpl_array = [];
+
tmpl_array.push('<div class="library_style_container">');
- // TOOLBAR
tmpl_array.push(' <div id="toolbar_form">');
tmpl_array.push(' <div id="library_toolbar">');
- tmpl_array.push(' <span><strong>DATA LIBRARIES</strong></span>');
- tmpl_array.push(' <% if(admin_user === true) { %>');
- tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');
- tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
- tmpl_array.push(' <% } %>');
- tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
- tmpl_array.push(' </div>');
-
- tmpl_array.push(' <div>');
- tmpl_array.push(' ');
- tmpl_array.push(' </div>');
-
+ tmpl_array.push(' <form class="form-inline" role="form">');
+ tmpl_array.push(' <span><strong><a href="#" title="Go to first page">DATA LIBRARIES</a></strong></span>');
+ tmpl_array.push(' <% if(admin_user === true) { %>');
+ tmpl_array.push(' <div class="checkbox" style="height: 20px;">');
+ tmpl_array.push(' <label>');
+ tmpl_array.push(' <input id="include_deleted_chk" type="checkbox"> include deleted </input>');
+ tmpl_array.push(' </label>');
+ tmpl_array.push(' </div>');
+ tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
+ tmpl_array.push(' <span id="library_paginator" class="library-paginator">');
+ // paginator will append here
+ tmpl_array.push(' </span>');
+ tmpl_array.push(' </form>');
+ tmpl_array.push(' </div>');
tmpl_array.push(' </div>');
tmpl_array.push(' <div id="libraries_element">');
// table with libraries will append here
@@ -138,6 +166,39 @@
return _.template(tmpl_array.join(''));
},
+ templatePaginator: function(){
+ tmpl_array = [];
+
+ tmpl_array.push(' <ul class="pagination pagination-sm">');
+ tmpl_array.push(' <% if ( ( show_page - 1 ) > 0 ) { %>');
+ tmpl_array.push(' <% if ( ( show_page - 1 ) > page_count ) { %>'); // we are on higher page than total page count
+ tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } else { %>');
+ tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li><a href="#page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <% } else { %>'); // we are on the first page
+ tmpl_array.push(' <li class="disabled"><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <li class="active">');
+ tmpl_array.push(' <a href="#page/<% print( show_page ) %>"><% print( show_page ) %></a>');
+ tmpl_array.push(' </li>');
+ tmpl_array.push(' <% if ( ( show_page ) < page_count ) { %>');
+ tmpl_array.push(' <li><a href="#page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');
+ tmpl_array.push(' <li><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');
+ tmpl_array.push(' <% } else { %>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' </ul>');
+ tmpl_array.push(' <span>');
+ tmpl_array.push(' showing <a id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
+ tmpl_array.push(' </span>');
+
+ return _.template(tmpl_array.join(''));
+ },
templateNewLibraryInModal: function(){
tmpl_array = [];
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 lib/galaxy/managers/libraries.py
--- a/lib/galaxy/managers/libraries.py
+++ b/lib/galaxy/managers/libraries.py
@@ -103,6 +103,9 @@
:param deleted: if True, show only ``deleted`` libraries, if False show only ``non-deleted``
:type deleted: boolean (optional)
+
+ :returns: query that will emit all accessible libraries
+ :rtype: sqlalchemy query
"""
is_admin = trans.user_is_admin()
query = trans.sa_session.query( trans.app.model.Library )
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/galaxy.library.js
--- a/static/scripts/galaxy.library.js
+++ b/static/scripts/galaxy.library.js
@@ -16,19 +16,19 @@
"mvc/library/library-library-view",
"mvc/library/library-folder-view"
],
-function(mod_masthead,
- mod_utils,
- mod_toastr,
- mod_baseMVC,
- mod_library_model,
- mod_folderlist_view,
- mod_librarylist_view,
- mod_librarytoolbar_view,
- mod_foldertoolbar_view,
- mod_library_dataset_view,
- mod_library_library_view,
- mod_library_folder_view
- ) {
+ function(mod_masthead,
+ mod_utils,
+ mod_toastr,
+ mod_baseMVC,
+ mod_library_model,
+ mod_folderlist_view,
+ mod_librarylist_view,
+ mod_librarytoolbar_view,
+ mod_foldertoolbar_view,
+ mod_library_dataset_view,
+ mod_library_library_view,
+ mod_library_folder_view
+ ) {
// ============================================================================
// ROUTER
@@ -37,10 +37,11 @@
this.routesHit = 0;
//keep count of number of routes handled by the application
Backbone.history.on('route', function() { this.routesHit++; }, this);
- },
+},
- routes: {
+routes: {
"" : "libraries",
+ "page/:show_page" : "libraries_page",
"library/:library_id/permissions" : "library_permissions",
"folders/:folder_id/permissions" : "folder_permissions",
"folders/:id" : "folder_content",
@@ -49,27 +50,28 @@
"folders/:folder_id/datasets/:dataset_id/versions/:ldda_id" : "dataset_version",
"folders/:folder_id/download/:format" : "download",
"folders/:folder_id/import/:source" : "import_datasets"
- },
+},
- back: function() {
+back: function() {
if(this.routesHit > 1) {
//more than one route hit -> user did not land to current page directly
window.history.back();
- } else {
+ } else {
//otherwise go to the home page. Use replaceState if available so
//the navigation doesn't create an extra history entry
this.navigate('#', {trigger:true, replace:true});
- }
}
+}
});
// ============================================================================
/** session storage for library preferences */
var LibraryPrefs = mod_baseMVC.SessionStorageModel.extend({
defaults : {
- with_deleted : false,
- sort_order : 'asc',
- sort_by : 'name'
+ with_deleted : false,
+ sort_order : 'asc',
+ sort_by : 'name',
+ library_page_size : 20
}
});
@@ -88,77 +90,86 @@
initialize : function(){
Galaxy.libraries = this;
- this.preferences = new LibraryPrefs( {id: 'global-lib-prefs'} );
+ this.preferences = new LibraryPrefs( { id: 'global-lib-prefs' } );
this.library_router = new LibraryRouter();
this.library_router.on('route:libraries', function() {
Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView();
+ });
+
+ this.library_router.on('route:libraries_page', function( show_page ) {
+ if ( Galaxy.libraries.libraryToolbarView === null ){
+ Galaxy.libraries.libraryToolbarView = new mod_librarytoolbar_view.LibraryToolbarView();
+ Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView( { show_page: show_page } );
+ } else {
+ Galaxy.libraries.libraryListView.render( { show_page: show_page } )
+ }
});
this.library_router.on('route:folder_content', function(id) {
if (Galaxy.libraries.folderToolbarView){
Galaxy.libraries.folderToolbarView.$el.unbind('click');
- }
- Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: id});
- Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: id});
- });
+ }
+ Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: id});
+ Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: id});
+ });
- this.library_router.on('route:download', function(folder_id, format) {
+ this.library_router.on('route:download', function(folder_id, format) {
if ($('#folder_list_body').find(':checked').length === 0) {
mod_toastr.info( 'You must select at least one dataset to download' );
Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: true, replace: true});
- } else {
+ } else {
Galaxy.libraries.folderToolbarView.download(folder_id, format);
Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: false, replace: true});
- }
- });
+ }
+ });
- this.library_router.on('route:dataset_detail', function(folder_id, dataset_id){
+ this.library_router.on('route:dataset_detail', function(folder_id, dataset_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id});
- });
- this.library_router.on('route:dataset_version', function(folder_id, dataset_id, ldda_id){
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id});
+ });
+ this.library_router.on('route:dataset_version', function(folder_id, dataset_id, ldda_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, ldda_id: ldda_id, show_version: true});
- });
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, ldda_id: ldda_id, show_version: true});
+ });
- this.library_router.on('route:dataset_permissions', function(folder_id, dataset_id){
+ this.library_router.on('route:dataset_permissions', function(folder_id, dataset_id){
if (Galaxy.libraries.datasetView){
Galaxy.libraries.datasetView.$el.unbind('click');
- }
- Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, show_permissions: true});
- });
+ }
+ Galaxy.libraries.datasetView = new mod_library_dataset_view.LibraryDatasetView({id: dataset_id, show_permissions: true});
+ });
- this.library_router.on('route:library_permissions', function(library_id){
+ this.library_router.on('route:library_permissions', function(library_id){
if (Galaxy.libraries.libraryView){
Galaxy.libraries.libraryView.$el.unbind('click');
- }
- Galaxy.libraries.libraryView = new mod_library_library_view.LibraryView({id: library_id, show_permissions: true});
- });
+ }
+ Galaxy.libraries.libraryView = new mod_library_library_view.LibraryView({id: library_id, show_permissions: true});
+ });
- this.library_router.on('route:folder_permissions', function(folder_id){
+ this.library_router.on('route:folder_permissions', function(folder_id){
if (Galaxy.libraries.folderView){
Galaxy.libraries.folderView.$el.unbind('click');
- }
- Galaxy.libraries.folderView = new mod_library_folder_view.FolderView({id: folder_id, show_permissions: true});
- });
- this.library_router.on('route:import_datasets', function(folder_id, source){
+ }
+ Galaxy.libraries.folderView = new mod_library_folder_view.FolderView({id: folder_id, show_permissions: true});
+ });
+ this.library_router.on('route:import_datasets', function(folder_id, source){
if (Galaxy.libraries.folderToolbarView && Galaxy.libraries.folderListView){
Galaxy.libraries.folderToolbarView.showImportModal({source:source});
- } else {
+ } else {
Galaxy.libraries.folderToolbarView = new mod_foldertoolbar_view.FolderToolbarView({id: folder_id});
Galaxy.libraries.folderListView = new mod_folderlist_view.FolderListView({id: folder_id});
Galaxy.libraries.folderToolbarView.showImportModal({source: source});
- }
- });
+ }
+ });
- Backbone.history.start({pushState: false});
+ Backbone.history.start({pushState: false});
}
});
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/mvc/library/library-foldertoolbar-view.js
@@ -72,7 +72,7 @@
},
render: function(options){
- this.options = _.extend(this.options, options);
+ this.options = _.extend( this.options, options );
var toolbar_template = this.templateToolBar();
var template_defaults = {
id: this.options.id,
@@ -346,18 +346,18 @@
this.modal = Galaxy.modal;
var template_modal = this.templateImportPathModal();
this.modal.show({
- closing_events : true,
- title : 'Please enter paths to import',
- body : template_modal({}),
- buttons : {
- 'Import' : function() {that.importFromPathsClicked(that);},
- 'Close' : function() {Galaxy.modal.hide();}
- },
- closing_callback: function(){
- // TODO: should not trigger routes outside of the router
- Galaxy.libraries.library_router.navigate('folders/' + that.id, {trigger: true});
- }
- });
+ closing_events : true,
+ title : 'Please enter paths to import',
+ body : template_modal({}),
+ buttons : {
+ 'Import' : function() { that.importFromPathsClicked(that); },
+ 'Close' : function() { Galaxy.modal.hide(); }
+ },
+ closing_callback: function(){
+ // TODO: should not trigger routes outside of the router
+ Galaxy.libraries.library_router.navigate( 'folders/' + that.id, { trigger: true } );
+ }
+ });
this.renderSelectBoxes();
},
@@ -367,34 +367,37 @@
*/
fetchExtAndGenomes: function(){
var that = this;
- mod_utils.get(galaxy_config.root + "api/datatypes?extension_only=False",
- function(datatypes) {
- for (key in datatypes) {
- that.list_extensions.push({
- id : datatypes[key].extension,
- text : datatypes[key].extension,
- description : datatypes[key].description,
- description_url : datatypes[key].description_url
- });
- }
- that.list_extensions.sort(function(a, b) {
- return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
- });
- that.list_extensions.unshift(that.auto);
-
- });
- mod_utils.get(galaxy_config.root + "api/genomes",
- function(genomes) {
- for (key in genomes) {
- that.list_genomes.push({
- id : genomes[key][1],
- text : genomes[key][0]
- });
- }
- that.list_genomes.sort(function(a, b) {
- return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
- });
- });
+ mod_utils.get({
+ url : galaxy_config.root + "api/datatypes?extension_only=False",
+ success : function( datatypes ) {
+ for (key in datatypes) {
+ that.list_extensions.push({
+ id : datatypes[key].extension,
+ text : datatypes[key].extension,
+ description : datatypes[key].description,
+ description_url : datatypes[key].description_url
+ });
+ }
+ that.list_extensions.sort(function(a, b) {
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
+ });
+ that.list_extensions.unshift(that.auto);
+ }
+ });
+ mod_utils.get({
+ url: galaxy_config.root + "api/genomes",
+ success: function( genomes ) {
+ for ( key in genomes ) {
+ that.list_genomes.push({
+ id : genomes[key][1],
+ text : genomes[key][0]
+ });
+ }
+ that.list_genomes.sort(function(a, b) {
+ return a.id > b.id ? 1 : a.id < b.id ? -1 : 0;
+ });
+ }
+ });
},
renderSelectBoxes: function(){
@@ -1027,7 +1030,7 @@
tmpl_array.push(' </div>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');
tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');
- tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
+ tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
tmpl_array.push(' </div>');
// TOOLBAR END
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/mvc/library/library-librarylist-view.js
--- a/static/scripts/mvc/library/library-librarylist-view.js
+++ b/static/scripts/mvc/library/library-librarylist-view.js
@@ -4,13 +4,15 @@
"utils/utils",
"libs/toastr",
"mvc/library/library-model",
- "mvc/library/library-libraryrow-view"],
-function(mod_masthead,
- mod_baseMVC,
- mod_utils,
- mod_toastr,
- mod_library_model,
- mod_library_libraryrow_view) {
+ "mvc/library/library-libraryrow-view"
+], function(
+ mod_masthead,
+ mod_baseMVC,
+ mod_utils,
+ mod_toastr,
+ mod_library_model,
+ mod_library_libraryrow_view
+){
var LibraryListView = Backbone.View.extend({
el: '#libraries_element',
@@ -19,104 +21,135 @@
'click .sort-libraries-link' : 'sort_clicked'
},
- modal: null,
+ /**
+ * Initialize and fetch the libraries from server.
+ * Async render afterwards.
+ * @param {object} options an options object
+ */
+ defaults: {
+ page_count: null,
+ show_page: null
+ },
- // collection of {Item}s
- collection: null,
+ initialize : function( options ){
+ this.options = _.defaults( this.options || {}, this.defaults, options );
- // map of library model ids to library views = cache
- rowViews: {},
-
- initialize : function(options){
- this.options = _.defaults(this.options || {}, options);
- var that = this;
+ var that = this;
+ this.modal = null;
+ // map of library model ids to library views = cache
this.rowViews = {};
+ // collection of {Item}s
this.collection = new mod_library_model.Libraries();
this.collection.fetch({
success: function(){
that.render();
},
- error: function(model, response){
- if (typeof response.responseJSON !== "undefined"){
- mod_toastr.error(response.responseJSON.err_msg);
+ error: function( model, response ){
+ if ( typeof response.responseJSON !== "undefined" ){
+ mod_toastr.error( response.responseJSON.err_msg );
} else {
- mod_toastr.error('An error ocurred.');
+ mod_toastr.error( 'An error ocurred.' );
}
}
});
},
- /** Renders the libraries table either from the object's own collection,
- * or from a given array of library models,
- * or renders an empty list in case no data is given. */
- render: function (options) {
- $(".tooltip").hide();
+ /**
+ * Render the libraries table either from the object's own collection,
+ * or from a given array of library models,
+ * or render an empty list in case no data is given.
+ */
+ render: function ( options ) {
+ this.options = _.extend( this.options, options );
+
+ if ( ( this.options.page_size != null ) && ( this.options.page_size == parseInt( this.options.page_size ) ) ) {
+ Galaxy.libraries.preferences.set( { 'library_page_size': parseInt( this.options.page_size ) } );
+ }
+
+ $( ".tooltip" ).hide();
+ // this.options.show_page = this.options.show_page || 1;
var template = this.templateLibraryList();
var libraries_to_render = null;
- var include_deleted = Galaxy.libraries.preferences.get('with_deleted');
var models = null;
- if (typeof options !== 'undefined'){
- include_deleted = typeof options.with_deleted !== 'undefined' ? options.with_deleted : false;
+ if ( this.options.show_page === null || this.options.show_page < 1 ){
+ this.options.show_page = 1;
+ }
+ if ( typeof options !== 'undefined' ){
models = typeof options.models !== 'undefined' ? options.models : null;
}
-
- if (this.collection !== null && models === null){
+ if ( this.collection !== null && models === null ){
this.sortLibraries();
- if (include_deleted){ // show all the libraries
+ if ( Galaxy.libraries.preferences.get( 'with_deleted' ) ){
libraries_to_render = this.collection.models;
- } else{ // show only undeleted libraries
- libraries_to_render = this.collection.where({deleted: false});
+ } else {
+ libraries_to_render = this.collection.where( { deleted: false } );
}
- } else if (models !== null){
+ } else if ( models !== null ){
libraries_to_render = models;
} else {
libraries_to_render = [];
+ }
+ this.options.total_libraries_count = libraries_to_render.length
+ var page_start = ( Galaxy.libraries.preferences.get( 'library_page_size' ) * ( this.options.show_page - 1 ) );
+ this.options.page_count = Math.ceil( this.options.total_libraries_count / Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ if ( this.options.total_libraries_count > 0 && ( page_start < this.options.total_libraries_count ) ){
+ libraries_to_render = libraries_to_render.slice( page_start, page_start + Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ this.options.libraries_shown = libraries_to_render.length;
+ // User requests page with no libraries
+ if ( Galaxy.libraries.preferences.get( 'library_page_size' ) * this.options.show_page > ( this.options.total_libraries_count + Galaxy.libraries.preferences.get( 'library_page_size' ) ) ){
+ libraries_to_render = [];
}
-
- this.$el.html(template({length: libraries_to_render.length, order: Galaxy.libraries.preferences.get('sort_order') }));
-
- if (libraries_to_render.length > 0){
- this.renderRows(libraries_to_render);
+ this.$el.html( template({
+ length: 1,
+ order: Galaxy.libraries.preferences.get( 'sort_order' )
+ }));
+ Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
+ this.renderRows( libraries_to_render );
+ } else {
+ this.$el.html( template({
+ length: 0,
+ order: Galaxy.libraries.preferences.get( 'sort_order' )
+ }));
+ Galaxy.libraries.libraryToolbarView.renderPaginator( this.options );
}
- // initialize the library tooltips
- $("#center [data-toggle]").tooltip();
- // modification of upper DOM element to show scrollbars due
- // to the #center element inheritance
- $("#center").css('overflow','auto');
+ $( "#center [data-toggle]" ).tooltip();
+ $( "#center" ).css( 'overflow','auto' );
},
- /** Renders all given models as rows in the library list */
- renderRows: function(libraries_to_render){
- for (var i = 0; i < libraries_to_render.length; i++) {
+ /**
+ * Render all given models as rows in the library list
+ * @param {array} libraries_to_render array of library models to render
+ */
+ renderRows: function( libraries_to_render ){
+ for ( var i = 0; i < libraries_to_render.length; i++ ) {
var library = libraries_to_render[i];
- var cachedView = _.findWhere(this.rowViews, {id: library.get('id')});
- if (cachedView !== undefined && this instanceof Backbone.View){
+ // search whether we have the item cached
+ var cachedView = _.findWhere( this.rowViews, { id: library.get( 'id' ) } );
+ if ( cachedView !== undefined && this instanceof Backbone.View ){
cachedView.delegateEvents();
- this.$el.find('#library_list_body').append(cachedView.el);
+ this.$el.find( '#library_list_body' ).append( cachedView.el );
} else {
- this.renderOne({library:library})
+ this.renderOne( { library: library } )
}
}
},
/**
- * Creates a view for the given model and adds it to the libraries view.
+ * Create a view for the given model and add it to the libraries view.
* @param {Library} model of the view that will be rendered
*/
- renderOne: function(options){
+ renderOne: function( options ){
var library = options.library;
- var rowView = new mod_library_libraryrow_view.LibraryRowView(library);
- // we want to prepend new item
- if (options.prepend){
- this.$el.find('#library_list_body').prepend(rowView.el);
- } else {
- this.$el.find('#library_list_body').append(rowView.el);
- }
+ var rowView = new mod_library_libraryrow_view.LibraryRowView( library );
+ this.$el.find( '#library_list_body' ).append( rowView.el );
// save new rowView to cache
- this.rowViews[library.get('id')] = rowView;
+ this.rowViews[ library.get( 'id' ) ] = rowView;
},
- /** Table heading was clicked, update sorting preferences and re-render */
+ /**
+ * Table heading was clicked, update sorting preferences and re-render.
+ * @return {[type]} [description]
+ */
sort_clicked : function(){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
Galaxy.libraries.preferences.set({'sort_order': 'desc'});
@@ -126,8 +159,10 @@
this.render();
},
- /** Sorts the underlying collection according to the parameters received.
- Currently supports only sorting by name. */
+ /**
+ * Sort the underlying collection according to the parameters received.
+ * Currently supports only sorting by name.
+ */
sortLibraries: function(){
if (Galaxy.libraries.preferences.get('sort_by') === 'name'){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
@@ -138,6 +173,13 @@
}
},
+ redirectToHome: function(){
+ window.location = '../';
+ },
+ redirectToLogin: function(){
+ window.location = '/user/login';
+ },
+
// MMMMMMMMMMMMMMMMMM
// === TEMPLATES ====
// MMMMMMMMMMMMMMMMMM
@@ -147,14 +189,14 @@
tmpl_array.push('<div class="library_container table-responsive">');
tmpl_array.push('<% if(length === 0) { %>');
- tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');
+ tmpl_array.push('<div>There are no libraries visible to you here. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');
tmpl_array.push('<% } else{ %>');
tmpl_array.push('<table class="grid table table-condensed">');
tmpl_array.push(' <thead>');
tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');
tmpl_array.push(' <th style="width:22%;">description</th>');
tmpl_array.push(' <th style="width:22%;">synopsis</th> ');
- tmpl_array.push(' <th style="width:26%;"></th> ');
+ tmpl_array.push(' <th style="width:26%;"></th>');
tmpl_array.push(' </thead>');
tmpl_array.push(' <tbody id="library_list_body">');
// library item views will attach here
@@ -166,14 +208,6 @@
return _.template(tmpl_array.join(''));
},
-
- redirectToHome: function(){
- window.location = '../';
- },
- redirectToLogin: function(){
- window.location = '/user/login';
- },
-
});
return {
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/mvc/library/library-librarytoolbar-view.js
@@ -11,11 +11,13 @@
el: '#center',
events: {
- 'click #create_new_library_btn' : 'show_library_modal',
- 'click #include_deleted_chk' : 'check_include_deleted'
+ 'click #create_new_library_btn' : 'showLibraryModal',
+ 'click #include_deleted_chk' : 'includeDeletedChecked',
+ 'click #page_size_prompt' : 'showPageSizePrompt'
},
- initialize: function(){
+ initialize: function( options ){
+ this.options = _.defaults( this.options || {}, options );
this.render();
},
@@ -23,21 +25,34 @@
var toolbar_template = this.templateToolBar();
var is_admin = false;
var is_anonym = true;
- if (Galaxy.currUser){
+ if ( Galaxy.currUser ){
is_admin = Galaxy.currUser.isAdmin();
is_anonym = Galaxy.currUser.isAnonymous();
}
- this.$el.html(toolbar_template({admin_user: is_admin, anon_user: is_anonym}));
- if (is_admin){
- this.$el.find('#include_deleted_chk')[0].checked = Galaxy.libraries.preferences.get('with_deleted');
+ this.$el.html(toolbar_template( { admin_user: is_admin, anon_user: is_anonym } ) );
+ if ( is_admin ){
+ this.$el.find( '#include_deleted_chk' )[0].checked = Galaxy.libraries.preferences.get( 'with_deleted' );
}
},
- show_library_modal : function (event){
+ /**
+ * Called from LibraryListView when needed.
+ * @param {object} options common options
+ */
+ renderPaginator: function( options ){
+ this.options = _.extend( this.options, options );
+ var paginator_template = this.templatePaginator();
+ this.$el.find( '#library_paginator' ).html( paginator_template({
+ show_page: parseInt( this.options.show_page ),
+ page_count: parseInt( this.options.page_count ),
+ total_libraries_count: this.options.total_libraries_count,
+ libraries_shown: this.options.libraries_shown
+ }));
+ },
+
+ showLibraryModal : function (event){
event.preventDefault();
event.stopPropagation();
-
- // create modal
var self = this;
this.modal = Galaxy.modal;
this.modal.show({
@@ -45,22 +60,22 @@
title : 'Create New Library',
body : this.templateNewLibraryInModal(),
buttons : {
- 'Create' : function() {self.create_new_library_event();},
- 'Close' : function() {self.modal.hide();}
+ 'Create' : function() { self.createNewLibrary(); },
+ 'Close' : function() { self.modal.hide(); }
}
});
},
- create_new_library_event: function(){
- var libraryDetails = this.serialize_new_library();
- if (this.validate_new_library(libraryDetails)){
+ createNewLibrary: function(){
+ var libraryDetails = this.serializeNewLibrary();
+ if (this.valdiateNewLibrary(libraryDetails)){
var library = new mod_library_model.Library();
var self = this;
library.save(libraryDetails, {
success: function (library) {
Galaxy.libraries.libraryListView.collection.add(library);
self.modal.hide();
- self.clear_library_modal();
+ self.clearLibraryModal();
Galaxy.libraries.libraryListView.render();
mod_toastr.success('Library created.');
},
@@ -78,15 +93,22 @@
return false;
},
+ showPageSizePrompt: function(){
+ var library_page_size = prompt( 'How many libraries per page do you want to see?', Galaxy.libraries.preferences.get( 'library_page_size' ) );
+ if ( ( library_page_size != null ) && ( library_page_size == parseInt( library_page_size ) ) ) {
+ Galaxy.libraries.preferences.set( { 'library_page_size': parseInt( library_page_size ) } );
+ Galaxy.libraries.libraryListView.render();
+ }
+ },
+
// clear the library modal once saved
- clear_library_modal : function(){
+ clearLibraryModal : function(){
$("input[name='Name']").val('');
$("input[name='Description']").val('');
$("input[name='Synopsis']").val('');
},
- // serialize data from the new library form
- serialize_new_library : function(){
+ serializeNewLibrary : function(){
return {
name: $("input[name='Name']").val(),
description: $("input[name='Description']").val(),
@@ -94,18 +116,20 @@
};
},
- // validate new library info
- validate_new_library: function(libraryDetails){
+ valdiateNewLibrary: function( libraryDetails ){
return libraryDetails.name !== '';
},
- // include or exclude deleted libraries from the view
- check_include_deleted: function(event){
+ /**
+ * Include or exclude deleted libraries in the view.
+ * @param {object} event common event
+ */
+ includeDeletedChecked: function( event ){
if (event.target.checked){
- Galaxy.libraries.preferences.set({'with_deleted': true});
+ Galaxy.libraries.preferences.set( { 'with_deleted': true } );
Galaxy.libraries.libraryListView.render();
} else{
- Galaxy.libraries.preferences.set({'with_deleted': false});
+ Galaxy.libraries.preferences.set( { 'with_deleted': false } );
Galaxy.libraries.libraryListView.render();
}
},
@@ -113,22 +137,26 @@
templateToolBar: function(){
tmpl_array = [];
+
tmpl_array.push('<div class="library_style_container">');
- // TOOLBAR
tmpl_array.push(' <div id="toolbar_form">');
tmpl_array.push(' <div id="library_toolbar">');
- tmpl_array.push(' <span><strong>DATA LIBRARIES</strong></span>');
- tmpl_array.push(' <% if(admin_user === true) { %>');
- tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');
- tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
- tmpl_array.push(' <% } %>');
- tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
- tmpl_array.push(' </div>');
-
- tmpl_array.push(' <div>');
- tmpl_array.push(' ');
- tmpl_array.push(' </div>');
-
+ tmpl_array.push(' <form class="form-inline" role="form">');
+ tmpl_array.push(' <span><strong><a href="#" title="Go to first page">DATA LIBRARIES</a></strong></span>');
+ tmpl_array.push(' <% if(admin_user === true) { %>');
+ tmpl_array.push(' <div class="checkbox" style="height: 20px;">');
+ tmpl_array.push(' <label>');
+ tmpl_array.push(' <input id="include_deleted_chk" type="checkbox"> include deleted </input>');
+ tmpl_array.push(' </label>');
+ tmpl_array.push(' </div>');
+ tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');
+ tmpl_array.push(' <span id="library_paginator" class="library-paginator">');
+ // paginator will append here
+ tmpl_array.push(' </span>');
+ tmpl_array.push(' </form>');
+ tmpl_array.push(' </div>');
tmpl_array.push(' </div>');
tmpl_array.push(' <div id="libraries_element">');
// table with libraries will append here
@@ -138,6 +166,39 @@
return _.template(tmpl_array.join(''));
},
+ templatePaginator: function(){
+ tmpl_array = [];
+
+ tmpl_array.push(' <ul class="pagination pagination-sm">');
+ tmpl_array.push(' <% if ( ( show_page - 1 ) > 0 ) { %>');
+ tmpl_array.push(' <% if ( ( show_page - 1 ) > page_count ) { %>'); // we are on higher page than total page count
+ tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } else { %>');
+ tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li><a href="#page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <% } else { %>'); // we are on the first page
+ tmpl_array.push(' <li class="disabled"><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' <li class="active">');
+ tmpl_array.push(' <a href="#page/<% print( show_page ) %>"><% print( show_page ) %></a>');
+ tmpl_array.push(' </li>');
+ tmpl_array.push(' <% if ( ( show_page ) < page_count ) { %>');
+ tmpl_array.push(' <li><a href="#page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');
+ tmpl_array.push(' <li><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');
+ tmpl_array.push(' <% } else { %>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');
+ tmpl_array.push(' <li class="disabled"><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');
+ tmpl_array.push(' <% } %>');
+ tmpl_array.push(' </ul>');
+ tmpl_array.push(' <span>');
+ tmpl_array.push(' showing <a id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');
+ tmpl_array.push(' </span>');
+
+ return _.template(tmpl_array.join(''));
+ },
templateNewLibraryInModal: function(){
tmpl_array = [];
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/packed/galaxy.library.js
--- a/static/scripts/packed/galaxy.library.js
+++ b/static/scripts/packed/galaxy.library.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/base-mvc","mvc/library/library-model","mvc/library/library-folderlist-view","mvc/library/library-librarylist-view","mvc/library/library-librarytoolbar-view","mvc/library/library-foldertoolbar-view","mvc/library/library-dataset-view","mvc/library/library-library-view","mvc/library/library-folder-view"],function(h,e,j,n,k,c,i,g,l,f,b,a){var o=Backbone.Router.extend({initialize:function(){this.routesHit=0;Backbone.history.on("route",function(){this.routesHit++},this)},routes:{"":"libraries","library/:library_id/permissions":"library_permissions","folders/:folder_id/permissions":"folder_permissions","folders/:id":"folder_content","folders/:folder_id/datasets/:dataset_id":"dataset_detail","folders/:folder_id/datasets/:dataset_id/permissions":"dataset_permissions","folders/:folder_id/datasets/:dataset_id/versions/:ldda_id":"dataset_version","folders/:folder_id/download/:format":"download","folders/:folder_id/import/:source":"import_datasets"},back:function(){if(this.routesHit>1){window.history.back()}else{this.navigate("#",{trigger:true,replace:true})}}});var m=n.SessionStorageModel.extend({defaults:{with_deleted:false,sort_order:"asc",sort_by:"name"}});var d=Backbone.View.extend({libraryToolbarView:null,libraryListView:null,library_router:null,libraryView:null,folderToolbarView:null,folderListView:null,datasetView:null,initialize:function(){Galaxy.libraries=this;this.preferences=new m({id:"global-lib-prefs"});this.library_router=new o();this.library_router.on("route:libraries",function(){Galaxy.libraries.libraryToolbarView=new g.LibraryToolbarView();Galaxy.libraries.libraryListView=new i.LibraryListView()});this.library_router.on("route:folder_content",function(p){if(Galaxy.libraries.folderToolbarView){Galaxy.libraries.folderToolbarView.$el.unbind("click")}Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p})});this.library_router.on("route:download",function(p,q){if($("#folder_list_body").find(":checked").length===0){j.info("You must select at least one dataset to download");Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:true,replace:true})}else{Galaxy.libraries.folderToolbarView.download(p,q);Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:false,replace:true})}});this.library_router.on("route:dataset_detail",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p})});this.library_router.on("route:dataset_version",function(q,p,r){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,ldda_id:r,show_version:true})});this.library_router.on("route:dataset_permissions",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,show_permissions:true})});this.library_router.on("route:library_permissions",function(p){if(Galaxy.libraries.libraryView){Galaxy.libraries.libraryView.$el.unbind("click")}Galaxy.libraries.libraryView=new b.LibraryView({id:p,show_permissions:true})});this.library_router.on("route:folder_permissions",function(p){if(Galaxy.libraries.folderView){Galaxy.libraries.folderView.$el.unbind("click")}Galaxy.libraries.folderView=new a.FolderView({id:p,show_permissions:true})});this.library_router.on("route:import_datasets",function(p,q){if(Galaxy.libraries.folderToolbarView&&Galaxy.libraries.folderListView){Galaxy.libraries.folderToolbarView.showImportModal({source:q})}else{Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p});Galaxy.libraries.folderToolbarView.showImportModal({source:q})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:d}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/base-mvc","mvc/library/library-model","mvc/library/library-folderlist-view","mvc/library/library-librarylist-view","mvc/library/library-librarytoolbar-view","mvc/library/library-foldertoolbar-view","mvc/library/library-dataset-view","mvc/library/library-library-view","mvc/library/library-folder-view"],function(h,e,j,n,k,c,i,g,l,f,b,a){var o=Backbone.Router.extend({initialize:function(){this.routesHit=0;Backbone.history.on("route",function(){this.routesHit++},this)},routes:{"":"libraries","page/:show_page":"libraries_page","library/:library_id/permissions":"library_permissions","folders/:folder_id/permissions":"folder_permissions","folders/:id":"folder_content","folders/:folder_id/datasets/:dataset_id":"dataset_detail","folders/:folder_id/datasets/:dataset_id/permissions":"dataset_permissions","folders/:folder_id/datasets/:dataset_id/versions/:ldda_id":"dataset_version","folders/:folder_id/download/:format":"download","folders/:folder_id/import/:source":"import_datasets"},back:function(){if(this.routesHit>1){window.history.back()}else{this.navigate("#",{trigger:true,replace:true})}}});var m=n.SessionStorageModel.extend({defaults:{with_deleted:false,sort_order:"asc",sort_by:"name",library_page_size:20}});var d=Backbone.View.extend({libraryToolbarView:null,libraryListView:null,library_router:null,libraryView:null,folderToolbarView:null,folderListView:null,datasetView:null,initialize:function(){Galaxy.libraries=this;this.preferences=new m({id:"global-lib-prefs"});this.library_router=new o();this.library_router.on("route:libraries",function(){Galaxy.libraries.libraryToolbarView=new g.LibraryToolbarView();Galaxy.libraries.libraryListView=new i.LibraryListView()});this.library_router.on("route:libraries_page",function(p){if(Galaxy.libraries.libraryToolbarView===null){Galaxy.libraries.libraryToolbarView=new g.LibraryToolbarView();Galaxy.libraries.libraryListView=new i.LibraryListView({show_page:p})}else{Galaxy.libraries.libraryListView.render({show_page:p})}});this.library_router.on("route:folder_content",function(p){if(Galaxy.libraries.folderToolbarView){Galaxy.libraries.folderToolbarView.$el.unbind("click")}Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p})});this.library_router.on("route:download",function(p,q){if($("#folder_list_body").find(":checked").length===0){j.info("You must select at least one dataset to download");Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:true,replace:true})}else{Galaxy.libraries.folderToolbarView.download(p,q);Galaxy.libraries.library_router.navigate("folders/"+p,{trigger:false,replace:true})}});this.library_router.on("route:dataset_detail",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p})});this.library_router.on("route:dataset_version",function(q,p,r){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,ldda_id:r,show_version:true})});this.library_router.on("route:dataset_permissions",function(q,p){if(Galaxy.libraries.datasetView){Galaxy.libraries.datasetView.$el.unbind("click")}Galaxy.libraries.datasetView=new f.LibraryDatasetView({id:p,show_permissions:true})});this.library_router.on("route:library_permissions",function(p){if(Galaxy.libraries.libraryView){Galaxy.libraries.libraryView.$el.unbind("click")}Galaxy.libraries.libraryView=new b.LibraryView({id:p,show_permissions:true})});this.library_router.on("route:folder_permissions",function(p){if(Galaxy.libraries.folderView){Galaxy.libraries.folderView.$el.unbind("click")}Galaxy.libraries.folderView=new a.FolderView({id:p,show_permissions:true})});this.library_router.on("route:import_datasets",function(p,q){if(Galaxy.libraries.folderToolbarView&&Galaxy.libraries.folderListView){Galaxy.libraries.folderToolbarView.showImportModal({source:q})}else{Galaxy.libraries.folderToolbarView=new l.FolderToolbarView({id:p});Galaxy.libraries.folderListView=new c.FolderListView({id:p});Galaxy.libraries.folderToolbarView.showImportModal({source:q})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:d}});
\ No newline at end of file
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/packed/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(g){this.options=_.defaults(g||{},this.defaults);this.fetchExtAndGenomes();this.render()},render:function(g){this.options=_.extend(this.options,g);var i=this.templateToolBar();var h={id:this.options.id,is_admin:false,is_anonym:true,mutiple_add_dataset_options:false};if(Galaxy.currUser){h.is_admin=Galaxy.currUser.isAdmin();h.is_anonym=Galaxy.currUser.isAnonymous();if(Galaxy.config.user_library_import_dir!==null||Galaxy.config.allow_library_path_paste!==false||Galaxy.config.library_import_dir!==null){h.mutiple_add_dataset_options=true}}this.$el.html(i(h))},configureElements:function(g){this.options=_.extend(this.options,g);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(i){i.preventDefault();i.stopPropagation();var g=this;var h=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:h(),buttons:{Create:function(){g.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var g=this.serialize_new_folder();if(this.validate_new_folder(g)){var h=new d.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];h.url=h.urlRoot+"/"+current_folder_id;h.save(g,{success:function(i){Galaxy.modal.hide();f.success("Folder created.");i.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(i)},error:function(j,i){Galaxy.modal.hide();if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}else{f.error("Folder's name is missing.")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(g){return g.name!==""},modalBulkImport:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select some datasets first.")}else{this.refreshUserHistoriesList(function(i){var h=i.templateBulkImportInModal();i.modal=Galaxy.modal;i.modal.show({closing_events:true,title:"Import into History",body:h({histories:i.histories.models}),buttons:{Import:function(){i.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(h){var g=this;this.histories=new d.GalaxyHistories();this.histories.fetch({success:function(){h(g)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var k=$("select[name=dataset_import_bulk] option:selected").val();var n=$("select[name=dataset_import_bulk] option:selected").text();this.options.last_used_history_id=k;var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var m=[];for(var j=h.length-1;j>=0;j--){var g=h[j];var l=new d.HistoryItem();l.url=l.urlRoot+k+"/contents";l.content=g;l.source="library";m.push(l)}this.initChainCallControl({length:m.length,action:"to_history",history_name:n});jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+k);this.chainCallImportingIntoHistory(m,n)},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(g,k){var i=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){i.push(this.parentElement.parentElement.id)}});var h="/api/libraries/datasets/download/"+k;var j={ld_ids:i};this.processDownload(h,j,"get")},processDownload:function(h,i,j){if(h&&i){i=typeof i==="string"?i:$.param(i);var g="";$.each(i.split("&"),function(){var k=this.split("=");g+='<input type="hidden" name="'+k[0]+'" value="'+k[1]+'" />'});$('<form action="'+h+'" method="'+(j||"post")+'">'+g+"</form>").appendTo("body").submit().remove();f.info("Your download will begin soon.")}else{f.error("An error occurred.")}},addFilesFromHistoryModal:function(){this.refreshUserHistoriesList(function(g){g.modal=Galaxy.modal;var h=g.templateAddFilesFromHistory();var i=g.options.full_path[g.options.full_path.length-1][1];g.modal.show({closing_events:true,title:"Adding datasets from your history to folder "+i,body:h({histories:g.histories.models}),buttons:{Add:function(){g.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.back()}});if(g.histories.models.length>0){g.fetchAndDisplayHistoryContents(g.histories.models[0].id);$("#dataset_add_bulk").change(function(j){g.fetchAndDisplayHistoryContents(j.target.value)})}else{f.error("An error ocurred.")}})},importFilesFromPathModal:function(){var h=this;this.modal=Galaxy.modal;var g=this.templateImportPathModal();this.modal.show({closing_events:true,title:"Please enter paths to import",body:g({}),buttons:{Import:function(){h.importFromPathsClicked(h)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+h.id,{trigger:true})}});this.renderSelectBoxes()},fetchExtAndGenomes:function(){var g=this;e.get(galaxy_config.root+"api/datatypes?extension_only=False",function(h){for(key in h){g.list_extensions.push({id:h[key].extension,text:h[key].extension,description:h[key].description,description_url:h[key].description_url})}g.list_extensions.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0});g.list_extensions.unshift(g.auto)});e.get(galaxy_config.root+"api/genomes",function(h){for(key in h){g.list_genomes.push({id:h[key][1],text:h[key][0]})}g.list_genomes.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0})})},renderSelectBoxes:function(){var g=this;this.select_genome=new a.View({css:"library-genome-select",data:g.list_genomes,container:Galaxy.modal.$el.find("#library_genome_select"),value:"?"});this.select_extension=new a.View({css:"library-extension-select",data:g.list_extensions,container:Galaxy.modal.$el.find("#library_extension_select"),value:"auto"})},importFilesFromGalaxyFolderModal:function(g){var i=this;var h=this.templateBrowserModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Please select folders or files",body:h({}),buttons:{Import:function(){i.importFromJstreePath(i,g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+i.id,{trigger:true})}});this.renderSelectBoxes();g.disabled_jstree_element="folders";this.renderJstree(g);$("input[type=radio]").change(function(j){if(j.target.value==="jstree-disable-folders"){g.disabled_jstree_element="folders";i.renderJstree(g);$(".jstree-folders-message").hide();$(".jstree-preserve-structure").hide();$(".jstree-link-files").hide();$(".jstree-files-message").show()}else{if(j.target.value==="jstree-disable-files"){$(".jstree-files-message").hide();$(".jstree-folders-message").show();$(".jstree-link-files").show();$(".jstree-preserve-structure").show();g.disabled_jstree_element="files";i.renderJstree(g)}}})},renderJstree:function(g){var i=this;this.options=_.extend(this.options,g);var j=g.source||"userdir";var h=this.options.disabled_jstree_element;this.jstree=new d.Jstree();this.jstree.url=this.jstree.urlRoot+"?target="+j+"&format=jstree&disable="+h;this.jstree.fetch({success:function(l,k){define("jquery",function(){return jQuery});require(["libs/jquery/jstree"],function(m){$("#jstree_browser").jstree("destroy");$("#jstree_browser").jstree({core:{data:l},plugins:["types","checkbox"],types:{folder:{icon:"jstree-folder"},file:{icon:"jstree-file"}},checkbox:{three_state:false}})})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){f.error(k.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importFromPathsClicked:function(){var g=this.modal.$el.find(".preserve-checkbox").is(":checked");var n=this.modal.$el.find(".link-checkbox").is(":checked");var h=this.select_extension.value();var j=this.select_genome.value();var m=$("textarea#import_paths").val();var l=[];if(!m){f.info("Please enter a path relative to Galaxy root.")}else{this.modal.disableButton("Import");m=m.split("\n");for(var k=m.length-1;k>=0;k--){trimmed=m[k].trim();if(trimmed.length!==0){l.push(trimmed)}}this.initChainCallControl({length:l.length,action:"adding_datasets"});this.chainCallImportingFolders({paths:l,preserve_dirs:g,link_data:n,source:"admin_path",file_type:h,dbkey:j})}},initChainCallControl:function(g){var h;switch(g.action){case"adding_datasets":h=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h({folder_name:this.options.folder_name}));break;case"deleting_datasets":h=this.templateDeletingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h());break;case"to_history":h=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(h({history_name:g.history_name}));break;default:console.error("Wrong action specified.");break}this.progress=0;this.progressStep=100/g.length;this.options.chain_call_control.total_number=g.length;this.options.chain_call_control.failed_number=0},importFromJstreePath:function(n,r){var g=$("#jstree_browser").jstree().get_selected(true);var m=this.modal.$el.find(".preserve-checkbox").is(":checked");var o=this.modal.$el.find(".link-checkbox").is(":checked");var j=this.select_extension.value();var p=this.select_genome.value();var k=g[0].type;var q=[];if(g.length<1){f.info("Please select some items first.")}else{this.modal.disableButton("Import");for(var l=g.length-1;l>=0;l--){if(g[l].li_attr.full_path!==undefined){q.push(g[l].li_attr.full_path)}}this.initChainCallControl({length:q.length,action:"adding_datasets"});if(k==="folder"){var h=r.source+"_folder";this.chainCallImportingFolders({paths:q,preserve_dirs:m,link_data:o,source:h,file_type:j,dbkey:p})}else{if(k==="file"){var h=r.source+"_file";this.chainCallImportingUserdirFiles({paths:q,file_type:j,dbkey:p,source:h})}}}},fetchAndDisplayHistoryContents:function(i){var h=new d.HistoryContents({id:i});var g=this;h.fetch({success:function(k){var j=g.templateHistoryContents();g.histories.get(i).set({contents:k});g.modal.$el.find("#selected_history_content").html(j({history_contents:k.models.reverse()}))},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},addAllDatasetsFromHistory:function(){var l=this.modal.$el.find("#selected_history_content").find(":checked");var g=[];var k=[];if(l.length<1){f.info("You must select some datasets first.")}else{this.modal.disableButton("Add");l.each(function(){var i=$(this.parentElement).data("id");if(i){g.push(i)}});for(var j=g.length-1;j>=0;j--){history_dataset_id=g[j];var h=new d.Item();h.url="/api/folders/"+this.options.id+"/contents";h.set({from_hda_id:history_dataset_id});k.push(h)}this.initChainCallControl({length:k.length,action:"adding_datasets"});this.chainCallAddingHdas(k)}},chainCallImportingIntoHistory:function(h,k){var g=this;var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be imported into history. Click this to see what was imported.","",{onclick:function(){window.location="/"}})}}}Galaxy.modal.hide();return true}var j=$.when(i.save({content:i.content,source:i.source}));j.done(function(){g.updateProgress();g.chainCallImportingIntoHistory(h,k)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallImportingIntoHistory(h,k)})},chainCallImportingUserdirFiles:function(g){var h=this;var i=g.paths.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected files imported into the current folder");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingUserdirFiles(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingUserdirFiles(g)})},chainCallImportingFolders:function(g){var h=this;var i=g.paths.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected folders and their contents imported into the current folder.");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&preserve_dirs="+g.preserve_dirs+"&link_data="+g.link_data+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingFolders(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingFolders(g)})},chainCallAddingHdas:function(h){var g=this;this.added_hdas=new d.Folder();var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var j=$.when(i.save({from_hda_id:i.get("from_hda_id")}));j.done(function(k){Galaxy.libraries.folderListView.collection.add(k);g.updateProgress();g.chainCallAddingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallAddingHdas(h)})},chainCallDeletingHdas:function(h){var g=this;this.deleted_lddas=new d.Folder();var i=h.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var j=$.when(i.destroy());j.done(function(l){Galaxy.libraries.folderListView.collection.remove(i.id);g.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var k=new d.Item(l);Galaxy.libraries.folderListView.collection.add(k)}g.chainCallDeletingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallDeletingHdas(h)})},checkIncludeDeleted:function(g){if(g.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select at least one dataset for deletion.")}else{var k=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:k({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var h=[];g.each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});this.progressStep=100/h.length;this.progress=0;var m=[];for(var j=h.length-1;j>=0;j--){var l=new d.Item({id:h[j]});m.push(l)}this.options.chain_call_control.total_number=h.length;this.chainCallDeletingHdas(m)}},showLibInfo:function(){var h=Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;var g=null;var i=this;if(Galaxy.libraries.libraryListView!==null){g=Galaxy.libraries.libraryListView.collection.get(h);this.showLibInfoModal(g)}else{g=new d.Library({id:h});g.fetch({success:function(){i.showLibInfoModal(g)},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}},showLibInfoModal:function(g){var h=this.templateLibInfoInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Library Information",body:h({library:g}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(g){switch(g.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back();f.error("Invalid import source.");break}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push("<% if(mutiple_add_dataset_options) { %>");tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button title="Add Datasets to Current Folder" id="" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-plus"></span><span class="fa fa-file"></span><span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#folders/<%= id %>/import/history"> from History</a></li>');tmpl_array.push("<% if(Galaxy.config.user_library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/userdir"> from User Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li class="divider"></li>');tmpl_array.push(' <li class="dropdown-header">Admins only</li>');tmpl_array.push("<% if(Galaxy.config.library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/importdir">from Import Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/path">from Path</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push("<% } else { %>");tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("<% } %>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> Download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('<div id="lif_info_modal">');tmpl_array.push("<h2>Library name:</h2>");tmpl_array.push('<p><%- library.get("name") %></p>');tmpl_array.push("<h3>Library description:</h3>");tmpl_array.push('<p><%- library.get("description") %></p>');tmpl_array.push("<h3>Library synopsis:</h3>");tmpl_array.push('<p><%- library.get("synopsis") %></p>');tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var g=[];g.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');g.push("Select history: ");g.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</span>");return _.template(g.join(""))},templateImportIntoHistoryProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateAddingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Adding selected datasets to library folder <b><%= _.escape(folder_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateDeletingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateBrowserModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');g.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom:1em;">');g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');g.push("</label>");g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting folders" type="radio" name="jstree-radio" value="jstree-disable-files"> Folders');g.push("</label>");g.push("</div>");g.push('<div style="margin-bottom:1em;">');g.push('<label class="checkbox-inline jstree-preserve-structure" style="display:none;">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files" style="display:none;">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<div id="jstree_browser">');g.push("</div>");g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateImportPathModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-folders-message">All files within the given folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom: 0.5em;">');g.push('<label class="checkbox-inline jstree-preserve-structure">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<textarea id="import_paths" class="form-control" rows="5" placeholder="Absolute paths (or paths relative to Galaxy root) separated by newline"></textarea>');g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateAddFilesFromHistory:function(){var g=[];g.push('<div id="add_files_modal">');g.push('<div id="history_modal_combo_bulk">');g.push("Select history: ");g.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</div>");g.push("<br/>");g.push('<div id="selected_history_content">');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateHistoryContents:function(){var g=[];g.push("<strong>Choose the datasets to import:</strong>");g.push("<ul>");g.push(" <% _.each(history_contents, function(history_item) { %>");g.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');g.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');g.push(" </li>");g.push(" <% }); %>");g.push("</ul>");return _.template(g.join(""))}});return{FolderToolbarView:b}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0},disabled_jstree_element:"folders"},modal:null,jstree:null,histories:null,select_genome:null,select_extension:null,list_extensions:[],auto:{id:"auto",text:"Auto-detect",description:"This system will try to detect the file type automatically. If your file is not detected properly as one of the known formats, it most likely means that it has some format problems (e.g., different number of columns on different rows). You can still coerce the system to set your data to the format you think it should be. You can also upload compressed files, which will automatically be decompressed."},list_genomes:[],initialize:function(g){this.options=_.defaults(g||{},this.defaults);this.fetchExtAndGenomes();this.render()},render:function(g){this.options=_.extend(this.options,g);var i=this.templateToolBar();var h={id:this.options.id,is_admin:false,is_anonym:true,mutiple_add_dataset_options:false};if(Galaxy.currUser){h.is_admin=Galaxy.currUser.isAdmin();h.is_anonym=Galaxy.currUser.isAnonymous();if(Galaxy.config.user_library_import_dir!==null||Galaxy.config.allow_library_path_paste!==false||Galaxy.config.library_import_dir!==null){h.mutiple_add_dataset_options=true}}this.$el.html(i(h))},configureElements:function(g){this.options=_.extend(this.options,g);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(i){i.preventDefault();i.stopPropagation();var g=this;var h=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:h(),buttons:{Create:function(){g.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var g=this.serialize_new_folder();if(this.validate_new_folder(g)){var h=new d.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];h.url=h.urlRoot+"/"+current_folder_id;h.save(g,{success:function(i){Galaxy.modal.hide();f.success("Folder created.");i.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(i)},error:function(j,i){Galaxy.modal.hide();if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}else{f.error("Folder's name is missing.")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(g){return g.name!==""},modalBulkImport:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select some datasets first.")}else{this.refreshUserHistoriesList(function(i){var h=i.templateBulkImportInModal();i.modal=Galaxy.modal;i.modal.show({closing_events:true,title:"Import into History",body:h({histories:i.histories.models}),buttons:{Import:function(){i.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(h){var g=this;this.histories=new d.GalaxyHistories();this.histories.fetch({success:function(){h(g)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var k=$("select[name=dataset_import_bulk] option:selected").val();var n=$("select[name=dataset_import_bulk] option:selected").text();this.options.last_used_history_id=k;var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var m=[];for(var j=h.length-1;j>=0;j--){var g=h[j];var l=new d.HistoryItem();l.url=l.urlRoot+k+"/contents";l.content=g;l.source="library";m.push(l)}this.initChainCallControl({length:m.length,action:"to_history",history_name:n});jQuery.getJSON(galaxy_config.root+"history/set_as_current?id="+k);this.chainCallImportingIntoHistory(m,n)},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(g,k){var i=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){i.push(this.parentElement.parentElement.id)}});var h="/api/libraries/datasets/download/"+k;var j={ld_ids:i};this.processDownload(h,j,"get")},processDownload:function(h,i,j){if(h&&i){i=typeof i==="string"?i:$.param(i);var g="";$.each(i.split("&"),function(){var k=this.split("=");g+='<input type="hidden" name="'+k[0]+'" value="'+k[1]+'" />'});$('<form action="'+h+'" method="'+(j||"post")+'">'+g+"</form>").appendTo("body").submit().remove();f.info("Your download will begin soon.")}else{f.error("An error occurred.")}},addFilesFromHistoryModal:function(){this.refreshUserHistoriesList(function(g){g.modal=Galaxy.modal;var h=g.templateAddFilesFromHistory();var i=g.options.full_path[g.options.full_path.length-1][1];g.modal.show({closing_events:true,title:"Adding datasets from your history to folder "+i,body:h({histories:g.histories.models}),buttons:{Add:function(){g.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.back()}});if(g.histories.models.length>0){g.fetchAndDisplayHistoryContents(g.histories.models[0].id);$("#dataset_add_bulk").change(function(j){g.fetchAndDisplayHistoryContents(j.target.value)})}else{f.error("An error ocurred.")}})},importFilesFromPathModal:function(){var h=this;this.modal=Galaxy.modal;var g=this.templateImportPathModal();this.modal.show({closing_events:true,title:"Please enter paths to import",body:g({}),buttons:{Import:function(){h.importFromPathsClicked(h)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+h.id,{trigger:true})}});this.renderSelectBoxes()},fetchExtAndGenomes:function(){var g=this;e.get({url:galaxy_config.root+"api/datatypes?extension_only=False",success:function(h){for(key in h){g.list_extensions.push({id:h[key].extension,text:h[key].extension,description:h[key].description,description_url:h[key].description_url})}g.list_extensions.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0});g.list_extensions.unshift(g.auto)}});e.get({url:galaxy_config.root+"api/genomes",success:function(h){for(key in h){g.list_genomes.push({id:h[key][1],text:h[key][0]})}g.list_genomes.sort(function(j,i){return j.id>i.id?1:j.id<i.id?-1:0})}})},renderSelectBoxes:function(){var g=this;this.select_genome=new a.View({css:"library-genome-select",data:g.list_genomes,container:Galaxy.modal.$el.find("#library_genome_select"),value:"?"});this.select_extension=new a.View({css:"library-extension-select",data:g.list_extensions,container:Galaxy.modal.$el.find("#library_extension_select"),value:"auto"})},importFilesFromGalaxyFolderModal:function(g){var i=this;var h=this.templateBrowserModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Please select folders or files",body:h({}),buttons:{Import:function(){i.importFromJstreePath(i,g)},Close:function(){Galaxy.modal.hide()}},closing_callback:function(){Galaxy.libraries.library_router.navigate("folders/"+i.id,{trigger:true})}});this.renderSelectBoxes();g.disabled_jstree_element="folders";this.renderJstree(g);$("input[type=radio]").change(function(j){if(j.target.value==="jstree-disable-folders"){g.disabled_jstree_element="folders";i.renderJstree(g);$(".jstree-folders-message").hide();$(".jstree-preserve-structure").hide();$(".jstree-link-files").hide();$(".jstree-files-message").show()}else{if(j.target.value==="jstree-disable-files"){$(".jstree-files-message").hide();$(".jstree-folders-message").show();$(".jstree-link-files").show();$(".jstree-preserve-structure").show();g.disabled_jstree_element="files";i.renderJstree(g)}}})},renderJstree:function(g){var i=this;this.options=_.extend(this.options,g);var j=g.source||"userdir";var h=this.options.disabled_jstree_element;this.jstree=new d.Jstree();this.jstree.url=this.jstree.urlRoot+"?target="+j+"&format=jstree&disable="+h;this.jstree.fetch({success:function(l,k){define("jquery",function(){return jQuery});require(["libs/jquery/jstree"],function(m){$("#jstree_browser").jstree("destroy");$("#jstree_browser").jstree({core:{data:l},plugins:["types","checkbox"],types:{folder:{icon:"jstree-folder"},file:{icon:"jstree-file"}},checkbox:{three_state:false}})})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){f.error(k.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},importFromPathsClicked:function(){var g=this.modal.$el.find(".preserve-checkbox").is(":checked");var n=this.modal.$el.find(".link-checkbox").is(":checked");var h=this.select_extension.value();var j=this.select_genome.value();var m=$("textarea#import_paths").val();var l=[];if(!m){f.info("Please enter a path relative to Galaxy root.")}else{this.modal.disableButton("Import");m=m.split("\n");for(var k=m.length-1;k>=0;k--){trimmed=m[k].trim();if(trimmed.length!==0){l.push(trimmed)}}this.initChainCallControl({length:l.length,action:"adding_datasets"});this.chainCallImportingFolders({paths:l,preserve_dirs:g,link_data:n,source:"admin_path",file_type:h,dbkey:j})}},initChainCallControl:function(g){var h;switch(g.action){case"adding_datasets":h=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h({folder_name:this.options.folder_name}));break;case"deleting_datasets":h=this.templateDeletingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(h());break;case"to_history":h=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(h({history_name:g.history_name}));break;default:console.error("Wrong action specified.");break}this.progress=0;this.progressStep=100/g.length;this.options.chain_call_control.total_number=g.length;this.options.chain_call_control.failed_number=0},importFromJstreePath:function(n,r){var g=$("#jstree_browser").jstree().get_selected(true);var m=this.modal.$el.find(".preserve-checkbox").is(":checked");var o=this.modal.$el.find(".link-checkbox").is(":checked");var j=this.select_extension.value();var p=this.select_genome.value();var k=g[0].type;var q=[];if(g.length<1){f.info("Please select some items first.")}else{this.modal.disableButton("Import");for(var l=g.length-1;l>=0;l--){if(g[l].li_attr.full_path!==undefined){q.push(g[l].li_attr.full_path)}}this.initChainCallControl({length:q.length,action:"adding_datasets"});if(k==="folder"){var h=r.source+"_folder";this.chainCallImportingFolders({paths:q,preserve_dirs:m,link_data:o,source:h,file_type:j,dbkey:p})}else{if(k==="file"){var h=r.source+"_file";this.chainCallImportingUserdirFiles({paths:q,file_type:j,dbkey:p,source:h})}}}},fetchAndDisplayHistoryContents:function(i){var h=new d.HistoryContents({id:i});var g=this;h.fetch({success:function(k){var j=g.templateHistoryContents();g.histories.get(i).set({contents:k});g.modal.$el.find("#selected_history_content").html(j({history_contents:k.models.reverse()}))},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})},addAllDatasetsFromHistory:function(){var l=this.modal.$el.find("#selected_history_content").find(":checked");var g=[];var k=[];if(l.length<1){f.info("You must select some datasets first.")}else{this.modal.disableButton("Add");l.each(function(){var i=$(this.parentElement).data("id");if(i){g.push(i)}});for(var j=g.length-1;j>=0;j--){history_dataset_id=g[j];var h=new d.Item();h.url="/api/folders/"+this.options.id+"/contents";h.set({from_hda_id:history_dataset_id});k.push(h)}this.initChainCallControl({length:k.length,action:"adding_datasets"});this.chainCallAddingHdas(k)}},chainCallImportingIntoHistory:function(h,k){var g=this;var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be imported into history. Click this to see what was imported.","",{onclick:function(){window.location="/"}})}}}Galaxy.modal.hide();return true}var j=$.when(i.save({content:i.content,source:i.source}));j.done(function(){g.updateProgress();g.chainCallImportingIntoHistory(h,k)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallImportingIntoHistory(h,k)})},chainCallImportingUserdirFiles:function(g){var h=this;var i=g.paths.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected files imported into the current folder");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingUserdirFiles(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingUserdirFiles(g)})},chainCallImportingFolders:function(g){var h=this;var i=g.paths.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected folders and their contents imported into the current folder.");Galaxy.modal.hide()}else{f.error("An error occured.")}return true}var j=$.when($.post("/api/libraries/datasets?encoded_folder_id="+h.id+"&source="+g.source+"&path="+i+"&preserve_dirs="+g.preserve_dirs+"&link_data="+g.link_data+"&file_type="+g.file_type+"&dbkey="+g.dbkey));j.done(function(k){h.updateProgress();h.chainCallImportingFolders(g)}).fail(function(){h.options.chain_call_control.failed_number+=1;h.updateProgress();h.chainCallImportingFolders(g)})},chainCallAddingHdas:function(h){var g=this;this.added_hdas=new d.Folder();var i=h.pop();if(typeof i=="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var j=$.when(i.save({from_hda_id:i.get("from_hda_id")}));j.done(function(k){Galaxy.libraries.folderListView.collection.add(k);g.updateProgress();g.chainCallAddingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallAddingHdas(h)})},chainCallDeletingHdas:function(h){var g=this;this.deleted_lddas=new d.Folder();var i=h.pop();if(typeof i==="undefined"){if(this.options.chain_call_control.failed_number===0){f.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){f.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){f.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var j=$.when(i.destroy());j.done(function(l){Galaxy.libraries.folderListView.collection.remove(i.id);g.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var k=new d.Item(l);Galaxy.libraries.folderListView.collection.add(k)}g.chainCallDeletingHdas(h)}).fail(function(){g.options.chain_call_control.failed_number+=1;g.updateProgress();g.chainCallDeletingHdas(h)})},checkIncludeDeleted:function(g){if(g.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var g=$("#folder_table").find(":checked");if(g.length===0){f.info("You must select at least one dataset for deletion.")}else{var k=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:k({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var h=[];g.each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});this.progressStep=100/h.length;this.progress=0;var m=[];for(var j=h.length-1;j>=0;j--){var l=new d.Item({id:h[j]});m.push(l)}this.options.chain_call_control.total_number=h.length;this.chainCallDeletingHdas(m)}},showLibInfo:function(){var h=Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id;var g=null;var i=this;if(Galaxy.libraries.libraryListView!==null){g=Galaxy.libraries.libraryListView.collection.get(h);this.showLibInfoModal(g)}else{g=new d.Library({id:h});g.fetch({success:function(){i.showLibInfoModal(g)},error:function(k,j){if(typeof j.responseJSON!=="undefined"){f.error(j.responseJSON.err_msg)}else{f.error("An error ocurred.")}}})}},showLibInfoModal:function(g){var h=this.templateLibInfoInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Library Information",body:h({library:g}),buttons:{Close:function(){Galaxy.modal.hide()}}})},showImportModal:function(g){switch(g.source){case"history":this.addFilesFromHistoryModal();break;case"importdir":this.importFilesFromGalaxyFolderModal({source:"importdir"});break;case"path":this.importFilesFromPathModal();break;case"userdir":this.importFilesFromGalaxyFolderModal({source:"userdir"});break;default:Galaxy.libraries.library_router.back();f.error("Invalid import source.");break}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"> | <input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"> include deleted | </input></span>');tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push("<% if(mutiple_add_dataset_options) { %>");tmpl_array.push(' <div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button title="Add Datasets to Current Folder" id="" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-plus"></span><span class="fa fa-file"></span><span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#folders/<%= id %>/import/history"> from History</a></li>');tmpl_array.push("<% if(Galaxy.config.user_library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/userdir"> from User Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li class="divider"></li>');tmpl_array.push(' <li class="dropdown-header">Admins only</li>');tmpl_array.push("<% if(Galaxy.config.library_import_dir !== null) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/importdir">from Import Directory</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% if(Galaxy.config.allow_library_path_paste) { %>");tmpl_array.push(' <li><a href="#folders/<%= id %>/import/path">from Path</a></li>');tmpl_array.push("<% } %>");tmpl_array.push("<% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push("<% } else { %>");tmpl_array.push(' <button style="display:none;" data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button add-library-items" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("<% } %>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to History</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> Download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> Delete</button>');tmpl_array.push(' <button data-id="<%- id %>" data-toggle="tooltip" data-placement="top" title="Show library information" id="toolbtn_show_libinfo" class="primary-button" style="margin-left: 0.5em;" type="button"><span class="fa fa-info-circle"></span> Library Info</button>');tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/FolderContents" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('<div id="lif_info_modal">');tmpl_array.push("<h2>Library name:</h2>");tmpl_array.push('<p><%- library.get("name") %></p>');tmpl_array.push("<h3>Library description:</h3>");tmpl_array.push('<p><%- library.get("description") %></p>');tmpl_array.push("<h3>Library synopsis:</h3>");tmpl_array.push('<p><%- library.get("synopsis") %></p>');tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var g=[];g.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');g.push("Select history: ");g.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</span>");return _.template(g.join(""))},templateImportIntoHistoryProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateAddingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("Adding selected datasets to library folder <b><%= _.escape(folder_name) %></b>");g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateDeletingDatasetsProgressBar:function(){var g=[];g.push('<div class="import_text">');g.push("</div>");g.push('<div class="progress">');g.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');g.push(' <span class="completion_span">0% Complete</span>');g.push(" </div>");g.push("</div>");g.push("");return _.template(g.join(""))},templateBrowserModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-files-message">All files you select will be imported into the current folder.</div>');g.push('<div class="alert alert-info jstree-folders-message" style="display:none;">All files within the selected folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom:1em;">');g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting files" type="radio" name="jstree-radio" value="jstree-disable-folders" checked="checked"> Files');g.push("</label>");g.push('<label class="radio-inline">');g.push(' <input title="Switch to selecting folders" type="radio" name="jstree-radio" value="jstree-disable-files"> Folders');g.push("</label>");g.push("</div>");g.push('<div style="margin-bottom:1em;">');g.push('<label class="checkbox-inline jstree-preserve-structure" style="display:none;">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files" style="display:none;">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<div id="jstree_browser">');g.push("</div>");g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateImportPathModal:function(){var g=[];g.push('<div id="file_browser_modal">');g.push('<div class="alert alert-info jstree-folders-message">All files within the given folders and their subfolders will be imported into the current folder.</div>');g.push('<div style="margin-bottom: 0.5em;">');g.push('<label class="checkbox-inline jstree-preserve-structure">');g.push(' <input class="preserve-checkbox" type="checkbox" value="preserve_directory_structure">');g.push("Preserve directory structure");g.push(" </label>");g.push('<label class="checkbox-inline jstree-link-files">');g.push(' <input class="link-checkbox" type="checkbox" value="link_files">');g.push("Link files instead of copying");g.push(" </label>");g.push("</div>");g.push('<textarea id="import_paths" class="form-control" rows="5" placeholder="Absolute paths (or paths relative to Galaxy root) separated by newline"></textarea>');g.push("<hr />");g.push("<p>You can set extension type and genome for all imported datasets at once:</p>");g.push("<div>");g.push('Type: <span id="library_extension_select" class="library-extension-select" />');g.push(' Genome: <span id="library_genome_select" class="library-genome-select" />');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateAddFilesFromHistory:function(){var g=[];g.push('<div id="add_files_modal">');g.push('<div id="history_modal_combo_bulk">');g.push("Select history: ");g.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');g.push(" <% _.each(histories, function(history) { %>");g.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');g.push(" <% }); %>");g.push("</select>");g.push("</div>");g.push("<br/>");g.push('<div id="selected_history_content">');g.push("</div>");g.push("</div>");return _.template(g.join(""))},templateHistoryContents:function(){var g=[];g.push("<strong>Choose the datasets to import:</strong>");g.push("<ul>");g.push(" <% _.each(history_contents, function(history_item) { %>");g.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');g.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');g.push(" </li>");g.push(" <% }); %>");g.push("</ul>");return _.template(g.join(""))}});return{FolderToolbarView:b}});
\ No newline at end of file
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/packed/mvc/library/library-librarylist-view.js
--- a/static/scripts/packed/mvc/library/library-librarylist-view.js
+++ b/static/scripts/packed/mvc/library/library-librarylist-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);var i=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){i.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/">Galaxy support site</a>.</div>');tmpl_array.push("<% } else{ %>");tmpl_array.push('<table class="grid table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');tmpl_array.push(' <th style="width:22%;">description</th>');tmpl_array.push(' <th style="width:22%;">synopsis</th> ');tmpl_array.push(' <th style="width:26%;"></th> ');tmpl_array.push(" </thead>");tmpl_array.push(' <tbody id="library_list_body">');tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("<% }%>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}});
\ No newline at end of file
+define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},defaults:{page_count:null,show_page:null},initialize:function(h){this.options=_.defaults(this.options||{},this.defaults,h);var i=this;this.modal=null;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){i.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred.")}}})},render:function(i){this.options=_.extend(this.options,i);if((this.options.page_size!=null)&&(this.options.page_size==parseInt(this.options.page_size))){Galaxy.libraries.preferences.set({library_page_size:parseInt(this.options.page_size)})}$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var l=null;if(this.options.show_page===null||this.options.show_page<1){this.options.show_page=1}if(typeof i!=="undefined"){l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(Galaxy.libraries.preferences.get("with_deleted")){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.options.total_libraries_count=k.length;var h=(Galaxy.libraries.preferences.get("library_page_size")*(this.options.show_page-1));this.options.page_count=Math.ceil(this.options.total_libraries_count/Galaxy.libraries.preferences.get("library_page_size"));if(this.options.total_libraries_count>0&&(h<this.options.total_libraries_count)){k=k.slice(h,h+Galaxy.libraries.preferences.get("library_page_size"));this.options.libraries_shown=k.length;if(Galaxy.libraries.preferences.get("library_page_size")*this.options.show_page>(this.options.total_libraries_count+Galaxy.libraries.preferences.get("library_page_size"))){k=[]}this.$el.html(j({length:1,order:Galaxy.libraries.preferences.get("sort_order")}));Galaxy.libraries.libraryToolbarView.renderPaginator(this.options);this.renderRows(k)}else{this.$el.html(j({length:0,order:Galaxy.libraries.preferences.get("sort_order")}));Galaxy.libraries.libraryToolbarView.renderPaginator(this.options)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);this.$el.find("#library_list_body").append(h.el);this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you here. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity" target="_blank">library security wikipage</a> or visit the <a href="https://biostar.usegalaxy.org/" target="_blank">Galaxy support site</a>.</div>');tmpl_array.push("<% } else{ %>");tmpl_array.push('<table class="grid table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');tmpl_array.push(' <th style="width:22%;">description</th>');tmpl_array.push(' <th style="width:22%;">synopsis</th> ');tmpl_array.push(' <th style="width:26%;"></th>');tmpl_array.push(" </thead>");tmpl_array.push(' <tbody id="library_list_body">');tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("<% }%>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},});return{LibraryListView:f}});
\ No newline at end of file
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/scripts/packed/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
@@ -1,1 +1,1 @@
-define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured.")}}})}else{b.error("Library's name is missing.")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(" <span><strong>DATA LIBRARIES</strong></span>");tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"> | <input id="include_deleted_chk" style="margin: 0;" type="checkbox"> include deleted |</input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button btn-xs" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(" </div>");tmpl_array.push(" <div>");tmpl_array.push(" ");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
+define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"showLibraryModal","click #include_deleted_chk":"includeDeletedChecked","click #page_size_prompt":"showPageSizePrompt"},initialize:function(d){this.options=_.defaults(this.options||{},d);this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},renderPaginator:function(e){this.options=_.extend(this.options,e);var d=this.templatePaginator();this.$el.find("#library_paginator").html(d({show_page:parseInt(this.options.show_page),page_count:parseInt(this.options.page_count),total_libraries_count:this.options.total_libraries_count,libraries_shown:this.options.libraries_shown}))},showLibraryModal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.createNewLibrary()},Close:function(){d.modal.hide()}}})},createNewLibrary:function(){var f=this.serializeNewLibrary();if(this.valdiateNewLibrary(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clearLibraryModal();Galaxy.libraries.libraryListView.render();b.success("Library created.")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured.")}}})}else{b.error("Library's name is missing.")}return false},showPageSizePrompt:function(){var d=prompt("How many libraries per page do you want to see?",Galaxy.libraries.preferences.get("library_page_size"));if((d!=null)&&(d==parseInt(d))){Galaxy.libraries.preferences.set({library_page_size:parseInt(d)});Galaxy.libraries.libraryListView.render()}},clearLibraryModal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serializeNewLibrary:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},valdiateNewLibrary:function(d){return d.name!==""},includeDeletedChecked:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form">');tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <form class="form-inline" role="form">');tmpl_array.push(' <span><strong><a href="#" title="Go to first page">DATA LIBRARIES</a></strong></span>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div class="checkbox" style="height: 20px;">');tmpl_array.push(" <label>");tmpl_array.push(' <input id="include_deleted_chk" type="checkbox"> include deleted </input>');tmpl_array.push(" </label>");tmpl_array.push(" </div>");tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button></span>');tmpl_array.push(" <% } %>");tmpl_array.push(' <span class="help-button" data-toggle="tooltip" data-placement="top" title="Visit Libraries Wiki"><a href="https://wiki.galaxyproject.org/DataLibraries/screen/ListOfLibraries" target="_blank"><button class="primary-button" type="button"><span class="fa fa-question-circle"></span> Help</button></a></span>');tmpl_array.push(' <span id="library_paginator" class="library-paginator">');tmpl_array.push(" </span>");tmpl_array.push(" </form>");tmpl_array.push(" </div>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templatePaginator:function(){tmpl_array=[];tmpl_array.push(' <ul class="pagination pagination-sm">');tmpl_array.push(" <% if ( ( show_page - 1 ) > 0 ) { %>");tmpl_array.push(" <% if ( ( show_page - 1 ) > page_count ) { %>");tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li><a href="#page/<% print( show_page - 1 ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#page/1"><span class="fa fa-angle-double-left"></span></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page - 1 ) %></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(' <li class="active">');tmpl_array.push(' <a href="#page/<% print( show_page ) %>"><% print( show_page ) %></a>');tmpl_array.push(" </li>");tmpl_array.push(" <% if ( ( show_page ) < page_count ) { %>");tmpl_array.push(' <li><a href="#page/<% print( show_page + 1 ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <li class="disabled"><a href="#page/<% print( show_page ) %>"><% print( show_page + 1 ) %></a></li>');tmpl_array.push(' <li class="disabled"><a href="#page/<% print( page_count ) %>"><span class="fa fa-angle-double-right"></span></a></li>');tmpl_array.push(" <% } %>");tmpl_array.push(" </ul>");tmpl_array.push(" <span>");tmpl_array.push(' showing <a id="page_size_prompt"><%- libraries_shown %></a> of <%- total_libraries_count %> libraries');tmpl_array.push(" </span>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -757,6 +757,7 @@
.dropdown-menu{max-width:auto}
input[type="checkbox"],input[type="radio"]{margin-left:0.5ex;margin-right:0.5ex}
.modal-dialog{width:690px}
+.pagination>.active>a{background-color:#ebd9b2;color:black}.pagination>.active>a:hover{color:black;background-color:#ebd9b2}
.modal-body{overflow:auto}
.nav-tabs{margin-bottom:15px}
a{text-decoration:underline}
@@ -1360,6 +1361,8 @@
.libraryItem-queued{margin-right:2px;padding:0 2px 0 2px;border:1px solid #bfbfbf;background:#eee}
.libraryItem-running{margin-right:2px;padding:0 2px 0 2px;border:1px solid #aa6;background:#ffc}
.libraryItem-upload{margin-right:2px;padding:0 2px 0 2px;border:1px solid #1197c0;background:#a6e4f7}
+.pagination-sm{height:15px}
+.library-paginator{margin-left:2em}
.toast-title{font-weight:bold}
.toast-message{-ms-word-wrap:break-word;word-wrap:break-word}.toast-message a,.toast-message label{color:#fff}
.toast-message a:hover{color:#ccc;text-decoration:none}
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/style/blue/library.css
--- a/static/style/blue/library.css
+++ b/static/style/blue/library.css
@@ -42,3 +42,5 @@
.libraryItem-queued{margin-right:2px;padding:0 2px 0 2px;border:1px solid #bfbfbf;background:#eee}
.libraryItem-running{margin-right:2px;padding:0 2px 0 2px;border:1px solid #aa6;background:#ffc}
.libraryItem-upload{margin-right:2px;padding:0 2px 0 2px;border:1px solid #1197c0;background:#a6e4f7}
+.pagination-sm{height:15px}
+.library-paginator{margin-left:2em}
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/style/src/less/galaxy_bootstrap/overrides.less
--- a/static/style/src/less/galaxy_bootstrap/overrides.less
+++ b/static/style/src/less/galaxy_bootstrap/overrides.less
@@ -35,6 +35,16 @@
width: 690px;
}
+.pagination {
+ > .active > a {
+ background-color: #ebd9b2;
+ color: black;
+ &:hover {
+ color: black;
+ background-color: #ebd9b2;
+ }
+ }
+}
/*
NOTE: these styles do not currently work.
@@ -70,4 +80,4 @@
.nav-tabs {
margin-bottom: 15px;
-}
\ No newline at end of file
+}
diff -r 905bcdb0f1191e9e5150330d210953d10af682a8 -r c86a489a597657c769848d2781af631ca668a279 static/style/src/less/library.less
--- a/static/style/src/less/library.less
+++ b/static/style/src/less/library.less
@@ -98,8 +98,7 @@
}
}
-th.button_heading
-{
+th.button_heading{
width: 2em;
}
@@ -209,3 +208,9 @@
border: 1px solid @state-upload-border;
background: @state-upload-bg;
}
+.pagination-sm {
+ height: 15px;
+}
+.library-paginator {
+ margin-left: 2em;
+}
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
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/905bcdb0f119/
Changeset: 905bcdb0f119
User: dannon
Date: 2014-10-10 18:40:58+00:00
Summary: Merge stable.
Affected #: 1 file
diff -r bfd407dbdd22a07a73eda40a359db6ab1e9acef3 -r 905bcdb0f1191e9e5150330d210953d10af682a8 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-a4f8476d787e254f11735896d0a3d2dced86e10b latest_2014.10.06
+0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac latest_2014.10.06
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
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7436bde1f785/
Changeset: 7436bde1f785
Branch: stable
User: dannon
Date: 2014-10-10 18:40:07+00:00
Summary: Merge.
Affected #: 1 file
diff -r c28c30887d37f3ea8fd2fb57276bab1c3b5d49f0 -r 7436bde1f7850762bcceb3a30fb4a3eceac42523 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-a4f8476d787e254f11735896d0a3d2dced86e10b latest_2014.10.06
+0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac latest_2014.10.06
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: dan: Merged in dannon/galaxy-central-prmaker/stable (pull request #524)
by commits-noreply@bitbucket.org 10 Oct '14
by commits-noreply@bitbucket.org 10 Oct '14
10 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/bfd407dbdd22/
Changeset: bfd407dbdd22
User: dan
Date: 2014-10-10 18:36:55+00:00
Summary: Merged in dannon/galaxy-central-prmaker/stable (pull request #524)
[STABLE] Strip r3 instance types for now; hvm virtualization required, which causes launch failures.
Affected #: 1 file
diff -r a575533ed283363e8e754a68ade04569c4e481f0 -r bfd407dbdd22a07a73eda40a359db6ab1e9acef3 lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
--- a/lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
+++ b/lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
@@ -36,9 +36,6 @@
("c3.large", "Compute optimized Large (2 vCPU/4GB RAM)"),
("c3.2xlarge", "Compute optimized 2xLarge (8 vCPU/15GB RAM)"),
("c3.8xlarge", "Compute optimized 8xLarge (32 vCPU/60GB RAM)"),
- ("r3.large", "Memory optimized Large (2 vCPU/15GB RAM)"),
- ("r3.2xlarge", "Memory optimized 2xLarge (8 vCPU/61GB RAM)"),
- ("r3.8xlarge", "Memory optimized 8xLarge (32 vCPU/244GB RAM)"),
]
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/c28c30887d37/
Changeset: c28c30887d37
Branch: stable
User: dannon
Date: 2014-10-10 18:13:46+00:00
Summary: Strip r3 instance types for now; hvm virtualization required, which causes launch failures.
Affected #: 1 file
diff -r 0f70d302b85e2a74d6c0c9ec7d4ccc6f11787eac -r c28c30887d37f3ea8fd2fb57276bab1c3b5d49f0 lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
--- a/lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
+++ b/lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
@@ -35,9 +35,6 @@
("c3.large", "Compute optimized Large (2 vCPU/4GB RAM)"),
("c3.2xlarge", "Compute optimized 2xLarge (8 vCPU/15GB RAM)"),
("c3.8xlarge", "Compute optimized 8xLarge (32 vCPU/60GB RAM)"),
- ("r3.large", "Memory optimized Large (2 vCPU/15GB RAM)"),
- ("r3.2xlarge", "Memory optimized 2xLarge (8 vCPU/61GB RAM)"),
- ("r3.8xlarge", "Memory optimized 8xLarge (32 vCPU/244GB RAM)"),
]
https://bitbucket.org/galaxy/galaxy-central/commits/bfd407dbdd22/
Changeset: bfd407dbdd22
User: dan
Date: 2014-10-10 18:36:55+00:00
Summary: Merged in dannon/galaxy-central-prmaker/stable (pull request #524)
[STABLE] Strip r3 instance types for now; hvm virtualization required, which causes launch failures.
Affected #: 1 file
diff -r a575533ed283363e8e754a68ade04569c4e481f0 -r bfd407dbdd22a07a73eda40a359db6ab1e9acef3 lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
--- a/lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
+++ b/lib/galaxy/webapps/galaxy/controllers/cloudlaunch.py
@@ -36,9 +36,6 @@
("c3.large", "Compute optimized Large (2 vCPU/4GB RAM)"),
("c3.2xlarge", "Compute optimized 2xLarge (8 vCPU/15GB RAM)"),
("c3.8xlarge", "Compute optimized 8xLarge (32 vCPU/60GB RAM)"),
- ("r3.large", "Memory optimized Large (2 vCPU/15GB RAM)"),
- ("r3.2xlarge", "Memory optimized 2xLarge (8 vCPU/61GB RAM)"),
- ("r3.8xlarge", "Memory optimized 8xLarge (32 vCPU/244GB RAM)"),
]
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
10 Oct '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a575533ed283/
Changeset: a575533ed283
User: guerler
Date: 2014-10-10 16:51:40+00:00
Summary: ToolForm: Unit makos
Affected #: 3 files
diff -r 8ce690c0910c1f6a11f90fe91b51ca964e879d1f -r a575533ed283363e8e754a68ade04569c4e481f0 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -1235,7 +1235,7 @@
requires_setting_metadata = True
default_tool_action = DefaultToolAction
dict_collection_visible_keys = ( 'id', 'name', 'version', 'description' )
- default_template = 'tool_form.api.mako'
+ default_template = 'tool_form.mako'
def __init__( self, config_file, root, app, guid=None, repository_id=None ):
"""Load a tool from the config named by `config_file`"""
diff -r 8ce690c0910c1f6a11f90fe91b51ca964e879d1f -r a575533ed283363e8e754a68ade04569c4e481f0 templates/webapps/galaxy/tool_form.api.mako
--- a/templates/webapps/galaxy/tool_form.api.mako
+++ /dev/null
@@ -1,47 +0,0 @@
-<%inherit file="/base.mako"/>
-<%
- # load tool help
- tool_help = ''
- if tool.help:
- if tool.has_multiple_pages:
- tool_help = tool.help_by_page[tool_state.page]
- else:
- tool_help = tool.help
-
- # Help is Mako template, so render using current static path.
- tool_help = tool_help.render( static_path=h.url_for( '/static' ), host_url=h.url_for('/', qualified=True) )
-
- # Convert to unicode to display non-ascii characters.
- if type( tool_help ) is not unicode:
- tool_help = unicode( tool_help, 'utf-8')
- endif
-
- # check if citations exist
- tool_citations = False
- if tool.citations:
- tool_citations = True
-
- # form configuration
- self.form_config = {
- 'id' : tool.id,
- 'help' : tool_help,
- 'citations' : tool_citations,
- 'biostar_url' : trans.app.config.biostar_url,
- 'history_id' : trans.security.encode_id( trans.history.id ),
- 'job_id' : trans.security.encode_id( job.id ) if job else None
- }
-%>
-${h.js("libs/bibtex", "libs/jquery/jquery-ui")}
-${h.css('base', 'jquery-ui/smoothness/jquery-ui')}
-<script>
- require(['mvc/tools/tools-form'], function(ToolsForm){
- $(function(){
- var form = new ToolsForm.View(${ h.dumps(self.form_config) });
- });
- });
-</script>
-
-## classic tool form
-<div id="tool-form-classic" style="display: none;">
- <%include file="tool_form.mako"/>
-</div>
\ No newline at end of file
diff -r 8ce690c0910c1f6a11f90fe91b51ca964e879d1f -r a575533ed283363e8e754a68ade04569c4e481f0 templates/webapps/galaxy/tool_form.mako
--- a/templates/webapps/galaxy/tool_form.mako
+++ b/templates/webapps/galaxy/tool_form.mako
@@ -1,412 +1,456 @@
-##<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-<%namespace file="/base_panels.mako" import="overlay" />
+<%inherit file="/base.mako"/>
+<%
+ # load tool help
+ tool_help = ''
+ if tool.help:
+ if tool.has_multiple_pages:
+ tool_help = tool.help_by_page[tool_state.page]
+ else:
+ tool_help = tool.help
-<% import galaxy.util %>
+ # Help is Mako template, so render using current static path.
+ tool_help = tool_help.render( static_path=h.url_for( '/static' ), host_url=h.url_for('/', qualified=True) )
-<%def name="stylesheets()">
- ${h.css( "autocomplete_tagging", "base", "library" )}
- <style type="text/css">
- html, body {
- background-color: #fff;
- }
- </style>
-</%def>
+ # Convert to unicode to display non-ascii characters.
+ if type( tool_help ) is not unicode:
+ tool_help = unicode( tool_help, 'utf-8')
+ endif
-<%def name="javascripts()">
- ${parent.javascripts()}
- ${h.js( "galaxy.panels", "libs/jquery/jstorage" )}
- ${h.js( "libs/bibtex" )}
- <script type="text/javascript">
- require( [ "galaxy.tools" ] );
- window.enhanced_galaxy_tools = true;
- </script>
- <script type="text/javascript">
- $(function() {
- $(window).bind("refresh_on_change", function() {
- $(':file').each( function() {
- var file = $(this);
- var file_value = file.val();
- if (file_value) {
- // disable file input, since we don't want to upload the file on refresh
- var file_name = $(this).attr("name");
- file.attr( { name: 'replaced_file_input_' + file_name, disabled: true } );
- // create a new hidden field which stores the filename and has the original name of the file input
- var new_file_input = $(document.createElement('input'));
- new_file_input.attr( { "type": "hidden", "value": file_value, "name": file_name } );
- file.after(new_file_input);
- }
+ # check if citations exist
+ tool_citations = False
+ if tool.citations:
+ tool_citations = True
+
+ # form configuration
+ self.form_config = {
+ 'id' : tool.id,
+ 'help' : tool_help,
+ 'citations' : tool_citations,
+ 'biostar_url' : trans.app.config.biostar_url,
+ 'history_id' : trans.security.encode_id( trans.history.id ),
+ 'job_id' : trans.security.encode_id( job.id ) if job else None
+ }
+%>
+${h.js("libs/bibtex", "libs/jquery/jquery-ui")}
+${h.css('base', 'jquery-ui/smoothness/jquery-ui')}
+<script>
+ require(['mvc/tools/tools-form'], function(ToolsForm){
+ $(function(){
+ var form = new ToolsForm.View(${ h.dumps(self.form_config) });
+ });
+ });
+</script>
+
+## classic tool form
+<div id="tool-form-classic" style="display: none;">
+ <%namespace file="/message.mako" import="render_msg" />
+ <%namespace file="/base_panels.mako" import="overlay" />
+
+ <% import galaxy.util %>
+
+ <%def name="stylesheets()">
+ ${h.css( "autocomplete_tagging", "base", "library" )}
+ <style type="text/css">
+ html, body {
+ background-color: #fff;
+ }
+ </style>
+ </%def>
+
+ <%def name="javascripts()">
+ ${parent.javascripts()}
+ ${h.js( "galaxy.panels", "libs/jquery/jstorage" )}
+ ${h.js( "libs/bibtex" )}
+ <script type="text/javascript">
+ require( [ "galaxy.tools" ] );
+ window.enhanced_galaxy_tools = true;
+ </script>
+ <script type="text/javascript">
+ $(function() {
+ $(window).bind("refresh_on_change", function() {
+ $(':file').each( function() {
+ var file = $(this);
+ var file_value = file.val();
+ if (file_value) {
+ // disable file input, since we don't want to upload the file on refresh
+ var file_name = $(this).attr("name");
+ file.attr( { name: 'replaced_file_input_' + file_name, disabled: true } );
+ // create a new hidden field which stores the filename and has the original name of the file input
+ var new_file_input = $(document.createElement('input'));
+ new_file_input.attr( { "type": "hidden", "value": file_value, "name": file_name } );
+ file.after(new_file_input);
+ }
+ });
});
- });
- // For drilldown parameters: add expand/collapse buttons and collapse initially-collapsed elements
- $( 'div.drilldown-container' ).each( function() {
- $(this).find('span.form-toggle' ).each( function() {
- var show_hide_click_elt = $(this);
- var group_id = show_hide_click_elt.attr('id').substring( 0, show_hide_click_elt.attr('id').lastIndexOf( '-click' ) );
- $('#' + group_id + '-container').each( function() {
- var show_hide_elt = $(this);
- if ( show_hide_click_elt.hasClass( 'toggle-expand' ) ) {
- show_hide_elt.hide();
+ // For drilldown parameters: add expand/collapse buttons and collapse initially-collapsed elements
+ $( 'div.drilldown-container' ).each( function() {
+ $(this).find('span.form-toggle' ).each( function() {
+ var show_hide_click_elt = $(this);
+ var group_id = show_hide_click_elt.attr('id').substring( 0, show_hide_click_elt.attr('id').lastIndexOf( '-click' ) );
+ $('#' + group_id + '-container').each( function() {
+ var show_hide_elt = $(this);
+ if ( show_hide_click_elt.hasClass( 'toggle-expand' ) ) {
+ show_hide_elt.hide();
+ }
+ show_hide_click_elt.click( function() {
+ if ( show_hide_click_elt.hasClass("toggle") ){
+ show_hide_click_elt.addClass("toggle-expand");
+ show_hide_click_elt.removeClass("toggle");
+ show_hide_elt.slideUp( 'fast' );
+ }
+ else {
+ show_hide_click_elt.addClass("toggle");
+ show_hide_click_elt.removeClass("toggle-expand");
+ show_hide_elt.slideDown( 'fast' );
+ }
+ });
+ });
+ });
+ });
+
+ $(".add-librarydataset").click(function() {
+ var link = $(this);
+ $.ajax({
+ url: "/visualization/list_libraries",
+ error: function(xhr, ajaxOptions, thrownError) { alert( "Grid failed" ); console.log(xhr, ajaxOptions, thrownError); },
+ success: function(table_html) {
+ show_modal(
+ "Select Library Dataset",
+ table_html, {
+ "Cancel": function() {
+ hide_modal();
+ },
+ "Select": function() {
+ var names = [];
+ var ids = [];
+ counter = 1;
+ $('input[name=ldda_ids]:checked').each(function() {
+ var name = $.trim( $(this).siblings("label").text() );
+ var id = $(this).val();
+ names.push( counter + ". " + name );
+ counter += 1;
+ ids.push(id);
+ });
+ link.html( names.join("<br/>") );
+ link.siblings("input[type=hidden]").val( ids.join("||") );
+ hide_modal();
+ }
+ }
+ );
}
- show_hide_click_elt.click( function() {
- if ( show_hide_click_elt.hasClass("toggle") ){
- show_hide_click_elt.addClass("toggle-expand");
- show_hide_click_elt.removeClass("toggle");
- show_hide_elt.slideUp( 'fast' );
- }
- else {
- show_hide_click_elt.addClass("toggle");
- show_hide_click_elt.removeClass("toggle-expand");
- show_hide_elt.slideDown( 'fast' );
- }
- });
});
});
});
- $(".add-librarydataset").click(function() {
- var link = $(this);
- $.ajax({
- url: "/visualization/list_libraries",
- error: function(xhr, ajaxOptions, thrownError) { alert( "Grid failed" ); console.log(xhr, ajaxOptions, thrownError); },
- success: function(table_html) {
- show_modal(
- "Select Library Dataset",
- table_html, {
- "Cancel": function() {
- hide_modal();
- },
- "Select": function() {
- var names = [];
- var ids = [];
- counter = 1;
- $('input[name=ldda_ids]:checked').each(function() {
- var name = $.trim( $(this).siblings("label").text() );
- var id = $(this).val();
- names.push( counter + ". " + name );
- counter += 1;
- ids.push(id);
- });
- link.html( names.join("<br/>") );
- link.siblings("input[type=hidden]").val( ids.join("||") );
- hide_modal();
- }
- }
- );
- }
- });
- });
- });
+ %if not add_frame.debug:
+ if( window.name != "galaxy_main" ) {
+ location.replace( '${h.url_for( controller='root', action='index', tool_id=tool.id )}' );
+ }
+ %endif
- %if not add_frame.debug:
- if( window.name != "galaxy_main" ) {
- location.replace( '${h.url_for( controller='root', action='index', tool_id=tool.id )}' );
- }
+ </script>
+
+ </%def>
+
+ <%def name="do_inputs( inputs, tool_state, errors, prefix, other_values=None )">
+ <%
+ from galaxy.util.expressions import ExpressionContext
+ other_values = ExpressionContext( tool_state, other_values )
+ %>
+ %for input_index, input in enumerate( inputs.itervalues() ):
+ %if not input.visible:
+ <% pass %>
+ %elif input.type == "repeat":
+ <div class="repeat-group">
+ <div class="form-title-row"><strong>${input.title_plural}</strong>
+ %if input.help:
+ <div class="toolParamHelp" style="clear: both;">
+ ${input.help}
+ </div>
+ %endif
+ </div>
+ <%
+ repeat_state = tool_state[input.name]
+ num_repeats = len( repeat_state )
+ %>
+ %for i in range( num_repeats ):
+ <div class="repeat-group-item">
+ <%
+ if input.name in errors:
+ rep_errors = errors[input.name][i]
+ else:
+ rep_errors = dict()
+ index = repeat_state[i]['__index__']
+ %>
+ <div class="form-title-row"><strong>${input.title} ${i + 1}</strong></div>
+ ${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
+ %if input.min < num_repeats:
+ <div class="form-row"><input type="submit" class="btn" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
+ %endif
+ </div>
+ %if rep_errors.has_key( '__index__' ):
+ <div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}"> <span style="vertical-align: middle;">${rep_errors['__index__']}</span></div>
+ %endif
+ %endfor
+ %if input.max > num_repeats:
+ <div class="form-row"><input type="submit" class="btn" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div>
+ %endif
+ </div>
+ %elif input.type == "conditional":
+ <%
+ group_state = tool_state[input.name]
+ group_errors = errors.get( input.name, {} )
+ current_case = group_state['__current_case__']
+ group_prefix = prefix + input.name + "|"
+ %>
+ %if input.value_ref_in_group:
+ ${row_for_param( group_prefix, input.test_param, group_state, group_errors, other_values )}
+ %endif
+ ${do_inputs( input.cases[current_case].inputs, group_state, group_errors, group_prefix, other_values )}
+ %elif input.type == "upload_dataset":
+ %if input.get_datatype( trans, other_values ).composite_type is None: #have non-composite upload appear as before
+ <%
+ if input.name in errors:
+ rep_errors = errors[input.name][0]
+ else:
+ rep_errors = dict()
+ %>
+ ${do_inputs( input.inputs, tool_state[input.name][0], rep_errors, prefix + input.name + "_" + str( 0 ) + "|", other_values )}
+ %else:
+ <div class="repeat-group">
+ <div class="form-title-row"><strong>${input.group_title( other_values )}</strong></div>
+ <%
+ repeat_state = tool_state[input.name]
+ %>
+ %for i in range( len( repeat_state ) ):
+ <div class="repeat-group-item">
+ <%
+ if input.name in errors:
+ rep_errors = errors[input.name][i]
+ else:
+ rep_errors = dict()
+ index = repeat_state[i]['__index__']
+ %>
+ <div class="form-title-row"><strong>File Contents for ${input.title_by_index( trans, i, other_values )}</strong></div>
+ ${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
+ ##<div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
+ </div>
+ %endfor
+ ##<div class="form-row"><input type="submit" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div>
+ </div>
+ %endif
+ %else:
+ ${row_for_param( prefix, input, tool_state, errors, other_values )}
+ %endif
+ %endfor
+ </%def>
+
+ <%def name="row_for_param( prefix, param, parent_state, parent_errors, other_values )">
+ <%
+ if parent_errors.has_key( param.name ):
+ cls = "form-row form-row-error"
+ else:
+ cls = "form-row"
+
+ field = param.get_html_field( trans, parent_state[ param.name ], other_values )
+ field.refresh_on_change = param.refresh_on_change
+
+ # Field may contain characters submitted by user and these characters may
+ # be unicode; handle non-ascii characters gracefully.
+ field_html = field.get_html( prefix )
+ if type( field_html ) is not unicode:
+ field_html = unicode( field_html, 'utf-8', 'replace' )
+
+ if param.type == "hidden":
+ return field_html
+ %>
+ <div class="${cls}">
+ ${label_for_param( param )}
+ ${input_for_param( param, field_html )}
+ ${errors_for_param( param, parent_errors )}
+ ${help_for_param( param )}
+ <div style="clear: both;"></div>
+ </div>
+ </%def>
+
+ <%def name="input_for_param( param, field_html )">
+ <div class="form-row-input">${field_html}</div>
+ </%def>
+
+ <%def name="label_for_param( param )">
+ <% label = param.get_label()%>
+ %if label:
+ <label for="${param.name}">${label}:</label>
+ %endif
+ </%def>
+
+ <%def name="errors_for_param( param, parent_errors )">
+ %if parent_errors.has_key( param.name ):
+ <div class="form-row-error-message">
+ <div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}"> <span style="vertical-align: middle;">${parent_errors[param.name]}</span></div>
+ </div>
+ %endif
+ </%def>
+
+ <%def name="help_for_param( param )">
+ %if param.help:
+ <div class="toolParamHelp" style="clear: both;">
+ ${param.help}
+ </div>
+ %endif
+ </%def>
+
+ <%def name="row_for_rerun()">
+ %if trans.app.config.track_jobs_in_database and tool_state.rerun_remap_job_id is not None:
+ <div id="remap-row" class="form-row">
+ <input type="checkbox" name="rerun_remap_job_id" value="${tool_state.rerun_remap_job_id}"> Resume dependencies from this job
+ <div class="toolParamHelp" style="clear: both;">
+ The previous run of this tool failed and other tools were waiting for it to finish successfully, use this option to resume those tools using the outputs of this tool run.
+ </div>
+ </div>
+ <div style="clear: both;"></div>
+ %endif
+ </%def>
+
+ <% overlay(visible=False) %>
+
+ %if add_frame.from_noframe:
+ <div class="warningmessage">
+ <strong>Welcome to Galaxy</strong>
+ <hr/>
+ It appears that you found this tool from a link outside of Galaxy.
+ If you're not familiar with Galaxy, please consider visiting the
+ <a href="${h.url_for( controller='root' )}" target="_top">welcome page</a>.
+ To learn more about what Galaxy is and what it can do for you, please visit
+ the <a href="${add_frame.wiki_url}" target="_top">Galaxy wiki</a>.
+ </div>
+ <br/>
%endif
- </script>
+ <%
+ # Render an error message if a dynamically generated select list is missing a required
+ # index file or entry in the tool_data_table_conf.xml file.
+ message = ""
+ params_with_missing_data_table_entry = tool.params_with_missing_data_table_entry
+ params_with_missing_index_file = tool.params_with_missing_index_file
+ if params_with_missing_data_table_entry:
+ param = params_with_missing_data_table_entry[0]
+ message += "Data table named '%s' is required by tool but not configured. " % param.options.missing_tool_data_table_name
+ if tool.params_with_missing_index_file:
+ param = params_with_missing_index_file[0]
+ message += "Index file named '%s' is required by tool but not available. " % param.options.missing_index_file
-</%def>
+ # Handle calculating the redirect url for the special case where we have nginx proxy
+ # upload and need to do url_for on the redirect portion of the tool action.
+ try:
+ tool_url = h.url_for(tool.action)
+ except AttributeError:
+ assert len(tool.action) == 2
+ tool_url = tool.action[0] + h.url_for(tool.action[1])
+ %>
-<%def name="do_inputs( inputs, tool_state, errors, prefix, other_values=None )"><%
- from galaxy.util.expressions import ExpressionContext
- other_values = ExpressionContext( tool_state, other_values )
+ # Name of the tool in lower case
+ low_tool_name = tool.name.lower()
%>
- %for input_index, input in enumerate( inputs.itervalues() ):
- %if not input.visible:
- <% pass %>
- %elif input.type == "repeat":
- <div class="repeat-group">
- <div class="form-title-row"><strong>${input.title_plural}</strong>
- %if input.help:
- <div class="toolParamHelp" style="clear: both;">
- ${input.help}
- </div>
- %endif
- </div>
- <%
- repeat_state = tool_state[input.name]
- num_repeats = len( repeat_state )
- %>
- %for i in range( num_repeats ):
- <div class="repeat-group-item">
- <%
- if input.name in errors:
- rep_errors = errors[input.name][i]
+
+ %if tool_id_version_message:
+ ${render_msg( tool_id_version_message, 'warning' )}
+ %endif
+
+ <div class="toolForm" id="${tool.id}">
+ <form id="tool_form" name="tool_form" action="${tool_url}" enctype="${tool.enctype}" target="${tool.target}" method="${tool.method}">
+ %if tool.has_multiple_pages:
+ <div class="toolFormTitle">${tool.name} (step ${tool_state.page+1} of ${tool.npages})
+ %elif not tool_version_select_field:
+ <div class="toolFormTitle">${tool.name} (version ${tool.version})
+ %else:
+ <div class="toolFormTitle">${tool.name} ${tool_version_select_field.get_html()}
+ %endif
+
+ <span class="pull-right">
+ %if trans.app.config.biostar_url:
+ ## BioStar links
+ Help from Biostar
+ <div class="icon-btn-group">
+ <a href="${h.url_for( controller='biostar', action='biostar_tool_tag_redirect', tool_id=tool.id )}"
+ target="_blank" class="icon-btn" title="Search for this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-search"></span></a>
+ <a href="${h.url_for( controller='biostar', action='biostar_tool_question_redirect', tool_id=tool.id )}"
+ target="_blank" class="icon-btn" title="Ask a question about this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-question-circle"></a>
+ </div>
+ %endif
+ <div class="icon-btn-group">
+ <a href="#" data-link="${h.url_for( controller='root', action='index', tool_id=tool.id, qualified=True )}"
+ class="icon-btn tool-share-link" title="Share this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-share"></span></a>
+ </div>
+ </span>
+ </div>
+ <div class="toolFormBody">
+ <input type="hidden" name="refresh" value="refresh">
+ <input type="hidden" name="tool_id" value="${tool.id}">
+ <input type="hidden" name="tool_state" value="${util.object_to_string( tool_state.encode( tool, app ) )}">
+ %if tool.display_by_page[tool_state.page]:
+ ${trans.fill_template_string( tool.display_by_page[tool_state.page], context=tool.get_param_html_map( trans, tool_state.page, tool_state.inputs ) )}
+ ${row_for_rerun()}
+ <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">
+ %else:
+ ${do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, errors, "" )}
+ %if tool_state.page == tool.last_page:
+ ${row_for_rerun()}
+ %endif
+ <div class="form-row form-actions">
+ %if tool_state.page == tool.last_page:
+ <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">
+ %else:
+ <input type="submit" class="btn btn-primary" name="runtool_btn" value="Next step">
+ %endif
+ </div>
+ %endif
+ </div>
+ </form>
+ </div>
+ %if tool.help:
+ <div class="toolHelp">
+ <div class="toolHelpBody">
+ <%
+ if tool.has_multiple_pages:
+ tool_help = tool.help_by_page[tool_state.page]
else:
- rep_errors = dict()
- index = repeat_state[i]['__index__']
- %>
- <div class="form-title-row"><strong>${input.title} ${i + 1}</strong></div>
- ${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
- %if input.min < num_repeats:
- <div class="form-row"><input type="submit" class="btn" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
- %endif
- </div>
- %if rep_errors.has_key( '__index__' ):
- <div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}"> <span style="vertical-align: middle;">${rep_errors['__index__']}</span></div>
- %endif
- %endfor
- %if input.max > num_repeats:
- <div class="form-row"><input type="submit" class="btn" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div>
- %endif
- </div>
- %elif input.type == "conditional":
- <%
- group_state = tool_state[input.name]
- group_errors = errors.get( input.name, {} )
- current_case = group_state['__current_case__']
- group_prefix = prefix + input.name + "|"
- %>
- %if input.value_ref_in_group:
- ${row_for_param( group_prefix, input.test_param, group_state, group_errors, other_values )}
- %endif
- ${do_inputs( input.cases[current_case].inputs, group_state, group_errors, group_prefix, other_values )}
- %elif input.type == "upload_dataset":
- %if input.get_datatype( trans, other_values ).composite_type is None: #have non-composite upload appear as before
- <%
- if input.name in errors:
- rep_errors = errors[input.name][0]
- else:
- rep_errors = dict()
+ tool_help = tool.help
+
+ # Help is Mako template, so render using current static path.
+ tool_help = tool_help.render( static_path=h.url_for( '/static' ), host_url=h.url_for('/', qualified=True) )
+
+ # Convert to unicode to display non-ascii characters.
+ if type( tool_help ) is not unicode:
+ tool_help = unicode( tool_help, 'utf-8')
%>
- ${do_inputs( input.inputs, tool_state[input.name][0], rep_errors, prefix + input.name + "_" + str( 0 ) + "|", other_values )}
- %else:
- <div class="repeat-group">
- <div class="form-title-row"><strong>${input.group_title( other_values )}</strong></div>
- <%
- repeat_state = tool_state[input.name]
- %>
- %for i in range( len( repeat_state ) ):
- <div class="repeat-group-item">
- <%
- if input.name in errors:
- rep_errors = errors[input.name][i]
- else:
- rep_errors = dict()
- index = repeat_state[i]['__index__']
- %>
- <div class="form-title-row"><strong>File Contents for ${input.title_by_index( trans, i, other_values )}</strong></div>
- ${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
- ##<div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
- </div>
- %endfor
- ##<div class="form-row"><input type="submit" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div>
- </div>
- %endif
- %else:
- ${row_for_param( prefix, input, tool_state, errors, other_values )}
- %endif
- %endfor
-</%def>
-
-<%def name="row_for_param( prefix, param, parent_state, parent_errors, other_values )">
- <%
- if parent_errors.has_key( param.name ):
- cls = "form-row form-row-error"
- else:
- cls = "form-row"
-
- field = param.get_html_field( trans, parent_state[ param.name ], other_values )
- field.refresh_on_change = param.refresh_on_change
-
- # Field may contain characters submitted by user and these characters may
- # be unicode; handle non-ascii characters gracefully.
- field_html = field.get_html( prefix )
- if type( field_html ) is not unicode:
- field_html = unicode( field_html, 'utf-8', 'replace' )
-
- if param.type == "hidden":
- return field_html
- %>
- <div class="${cls}">
- ${label_for_param( param )}
- ${input_for_param( param, field_html )}
- ${errors_for_param( param, parent_errors )}
- ${help_for_param( param )}
- <div style="clear: both;"></div>
- </div>
-</%def>
-
-<%def name="input_for_param( param, field_html )">
- <div class="form-row-input">${field_html}</div>
-</%def>
-
-<%def name="label_for_param( param )">
- <% label = param.get_label()%>
- %if label:
- <label for="${param.name}">${label}:</label>
- %endif
-</%def>
-
-<%def name="errors_for_param( param, parent_errors )">
- %if parent_errors.has_key( param.name ):
- <div class="form-row-error-message">
- <div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}"> <span style="vertical-align: middle;">${parent_errors[param.name]}</span></div>
+ ${tool_help}
+ </div></div>
%endif
-</%def>
-
-<%def name="help_for_param( param )">
- %if param.help:
- <div class="toolParamHelp" style="clear: both;">
- ${param.help}
+ %if tool.tool_shed_repository:
+ <% tool_url = tool.tool_shed_repository.get_sharable_url( tool.app ) %>
+ %if tool_url:
+ <br/>
+ ${ render_msg( 'This tool was installed from a ToolShed, you may be able to find additional information by following this link: <a href="%s" target="_blank">%s</a>' % ( tool_url, tool_url ), 'info' ) }
+ %endif
+ %endif
+ %if tool.citations:
+ <script>
+ require(["mvc/citation/citation-model", "mvc/citation/citation-view"
+ ], function( citationModel, citationView ){
+ $(function() {
+ var citations = new citationModel.ToolCitationCollection();
+ citations.tool_id = "${tool.id}";
+ var citation_list_view = new citationView.CitationListView({ collection: citations } );
+ citation_list_view.render();
+ citations.fetch();
+ } );
+ } );
+ </script>
+ <div id="citations"></div>
%endif
-</%def>
-
-<%def name="row_for_rerun()">
- %if trans.app.config.track_jobs_in_database and tool_state.rerun_remap_job_id is not None:
- <div id="remap-row" class="form-row">
- <input type="checkbox" name="rerun_remap_job_id" value="${tool_state.rerun_remap_job_id}"> Resume dependencies from this job
- <div class="toolParamHelp" style="clear: both;">
- The previous run of this tool failed and other tools were waiting for it to finish successfully, use this option to resume those tools using the outputs of this tool run.
- </div>
- </div>
- <div style="clear: both;"></div>
- %endif
-</%def>
-
-<% overlay(visible=False) %>
-
-%if add_frame.from_noframe:
- <div class="warningmessage">
- <strong>Welcome to Galaxy</strong>
- <hr/>
- It appears that you found this tool from a link outside of Galaxy.
- If you're not familiar with Galaxy, please consider visiting the
- <a href="${h.url_for( controller='root' )}" target="_top">welcome page</a>.
- To learn more about what Galaxy is and what it can do for you, please visit
- the <a href="${add_frame.wiki_url}" target="_top">Galaxy wiki</a>.
- </div>
- <br/>
-%endif
-
-<%
- # Render an error message if a dynamically generated select list is missing a required
- # index file or entry in the tool_data_table_conf.xml file.
- message = ""
- params_with_missing_data_table_entry = tool.params_with_missing_data_table_entry
- params_with_missing_index_file = tool.params_with_missing_index_file
- if params_with_missing_data_table_entry:
- param = params_with_missing_data_table_entry[0]
- message += "Data table named '%s' is required by tool but not configured. " % param.options.missing_tool_data_table_name
- if tool.params_with_missing_index_file:
- param = params_with_missing_index_file[0]
- message += "Index file named '%s' is required by tool but not available. " % param.options.missing_index_file
-
- # Handle calculating the redirect url for the special case where we have nginx proxy
- # upload and need to do url_for on the redirect portion of the tool action.
- try:
- tool_url = h.url_for(tool.action)
- except AttributeError:
- assert len(tool.action) == 2
- tool_url = tool.action[0] + h.url_for(tool.action[1])
-%>
-
-<%
- # Name of the tool in lower case
- low_tool_name = tool.name.lower()
-%>
-
-%if tool_id_version_message:
- ${render_msg( tool_id_version_message, 'warning' )}
-%endif
-
-<div class="toolForm" id="${tool.id}">
- <form id="tool_form" name="tool_form" action="${tool_url}" enctype="${tool.enctype}" target="${tool.target}" method="${tool.method}">
- %if tool.has_multiple_pages:
- <div class="toolFormTitle">${tool.name} (step ${tool_state.page+1} of ${tool.npages})
- %elif not tool_version_select_field:
- <div class="toolFormTitle">${tool.name} (version ${tool.version})
- %else:
- <div class="toolFormTitle">${tool.name} ${tool_version_select_field.get_html()}
- %endif
-
- <span class="pull-right">
- %if trans.app.config.biostar_url:
- ## BioStar links
- Help from Biostar
- <div class="icon-btn-group">
- <a href="${h.url_for( controller='biostar', action='biostar_tool_tag_redirect', tool_id=tool.id )}"
- target="_blank" class="icon-btn" title="Search for this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-search"></span></a>
- <a href="${h.url_for( controller='biostar', action='biostar_tool_question_redirect', tool_id=tool.id )}"
- target="_blank" class="icon-btn" title="Ask a question about this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-question-circle"></a>
- </div>
- %endif
- <div class="icon-btn-group">
- <a href="#" data-link="${h.url_for( controller='root', action='index', tool_id=tool.id, qualified=True )}"
- class="icon-btn tool-share-link" title="Share this tool" data-toggle="tooltip" data-placement="bottom"><span class="fa fa-share"></span></a>
- </div>
- </span>
- </div>
- <div class="toolFormBody">
- <input type="hidden" name="refresh" value="refresh">
- <input type="hidden" name="tool_id" value="${tool.id}">
- <input type="hidden" name="tool_state" value="${util.object_to_string( tool_state.encode( tool, app ) )}">
- %if tool.display_by_page[tool_state.page]:
- ${trans.fill_template_string( tool.display_by_page[tool_state.page], context=tool.get_param_html_map( trans, tool_state.page, tool_state.inputs ) )}
- ${row_for_rerun()}
- <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">
- %else:
- ${do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, errors, "" )}
- %if tool_state.page == tool.last_page:
- ${row_for_rerun()}
- %endif
- <div class="form-row form-actions">
- %if tool_state.page == tool.last_page:
- <input type="submit" class="btn btn-primary" name="runtool_btn" value="Execute">
- %else:
- <input type="submit" class="btn btn-primary" name="runtool_btn" value="Next step">
- %endif
- </div>
- %endif
- </div>
- </form>
-</div>
-%if tool.help:
- <div class="toolHelp">
- <div class="toolHelpBody">
- <%
- if tool.has_multiple_pages:
- tool_help = tool.help_by_page[tool_state.page]
- else:
- tool_help = tool.help
-
- # Help is Mako template, so render using current static path.
- tool_help = tool_help.render( static_path=h.url_for( '/static' ), host_url=h.url_for('/', qualified=True) )
-
- # Convert to unicode to display non-ascii characters.
- if type( tool_help ) is not unicode:
- tool_help = unicode( tool_help, 'utf-8')
- %>
- ${tool_help}
- </div>
- </div>
-%endif
-%if tool.tool_shed_repository:
- <% tool_url = tool.tool_shed_repository.get_sharable_url( tool.app ) %>
- %if tool_url:
- <br/>
- ${ render_msg( 'This tool was installed from a ToolShed, you may be able to find additional information by following this link: <a href="%s" target="_blank">%s</a>' % ( tool_url, tool_url ), 'info' ) }
- %endif
-%endif
-%if tool.citations:
- <script>
- require(["mvc/citation/citation-model", "mvc/citation/citation-view"
- ], function( citationModel, citationView ){
- $(function() {
- var citations = new citationModel.ToolCitationCollection();
- citations.tool_id = "${tool.id}";
- var citation_list_view = new citationView.CitationListView({ collection: citations } );
- citation_list_view.render();
- citations.fetch();
- } );
- } );
- </script>
- <div id="citations">
- </div>
-%endif
-
+</div>
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0