commit/galaxy-central: 21 new changesets
21 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ad8b91a9c47d/ Changeset: ad8b91a9c47d User: saketkc Date: 2014-01-17 11:48:28 Summary: Add support to edit workflows on the fly. Trello Card: https://trello.com/c/SRxD991Y/1012-workflow-default-parameters Affected #: 1 file diff -r 60f203c3934d16f96e013102bab7882dbd0f64cd -r ad8b91a9c47db728b14cdd9395506defbf33db99 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -3,6 +3,9 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> + $.fn.outerHTML = function(s) { + return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); + }; $( function() { function show_tool_body(title){ title.parent().show().css('border-bottom-width', '1px'); @@ -129,7 +132,34 @@ select.after(filter); select.width(new_width); }); + // Editable Workflow + $(".edit").on("click",function(){ + var state = $(this).attr("name"); + var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); + var split_name=stepToolBox.attr("name").split("|"); + var step_id = split_name[0]; + var step_name = split_name[2]; + hidden_html = "<input type='hidden' name='"+step_id+"|__runtime__"+step_name+"' value='true' />"; + if (state === "edit"){ + stepToolBoxClone = stepToolBox.clone(); + stepToolBoxClone.attr({"name":step_id+"|"+step_name}); + stepToolBoxClone.show() + $(this).parent().find(".editable").show(); + $(this).parent().parent().find(".uneditable_field").hide(); + $(this).parent().find(".editable").html(stepToolBoxClone.outerHTML()+hidden_html); + $(this).attr("name","revert"); + $(this).val("Revert") + } + else{ + $(this).parent().find(".editable").html(""); + $(this).parent().find(".display").show() + $(".uneditable_field").show(); + $(this).attr("name","edit"); + $(this).val("Edit") + stepToolBox.hide(); + } + }); // Augment hidden fields with icons. // http://stackoverflow.com/a/2088430 $(function(){ @@ -217,6 +247,9 @@ .workflow-annotation { margin-bottom: 1em; } + .editable { + display: none; + } </style></%def> @@ -353,7 +386,19 @@ <span class="p_text_wrapper">${p_text}</span><input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> %else: - ${param.value_to_display_text( value, app )} + <span class="workflow_parameters"> + <span class="uneditable_field"> + ${param.value_to_display_text( value, app )} + </span> + <span class="editable_field"> + <span class="editable"> + ${param.get_html_field( t, value, other_values).get_html( str(step.id) + "|" + "editable" + "|"+ prefix )} + </span> + + <input type="button" name="edit" value="Edit" class="edit"/> + <input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}" + </span> + </span> %endif %endif </div> https://bitbucket.org/galaxy/galaxy-central/commits/92064a2083bb/ Changeset: 92064a2083bb User: saketkc Date: 2014-01-17 11:43:13 Summary: Merged galaxy/galaxy-central into default Affected #: 6 files diff -r ad8b91a9c47db728b14cdd9395506defbf33db99 -r 92064a2083bbdd5e22d2b206266573a6179acd57 lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -512,13 +512,14 @@ def before_setting_metadata( self, dataset ): """This function is called on the dataset before metadata is set.""" dataset.clear_associated_files( metadata_safe = True ) - def __new_composite_file( self, name, optional = False, mimetype = None, description = None, substitute_name_with_metadata = None, is_binary = False, space_to_tab = False, **kwds ): + def __new_composite_file( self, name, optional = False, mimetype = None, description = None, substitute_name_with_metadata = None, is_binary = False, to_posix_lines = True, space_to_tab = False, **kwds ): kwds[ 'name' ] = name kwds[ 'optional' ] = optional kwds[ 'mimetype' ] = mimetype kwds[ 'description' ] = description kwds[ 'substitute_name_with_metadata' ] = substitute_name_with_metadata kwds[ 'is_binary' ] = is_binary + kwds[ 'to_posix_lines' ] = to_posix_lines kwds[ 'space_to_tab' ] = space_to_tab return Bunch( **kwds ) def add_composite_file( self, name, **kwds ): diff -r ad8b91a9c47db728b14cdd9395506defbf33db99 -r 92064a2083bbdd5e22d2b206266573a6179acd57 lib/galaxy/tools/actions/upload_common.py --- a/lib/galaxy/tools/actions/upload_common.py +++ b/lib/galaxy/tools/actions/upload_common.py @@ -332,6 +332,7 @@ is_binary=is_binary, link_data_only=link_data_only, uuid=uuid_str, + to_posix_lines=uploaded_dataset.to_posix_lines, space_to_tab=uploaded_dataset.space_to_tab, in_place=trans.app.config.external_chown_script is None, path=uploaded_dataset.path ) diff -r ad8b91a9c47db728b14cdd9395506defbf33db99 -r 92064a2083bbdd5e22d2b206266573a6179acd57 lib/galaxy/tools/parameters/grouping.py --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -266,6 +266,9 @@ name = context.get( 'NAME', None ) info = context.get( 'INFO', None ) warnings = [] + to_posix_lines = False + if context.get( 'to_posix_lines', None ) not in [ "None", None, False ]: + to_posix_lines = True space_to_tab = False if context.get( 'space_to_tab', None ) not in [ "None", None, False ]: space_to_tab = True @@ -298,6 +301,7 @@ break if file_bunch.path: break + file_bunch.to_posix_lines = to_posix_lines file_bunch.space_to_tab = space_to_tab return file_bunch, warnings def get_filenames( context ): @@ -307,16 +311,21 @@ ftp_files = context['ftp_files'] name = context.get( 'NAME', None ) info = context.get( 'INFO', None ) + to_posix_lines = False + if context.get( 'to_posix_lines', None ) not in [ "None", None, False ]: + to_posix_lines = True space_to_tab = False if context.get( 'space_to_tab', None ) not in [ "None", None, False ]: space_to_tab = True warnings = [] file_bunch = get_data_file_filename( data_file, override_name = name, override_info = info ) if file_bunch.path: + file_bunch.to_posix_lines = to_posix_lines file_bunch.space_to_tab = space_to_tab rval.append( file_bunch ) for file_bunch in get_url_paste_urls_or_filename( context, override_name = name, override_info = info ): if file_bunch.path: + file_bunch.to_posix_lines = to_posix_lines file_bunch.space_to_tab = space_to_tab rval.append( file_bunch ) # look for files uploaded via FTP @@ -390,11 +399,13 @@ #replace sniff here with just creating an empty file temp_name, is_multi_byte = sniff.stream_to_file( StringIO.StringIO( d_type.generate_primary_file( dataset ) ), prefix='upload_auto_primary_file' ) dataset.primary_file = temp_name + dataset.to_posix_lines = True dataset.space_to_tab = False else: file_bunch, warnings = get_one_filename( groups_incoming[ 0 ] ) writable_files_offset = 1 dataset.primary_file = file_bunch.path + dataset.to_posix_lines = file_bunch.to_posix_lines dataset.space_to_tab = file_bunch.space_to_tab dataset.warnings.extend( warnings ) if dataset.primary_file is None:#remove this before finish, this should create an empty dataset diff -r ad8b91a9c47db728b14cdd9395506defbf33db99 -r 92064a2083bbdd5e22d2b206266573a6179acd57 test/functional/api/test_tools.py --- a/test/functional/api/test_tools.py +++ b/test/functional/api/test_tools.py @@ -33,6 +33,27 @@ create_response = self._post( "tools", data=payload ) self._assert_has_keys( create_response.json(), 'outputs' ) + def test_upload_posix_newline_fixes( self ): + windows_content = "1\t2\t3\r4\t5\t6\r" + posix_content = windows_content.replace("\r", "\n") + result_content = self._upload_and_get_content( windows_content ) + self.assertEquals( result_content, posix_content ) + + def test_upload_disable_posix_fix( self ): + windows_content = "1\t2\t3\r4\t5\t6\r" + result_content = self._upload_and_get_content( windows_content, to_posix_lines=None ) + self.assertEquals( result_content, windows_content ) + + def test_upload_tab_to_space( self ): + table = "1 2 3\n4 5 6\n" + result_content = self._upload_and_get_content( table, space_to_tab="Yes" ) + self.assertEquals( result_content, "1\t2\t3\n4\t5\t6\n" ) + + def test_upload_tab_to_space_off_by_default( self ): + table = "1 2 3\n4 5 6\n" + result_content = self._upload_and_get_content( table ) + self.assertEquals( result_content, table ) + def test_run_cat1( self ): history_id = self._new_history() new_dataset = self._new_dataset( history_id ) @@ -52,6 +73,14 @@ self._assert_has_keys( create_response.json(), 'outputs' ) self._wait_for_history( history_id, assert_ok=True ) + def _upload_and_get_content( self, content, **upload_kwds ): + history_id = self._new_history() + new_dataset = self._new_dataset( history_id, content=content, **upload_kwds ) + self._wait_for_history( history_id, assert_ok=True ) + display_response = self._get( "histories/%s/contents/%s/display" % ( history_id, new_dataset[ "id" ] ) ) + self._assert_status_code_is( display_response, 200 ) + return display_response.content + def _new_dataset( self, history_id, content='TestData123', **kwds ): payload = self._upload_payload( history_id, content, **kwds ) run_response = self._post( "tools", data=payload ) @@ -86,6 +115,10 @@ 'dbkey': dbkey, 'file_type': file_type, } + if "to_posix_lines" in kwds: + upload_params[ "files_0|to_posix_lines"] = kwds[ "to_posix_lines" ] + if "space_to_tab" in kwds: + upload_params[ "files_0|space_to_tab" ] = kwds[ "space_to_tab" ] return self._run_tool_payload( tool_id='upload1', inputs=upload_params, diff -r ad8b91a9c47db728b14cdd9395506defbf33db99 -r 92064a2083bbdd5e22d2b206266573a6179acd57 tools/data_source/upload.py --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -264,10 +264,14 @@ if link_data_only == 'copy_files': if dataset.type in ( 'server_dir', 'path_paste' ) and data_type not in [ 'gzip', 'bz2', 'zip' ]: in_place = False - if dataset.space_to_tab: - line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place ) - else: - line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place ) + # Convert universal line endings to Posix line endings, but allow the user to turn it off, + # so that is becomes possible to upload gzip, bz2 or zip files with binary data without + # corrupting the content of those files. + if dataset.to_posix_lines: + if dataset.space_to_tab: + line_count, converted_path = sniff.convert_newlines_sep2tabs( dataset.path, in_place=in_place ) + else: + line_count, converted_path = sniff.convert_newlines( dataset.path, in_place=in_place ) if dataset.file_type == 'auto': ext = sniff.guess_ext( dataset.path, registry.sniff_order ) else: diff -r ad8b91a9c47db728b14cdd9395506defbf33db99 -r 92064a2083bbdd5e22d2b206266573a6179acd57 tools/data_source/upload.xml --- a/tools/data_source/upload.xml +++ b/tools/data_source/upload.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<tool name="Upload File" id="upload1" version="1.1.3" workflow_compatible="false"> +<tool name="Upload File" id="upload1" version="1.1.4" workflow_compatible="false"><description> from your computer </description> @@ -38,6 +38,12 @@ </param><param name="url_paste" type="text" area="true" size="5x35" label="URL/Text" help="Here you may specify a list of URLs (one per line) or paste the contents of a file."/><param name="ftp_files" type="ftpfile" label="Files uploaded via FTP"/> + <!-- Change the following parameter from hidden to select to enable + modifying this option via the Web GUI. See Bitbucket pull request + 171 for more information. --> + <param name="to_posix_lines" type="hidden" display="checkboxes" multiple="True" label="Convert universal line endings to Posix line endings" help="Turn this option off if you upload a gzip, bz2 or zip archive which contains a binary file." value="Yes"> + <option value="Yes" selected="true">Yes</option> + </param><param name="space_to_tab" type="select" display="checkboxes" multiple="True" label="Convert spaces to tabs" help="Use this option if you are entering intervals by hand."><option value="Yes">Yes</option></param> https://bitbucket.org/galaxy/galaxy-central/commits/6eb50cf0f062/ Changeset: 6eb50cf0f062 User: saketkc Date: 2014-01-17 21:45:54 Summary: Merged galaxy/galaxy-central into default Affected #: 9 files diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 lib/galaxy/tools/data/__init__.py --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -400,7 +400,7 @@ if fields not in self.data or allow_duplicates: self.data.append( fields ) else: - log.error( "Attempted to add fields (%s) to data table '%s', but this entry already exists and allow_duplicates is False.", fields, self.name ) + log.debug( "Attempted to add fields (%s) to data table '%s', but this entry already exists and allow_duplicates is False.", fields, self.name ) is_error = True else: log.error( "Attempted to add fields (%s) to data table '%s', but there were not enough fields specified ( %i < %i ).", fields, self.name, len( fields ), self.largest_index + 1 ) diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 lib/galaxy/webapps/galaxy/api/authenticate.py --- a/lib/galaxy/webapps/galaxy/api/authenticate.py +++ b/lib/galaxy/webapps/galaxy/api/authenticate.py @@ -21,19 +21,24 @@ def get_api_key( self, trans, **kwd ) * GET /api/authenticate/baseauth returns an API key for authenticated user based on BaseAuth headers + + :returns: api_key in json format + :rtype: dict + + :raises: ObjectNotFound, HTTPBadRequest """ email, password = self._decode_baseauth( trans.environ.get( 'HTTP_AUTHORIZATION' ) ) user = trans.sa_session.query( trans.app.model.User ).filter( trans.app.model.User.table.c.email == email ).all() - if (len(user) is not 1): + if ( len( user ) is not 1 ): # DB is inconsistent and we have more users with same email raise ObjectNotFound else: user = user[0] is_valid_user = user.check_password( password ) - if (is_valid_user): + if ( is_valid_user ): user_id = user.id api_key_row = trans.sa_session.query( trans.app.model.APIKeys ).filter( trans.app.model.APIKeys.table.c.user_id == user_id ).first() else: @@ -43,27 +48,38 @@ return dict( api_key= api_key_row.key ) def _decode_baseauth( self, encoded_str ): - """Decode an encrypted HTTP basic authentication string. Returns a tuple of + """ + Decode an encrypted HTTP basic authentication string. Returns a tuple of the form (email, password), and raises a HTTPBadRequest exception if nothing could be decoded. + + :param encoded_str: BaseAuth string encoded base64 + :type encoded_str: string + + :returns: email of the user + :rtype: string + :returns: password of the user + :rtype: string + + :raises: HTTPBadRequest """ - split = encoded_str.strip().split(' ') + split = encoded_str.strip().split( ' ' ) # If split is only one element, try to decode the email and password # directly. - if len(split) == 1: + if len( split ) == 1: try: - email, password = b64decode(split[0]).split(':') + email, password = b64decode( split[ 0 ] ).split( ':' ) except: raise HTTPBadRequest # If there are only two elements, check the first and ensure it says # 'basic' so that we know we're about to decode the right thing. If not, # bail out. - elif len(split) == 2: - if split[0].strip().lower() == 'basic': + elif len( split ) == 2: + if split[ 0 ].strip().lower() == 'basic': try: - email, password = b64decode(split[1]).split(':') + email, password = b64decode( split[ 1 ] ).split( ':' ) except: raise HTTPBadRequest else: @@ -74,4 +90,4 @@ else: raise HTTPBadRequest - return unquote(email), unquote(password) + return unquote( email ), unquote( password ) diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -303,7 +303,8 @@ with make_tmp_dir() as work_dir: with lcd( work_dir ): # The first action in the list of actions will be the one that defines the installation process. There - # are currently only two supported processes; download_by_url and clone via a "shell_command" action type. + # are currently three supported processes; download_binary, download_by_url and clone via a "shell_command" + # action type. action_type, action_dict = actions[ 0 ] if action_type == 'download_binary': url = action_dict[ 'url' ] @@ -316,11 +317,13 @@ downloaded_filename = td_common_util.download_binary( url, work_dir ) # Filter out any actions that are not download_binary, chmod, or set_environment. filtered_actions = filter_actions_after_binary_installation( actions[ 1: ] ) - # Set actions to the same, so that the current download_binary doesn't get re-run in the filtered actions below. + # Set actions to the same, so that the current download_binary doesn't get re-run in the + # filtered actions below. actions = filtered_actions except Exception, e: log.exception( str( e ) ) - # No binary exists, or there was an error downloading the binary from the generated URL. Proceed with the remaining actions. + # No binary exists, or there was an error downloading the binary from the generated URL. + # Proceed with the remaining actions. filtered_actions = actions[ 1: ] action_type, action_dict = filtered_actions[ 0 ] # If the downloaded file exists, move it to $INSTALL_DIR. Put this outside the try/catch above so that @@ -345,8 +348,9 @@ is_binary = action_dict.get( 'is_binary', False ) log.debug( 'Attempting to download via url: %s', url ) if 'target_filename' in action_dict: - # Sometimes compressed archives extract their content to a folder other than the default defined file name. Using this - # attribute will ensure that the file name is set appropriately and can be located after download, decompression and extraction. + # Sometimes compressed archives extract their content to a folder other than the default + # defined file name. Using this attribute will ensure that the file name is set appropriately + # and can be located after download, decompression and extraction. downloaded_filename = action_dict[ 'target_filename' ] else: downloaded_filename = os.path.split( url )[ -1 ] @@ -374,8 +378,9 @@ filtered_actions = actions[ 1: ] url = action_dict[ 'url' ] if 'target_filename' in action_dict: - # Sometimes compressed archives extracts their content to a folder other than the default defined file name. Using this - # attribute will ensure that the file name is set appropriately and can be located after download, decompression and extraction. + # Sometimes compressed archives extracts their content to a folder other than the default + # defined file name. Using this attribute will ensure that the file name is set appropriately + # and can be located after download, decompression and extraction. filename = action_dict[ 'target_filename' ] else: filename = url.split( '/' )[ -1 ] diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py @@ -324,31 +324,37 @@ def parse_package_elem( package_elem, platform_info_dict=None, include_after_install_actions=True ): """ - Parse a <package> element within a tool dependency definition and return a list of action tuples. This method is called when setting - metadata on a repository that includes a tool_dependencies.xml file or when installing a repository that includes a tool_dependencies.xml - file. If installing, platform_info_dict must be a valid dictionary and include_after_install_actions must be True. + Parse a <package> element within a tool dependency definition and return a list of action tuples. + This method is called when setting metadata on a repository that includes a tool_dependencies.xml + file or when installing a repository that includes a tool_dependencies.xml file. If installing, + platform_info_dict must be a valid dictionary and include_after_install_actions must be True. """ - # The actions_elem_tuples list contains <actions> tag sets (possibly inside of an <actions_group> tag set) to be processed in the order - # they are defined in the tool_dependencies.xml file. + # The actions_elem_tuples list contains <actions> tag sets (possibly inside of an <actions_group> + # tag set) to be processed in the order they are defined in the tool_dependencies.xml file. actions_elem_tuples = [] - # The tag sets that will go into the actions_elem_list are those that install a compiled binary if the architecture and operating system - # match it's defined attributes. If compiled binary is not installed, the first <actions> tag set [following those that have the os and - # architecture attributes] that does not have os or architecture attributes will be processed. This tag set must contain the recipe for - # downloading and compiling source. + # The tag sets that will go into the actions_elem_list are those that install a compiled binary if + # the architecture and operating system match it's defined attributes. If compiled binary is not + # installed, the first <actions> tag set [following those that have the os and architecture attributes] + # that does not have os or architecture attributes will be processed. This tag set must contain the + # recipe for downloading and compiling source. actions_elem_list = [] for elem in package_elem: if elem.tag == 'actions': - # We have an <actions> tag that should not be matched against a specific combination of architecture and operating system. + # We have an <actions> tag that should not be matched against a specific combination of + # architecture and operating system. in_actions_group = False actions_elem_tuples.append( ( in_actions_group, elem ) ) elif elem.tag == 'actions_group': - # We have an actions_group element, and its child <actions> elements should therefore be compared with the current operating system + # We have an actions_group element, and its child <actions> elements should therefore be compared + # with the current operating system # and processor architecture. in_actions_group = True - # Record the number of <actions> elements so we can filter out any <action> elements that precede <actions> elements. + # Record the number of <actions> elements so we can filter out any <action> elements that precede + # <actions> elements. actions_elem_count = len( elem.findall( 'actions' ) ) - # Record the number of <actions> elements that have both architecture and os specified, in order to filter out any - # platform-independent <actions> elements that come before platform-specific <actions> elements. + # Record the number of <actions> elements that have both architecture and os specified, in order + # to filter out any platform-independent <actions> elements that come before platform-specific + # <actions> elements. platform_actions_elements = [] for actions_elem in elem.findall( 'actions' ): if actions_elem.get( 'architecture' ) is not None and actions_elem.get( 'os' ) is not None: @@ -356,8 +362,9 @@ platform_actions_element_count = len( platform_actions_elements ) platform_actions_elements_processed = 0 actions_elems_processed = 0 - # The tag sets that will go into the after_install_actions list are <action> tags instead of <actions> tags. These will be processed - # only if they are at the very end of the <actions_group> tag set (after all <actions> tag sets). See below for details. + # The tag sets that will go into the after_install_actions list are <action> tags instead of <actions> + # tags. These will be processed only if they are at the very end of the <actions_group> tag set (after + # all <actions> tag sets). See below for details. after_install_actions = [] # Inspect the <actions_group> element and build the actions_elem_list and the after_install_actions list. for child_element in elem: @@ -365,60 +372,71 @@ actions_elems_processed += 1 system = child_element.get( 'os' ) architecture = child_element.get( 'architecture' ) - # Skip <actions> tags that have only one of architecture or os specified, in order for the count in - # platform_actions_elements_processed to remain accurate. + # Skip <actions> tags that have only one of architecture or os specified, in order for the + # count in platform_actions_elements_processed to remain accurate. if ( system and not architecture ) or ( architecture and not system ): log.debug( 'Error: Both architecture and os attributes must be specified in an <actions> tag.' ) continue - # Since we are inside an <actions_group> tag set, compare it with our current platform information and filter the <actions> - # tag sets that don't match. Require both the os and architecture attributes to be defined in order to find a match. + # Since we are inside an <actions_group> tag set, compare it with our current platform information + # and filter the <actions> tag sets that don't match. Require both the os and architecture attributes + # to be defined in order to find a match. if system and architecture: platform_actions_elements_processed += 1 - # If either the os or architecture do not match the platform, this <actions> tag will not be considered a match. Skip - # it and proceed with checking the next one. + # If either the os or architecture do not match the platform, this <actions> tag will not be + # considered a match. Skip it and proceed with checking the next one. if platform_info_dict: if platform_info_dict[ 'os' ] != system or platform_info_dict[ 'architecture' ] != architecture: continue else: - # We must not be installing a repository into Galaxy, so determining if we can install a binary is not necessary. + # We must not be installing a repository into Galaxy, so determining if we can install a + # binary is not necessary. continue else: - # <actions> tags without both os and architecture attributes are only allowed to be specified after platform-specific - # <actions> tags. If we find a platform-independent <actions> tag before all platform-specific <actions> tags have been - # processed. + # <actions> tags without both os and architecture attributes are only allowed to be specified + # after platform-specific <actions> tags. If we find a platform-independent <actions> tag before + # all platform-specific <actions> tags have been processed. if platform_actions_elements_processed < platform_actions_element_count: - message = 'Error: <actions> tags without os and architecture attributes are only allowed after all <actions> tags with ' - message += 'os and architecture attributes have been defined. Skipping the <actions> tag set with no os or architecture ' - message += 'attributes that has been defined between two <actions> tag sets that have these attributes defined. ' - log.debug( message ) + debug_msg = 'Error: <actions> tags without os and architecture attributes are only allowed ' + debug_msg += 'after all <actions> tags with os and architecture attributes have been defined. ' + debug_msg += 'Skipping the <actions> tag set with no os or architecture attributes that has ' + debug_msg += 'been defined between two <actions> tag sets that have these attributes defined. ' + log.debug( debug_msg ) continue - # If we reach this point, it means one of two things: 1) The system and architecture attributes are not defined in this - # <actions> tag, or 2) The system and architecture attributes are defined, and they are an exact match for the current - # platform. Append the child element to the list of elements to process. + # If we reach this point, it means one of two things: 1) The system and architecture attributes are + # not defined in this <actions> tag, or 2) The system and architecture attributes are defined, and + # they are an exact match for the current platform. Append the child element to the list of elements + # to process. actions_elem_list.append( child_element ) elif child_element.tag == 'action': # Any <action> tags within an <actions_group> tag set must come after all <actions> tags. if actions_elems_processed == actions_elem_count: - # If all <actions> elements have been processed, then this <action> element can be appended to the list of actions to - # execute within this group. + # If all <actions> elements have been processed, then this <action> element can be appended to the + # list of actions to execute within this group. after_install_actions.append( child_element ) else: - # If any <actions> elements remain to be processed, then log a message stating that <action> elements are not allowed - # to precede any <actions> elements within an <actions_group> tag set. - message = 'Error: <action> tags are only allowed at the end of an <actions_group> tag set after all <actions> tags. ' - message += 'Skipping <%s> element with type %s.' % ( child_element.tag, child_element.get( 'type' ) ) - log.debug( message ) + # If any <actions> elements remain to be processed, then log a message stating that <action> + # elements are not allowed to precede any <actions> elements within an <actions_group> tag set. + debug_msg = 'Error: <action> tags are only allowed at the end of an <actions_group> tag set after ' + debug_msg += 'all <actions> tags. Skipping <%s> element with type %s.' % \ + ( child_element.tag, child_element.get( 'type', 'unknown' ) ) + log.debug( debug_msg ) continue if platform_info_dict is None and not include_after_install_actions: # We must be setting metadata on a repository. - actions_elem_tuples.append( ( in_actions_group, actions_elem_list[ 0 ] ) ) + if len( actions_elem_list ) >= 1: + actions_elem_tuples.append( ( in_actions_group, actions_elem_list[ 0 ] ) ) + else: + # We are processing a recipe that contains only an <actions_group> tag set for installing a binary, + # but does not include an additional recipe for installing and compiling from source. + actions_elem_tuples.append( ( in_actions_group, [] ) ) elif platform_info_dict is not None and include_after_install_actions: # We must be installing a repository. if after_install_actions: actions_elem_list.extend( after_install_actions ) actions_elem_tuples.append( ( in_actions_group, actions_elem_list ) ) else: - # Skip any element that is not <actions> or <actions_group> - this will skip comments, <repository> tags and <readme> tags. + # Skip any element that is not <actions> or <actions_group> - this will skip comments, <repository> tags + # and <readme> tags. in_actions_group = False continue return actions_elem_tuples diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -791,26 +791,30 @@ if sub_elem.tag == 'readme': requirements_dict[ 'readme' ] = sub_elem.text elif sub_elem.tag == 'repository': - # We have a complex repository dependency. If the returned value of repository_dependency_is_valid is True, the tool - # dependency definition will be set as invalid. This is currently the only case where a tool dependency definition is - # considered invalid. - repository_dependency_tup, repository_dependency_is_valid, error_message = handle_repository_elem( app=app, - repository_elem=sub_elem, - only_if_compiling_contained_td=False ) + # We have a complex repository dependency. If the returned value of repository_dependency_is_valid + # is True, the tool dependency definition will be set as invalid. This is currently the only case + # where a tool dependency definition is considered invalid. + repository_dependency_tup, repository_dependency_is_valid, error_message = \ + handle_repository_elem( app=app, repository_elem=sub_elem, only_if_compiling_contained_td=False ) elif sub_elem.tag == 'install': package_install_version = sub_elem.get( 'version', '1.0' ) if package_install_version == '1.0': - # Complex repository dependencies can be defined within the last <actions> tag set contained in an <actions_group> tag set. - # Comments, <repository> tag sets and <readme> tag sets will be skipped in td_common_util.parse_package_elem(). - actions_elem_tuples = td_common_util.parse_package_elem( sub_elem, platform_info_dict=None, include_after_install_actions=False ) + # Complex repository dependencies can be defined within the last <actions> tag set contained in an + # <actions_group> tag set. Comments, <repository> tag sets and <readme> tag sets will be skipped + # in td_common_util.parse_package_elem(). + actions_elem_tuples = td_common_util.parse_package_elem( sub_elem, + platform_info_dict=None, + include_after_install_actions=False ) if actions_elem_tuples: - # We now have a list of a single tuple that looks something like: [(True, <Element 'actions' at 0x104017850>)] + # We now have a list of a single tuple that looks something like: + # [(True, <Element 'actions' at 0x104017850>)] actions_elem_tuple = actions_elem_tuples[ 0 ] in_actions_group, actions_elem = actions_elem_tuple if in_actions_group: - # Since we're inside an <actions_group> tag set, inspect the actions_elem to see if a complex repository dependency - # is defined. By definition, complex repository dependency definitions contained within the last <actions> tag set - # within an <actions_group> tag set will have the value of "only_if_compiling_contained_td" set to True in + # Since we're inside an <actions_group> tag set, inspect the actions_elem to see if a complex + # repository dependency is defined. By definition, complex repository dependency definitions + # contained within the last <actions> tag set within an <actions_group> tag set will have the + # value of "only_if_compiling_contained_td" set to True in for action_elem in actions_elem: if action_elem.tag == 'package': # <package name="libgtextutils" version="0.6"> @@ -834,7 +838,8 @@ # Append the error message to the requirements_dict. requirements_dict[ 'error' ] = error_message invalid_tool_dependencies_dict[ dependency_key ] = requirements_dict - return valid_tool_dependencies_dict, invalid_tool_dependencies_dict, repository_dependency_tup, repository_dependency_is_valid, error_message + return valid_tool_dependencies_dict, invalid_tool_dependencies_dict, repository_dependency_tup, \ + repository_dependency_is_valid, error_message def generate_repository_dependency_metadata( app, repository_dependencies_config, metadata_dict ): """ @@ -1986,7 +1991,8 @@ content_alert_str=content_alert_str, **kwd ) if error_message: - # FIXME: This probably should not redirect since this method is called from the upload controller as well as the repository controller. + # FIXME: This probably should not redirect since this method is called from the upload controller as well + # as the repository controller. # If there is an error, display it. return trans.response.send_redirect( web.url_for( controller='repository', action='manage_repository', diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 static/scripts/galaxy.library.js --- a/static/scripts/galaxy.library.js +++ b/static/scripts/galaxy.library.js @@ -406,9 +406,9 @@ if (typeof folder_id === 'undefined') { return false; } else if (folder_id === '0'){ - library_router.navigate('#', {trigger: true, replace: true}); + library_router.navigate('/', {trigger: true, replace: false}); } else { - library_router.navigate('folders/' + folder_id, {trigger: true, replace: true}); + library_router.navigate('folders/' + folder_id, {trigger: true, replace: false}); } }, @@ -984,9 +984,9 @@ } }); -Backbone.history.start(); +Backbone.history.start({pushState: false}); -return this +// return this } }); diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 static/scripts/packed/galaxy.library.js --- a/static/scripts/packed/galaxy.library.js +++ b/static/scripts/packed/galaxy.library.js @@ -1,1 +1,1 @@ -var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.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 tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("#",{trigger:true,replace:true})}else{library_router.navigate("folders/"+r,{trigger:true,replace:true})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.show()},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},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(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return 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("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.info("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start();return this}});return{GalaxyApp:g}}); \ No newline at end of file +var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.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 tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("/",{trigger:true,replace:false})}else{library_router.navigate("folders/"+r,{trigger:true,replace:false})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.show()},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},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(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return 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("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.info("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:g}}); \ No newline at end of file diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 static/scripts/packed/mvc/visualization/scatterplotControlForm.js --- /dev/null +++ b/static/scripts/packed/mvc/visualization/scatterplotControlForm.js @@ -0,0 +1,1 @@ +var ScatterplotControlForm=Backbone.View.extend(LoggableMixin).extend({className:"scatterplot-control-form",dataLoadDelay:4000,dataLoadSize:5000,loadingIndicatorImage:"loading_small_white_bg.gif",fetchMsg:"Fetching data...",renderMsg:"Rendering...",initialize:function(a){this.log(this+".initialize, attributes:",a);this.dataset=null;this.chartConfig=null;this.chart=null;this.loader=null;this.$dataControl=null;this.$chartControl=null;this.$statsDisplay=null;this.$chartDisplay=null;this.dataFetch=null;this.initializeFromAttributes(a);this.initializeChart(a);this.initializeDataLoader(a)},initializeFromAttributes:function(a){if(!a||!a.dataset){throw ("ScatterplotView requires a dataset")}else{this.dataset=a.dataset}if(jQuery.type(this.dataset.metadata_column_types)==="string"){this.dataset.metadata_column_types=this.dataset.metadata_column_types.split(", ")}this.log("\t dataset:",this.dataset);if(this.dataset.comment_lines&&this.dataset.comment_lines.length){var b=this.dataset.comment_lines[0],c=b.split("\t");if(c.length===this.dataset.metadata_column_types.length){this.possibleHeaders=c}}if(!a.apiDatasetsURL){throw ("ScatterplotView requires a apiDatasetsURL")}else{this.dataURL=a.apiDatasetsURL+"/"+this.dataset.id+"?"}this.log("\t dataURL:",this.dataURL)},initializeChart:function(a){this.chartConfig=a.chartConfig||{};this.log("\t initial chartConfig:",this.chartConfig);this.chart=new TwoVarScatterplot(this.chartConfig);this.chartConfig=this.chart.config},initializeDataLoader:function(b){var a=this;this.loader=new LazyDataLoader({url:null,start:b.start||0,total:b.total||this.dataset.metadata_data_lines,delay:this.dataLoadDelay,size:this.dataLoadSize,buildUrl:function(d,c){return this.url+"&"+jQuery.param({start_val:d,max_vals:c})}});$(this.loader).bind("error",function(e,c,d){a.log("ERROR:",c,d);alert("ERROR fetching data:\n"+c+"\n"+d);a.hideLoadingIndicator()})},render:function(){this.log(this+".render");this.$el.append(ScatterplotControlForm.templates.mainLayout({loadingIndicatorImagePath:galaxy_config.root+"static/images/"+this.loadingIndicatorImage,message:""}));this.$dataControl=this._render_dataControl();this.$chartControl=this._render_chartControl();this.$statsDisplay=this.$el.find(".tab-pane#stats-display");this.$chartDisplay=this._render_chartDisplay();if(this.chartConfig.xColumn&&this.chartConfig.yColumn){this.renderChart()}this.$el.find("[title]").tooltip();return this},_render_dataControl:function(){var b=this,a=[],e=[],c=(this.possibleHeaders&&this.$dataControl)?(this.$dataControl.find("#first-line-header-checkbox").is(":checked")):(false);_.each(this.dataset.metadata_column_types,function(i,g){var h=g+1,f="column "+h;if(b.dataset.metadata_column_names){f=b.dataset.metadata_column_names[g]}else{if(c){f=b.possibleHeaders[g]}}a.push({index:h,name:f});if(i==="int"||i==="float"){e.push({index:h,name:f})}});var d=this.$el.find(".tab-pane#data-control");d.html(ScatterplotControlForm.templates.dataControl({allColumns:a,numericColumns:e,possibleHeaders:(this.possibleHeaders)?(this.possibleHeaders.join(", ")):(""),usePossibleHeaders:c}));if(!this.dataset.metadata_column_names&&this.possibleHeaders){d.find("#first-line-header").show()}d.find("#X-select").val(this.chartConfig.xColumn);d.find("#Y-select").val(this.chartConfig.yColumn);if(this.chartConfig.idColumn!==undefined){d.find("#include-id-checkbox").attr("checked",true).trigger("change");d.find("#ID-select").val(this.chartConfig.idColumn)}return d},_render_chartControl:function(){var a=this,b=this.$el.find(".tab-pane#chart-control"),c={datapointSize:{min:2,max:10,step:1},width:{min:200,max:800,step:20},height:{min:200,max:800,step:20}};b.append(ScatterplotControlForm.templates.chartControl(this.chartConfig));b.find(".numeric-slider-input").each(function(){var f=$(this),e=f.find(".slider-output"),g=f.find(".slider"),h=f.attr("id");function d(){var j=$(this),i=j.slider("value");e.text(i)}g.slider(_.extend(c[h],{value:a.chartConfig[h],change:d,slide:d}))});return b},_render_chartDisplay:function(){var a=this.$el.find(".tab-pane#chart-display");a.append(ScatterplotControlForm.templates.chartDisplay(this.chartConfig));return a},events:{"change #include-id-checkbox":"toggleThirdColumnSelector","change #first-line-header-checkbox":"rerenderDataControl","click #data-control #render-button":"renderChart","click #chart-control #render-button":"changeChartSettings"},toggleThirdColumnSelector:function(){this.$el.find('select[name="ID"]').parent().toggle()},rerenderDataControl:function(){this.$dataControl=this._render_dataControl()},showLoadingIndicator:function(b,c){b=b||"";var a=this.$el.find("div#loading-indicator");messageBox=a.find(".loading-message");if(a.is(":visible")){if(b){messageBox.fadeOut("fast",function(){messageBox.text(b);messageBox.fadeIn("fast",c)})}else{c()}}else{if(b){messageBox.text(b)}a.fadeIn("fast",c)}},hideLoadingIndicator:function(a){this.$el.find("div#loading-indicator").fadeOut("fast",a)},renderChart:function(){this.log(this+".renderChart");this.data=null;this.meta=null;_.extend(this.chartConfig,this.getChartSettings());this.log("\t chartConfig:",this.chartConfig);this.chart.updateConfig(this.chartConfig,false);this.loader.url=this.dataURL+"&"+jQuery.param(this.getDataSettings());this.log("\t loader: total lines:",this.loader.total," url:",this.loader.url);var a=this;$(this.loader).bind("loaded.new",function(c,b){a.log(a+" loaded.new",b);a.postProcessDataFetchResponse(b);a.log("\t postprocessed data:",a.data);a.log("\t postprocessed meta:",a.meta);a.showLoadingIndicator(a.renderMsg,function(){a.chart.render(a.data,a.meta);a.renderStats(a.data,a.meta);a.hideLoadingIndicator()})});$(this.loader).bind("complete",function(b,c){a.log(a+" complete",c);$(a.loader).unbind()});a.showLoadingIndicator(a.fetchMsg,function(){a.$el.find("ul.nav").find('a[href="#chart-display"]').tab("show");a.loader.load()})},renderStats:function(){this.log(this+".renderStats");this.$statsDisplay.html(ScatterplotControlForm.templates.statsDisplay({stats:[{name:"Count",xval:this.meta[0].count,yval:this.meta[1].count},{name:"Min",xval:this.meta[0].min,yval:this.meta[1].min},{name:"Max",xval:this.meta[0].max,yval:this.meta[1].max},{name:"Sum",xval:this.meta[0].sum,yval:this.meta[1].sum},{name:"Mean",xval:this.meta[0].mean,yval:this.meta[1].mean},{name:"Median",xval:this.meta[0].median,yval:this.meta[1].median}]}))},changeChartSettings:function(){var a=this;newChartSettings=this.getChartSettings();_.extend(this.chartConfig,newChartSettings);this.log("this.chartConfig:",this.chartConfig);this.chart.updateConfig(this.chartConfig,false);if(a.data&&a.meta){a.showLoadingIndicator(a.renderMsg,function(){a.$el.find("ul.nav").find('a[href="#chart-display"]').tab("show");a.chart.render(a.data,a.meta);a.hideLoadingIndicator()})}else{this.renderChart()}},postProcessDataFetchResponse:function(a){this.postProcessData(a.data);this.postProcessMeta(a.meta)},postProcessData:function(b){var a=this;if(a.data){_.each(b,function(d,c){a.data[c]=a.data[c].concat(d)})}else{a.data=b}},postProcessMeta:function(c){var a=this,b=this.dataset.metadata_column_types;if(a.meta){_.each(c,function(e,d){var i=a.meta[d],g=b[d];i.count+=(e.count)?(e.count):(0);if((g==="int")||(g==="float")){i.min=Math.min(e.min,i.min);i.max=Math.max(e.max,i.max);i.sum=e.sum+i.sum;i.mean=(i.count)?(i.sum/i.count):(null);var f=a.data[d].slice().sort(),h=Math.floor(f.length/2);if(f.length%2===0){i.median=((f[h]+f[(h+1)])/2)}else{i.median=f[h]}}})}else{a.meta=c}},getDataSettings:function(){var b=this.getColumnSelections(),a=[];this.log("\t columnSelections:",b);a=[b.X.colIndex-1,b.Y.colIndex-1];if(this.$dataControl.find("#include-id-checkbox").attr("checked")){a.push(b.ID.colIndex-1)}var c={data_type:"raw_data",provider:"column_with_stats",columns:"["+a+"]"};this.log("\t data settings (url params):",c);return c},getColumnSelections:function(){var a={};this.$dataControl.find("div.column-select select").each(function(){var b=$(this),c=b.val();a[b.attr("name")]={colIndex:c,colName:b.children('[value="'+c+'"]').text()}});return a},getChartSettings:function(){var c={},d=this.getColumnSelections();c.datapointSize=this.$chartControl.find("#datapointSize.numeric-slider-input").find(".slider").slider("value");c.width=this.$chartControl.find("#width.numeric-slider-input").find(".slider").slider("value");c.height=this.$chartControl.find("#height.numeric-slider-input").find(".slider").slider("value");var b=this.$chartControl.find("input#X-axis-label").val(),a=this.$chartControl.find("input#Y-axis-label").val();c.xLabel=(b==="X")?(d.X.colName):(b);c.yLabel=(a==="Y")?(d.Y.colName):(a);c.animDuration=(this.$chartControl.find("#animate-chart").is(":checked"))?(this.chart.defaults.animDuration):(0);this.log("\t chartSettings:",c);return c},toString:function(){return"ScatterplotControlForm("+((this.dataset)?(this.dataset.id):(""))+")"}});ScatterplotControlForm.templates={mainLayout:Handlebars.templates["template-visualization-scatterplotControlForm"],dataControl:Handlebars.templates["template-visualization-dataControl"],chartControl:Handlebars.templates["template-visualization-chartControl"],statsDisplay:Handlebars.templates["template-visualization-statsDisplay"],chartDisplay:Handlebars.templates["template-visualization-chartDisplay"]}; \ No newline at end of file diff -r 92064a2083bbdd5e22d2b206266573a6179acd57 -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 static/scripts/packed/mvc/visualization/visualization-model.js --- /dev/null +++ b/static/scripts/packed/mvc/visualization/visualization-model.js @@ -0,0 +1,1 @@ +var Visualization=Backbone.Model.extend(LoggableMixin).extend({defaults:{},url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(a){this.log(this+".initialize",a,this.attributes);this._setUpListeners()},_setUpListeners:function(){},setConfig:function(b){var a=this.get("config");if(_.isObject(a)){b=_.extend(_.clone(a),b)}this.set("config",b);return this},toString:function(){var a=this.get("id")||"";if(this.get("title")){a+=":"+this.get("title")}return"Visualization("+a+")"}});var VisualizationCollection=Backbone.Collection.extend(LoggableMixin).extend({model:Visualization,url:function(){return galaxy_config.root+"api/visualizations"},initialize:function(b,a){a=a||{}},set:function(c,a){var b=this;c=_.map(c,function(e){var f=b.get(e.id);if(!f){return e}var d=f.toJSON();_.extend(d,e);return d});Backbone.Collection.prototype.set.call(this,c,a)},toString:function(){return(["VisualizationCollection(",[this.historyId,this.length].join(),")"].join(""))}}); \ No newline at end of file https://bitbucket.org/galaxy/galaxy-central/commits/5b406edd8b4a/ Changeset: 5b406edd8b4a User: saketkc Date: 2014-01-17 23:11:33 Summary: Merged galaxy/galaxy-central into default Affected #: 4 files diff -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 lib/galaxy/jobs/runners/__init__.py --- a/lib/galaxy/jobs/runners/__init__.py +++ b/lib/galaxy/jobs/runners/__init__.py @@ -41,6 +41,8 @@ def __getattr__( self, name ): return self.params.get( name, self.specs[ name ][ 'default' ] ) + __getitem__ = __getattr__ + class BaseJobRunner( object ): def __init__( self, app, nworkers, **kwargs ): diff -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 lib/galaxy/jobs/runners/drmaa.py --- a/lib/galaxy/jobs/runners/drmaa.py +++ b/lib/galaxy/jobs/runners/drmaa.py @@ -231,7 +231,10 @@ assert external_job_id not in ( None, 'None' ), '(%s/%s) Invalid job id' % ( galaxy_id_tag, external_job_id ) state = self.ds.jobStatus( external_job_id ) except ( drmaa.InternalException, drmaa.InvalidJobException ), e: - ecn = e.__class__.__name__ + if isinstance( e , drmaa.InvalidJobException ): + ecn = "InvalidJobException".lower() + else: + ecn = "InternalException".lower() retry_param = ecn.lower() + '_retries' state_param = ecn.lower() + '_state' retries = getattr( ajs, retry_param, 0 ) diff -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 lib/galaxy/webapps/tool_shed/api/repository_revisions.py --- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py +++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py @@ -186,9 +186,9 @@ value_mapper=self.__get_value_mapper( trans ) ) # We have to add the changeset_revision of of the repository dependency. repository_dependency_dict[ 'changeset_revision' ] = changeset_revision - repository_dependency_dict[ 'url' ] = web.url_for( controller='repository_revisions', + repository_dependency_dict[ 'url' ] = web.url_for( controller='repositories', action='show', - id=repository_dependency_repository_metadata_id ) + id=repository_dependency_id ) repository_dependencies_dicts.append( repository_dependency_dict ) return repository_dependencies_dicts @@ -205,11 +205,13 @@ if repository_metadata is None: log.debug( 'Cannot locate repository_metadata with id %s' % str( id ) ) return {} + encoded_repository_id = trans.security.encode_id( repository_metadata.repository_id ) + repository = suc.get_repository_by_id( trans, encoded_repository_id ) repository_metadata_dict = repository_metadata.to_dict( view='element', value_mapper=self.__get_value_mapper( trans ) ) - repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions', + repository_metadata_dict[ 'url' ] = web.url_for( controller='repositories', action='show', - id=trans.security.encode_id( repository_metadata.id ) ) + id=encoded_repository_id ) return repository_metadata_dict @web.expose_api @@ -223,8 +225,11 @@ raise HTTPBadRequest( detail="Missing required parameter 'id'." ) repository_metadata = metadata_util.get_repository_metadata_by_id( trans, repository_metadata_id ) if repository_metadata is None: - log.debug( 'Cannot locate repository_metadata with id %s' % str( repository_metadata_id ) ) + decoded_repository_metadata_id = trans.security.decode_id( repository_metadata_id ) + log.debug( 'Cannot locate repository_metadata with id %s' % str( decoded_repository_metadata_id ) ) return {} + else: + decoded_repository_metadata_id = repository_metadata.id flush_needed = False for key, new_value in payload.items(): if key == 'time_last_tested': @@ -239,6 +244,8 @@ setattr( repository_metadata, key, new_value ) flush_needed = True if flush_needed: + log.debug( 'Updating repository_metadata record with id %s and changeset_revision %s.' % \ + ( str( decoded_repository_metadata_id ), str( repository_metadata.changeset_revision ) ) ) trans.sa_session.add( repository_metadata ) trans.sa_session.flush() trans.sa_session.refresh( repository_metadata ) @@ -246,5 +253,5 @@ value_mapper=self.__get_value_mapper( trans ) ) repository_metadata_dict[ 'url' ] = web.url_for( controller='repository_revisions', action='show', - id=trans.security.encode_id( repository_metadata.id ) ) + id=repository_metadata_id ) return repository_metadata_dict diff -r 6eb50cf0f0620c8861e9abc1e4bad3a35a8c8272 -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 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 @@ -402,10 +402,13 @@ log.debug( "...retrieved %d repository revisions for installation and possible testing." % len( repository_dicts ) ) log.debug( "Repository revisions for testing:" ) for repository_dict in repository_dicts: + repository_id = str( repository_dict.get( 'repository_id', None ) ) + repository_metadata_id = str( repository_dict.get( 'id', None ) ) name = str( repository_dict.get( 'name', None ) ) owner = str( repository_dict.get( 'owner', None ) ) changeset_revision = str( repository_dict.get( 'changeset_revision', None ) ) - log.debug( "Revision %s of repository %s owned by %s" % ( changeset_revision, name, owner ) ) + log.debug( "Revision %s of repository %s owned by %s with repository_id %s, (repository_metadata) id %s" % \ + ( changeset_revision, name, owner, repository_id, repository_metadata_id ) ) return repository_dicts, error_message def get_repository( name, owner, changeset_revision ): https://bitbucket.org/galaxy/galaxy-central/commits/81342d9a3120/ Changeset: 81342d9a3120 User: saketkc Date: 2014-01-18 11:47:41 Summary: Merged galaxy/galaxy-central into default Affected #: 25 files diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 config/plugins/visualizations/charts/static/app.js --- a/config/plugins/visualizations/charts/static/app.js +++ b/config/plugins/visualizations/charts/static/app.js @@ -46,12 +46,23 @@ // append main this.charts_view.append(this.viewport_view.$el); - // create + // set elements + this.setElement(this.portlet.$el); + + // hide views this.group_view.$el.hide(); this.charts_view.$el.hide(); - // set elements - this.setElement(this.portlet.$el); + // events + var self = this; + this.config.on('change:current_view', function() { + self._showCurrent(); + }); + }, + + // current view + _showCurrent: function() { + }, // execute command diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/galaxy.library.js --- a/static/scripts/galaxy.library.js +++ b/static/scripts/galaxy.library.js @@ -11,7 +11,7 @@ define([ "galaxy.modal", "galaxy.masthead", - "utils/galaxy.utils", + "utils/utils", "libs/toastr"], function(mod_modal, mod_masthead, mod_utils, mod_toastr) { // MMMMMMMMMMMMMMM diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/galaxy.masthead.js --- a/static/scripts/galaxy.masthead.js +++ b/static/scripts/galaxy.masthead.js @@ -1,9 +1,5 @@ -/* - galaxy masthead -*/ - // dependencies -define(["utils/galaxy.utils"], function(mod_utils) { +define([], function() { // masthead var GalaxyMasthead = Backbone.View.extend( diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/galaxy.upload.js --- a/static/scripts/galaxy.upload.js +++ /dev/null @@ -1,703 +0,0 @@ -/* - galaxy upload -*/ - -// dependencies -define(["galaxy.modal", "galaxy.masthead", "utils/galaxy.utils", "utils/galaxy.uploadbox"], function(mod_modal, mod_masthead, mod_utils) { - -// galaxy upload -var GalaxyUpload = Backbone.View.extend( -{ - // own modal - modal : null, - - // button - button_show : null, - - // upload mod - uploadbox: null, - - // current history - current_history: null, - - // extension types - select_extension :[['Auto-detect', 'auto']], - - // genomes - select_genome : [['Unspecified (?)', '?']], - - // states - state : { - init : 'fa fa-trash-o', - queued : 'fa fa-spinner fa-spin', - running : '__running__', - success : 'fa fa-check', - error : 'fa fa-exclamation-triangle' - }, - - // counter - counter : { - // stats - announce : 0, - success : 0, - error : 0, - running : 0, - - // reset stats - reset : function() - { - this.announce = this.success = this.error = this.running = 0; - } - }, - - // options - options : { - nginx_upload_path : '' - }, - - // initialize - initialize : function(options) - { - // wait for galaxy history panel (workaround due to the use of iframes) - if (!Galaxy.currHistoryPanel) - { - var self = this; - window.setTimeout(function() { self.initialize() }, 500) - return; - } - - // check if logged in - if (!Galaxy.currUser.get('id')) - return; - - // add activate icon - var self = this; - this.button_show = new mod_masthead.GalaxyMastheadIcon ( - { - icon : 'fa-arrow-circle-o-up', - tooltip : 'Upload Files', - on_click : function(e) { self.event_show(e) }, - on_unload : function() { - if (self.counter.running > 0) - return "Several uploads are still processing."; - }, - with_number : true - }); - - // add to masthead - Galaxy.masthead.prepend(this.button_show); - - // load extension - var self = this; - mod_utils.jsonFromUrl(galaxy_config.root + "api/datatypes", - function(datatypes) { - for (key in datatypes) - self.select_extension.push([datatypes[key], datatypes[key]]); - }); - - // load genomes - mod_utils.jsonFromUrl(galaxy_config.root + "api/genomes", - function(genomes) { - // backup default - var def = self.select_genome[0]; - - // fill array - self.select_genome = []; - for (key in genomes) - if (genomes[key].length > 1) - if (genomes[key][1] !== def[1]) - self.select_genome.push(genomes[key]); - - // sort - self.select_genome.sort(function(a, b) { - return a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0; - }); - - // insert default back to array - self.select_genome.unshift(def); - }); - - // read in options - if (options) { - this.options = _.defaults(options, this.options); - } - }, - - // mouse over - event_dragover : function (e) - { - }, - - // mouse left - event_dragleave : function (e) - { - }, - - // start - event_announce : function(index, file, message) - { - // make id - var id = '#upload-' + index; - - // add upload item - $(this.el).find('tbody:last').append(this.template_row(id)); - - // access upload item - var it = this.get_upload_item(index); - - // fade in - it.fadeIn(); - - // update title - it.find('#title').html(file.name); - - // update info - it.find('#size').html(this.size_to_string (file.size)); - - // add functionality to new row elements - var self = this; - - // handle click event - it.find('#symbol').on('click', function() { self.event_remove (index) }); - - // handle text editing event - it.find('#text-content').on('keyup', function() { - var count = it.find('#text-content').val().length; - it.find('#size').html(self.size_to_string (count)); - }); - - // handle genome selection event - var self = this; - it.find('#genome').on('change', function(e) { - // identify selected genome - var selected_genome = $(e.target).val(); - - // update genome - var items = $(self.el).find('.upload-item'); - items.each(function() - { - var symbol = $(this).find('#symbol'); - var genome = $(this).find('#genome'); - if(symbol.hasClass(self.state.init) && genome.val() == '?') { - genome.val(selected_genome); - } - }); - }); - - // initialize progress - this.event_progress(index, file, 0); - - // update counter - this.counter.announce++; - - // update screen - this.update_screen(); - - // activate text field if file content is zero - if (file.size == -1) - { - // get text component - var text = it.find('#text'); - - // get padding - var padding = 8; - - // get dimensions - var width = it.width() - 2 * padding; - var height = it.height() - padding; - - // set dimensions - text.css('width', width + 'px'); - text.css('top', height + 'px'); - it.height(height + text.height() + 2 * padding); - - // show text field - text.show(); - } - }, - - // start - event_initialize : function(index, file, message) - { - // update on screen counter - this.button_show.number(this.counter.announce); - - // get element - var it = this.get_upload_item(index); - - // update status - var sy = it.find('#symbol'); - sy.addClass(this.state.running); - - // get configuration - var file_type = it.find('#extension').val(); - var genome = it.find('#genome').val(); - var url_paste = it.find('#text-content').val(); - var space_to_tabs = it.find('#space_to_tabs').is(':checked'); - - // validate - if (!url_paste && !(file.size > 0)) - return null; - - // configure uploadbox - this.uploadbox.configure({url : this.options.nginx_upload_path, paramname : "files_0|file_data"}); - - // configure tool - tool_input = {}; - tool_input['dbkey'] = genome; - tool_input['file_type'] = file_type; - tool_input['files_0|NAME'] = file.name; - tool_input['files_0|type'] = 'upload_dataset'; - tool_input['files_0|url_paste'] = url_paste; - tool_input['space_to_tabs'] = space_to_tabs; - - // setup data - data = {}; - data['history_id'] = this.current_history; - data['tool_id'] = 'upload1'; - data['inputs'] = JSON.stringify(tool_input); - - // return additional data to be send with file - return data; - }, - - // progress - event_progress : function(index, file, message) - { - // get element - var it = this.get_upload_item(index); - - // get value - var percentage = parseInt(message); - - // update progress - it.find('.progress-bar').css({ width : percentage + '%' }); - - // update value - if (percentage != 100) - it.find('#percentage').html(percentage + '%'); - else - it.find('#percentage').html('Adding to history...'); - }, - - // success - event_success : function(index, file, message) - { - // make sure progress is shown correctly - this.event_progress(index, file, 100); - - // update on screen counter - this.button_show.number(''); - - // update counter - this.counter.announce--; - this.counter.success++; - - // update on screen info - this.update_screen(); - - // get element - var it = this.get_upload_item(index); - - // update progress frame - it.addClass('success'); - - // update text - it.find('#percentage').html('100%'); - - // update icon - var sy = it.find('#symbol'); - sy.removeClass(this.state.running); - sy.removeClass(this.state.queued); - sy.addClass(this.state.success); - - // update galaxy history - Galaxy.currHistoryPanel.refreshHdas(); - }, - - // error - event_error : function(index, file, message) - { - // make sure progress is shown correctly - this.event_progress(index, file, 0); - - // update on screen counter - this.button_show.number(''); - - // update counter - this.counter.announce--; - this.counter.error++; - - // update on screen info - this.update_screen(); - - // get element - var it = this.get_upload_item(index); - - // update progress frame - it.addClass('danger'); - - // remove progress bar - it.find('.progress').remove(); - - // write error message - it.find('#info').html('<strong>Failed: </strong>' + message).show(); - - // update icon - var sy = it.find('#symbol'); - sy.removeClass(this.state.running); - sy.removeClass(this.state.queued); - sy.addClass(this.state.error); - }, - - // start upload process - event_start : function() - { - // check - if (this.counter.announce == 0 || this.counter.running > 0) - return; - - // switch icons for new uploads - var items = $(this.el).find('.upload-item'); - var self = this; - items.each(function() - { - var symbol = $(this).find('#symbol'); - if(symbol.hasClass(self.state.init)) - { - // set status - symbol.removeClass(self.state.init); - symbol.addClass(self.state.queued); - - // disable options - $(this).find('#text-content').attr('disabled', true); - $(this).find('#genome').attr('disabled', true); - $(this).find('#extension').attr('disabled', true); - $(this).find('#space_to_tabs').attr('disabled', true); - } - }); - - // backup current history - this.current_history = Galaxy.currHistoryPanel.model.get('id'); - - // update running - this.counter.running = this.counter.announce; - this.update_screen(); - - // initiate upload procedure in plugin - this.uploadbox.start(); - }, - - // pause upload process - event_stop : function() - { - // check - if (this.counter.running == 0) - return; - - // request pause - this.uploadbox.stop(); - - // set html content - $('#upload-info').html('Queue will pause after completing the current file...'); - }, - - // queue is done - event_complete: function() - { - // update running - this.counter.running = 0; - this.update_screen(); - - // switch icons for new uploads - var items = $(this.el).find('.upload-item'); - var self = this; - items.each(function() - { - var symbol = $(this).find('#symbol'); - if(symbol.hasClass(self.state.queued) && !symbol.hasClass(self.state.running)) - { - // update status - symbol.removeClass(self.state.queued); - symbol.addClass(self.state.init); - - // disable options - $(this).find('#text-content').attr('disabled', false); - $(this).find('#genome').attr('disabled', false); - $(this).find('#extension').attr('disabled', false); - $(this).find('#space_to_tabs').attr('disabled', false); - } - }); - }, - - // remove all - event_reset : function() - { - // make sure queue is not running - if (this.counter.running == 0) - { - // remove from screen - var items = $(this.el).find('.upload-item'); - $(this.el).find('table').fadeOut({ complete : function() { items.remove(); }}); - - // reset counter - this.counter.reset(); - - // show on screen info - this.update_screen(); - - // remove from queue - this.uploadbox.reset(); - } - }, - - // remove item from upload list - event_remove : function(index) - { - // get item - var it = this.get_upload_item(index); - var sy = it.find('#symbol'); - - // only remove from queue if not in processing line - if (sy.hasClass(this.state.init) || sy.hasClass(this.state.success) || sy.hasClass(this.state.error)) - { - // reduce counter - if (it.hasClass('success')) - this.counter.success--; - else if (it.hasClass('danger')) - this.counter.error--; - else - this.counter.announce--; - - // show on screen info - this.update_screen(); - - // remove from queue - this.uploadbox.remove(index); - - // remove element - it.remove(); - } - }, - - // create (pseudo) file - event_create : function () - { - this.uploadbox.add([{ name : 'New File', size : -1 }]); - }, - - // show/hide upload frame - event_show : function (e) - { - // prevent default - e.preventDefault(); - - // create modal - if (!this.modal) - { - // make modal - var self = this; - this.modal = new mod_modal.GalaxyModal( - { - title : 'Upload files from your local drive', - body : this.template('upload-box', 'upload-info'), - buttons : { - 'Select' : function() {self.uploadbox.select()}, - 'Create' : function() {self.event_create()}, - 'Upload' : function() {self.event_start()}, - 'Pause' : function() {self.event_stop()}, - 'Reset' : function() {self.event_reset()}, - 'Close' : function() {self.modal.hide()}, - }, - height : '400', - width : '900' - }); - - // set element - this.setElement('#upload-box'); - - // file upload - var self = this; - this.uploadbox = this.$el.uploadbox( - { - dragover : function() { self.event_dragover() }, - dragleave : function() { self.event_dragleave() }, - announce : function(index, file, message) { self.event_announce(index, file, message) }, - initialize : function(index, file, message) { return self.event_initialize(index, file, message) }, - success : function(index, file, message) { self.event_success(index, file, message) }, - progress : function(index, file, message) { self.event_progress(index, file, message) }, - error : function(index, file, message) { self.event_error(index, file, message) }, - complete : function() { self.event_complete() }, - }); - - // setup info - this.update_screen(); - } - - // show modal - this.modal.show(); - }, - - // get upload item - get_upload_item: function(index) - { - // get element - return $(this.el).find('#upload-' + index); - }, - - // to string - size_to_string : function (size) - { - // identify unit - var unit = ""; - if (size >= 100000000000) { size = size / 100000000000; unit = 'TB'; } else - if (size >= 100000000) { size = size / 100000000; unit = 'GB'; } else - if (size >= 100000) { size = size / 100000; unit = 'MB'; } else - if (size >= 100) { size = size / 100; unit = 'KB'; } else - if (size > 0) { size = size * 10; unit = 'b'; } else - return '<strong>-</strong>'; - - // return formatted string - return '<strong>' + (Math.round(size) / 10) + '</strong> ' + unit; - }, - - // set screen - update_screen: function () - { - /* - update on screen info - */ - - // check default message - if(this.counter.announce == 0) - { - if (this.uploadbox.compatible()) - message = 'Drag&drop files into this box or click \'Select\' to select files!'; - else - message = 'Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.' - } else { - if (this.counter.running == 0) - message = 'You added ' + this.counter.announce + ' file(s) to the queue. Add more files or click \'Upload\' to proceed.'; - else - message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.'; - } - - // set html content - $('#upload-info').html(message); - - /* - update button status - */ - - // update reset button - if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0) - this.modal.enableButton('Reset'); - else - this.modal.disableButton('Reset'); - - // update upload button - if (this.counter.running == 0 && this.counter.announce > 0) - this.modal.enableButton('Upload'); - else - this.modal.disableButton('Upload'); - - // pause upload button - if (this.counter.running > 0) - this.modal.enableButton('Pause'); - else - this.modal.disableButton('Pause'); - - // select upload button - if (this.counter.running == 0) - { - this.modal.enableButton('Select'); - this.modal.enableButton('Create'); - } else { - this.modal.disableButton('Select'); - this.modal.disableButton('Create'); - } - - // table visibility - if (this.counter.announce + this.counter.success + this.counter.error > 0) - $(this.el).find('table').show(); - else - $(this.el).find('table').hide(); - }, - - // load html template - template: function(id, idInfo) - { - return '<div id="' + id + '" class="upload-box">' + - '<table class="table table-striped" style="display: none;">' + - '<thead>' + - '<tr>' + - '<th>Name</th>' + - '<th>Size</th>' + - '<th>Type</th>' + - '<th>Genome</th>' + - '<th>Space→Tab</th>' + - '<th>Status</th>' + - '<th></th>' + - '</tr>' + - '</thead>' + - '<tbody></tbody>' + - '</table>' + - '</div>' + - '<h6 id="' + idInfo + '" class="upload-info"></h6>'; - }, - - template_row: function(id) - { - // construct template - var tmpl = '<tr id="' + id.substr(1) + '" class="upload-item">' + - '<td>' + - '<div style="position: relative;">' + - '<div id="title" class="title"></div>' + - '<div id="text" class="text">' + - '<div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div>' + - '<textarea id="text-content" class="text-content form-control"></textarea>' + - '</div>' + - '</div>' + - '</td>' + - '<td><div id="size" class="size"></div></td>'; - - // add file type selectore - tmpl += '<td>' + - '<select id="extension" class="extension">'; - for (key in this.select_extension) - tmpl += '<option value="' + this.select_extension[key][1] + '">' + this.select_extension[key][0] + '</option>'; - tmpl += '</select>' + - '</td>'; - - // add genome selector - tmpl += '<td>' + - '<select id="genome" class="genome">'; - for (key in this.select_genome) - tmpl += '<option value="' + this.select_genome[key][1] + '">' + this.select_genome[key][0] + '</option>'; - tmpl += '</select>' + - '</td>'; - - // add next row - tmpl += '<td><input id="space_to_tabs" type="checkbox"></input></td>' + - '<td>' + - '<div id="info" class="info">' + - '<div class="progress">' + - '<div class="progress-bar progress-bar-success"></div>' + - '<div id="percentage" class="percentage">0%</div>' + - '</div>' + - '</div>' + - '</td>' + - '<td><div id="symbol" class="symbol ' + this.state.init + '"></div></td>' + - '</tr>'; - - // return html string - return tmpl; - } -}); - -// return -return { - GalaxyUpload: GalaxyUpload -}; - -}); diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/mvc/data.js --- a/static/scripts/mvc/data.js +++ b/static/scripts/mvc/data.js @@ -304,27 +304,28 @@ } // check - if(this.col.chrom === null) - { - console.log("TabularButtonTrackster : Chromosome column undefined."); + if(this.col.chrom === null) { return; } // get dataset id - if (typeof options.model.attributes.id === "undefined") + if (typeof options.model.attributes.id === "undefined") { console.log("TabularButtonTrackster : Dataset identification is missing."); - else + } else { this.dataset_id = options.model.attributes.id; + } // get url - if (typeof options.model.attributes.url_viz === "undefined") + if (typeof options.model.attributes.url_viz === "undefined") { console.log("TabularButtonTrackster : Url for visualization controller is missing."); - else + } else { this.url_viz = options.model.attributes.url_viz; + } // get genome_build / database key - if (typeof options.model.attributes.genome_build !== "undefined") + if (typeof options.model.attributes.genome_build !== "undefined") { this.genome_build = options.model.attributes.genome_build; + } // render the icon from template var btn_viz = new IconButtonView({ model : new IconButton({ diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/mvc/upload/upload-model.js --- /dev/null +++ b/static/scripts/mvc/upload/upload-model.js @@ -0,0 +1,27 @@ +// dependencies +define([], function() { + +// model +var Model = Backbone.Model.extend({ + defaults: { + extension : 'auto', + genome : '?', + url_paste : '', + space_to_tabs : false, + status : 'init', + info : null + } +}); + +// collection +var Collection = Backbone.Collection.extend({ + model: Model +}); + +// return +return { + Model: Model, + Collection : Collection +}; + +}); diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/mvc/upload/upload-row.js --- /dev/null +++ b/static/scripts/mvc/upload/upload-row.js @@ -0,0 +1,281 @@ +// dependencies +define(['mvc/upload/upload-model'], function(UploadModel) { + +// item view +return Backbone.View.extend({ + // options + options: { + padding : 8 + }, + + // states + status_classes : { + init : 'symbol fa fa-trash-o', + queued : 'symbol fa fa-spinner fa-spin', + success : 'symbol fa fa-check', + error : 'symbol fa fa-exclamation-triangle' + }, + + // render + initialize: function(app, options) { + // link app + this.app = app; + + // link this + var self = this; + + // create model + this.model = new UploadModel.Model(options); + + // add upload item + this.setElement(this._template(options)); + + // link item + var it = this.$el; + + // handle click event + it.find('#symbol').on('click', function() { + // get current status + var status = self.model.get('status'); + + // only remove from queue if not in processing line + if (status == 'init' || status == 'success' || status == 'error') + { + // remove from collection + self.app.collection.remove(self.model); + } + }); + + // handle text editing event + it.find('#text-content').on('keyup', function() { + // get properties + var $el = it.find('#text-content'); + var value = $el.val(); + var count = value.length; + + // update size string + it.find('#size').html(self._formatSize (count)); + + // update url paste content + self.model.set('url_paste', value); + }); + + // handle genome selection + it.find('#genome').on('change', function(e) { + self.model.set('genome', $(e.target).val()); + }); + + // handle extension selection + it.find('#extension').on('change', function(e) { + self.model.set('extension', $(e.target).val()); + }); + + // handle space to tabs button + it.find('#space_to_tabs').on('change', function(e) { + self.model.set('space_to_tabs', $(e.target).prop('checked')); + }); + + // events + this.model.on('change:percentage', function() { + self._refreshPercentage(); + }); + this.model.on('change:status', function() { + self._refreshStatus(); + }); + this.model.on('change:info', function() { + self._refreshInfo(); + }); + this.model.on('change:genome', function() { + self._refreshGenome(); + }); + this.model.on('remove', function() { + self.remove(); + }); + this.app.collection.on('reset', function() { + self.remove(); + }); + }, + + // render + render: function() { + // read model + var file_name = this.model.get('file_name'); + var file_size = this.model.get('file_size'); + + // link item + var it = this.$el; + + // update title + it.find('#title').html(file_name); + + // update info + it.find('#size').html(this._formatSize (file_size)); + + // activate text field if file content is zero + if (file_size == -1) + { + // get text component + var text = it.find('#text'); + + // get padding + var padding = this.options.padding; + + // get dimensions + var width = it.width() - 2 * padding; + var height = it.height() - padding; + + // set dimensions + text.css('width', width + 'px'); + text.css('top', height + 'px'); + it.height(height + text.height() + 2 * padding); + + // show text field + text.show(); + } + }, + + // genome + _refreshGenome: function() + { + // write error message + var genome = this.model.get('genome'); + this.$el.find('#genome').val(genome); + }, + + // progress + _refreshInfo: function() + { + // write error message + var info = this.model.get('info'); + if (info) { + this.$el.find('#info').html('<strong>Failed: </strong>' + info).show(); + } else { + this.$el.find('#info').hide(); + } + }, + + // progress + _refreshPercentage : function() + { + var percentage = parseInt(this.model.get('percentage')); + this.$el.find('.progress-bar').css({ width : percentage + '%' }); + if (percentage != 100) + this.$el.find('#percentage').html(percentage + '%'); + else + this.$el.find('#percentage').html('Adding to history...'); + }, + + // status + _refreshStatus : function() + { + // get element + var it = this.$el; + + // identify new status + var status = this.model.get('status'); + var status_class = this.status_classes[status]; + + // identify symbol and reset classes + var sy = this.$el.find('#symbol'); + sy.removeClass(); + + // set new status class + sy.addClass(status_class); + + // enable form fields + if (status == 'init') { + it.find('#text-content').attr('disabled', false); + it.find('#genome').attr('disabled', false); + it.find('#extension').attr('disabled', false); + it.find('#space_to_tabs').attr('disabled', false); + } else { + it.find('#text-content').attr('disabled', true); + it.find('#genome').attr('disabled', true); + it.find('#extension').attr('disabled', true); + it.find('#space_to_tabs').attr('disabled', true); + } + + // success + if (status == 'success') { + it.addClass('success'); + it.find('#percentage').html('100%'); + } + + // error + if (status == 'error') { + it.addClass('danger'); + it.find('.progress').remove(); + } + }, + + // to string + _formatSize : function (size) + { + // identify unit + var unit = ""; + if (size >= 100000000000) { size = size / 100000000000; unit = 'TB'; } else + if (size >= 100000000) { size = size / 100000000; unit = 'GB'; } else + if (size >= 100000) { size = size / 100000; unit = 'MB'; } else + if (size >= 100) { size = size / 100; unit = 'KB'; } else + if (size > 0) { size = size * 10; unit = 'b'; } else + return '<strong>-</strong>'; + + // return formatted string + return '<strong>' + (Math.round(size) / 10) + '</strong> ' + unit; + }, + + // template + _template: function(options) + { + // link this + var self = this; + + // construct template + var tmpl = '<tr id="upload-item-' + options.id + '" class="upload-item">' + + '<td>' + + '<div style="position: relative;">' + + '<div id="title" class="title"></div>' + + '<div id="text" class="text">' + + '<div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div>' + + '<textarea id="text-content" class="text-content form-control"></textarea>' + + '</div>' + + '</div>' + + '</td>' + + '<td><div id="size" class="size"></div></td>'; + + // add file type selectore + tmpl += '<td>' + + '<select id="extension" class="extension">'; + for (key in self.app.select_extension) + tmpl += '<option value="' + self.app.select_extension[key][1] + '">' + self.app.select_extension[key][0] + '</option>'; + tmpl += '</select>' + + '</td>'; + + // add genome selector + tmpl += '<td>' + + '<select id="genome" class="genome">'; + for (key in self.app.select_genome) + tmpl += '<option value="' + self.app.select_genome[key][1] + '">' + self.app.select_genome[key][0] + '</option>'; + tmpl += '</select>' + + '</td>'; + + // add next row + tmpl += '<td><input id="space_to_tabs" type="checkbox"></input></td>' + + '<td>' + + '<div id="info" class="info">' + + '<div class="progress">' + + '<div class="progress-bar progress-bar-success"></div>' + + '<div id="percentage" class="percentage">0%</div>' + + '</div>' + + '</div>' + + '</td>' + + '<td><div id="symbol" class="' + this.status_classes.init + '"></div></td>' + + '</tr>'; + + // return html string + return tmpl; + } + +}); + +}); diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/mvc/upload/upload-view.js --- /dev/null +++ b/static/scripts/mvc/upload/upload-view.js @@ -0,0 +1,514 @@ +// dependencies +define(["galaxy.modal", + "galaxy.masthead", + "utils/utils", + "mvc/upload/upload-model", + "mvc/upload/upload-row", + "utils/uploadbox"], + + function( mod_modal, + mod_masthead, + mod_utils, + UploadModel, + UploadItem + ) { + +// galaxy upload +return Backbone.View.extend( +{ + // own modal + modal : null, + + // button + button_show : null, + + // jquery uploadbox plugin + uploadbox: null, + + // current history + current_history: null, + + // extension types + select_extension :[['Auto-detect', 'auto']], + + // genomes + select_genome : [['Unspecified (?)', '?']], + + // collection + collection : new UploadModel.Collection(), + + // counter + counter : { + // stats + announce : 0, + success : 0, + error : 0, + running : 0, + + // reset stats + reset : function() + { + this.announce = this.success = this.error = this.running = 0; + } + }, + + // options + options : { + nginx_upload_path : '' + }, + + // initialize + initialize : function(options) + { + // link this + var self = this; + + // wait for galaxy history panel (workaround due to the use of iframes) + if (!Galaxy.currHistoryPanel) + { + window.setTimeout(function() { self.initialize() }, 500) + return; + } + + // check if logged in + if (!Galaxy.currUser.get('id')) + return; + + // add activate icon + this.button_show = new mod_masthead.GalaxyMastheadIcon ( + { + icon : 'fa-arrow-circle-o-up', + tooltip : 'Upload Files', + on_click : function(e) { self._eventShow(e) }, + on_unload : function() { + if (self.counter.running > 0) + return "Several uploads are still processing."; + }, + with_number : true + }); + + // add to masthead + Galaxy.masthead.prepend(this.button_show); + + // load extension + var self = this; + mod_utils.jsonFromUrl(galaxy_config.root + "api/datatypes", + function(datatypes) { + for (key in datatypes) + self.select_extension.push([datatypes[key], datatypes[key]]); + }); + + // load genomes + mod_utils.jsonFromUrl(galaxy_config.root + "api/genomes", + function(genomes) { + // backup default + var def = self.select_genome[0]; + + // fill array + self.select_genome = []; + for (key in genomes) + if (genomes[key].length > 1) + if (genomes[key][1] !== def[1]) + self.select_genome.push(genomes[key]); + + // sort + self.select_genome.sort(function(a, b) { + return a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0; + }); + + // insert default back to array + self.select_genome.unshift(def); + }); + + // read in options + if (options) { + this.options = _.defaults(options, this.options); + } + + // events + this.collection.on('remove', function(item) { + self._eventRemove(item); + }); + this.collection.on('change:genome', function(item) { + var genome = item.get('genome'); + self.collection.each(function(item) { + if (item.get('status') == 'init' && item.get('genome') == '?') { + item.set('genome', genome); + } + }); + }); + }, + + // + // event triggered by upload button + // + + // show/hide upload frame + _eventShow : function (e) + { + // prevent default + e.preventDefault(); + + // create modal + if (!this.modal) + { + // make modal + var self = this; + this.modal = new mod_modal.GalaxyModal( + { + title : 'Upload files from your local drive', + body : this._template('upload-box', 'upload-info'), + buttons : { + 'Select' : function() {self.uploadbox.select()}, + 'Create' : function() {self._eventCreate()}, + 'Upload' : function() {self._eventStart()}, + 'Pause' : function() {self._eventStop()}, + 'Reset' : function() {self._eventReset()}, + 'Close' : function() {self.modal.hide()}, + }, + height : '400', + width : '900' + }); + + // set element + this.setElement('#upload-box'); + + // file upload + var self = this; + this.uploadbox = this.$el.uploadbox( + { + announce : function(index, file, message) { self._eventAnnounce(index, file, message) }, + initialize : function(index, file, message) { return self._eventInitialize(index, file, message) }, + progress : function(index, file, message) { self._eventProgress(index, file, message) }, + success : function(index, file, message) { self._eventSuccess(index, file, message) }, + error : function(index, file, message) { self._eventError(index, file, message) }, + complete : function() { self._eventComplete() } + }); + + // setup info + this._updateScreen(); + } + + // show modal + this.modal.show(); + }, + + // + // events triggered by collection + // + + // remove item from upload list + _eventRemove : function(item) + { + // update status + var status = item.get('status'); + + // reduce counter + if (status == 'success') { + this.counter.success--; + } else if (status == 'error') { + this.counter.error--; + } else { + this.counter.announce--; + } + + // show on screen info + this._updateScreen(); + + // remove from queue + this.uploadbox.remove(item.id); + }, + + // + // events triggered by the upload box plugin + // + + // a new file has been dropped/selected through the uploadbox plugin + _eventAnnounce : function(index, file, message) + { + // update counter + this.counter.announce++; + + // update screen + this._updateScreen(); + + // create view/model + var upload_item = new UploadItem(this, { + id : index, + file_name : file.name, + file_size : file.size + }); + + // add to collection + this.collection.add(upload_item.model); + + // add upload item element to table + $(this.el).find('tbody:last').append(upload_item.$el); + + // render + upload_item.render(); + }, + + // the uploadbox plugin is initializing the upload for this file + _eventInitialize : function(index, file, message) + { + // get element + var it = this.collection.get(index); + + // update status + it.set('state', 'running'); + + // update on screen counter + this.button_show.number(this.counter.announce); + + // get configuration + var file_type = it.get('extension'); + var file_name = it.get('file_name'); + var genome = it.get('genome'); + var url_paste = it.get('url_paste'); + var space_to_tabs = it.get('space_to_tabs'); + + // validate + if (!url_paste && !(file.size > 0)) + return null; + + // configure uploadbox + this.uploadbox.configure({url : this.options.nginx_upload_path, paramname : "files_0|file_data"}); + + // configure tool + tool_input = {}; + tool_input['dbkey'] = genome; + tool_input['file_type'] = file_type; + tool_input['files_0|NAME'] = file_name; + tool_input['files_0|type'] = 'upload_dataset'; + tool_input['files_0|url_paste'] = url_paste; + tool_input['space_to_tabs'] = space_to_tabs; + + // setup data + data = {}; + data['history_id'] = this.current_history; + data['tool_id'] = 'upload1'; + data['inputs'] = JSON.stringify(tool_input); + + // return additional data to be send with file + return data; + }, + + // progress + _eventProgress : function(index, file, percentage) + { + var it = this.collection.get(index); + it.set('percentage', percentage); + }, + + // success + _eventSuccess : function(index, file, message) + { + // update status + var it = this.collection.get(index); + it.set('status', 'success'); + + // update on screen counter + this.button_show.number(''); + + // update counter + this.counter.announce--; + this.counter.success++; + + // update on screen info + this._updateScreen(); + + // update galaxy history + Galaxy.currHistoryPanel.refreshHdas(); + }, + + // error + _eventError : function(index, file, message) + { + // get element + var it = this.collection.get(index); + + // update status + it.set('status', 'error'); + it.set('info', message); + + // update on screen counter + this.button_show.number(''); + + // update counter + this.counter.announce--; + this.counter.error++; + + // update on screen info + this._updateScreen(); + }, + + // queue is done + _eventComplete: function() { + // reset queued upload to initial status + this.collection.each(function(item) { + if(item.get('status') == 'queued') { + item.set('status', 'init'); + } + }); + + // update running + this.counter.running = 0; + this._updateScreen(); + }, + + // + // events triggered by this view + // + + // create (pseudo) file + _eventCreate : function () + { + this.uploadbox.add([{ name : 'New File', size : -1 }]); + }, + + // start upload process + _eventStart : function() { + // check + if (this.counter.announce == 0 || this.counter.running > 0) { + return; + } + + // switch icons for new uploads + this.collection.each(function(item) { + if(item.get('status') == 'init') { + item.set('status', 'queued'); + } + }); + + // backup current history + this.current_history = Galaxy.currHistoryPanel.model.get('id'); + + // update running + this.counter.running = this.counter.announce; + this._updateScreen(); + + // initiate upload procedure in plugin + this.uploadbox.start(); + }, + + // pause upload process + _eventStop : function() { + // check + if (this.counter.running == 0) { + return; + } + + // request pause + this.uploadbox.stop(); + + // set html content + $('#upload-info').html('Queue will pause after completing the current file...'); + }, + + // remove all + _eventReset : function() { + // make sure queue is not running + if (this.counter.running == 0) + { + // reset collection + this.collection.reset(); + + // reset counter + this.counter.reset(); + + // show on screen info + this._updateScreen(); + + // remove from queue + this.uploadbox.reset(); + } + }, + + // set screen + _updateScreen: function () + { + /* + update on screen info + */ + + // check default message + if(this.counter.announce == 0) + { + if (this.uploadbox.compatible()) + message = 'Drag&drop files into this box or click \'Select\' to select files!'; + else + message = 'Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.' + } else { + if (this.counter.running == 0) + message = 'You added ' + this.counter.announce + ' file(s) to the queue. Add more files or click \'Upload\' to proceed.'; + else + message = 'Please wait...' + this.counter.announce + ' out of ' + this.counter.running + ' remaining.'; + } + + // set html content + $('#upload-info').html(message); + + /* + update button status + */ + + // update reset button + if (this.counter.running == 0 && this.counter.announce + this.counter.success + this.counter.error > 0) + this.modal.enableButton('Reset'); + else + this.modal.disableButton('Reset'); + + // update upload button + if (this.counter.running == 0 && this.counter.announce > 0) + this.modal.enableButton('Upload'); + else + this.modal.disableButton('Upload'); + + // pause upload button + if (this.counter.running > 0) + this.modal.enableButton('Pause'); + else + this.modal.disableButton('Pause'); + + // select upload button + if (this.counter.running == 0) + { + this.modal.enableButton('Select'); + this.modal.enableButton('Create'); + } else { + this.modal.disableButton('Select'); + this.modal.disableButton('Create'); + } + + // table visibility + if (this.counter.announce + this.counter.success + this.counter.error > 0) + $(this.el).find('table').show(); + else + $(this.el).find('table').hide(); + }, + + // load html template + _template: function(id, idInfo) + { + return '<div id="' + id + '" class="upload-box">' + + '<table class="table table-striped" style="display: none;">' + + '<thead>' + + '<tr>' + + '<th>Name</th>' + + '<th>Size</th>' + + '<th>Type</th>' + + '<th>Genome</th>' + + '<th>Space→Tab</th>' + + '<th>Status</th>' + + '<th></th>' + + '</tr>' + + '</thead>' + + '<tbody></tbody>' + + '</table>' + + '</div>' + + '<h6 id="' + idInfo + '" class="upload-info"></h6>'; + } +}); + +}); diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/galaxy.library.js --- a/static/scripts/packed/galaxy.library.js +++ b/static/scripts/packed/galaxy.library.js @@ -1,1 +1,1 @@ -var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.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 tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("/",{trigger:true,replace:false})}else{library_router.navigate("folders/"+r,{trigger:true,replace:false})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.show()},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},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(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return 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("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.info("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:g}}); \ No newline at end of file +var view=null;var library_router=null;var responses=[];define(["galaxy.modal","galaxy.masthead","utils/utils","libs/toastr"],function(k,l,h,n){var f=Backbone.Model.extend({urlRoot:"/api/libraries"});var c=Backbone.Model.extend({urlRoot:"/api/folders"});var o=Backbone.Collection.extend({url:"/api/libraries",model:f});var i=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var d=Backbone.Collection.extend({model:i});var e=Backbone.Model.extend({defaults:{folder:new d(),full_path:"unknown",urlRoot:"/api/folders/",id:"unknown"},parse:function(r){this.full_path=r[0].full_path;this.get("folder").reset(r[1].folder_contents);return r}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Model.extend({url:"/api/histories/"});var p=Backbone.Collection.extend({url:"/api/histories",model:j});var q=Backbone.Router.extend({routes:{"":"libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var m=Backbone.View.extend({el:"#center",progress:0,progressStep:1,lastSelectedHistory:"",modal:null,folders:null,initialize:function(){this.folders=[];this.queue=jQuery.Deferred();this.queue.resolve()},templateFolder:function(){var r=[];r.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; ">');r.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');r.push('<div id="library_folder_toolbar" >');r.push(' <button title="Create New Folder" id="toolbtn_create_folder" class="btn btn-primary" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder-close"></span> folder</button>');r.push(' <button id="toolbtn_bulk_import" class="btn btn-primary" style="display: none; margin-left: 0.5em;" type="button"><span class="fa fa-external-link"></span> to history</button>');r.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; display: none; ">');r.push(' <button id="drop_toggle" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">');r.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');r.push(" </button>");r.push(' <ul class="dropdown-menu" role="menu">');r.push(' <li><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');r.push(' <li><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');r.push(" </ul>");r.push(" </div>");r.push("</div>");r.push('<div class="library_breadcrumb">');r.push('<a title="Return to the list of libraries" href="#">Libraries</a><b>|</b> ');r.push("<% _.each(path, function(path_item) { %>");r.push("<% if (path_item[0] != id) { %>");r.push('<a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a><b>|</b> ');r.push("<% } else { %>");r.push('<span title="You are in this folder"><%- path_item[1] %></span>');r.push("<% } %>");r.push("<% }); %>");r.push("</div>");r.push('<table id="folder_table" class="table table-condensed">');r.push(" <thead>");r.push(' <th style="text-align: center; width: 20px; "><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');r.push(' <th class="button_heading">view</th>');r.push(" <th>name</th>");r.push(" <th>data type</th>");r.push(" <th>size</th>");r.push(" <th>date (UTC)</th>");r.push(" </thead>");r.push(" <tbody>");r.push(" <td></td>");r.push(' <td><button title="Go to parent folder" type="button" data-id="<%- upper_folder_id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-arrow-up"></span> .. go up</td>');r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" <td></td>");r.push(" </tr>");r.push(" <% _.each(items, function(content_item) { %>");r.push(' <tr class="folder_row light" id="<%- content_item.id %>">');r.push(' <% if (content_item.get("type") === "folder") { %>');r.push(" <td></td>");r.push(' <td><button title="Open this folder" type="button" data-id="<%- content_item.id %>" class="btn_open_folder btn btn-default btn-xs">');r.push(' <span class="fa fa-folder-open"></span> browse</td>');r.push(' <td><%- content_item.get("name") %>');r.push(' <% if (content_item.get("item_count") === 0) { %>');r.push(' <span class="muted">(empty folder)</span>');r.push(" <% } %>");r.push(" </td>");r.push(" <td>folder</td>");r.push(' <td><%= _.escape(content_item.get("item_count")) %> item(s)</td>');r.push(" <% } else { %>");r.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');r.push(" <td>");r.push(' <button title="See details of this dataset" type="button" class="library-dataset btn btn-default btn-xs">');r.push(' <span class="fa fa-eye"></span> details');r.push(" </button>");r.push(" </td>");r.push(' <td><%- content_item.get("name") %></td>');r.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');r.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');r.push(" <% } %> ");r.push(' <td><%= _.escape(content_item.get("time_updated")) %></td>');r.push(" </tr>");r.push(" <% }); %>");r.push(" ");r.push(" </tbody>");r.push("</table>");r.push("</div>");return r.join("")},templateDatasetModal:function(){var r=[];r.push('<div id="dataset_info_modal">');r.push(' <table class="table table-striped table-condensed">');r.push(" <tr>");r.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');r.push(' <td><%= _.escape(item.get("name")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Data type</th>');r.push(' <td><%= _.escape(item.get("data_type")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Genome build</th>');r.push(' <td><%= _.escape(item.get("genome_build")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Size</th>');r.push(" <td><%= _.escape(size) %></td>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Date uploaded (UTC)</th>');r.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Uploaded by</th>');r.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');r.push(" </tr>");r.push(' <tr scope="row">');r.push(' <th scope="row">Data Lines</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');r.push(" </tr>");r.push(' <th scope="row">Comment Lines</th>');r.push(' <% if (item.get("metadata_comment_lines") === "") { %>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');r.push(" <% } else { %>");r.push(' <td scope="row">unknown</td>');r.push(" <% } %>");r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Number of Columns</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Column Types</th>');r.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');r.push(" </tr>");r.push(" <tr>");r.push(' <th scope="row">Miscellaneous information</th>');r.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');r.push(" </tr>");r.push(" </table>");r.push(' <pre class="peek">');r.push(" </pre>");r.push("</div>");return r.join("")},templateHistorySelectInModal:function(){var r=[];r.push('<span id="history_modal_combo" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_single" name="dataset_import_single" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateBulkImportInModal:function(){var r=[];r.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');r.push("Select history: ");r.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');r.push(" <% _.each(histories, function(history) { %>");r.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');r.push(" <% }); %>");r.push("</select>");r.push("</span>");return r.join("")},templateProgressBar:function(){var r=[];r.push('<div class="import_text">');r.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");r.push("</div>");r.push('<div class="progress">');r.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');r.push(' <span class="completion_span">0% Complete</span>');r.push(" </div>");r.push("</div>");r.push("");return r.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 tmpl_array.join("")},events:{"click #select-all-checkboxes":"selectAll","click .folder_row":"selectClickedRow","click #toolbtn_bulk_import":"modalBulkImport","click #toolbtn_dl":"bulkDownload","click .library-dataset":"showDatasetDetails","click #toolbtn_create_folder":"createFolderFromModal","click .btn_open_folder":"navigateToFolder"},render:function(r){$("#center").css("overflow","auto");view=this;var t=this;var s=new e({id:r.id});s.url=s.attributes.urlRoot+r.id+"/contents";s.fetch({success:function(u){for(var w=0;w<s.attributes.folder.models.length;w++){var v=s.attributes.folder.models[w];if(v.get("type")==="file"){v.set("readable_size",t.size_to_string(v.get("file_size")))}}var y=s.full_path;var z;if(y.length===1){z=0}else{z=y[y.length-2][0]}var x=_.template(t.templateFolder(),{path:s.full_path,items:s.attributes.folder.models,id:r.id,upper_folder_id:z});t.$el.html(x)},error:function(){n.error("An error occured :(")}})},size_to_string:function(r){var s="";if(r>=100000000000){r=r/100000000000;s="TB"}else{if(r>=100000000){r=r/100000000;s="GB"}else{if(r>=100000){r=r/100000;s="MB"}else{if(r>=100){r=r/100;s="KB"}else{r=r*10;s="b"}}}}return(Math.round(r)/10)+s},navigateToFolder:function(s){var r=$(s.target).attr("data-id");if(typeof r==="undefined"){return false}else{if(r==="0"){library_router.navigate("/",{trigger:true,replace:false})}else{library_router.navigate("folders/"+r,{trigger:true,replace:false})}}},showDatasetDetails:function(u){u.preventDefault();var v=$(u.target).parent().parent().attr("id");var t=new i();var s=new p();t.id=v;var r=this;t.fetch({success:function(w){s.fetch({success:function(x){r.renderModalAfterFetch(w,x)},error:function(){n.error("An error occured during fetching histories:(");r.renderModalAfterFetch(w)}})},error:function(){n.error("An error occured during loading dataset details :(")}})},renderModalAfterFetch:function(w,t){var u=this.size_to_string(w.get("file_size"));var v=_.template(this.templateDatasetModal(),{item:w,size:u});var s=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Dataset Details",body:v,buttons:{Import:function(){s.importCurrentIntoHistory()},Download:function(){s.downloadCurrent()},Close:function(){s.modal.hideOrDestroy()}}});$(".peek").html(w.get("peek"));if(typeof history.models!==undefined){var r=_.template(this.templateHistorySelectInModal(),{histories:t.models});$(this.modal.elMain).find(".buttons").prepend(r);if(s.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(s.lastSelectedHistory)}}this.modal.show()},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var r=[];r.push($("#id_row").attr("data-id"));var s="/api/libraries/datasets/download/uncompressed";var t={ldda_ids:r};folderContentView.processDownload(s,t);this.modal.enableButton("Import");this.modal.enableButton("Download")},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var t=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=t;var r=$("#id_row").attr("data-id");var u=new b();var s=this;u.url=u.urlRoot+t+"/contents";u.save({content:r,source:"library"},{success:function(){n.success("Dataset imported");s.modal.enableButton("Import");s.modal.enableButton("Download")},error:function(){n.error("An error occured! Dataset not imported. Please try again.");s.modal.enableButton("Import");s.modal.enableButton("Download")}})},selectAll:function(s){var r=s.target.checked;that=this;$(":checkbox").each(function(){this.checked=r;$row=$(this.parentElement.parentElement);(r)?that.makeDarkRow($row):that.makeWhiteRow($row)});this.checkTools()},selectClickedRow:function(s){var u="";var r;var t;if(s.target.localName==="input"){u=s.target;r=$(s.target.parentElement.parentElement);t="input"}else{if(s.target.localName==="td"){u=$("#"+s.target.parentElement.id).find(":checkbox")[0];r=$(s.target.parentElement);t="td"}}if(u===""){s.stopPropagation();return}if(u===undefined){s.stopPropagation();return}if(u.checked){if(t==="td"){u.checked="";this.makeWhiteRow(r)}else{if(t==="input"){this.makeDarkRow(r)}}}else{if(t==="td"){u.checked="selected";this.makeDarkRow(r)}else{if(t==="input"){this.makeWhiteRow(r)}}}this.checkTools()},makeDarkRow:function(r){r.removeClass("light");r.find("a").removeClass("light");r.addClass("dark");r.find("a").addClass("dark")},makeWhiteRow:function(r){r.removeClass("dark");r.find("a").removeClass("dark");r.addClass("light");r.find("a").addClass("light")},checkTools:function(){var r=$("#folder_table").find(":checked");if(r.length>0){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}else{$("#toolbtn_bulk_import").hide();$("#toolbtn_dl").hide()}},modalBulkImport:function(){var s=this;var r=new p();r.fetch({success:function(t){var u=_.template(s.templateBulkImportInModal(),{histories:t.models});s.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Import into History",body:u,buttons:{Import:function(){s.importAllIntoHistory()},Close:function(){s.modal.hideOrDestroy()}}});s.modal.show()},error:function(){n.error("An error occured :(")}})},importAllIntoHistory:function(){this.modal.disableButton("Import");var t=$("select[name=dataset_import_bulk] option:selected").val();var x=$("select[name=dataset_import_bulk] option:selected").text();var z=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){z.push(this.parentElement.parentElement.id)}});var y=_.template(this.templateProgressBar(),{history_name:x});$(this.modal.elMain).find(".modal-body").html(y);var u=100/z.length;this.initProgress(u);var r=[];for(var s=z.length-1;s>=0;s--){library_dataset_id=z[s];var v=new b();var w=this;v.url=v.urlRoot+t+"/contents";v.content=library_dataset_id;v.source="library";r.push(v)}this.chainCall(r)},chainCall:function(s){var r=this;var t=s.pop();if(typeof t==="undefined"){n.success("All datasets imported");this.modal.hideOrDestroy();return}var u=$.when(t.save({content:t.content,source:t.source})).done(function(v){r.updateProgress();responses.push(v);r.chainCall(s)})},initProgress:function(r){this.progress=0;this.progressStep=r},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(r,v){var t=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!=""){t.push(this.parentElement.parentElement.id)}});var s="/api/libraries/datasets/download/"+v;var u={ldda_ids:t};this.processDownload(s,u,"get")},processDownload:function(s,t,u){if(s&&t){t=typeof t=="string"?t:$.param(t);var r="";$.each(t.split("&"),function(){var v=this.split("=");r+='<input type="hidden" name="'+v[0]+'" value="'+v[1]+'" />'});$('<form action="'+s+'" method="'+(u||"post")+'">'+r+"</form>").appendTo("body").submit().remove();n.info("Your download will begin soon")}},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Folder",body:this.templateNewFolderInModal(),buttons:{Create:function(){r.create_new_folder_event()},Close:function(){r.modal.hideOrDestroy();r.modal=null}}});this.modal.show()},create_new_folder_event:function(){var r=this.serialize_new_folder();if(this.validate_new_folder(r)){var t=new c();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];t.url=t.urlRoot+"/"+current_folder_id;var s=this;t.save(r,{success:function(u){s.modal.hideOrDestroy();n.success("Folder created");s.render({id:current_folder_id})},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var a=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal"},initialize:function(){},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div id="library_container" style="width: 90%; margin: auto; margin-top: 2em; overflow: auto !important; ">');tmpl_array.push("");tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fold..." target="_blank">Trello</a>.</h3>');tmpl_array.push('<a href="" id="create_new_library_btn" class="btn btn-primary file ">New Library</a>');tmpl_array.push('<table class="table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th class="button_heading"></th>');tmpl_array.push(" <th>name</th>");tmpl_array.push(" <th>description</th>");tmpl_array.push(" <th>synopsis</th> ");tmpl_array.push(" <th>model type</th> ");tmpl_array.push(" </thead>");tmpl_array.push(" <tbody>");tmpl_array.push(" <% _.each(libraries, function(library) { %>");tmpl_array.push(" <tr>");tmpl_array.push(' <td><button title="Open this library" type="button" data-id="<%- library.get("root_folder_id") %>" class="btn_open_folder btn btn-default btn-xs">');tmpl_array.push(' <span class="fa fa-folder-open"></span> browse</td>');tmpl_array.push(' <td><%- library.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("model_class")) %></td>');tmpl_array.push(" </tr>");tmpl_array.push(" <% }); %>");tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("</div>");return 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("")},render:function(){$("#center").css("overflow","auto");var r=this;libraries=new o();libraries.fetch({success:function(s){var t=_.template(r.templateLibraryList(),{libraries:s.models});r.$el.html(t)},error:function(t,s){if(s.statusCode().status===403){n.info("Please log in first. Redirecting to login page in 3s.");setTimeout(r.redirectToLogin,3000)}else{n.error("An error occured. Please try again.")}}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},modal:null,show_library_modal:function(s){s.preventDefault();s.stopPropagation();var r=this;this.modal=new k.GalaxyModal({destructible:true,bindClosingEvents:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){r.create_new_library_event()},Close:function(){r.modal.hideOrDestroy()}}});this.modal.show()},create_new_library_event:function(){var t=this.serialize_new_library();if(this.validate_new_library(t)){var s=new f();var r=this;s.save(t,{success:function(u){r.modal.hideOrDestroy();r.clear_library_modal();r.render();n.success("Library created")},error:function(){n.error("An error occured :(")}})}else{n.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(r){return r.name!==""}});var g=Backbone.View.extend({folderContentView:null,galaxyLibraryview:null,initialize:function(){folderContentView=new m();galaxyLibraryview=new a();library_router=new q();library_router.on("route:libraries",function(){galaxyLibraryview.render()});library_router.on("route:folder_content",function(r){folderContentView.render({id:r})});library_router.on("route:download",function(r,s){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+r,{trigger:true,replace:true})}else{folderContentView.download(r,s);library_router.navigate("folders/"+r,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:g}}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/galaxy.masthead.js --- a/static/scripts/packed/galaxy.masthead.js +++ b/static/scripts/packed/galaxy.masthead.js @@ -1,1 +1,1 @@ -define(["utils/galaxy.utils"],function(c){var a=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(f){this.options=f;$("body").off();this.setElement($(this._template(f)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var e=this;window.onbeforeunload=function(){var h="";for(key in e.list){if(e.list[key].options.on_unload){var g=e.list[key].options.on_unload();if(g){h+=g+" "}}}if(h!=""){return h}}},events:{click:"_click",mousedown:function(f){f.preventDefault()}},append:function(e){return this._add(e,true)},prepend:function(e){return this._add(e,false)},highlight:function(f){var e=$(this.el).find("#"+f+"> li");if(e){e.addClass("active")}},_add:function(h,f){var e=$(this.el).find("#"+h.location);if(e){var g=$(h.el);g.addClass("masthead-item");if(f){e.append(g)}else{e.prepend(g)}this.list.push(h)}return null},_click:function(h){var g=$(this.el).find(".popup");if(g){g.hide()}var f=$(h.target).closest(".masthead-item").find(".popup");if($(h.target).hasClass("head")){f.show();this.$background.show()}else{this.$background.hide()}},_template:function(e){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+e.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+e.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:false,on_click:function(){alert("clicked")},on_unload:null,visible:true},location:"iconbar",initialize:function(f){if(f){this.options=_.defaults(f,this.options)}this.setElement($(this._template(this.options)));var e=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",e.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(e){$(this.el).find(".icon").removeClass(this.options.icon).addClass(e);this.options.icon=e},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(e){$(this.el).find(".number").text(e)},_template:function(f){var e='<div id="'+f.id+'" class="symbol"><div class="icon fa fa-2x '+f.icon+'"></div>';if(f.with_number){e+='<div class="number"></div>'}e+="</div>";return e}});var d=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:false,on_unload:null,visible:true,disabled:false,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(e){if(e){this.options=_.defaults(e,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(this.options.disabled){$(this.el).find(".root").addClass("disabled");this._attachPopover()}if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(g){var h={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(g){h=_.defaults(g,h)}if(h.content&&h.content.indexOf("//")===-1){h.content=galaxy_config.root+h.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".popup")}var f=$(this._templateMenuItem(h));this.$menu.append(f);var e=this;f.on("click",function(i){i.preventDefault();if(e.options.target==="_blank"){return true}Galaxy.frame.add(g)});if(h.divider){this.$menu.append($(this._templateDivider()))}},_head:function(f){f.preventDefault();if(this.options.disabled){return}if(!this.$menu){Galaxy.frame.add(this.options)}},_attachPopover:function(){var e=$(this.el).find(".head");e.popover({html:true,content:'Please <a href="/user/login">log in</a> or <a href="/user/create">register</a> to use this feature.',placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){e.popover("hide")},5000)})},_templateMenuItem:function(e){return'<li><a href="'+e.content+'" target="'+e.target+'">'+e.title+"</a></li>"},_templateMenu:function(){return'<ul class="popup dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(f){var e='<ul id="'+f.id+'" class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+f.target+'" href="'+f.content+'" title="'+f.title_attribute+'">'+f.title+'<b class="symbol"></b></a></li></ul>';return e}});return{GalaxyMasthead:a,GalaxyMastheadTab:d,GalaxyMastheadIcon:b}}); \ No newline at end of file +define([],function(){var a=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e;$("body").off();this.setElement($(this._template(e)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var d=this;window.onbeforeunload=function(){var g="";for(key in d.list){if(d.list[key].options.on_unload){var f=d.list[key].options.on_unload();if(f){g+=f+" "}}}if(g!=""){return g}}},events:{click:"_click",mousedown:function(d){d.preventDefault()}},append:function(d){return this._add(d,true)},prepend:function(d){return this._add(d,false)},highlight:function(e){var d=$(this.el).find("#"+e+"> li");if(d){d.addClass("active")}},_add:function(g,e){var d=$(this.el).find("#"+g.location);if(d){var f=$(g.el);f.addClass("masthead-item");if(e){d.append(f)}else{d.prepend(f)}this.list.push(g)}return null},_click:function(g){var f=$(this.el).find(".popup");if(f){f.hide()}var d=$(g.target).closest(".masthead-item").find(".popup");if($(g.target).hasClass("head")){d.show();this.$background.show()}else{this.$background.hide()}},_template:function(d){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+d.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+d.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:false,on_click:function(){alert("clicked")},on_unload:null,visible:true},location:"iconbar",initialize:function(e){if(e){this.options=_.defaults(e,this.options)}this.setElement($(this._template(this.options)));var d=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",d.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(d){$(this.el).find(".icon").removeClass(this.options.icon).addClass(d);this.options.icon=d},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(d){$(this.el).find(".number").text(d)},_template:function(e){var d='<div id="'+e.id+'" class="symbol"><div class="icon fa fa-2x '+e.icon+'"></div>';if(e.with_number){d+='<div class="number"></div>'}d+="</div>";return d}});var c=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:false,on_unload:null,visible:true,disabled:false,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(d){if(d){this.options=_.defaults(d,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(this.options.disabled){$(this.el).find(".root").addClass("disabled");this._attachPopover()}if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(f){var g={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(f){g=_.defaults(f,g)}if(g.content&&g.content.indexOf("//")===-1){g.content=galaxy_config.root+g.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".popup")}var e=$(this._templateMenuItem(g));this.$menu.append(e);var d=this;e.on("click",function(h){h.preventDefault();if(d.options.target==="_blank"){return true}Galaxy.frame.add(f)});if(g.divider){this.$menu.append($(this._templateDivider()))}},_head:function(d){d.preventDefault();if(this.options.disabled){return}if(!this.$menu){Galaxy.frame.add(this.options)}},_attachPopover:function(){var d=$(this.el).find(".head");d.popover({html:true,content:'Please <a href="/user/login">log in</a> or <a href="/user/create">register</a> to use this feature.',placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){d.popover("hide")},5000)})},_templateMenuItem:function(d){return'<li><a href="'+d.content+'" target="'+d.target+'">'+d.title+"</a></li>"},_templateMenu:function(){return'<ul class="popup dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var d='<ul id="'+e.id+'" class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+e.target+'" href="'+e.content+'" title="'+e.title_attribute+'">'+e.title+'<b class="symbol"></b></a></li></ul>';return d}});return{GalaxyMasthead:a,GalaxyMastheadTab:c,GalaxyMastheadIcon:b}}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/galaxy.upload.js --- a/static/scripts/packed/galaxy.upload.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["galaxy.modal","galaxy.masthead","utils/galaxy.utils","utils/galaxy.uploadbox"],function(b,c,d){var a=Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],state:{init:"fa fa-trash-o",queued:"fa fa-spinner fa-spin",running:"__running__",success:"fa fa-check",error:"fa fa-exclamation-triangle"},counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(f){if(!Galaxy.currHistoryPanel){var e=this;window.setTimeout(function(){e.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}var e=this;this.button_show=new c.GalaxyMastheadIcon({icon:"fa-arrow-circle-o-up",tooltip:"Upload Files",on_click:function(g){e.event_show(g)},on_unload:function(){if(e.counter.running>0){return"Several uploads are still processing."}},with_number:true});Galaxy.masthead.prepend(this.button_show);var e=this;d.jsonFromUrl(galaxy_config.root+"api/datatypes",function(g){for(key in g){e.select_extension.push([g[key],g[key]])}});d.jsonFromUrl(galaxy_config.root+"api/genomes",function(g){var h=e.select_genome[0];e.select_genome=[];for(key in g){if(g[key].length>1){if(g[key][1]!==h[1]){e.select_genome.push(g[key])}}}e.select_genome.sort(function(j,i){return j[0]>i[0]?1:j[0]<i[0]?-1:0});e.select_genome.unshift(h)});if(f){this.options=_.defaults(f,this.options)}},event_dragover:function(f){},event_dragleave:function(f){},event_announce:function(i,g,n){var f="#upload-"+i;$(this.el).find("tbody:last").append(this.template_row(f));var h=this.get_upload_item(i);h.fadeIn();h.find("#title").html(g.name);h.find("#size").html(this.size_to_string(g.size));var m=this;h.find("#symbol").on("click",function(){m.event_remove(i)});h.find("#text-content").on("keyup",function(){var o=h.find("#text-content").val().length;h.find("#size").html(m.size_to_string(o))});var m=this;h.find("#genome").on("change",function(q){var p=$(q.target).val();var o=$(m.el).find(".upload-item");o.each(function(){var s=$(this).find("#symbol");var r=$(this).find("#genome");if(s.hasClass(m.state.init)&&r.val()=="?"){r.val(p)}})});this.event_progress(i,g,0);this.counter.announce++;this.update_screen();if(g.size==-1){var l=h.find("#text");var j=8;var e=h.width()-2*j;var k=h.height()-j;l.css("width",e+"px");l.css("top",k+"px");h.height(k+l.height()+2*j);l.show()}},event_initialize:function(i,e,m){this.button_show.number(this.counter.announce);var g=this.get_upload_item(i);var j=g.find("#symbol");j.addClass(this.state.running);var f=g.find("#extension").val();var l=g.find("#genome").val();var k=g.find("#text-content").val();var h=g.find("#space_to_tabs").is(":checked");if(!k&&!(e.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=l;tool_input.file_type=f;tool_input["files_0|NAME"]=e.name;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=k;tool_input.space_to_tabs=h;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},event_progress:function(f,g,i){var h=this.get_upload_item(f);var e=parseInt(i);h.find(".progress-bar").css({width:e+"%"});if(e!=100){h.find("#percentage").html(e+"%")}else{h.find("#percentage").html("Adding to history...")}},event_success:function(e,f,h){this.event_progress(e,f,100);this.button_show.number("");this.counter.announce--;this.counter.success++;this.update_screen();var g=this.get_upload_item(e);g.addClass("success");g.find("#percentage").html("100%");var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.success);Galaxy.currHistoryPanel.refreshHdas()},event_error:function(e,f,h){this.event_progress(e,f,0);this.button_show.number("");this.counter.announce--;this.counter.error++;this.update_screen();var g=this.get_upload_item(e);g.addClass("danger");g.find(".progress").remove();g.find("#info").html("<strong>Failed: </strong>"+h).show();var i=g.find("#symbol");i.removeClass(this.state.running);i.removeClass(this.state.queued);i.addClass(this.state.error)},event_start:function(){if(this.counter.announce==0||this.counter.running>0){return}var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.init)){g.removeClass(e.state.init);g.addClass(e.state.queued);$(this).find("#text-content").attr("disabled",true);$(this).find("#genome").attr("disabled",true);$(this).find("#extension").attr("disabled",true);$(this).find("#space_to_tabs").attr("disabled",true)}});this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this.update_screen();this.uploadbox.start()},event_stop:function(){if(this.counter.running==0){return}this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},event_complete:function(){this.counter.running=0;this.update_screen();var f=$(this.el).find(".upload-item");var e=this;f.each(function(){var g=$(this).find("#symbol");if(g.hasClass(e.state.queued)&&!g.hasClass(e.state.running)){g.removeClass(e.state.queued);g.addClass(e.state.init);$(this).find("#text-content").attr("disabled",false);$(this).find("#genome").attr("disabled",false);$(this).find("#extension").attr("disabled",false);$(this).find("#space_to_tabs").attr("disabled",false)}})},event_reset:function(){if(this.counter.running==0){var e=$(this.el).find(".upload-item");$(this.el).find("table").fadeOut({complete:function(){e.remove()}});this.counter.reset();this.update_screen();this.uploadbox.reset()}},event_remove:function(e){var f=this.get_upload_item(e);var g=f.find("#symbol");if(g.hasClass(this.state.init)||g.hasClass(this.state.success)||g.hasClass(this.state.error)){if(f.hasClass("success")){this.counter.success--}else{if(f.hasClass("danger")){this.counter.error--}else{this.counter.announce--}}this.update_screen();this.uploadbox.remove(e);f.remove()}},event_create:function(){this.uploadbox.add([{name:"New File",size:-1}])},event_show:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new b.GalaxyModal({title:"Upload files from your local drive",body:this.template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Create:function(){f.event_create()},Upload:function(){f.event_start()},Pause:function(){f.event_stop()},Reset:function(){f.event_reset()},Close:function(){f.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({dragover:function(){f.event_dragover()},dragleave:function(){f.event_dragleave()},announce:function(e,h,i){f.event_announce(e,h,i)},initialize:function(e,h,i){return f.event_initialize(e,h,i)},success:function(e,h,i){f.event_success(e,h,i)},progress:function(e,h,i){f.event_progress(e,h,i)},error:function(e,h,i){f.event_error(e,h,i)},complete:function(){f.event_complete()},});this.update_screen()}this.modal.show()},get_upload_item:function(e){return $(this.el).find("#upload-"+e)},size_to_string:function(e){var f="";if(e>=100000000000){e=e/100000000000;f="TB"}else{if(e>=100000000){e=e/100000000;f="GB"}else{if(e>=100000){e=e/100000;f="MB"}else{if(e>=100){e=e/100;f="KB"}else{if(e>0){e=e*10;f="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(e)/10)+"</strong> "+f},update_screen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},template:function(f,e){return'<div id="'+f+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+e+'" class="upload-info"></h6>'},template_row:function(f){var e='<tr id="'+f.substr(1)+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';e+='<td><select id="extension" class="extension">';for(key in this.select_extension){e+='<option value="'+this.select_extension[key][1]+'">'+this.select_extension[key][0]+"</option>"}e+="</select></td>";e+='<td><select id="genome" class="genome">';for(key in this.select_genome){e+='<option value="'+this.select_genome[key][1]+'">'+this.select_genome[key][0]+"</option>"}e+="</select></td>";e+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="symbol '+this.state.init+'"></div></td></tr>';return e}});return{GalaxyUpload:a}}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/mvc/data.js --- a/static/scripts/packed/mvc/data.js +++ b/static/scripts/packed/mvc/data.js @@ -1,1 +1,1 @@ -define([],function(){var d=Backbone.Model.extend({});var e=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var i=new d();_.each(_.keys(this.attributes),function(j){if(j.indexOf("metadata_")===0){var l=j.split("metadata_")[1];i.set(l,this.attributes[j]);delete this.attributes[j]}},this);this.set("metadata",i,{silent:true})},get_metadata:function(i){return this.attributes.metadata.get(i)},urlRoot:galaxy_config.root+"api/datasets"});var c=e.extend({defaults:_.extend({},e.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(i){e.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0)},get_next_chunk:function(){if(this.attributes.at_eof){return null}var i=this,j=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:i.attributes.chunk_index++}).success(function(k){var l;if(k.ck_data!==""){l=k}else{i.attributes.at_eof=true;l=null}j.resolve(l)});return j}});var g=Backbone.Collection.extend({model:e});var f=Backbone.View.extend({initialize:function(i){new b(i)},render:function(){var m=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(m);var i=this.model.get_metadata("column_names");if(i){m.append("<tr><th>"+i.join("</th><th>")+"</th></tr>")}var k=this.model.get("first_data_chunk");if(k){this._renderChunk(k)}var j=this,n=_.find(this.$el.parents(),function(o){return $(o).css("overflow")==="auto"}),l=false;if(!n){n=window}n=$(n);n.scroll(function(){if(!l&&(j.$el.height()-n.scrollTop()-n.height()<=0)){l=true;$.when(j.model.get_next_chunk()).then(function(o){if(o){j._renderChunk(o);l=false}})}});$("#loading_indicator").ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})},_renderCell:function(l,i,m){var j=$("<td>").text(l);var k=this.model.get_metadata("column_types");if(m!==undefined){j.attr("colspan",m).addClass("stringalign")}else{if(k){if(i<k.length){if(k[i]==="str"||k==="list"){j.addClass("stringalign")}}}}return j},_renderRow:function(i){var j=i.split("\t"),l=$("<tr>"),k=this.model.get_metadata("columns");if(j.length===k){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this)}else{if(j.length>k){_.each(j.slice(0,k-1),function(n,m){l.append(this._renderCell(n,m))},this);l.append(this._renderCell(j.slice(k-1).join("\t"),k-1))}else{if(k>5&&j.length===k-1){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this);l.append($("<td>"))}else{l.append(this._renderCell(i,0,k))}}}return l},_renderChunk:function(i){var j=this.$el.find("table");_.each(i.ck_data.split("\n"),function(k,l){j.append(this._renderRow(k))},this)}});var b=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(k){var j=k.model.attributes;var m=k.model.attributes.metadata.attributes;if(typeof j.data_type!=="undefined"){this.data_type=j.data_type}else{console.log("TabularButtonTrackster : Data type missing.")}if(this.data_type=="bed"){if(typeof m.chromCol!=="undefined"||typeof m.startCol!=="undefined"||typeof m.endCol!=="undefined"){this.col.chrom=m.chromCol-1;this.col.start=m.startCol-1;this.col.end=m.endCol-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.")}}if(this.data_type=="vcf"){function l(o,p){for(var n=0;n<p.length;n++){if(p[n].match(o)){return n}}return -1}this.col.chrom=l("Chrom",m.column_names);this.col.start=l("Pos",m.column_names);this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.")}}if(this.col.chrom===null){console.log("TabularButtonTrackster : Chromosome column undefined.");return}if(typeof k.model.attributes.id==="undefined"){console.log("TabularButtonTrackster : Dataset identification is missing.")}else{this.dataset_id=k.model.attributes.id}if(typeof k.model.attributes.url_viz==="undefined"){console.log("TabularButtonTrackster : Url for visualization controller is missing.")}else{this.url_viz=k.model.attributes.url_viz}if(typeof k.model.attributes.genome_build!=="undefined"){this.genome_build=k.model.attributes.genome_build}var i=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.$el.append(i.render().$el);$("#btn_viz").hide()},events:{"mouseover tr":"btn_viz_show",mouseleave:"btn_viz_hide"},btn_viz_show:function(n){function m(s){return !isNaN(parseFloat(s))&&isFinite(s)}if(this.col.chrom===null){return}var r=$(n.target).parent();var o=r.children().eq(this.col.chrom).html();var i=r.children().eq(this.col.start).html();var k=this.col.end?r.children().eq(this.col.end).html():i;if(!o.match("^#")&&o!==""&&m(i)){var q={dataset_id:this.dataset_id,gene_region:o+":"+i+"-"+k};var l=r.offset();var j=l.left-10;var p=l.top-$(window).scrollTop();$("#btn_viz").css({position:"fixed",top:p+"px",left:j+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,q,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},btn_viz_hide:function(){$("#btn_viz").hide()},create_trackster_action:function(i,k,j){return function(){var l={};if(j){l["f-dbkey"]=j}$.ajax({url:i+"/list_tracks?"+$.param(l),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(m){var n=window.parent;n.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.Galaxy.modal.hide()},"View in saved visualization":function(){n.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:m,buttons:{Cancel:function(){n.Galaxy.modal.hide()},"Add to visualization":function(){$(n.document).find("input[name=id]:checked").each(function(){n.Galaxy.modal.hide();var o=$(this).val();k.id=o;n.Galaxy.frame.add({title:"Trackster",type:"url",content:i+"/trackster?"+$.param(k)})})}}})},"View in new visualization":function(){n.Galaxy.modal.hide();var o=i+"/trackster?"+$.param(k);n.Galaxy.frame.add({title:"Trackster",type:"url",content:o})}}})}});return false}}});var a=function(l,j,m,i){var k=new j({model:new l(m)});k.render();if(i){i.append(k.$el)}return k};var h=function(k,i){var j=$("<div/>").appendTo(i);return new f({el:j,model:new c(k)}).render()};return{Dataset:e,TabularDataset:c,DatasetCollection:g,TabularDatasetChunkedView:f,createTabularDatasetChunkedView:h}}); \ No newline at end of file +define([],function(){var d=Backbone.Model.extend({});var e=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var i=new d();_.each(_.keys(this.attributes),function(j){if(j.indexOf("metadata_")===0){var l=j.split("metadata_")[1];i.set(l,this.attributes[j]);delete this.attributes[j]}},this);this.set("metadata",i,{silent:true})},get_metadata:function(i){return this.attributes.metadata.get(i)},urlRoot:galaxy_config.root+"api/datasets"});var c=e.extend({defaults:_.extend({},e.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(i){e.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0)},get_next_chunk:function(){if(this.attributes.at_eof){return null}var i=this,j=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:i.attributes.chunk_index++}).success(function(k){var l;if(k.ck_data!==""){l=k}else{i.attributes.at_eof=true;l=null}j.resolve(l)});return j}});var g=Backbone.Collection.extend({model:e});var f=Backbone.View.extend({initialize:function(i){new b(i)},render:function(){var m=$("<table/>").attr({id:"content_table",cellpadding:0});this.$el.append(m);var i=this.model.get_metadata("column_names");if(i){m.append("<tr><th>"+i.join("</th><th>")+"</th></tr>")}var k=this.model.get("first_data_chunk");if(k){this._renderChunk(k)}var j=this,n=_.find(this.$el.parents(),function(o){return $(o).css("overflow")==="auto"}),l=false;if(!n){n=window}n=$(n);n.scroll(function(){if(!l&&(j.$el.height()-n.scrollTop()-n.height()<=0)){l=true;$.when(j.model.get_next_chunk()).then(function(o){if(o){j._renderChunk(o);l=false}})}});$("#loading_indicator").ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})},_renderCell:function(l,i,m){var j=$("<td>").text(l);var k=this.model.get_metadata("column_types");if(m!==undefined){j.attr("colspan",m).addClass("stringalign")}else{if(k){if(i<k.length){if(k[i]==="str"||k==="list"){j.addClass("stringalign")}}}}return j},_renderRow:function(i){var j=i.split("\t"),l=$("<tr>"),k=this.model.get_metadata("columns");if(j.length===k){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this)}else{if(j.length>k){_.each(j.slice(0,k-1),function(n,m){l.append(this._renderCell(n,m))},this);l.append(this._renderCell(j.slice(k-1).join("\t"),k-1))}else{if(k>5&&j.length===k-1){_.each(j,function(n,m){l.append(this._renderCell(n,m))},this);l.append($("<td>"))}else{l.append(this._renderCell(i,0,k))}}}return l},_renderChunk:function(i){var j=this.$el.find("table");_.each(i.ck_data.split("\n"),function(k,l){j.append(this._renderRow(k))},this)}});var b=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(k){var j=k.model.attributes;var m=k.model.attributes.metadata.attributes;if(typeof j.data_type!=="undefined"){this.data_type=j.data_type}else{console.log("TabularButtonTrackster : Data type missing.")}if(this.data_type=="bed"){if(typeof m.chromCol!=="undefined"||typeof m.startCol!=="undefined"||typeof m.endCol!=="undefined"){this.col.chrom=m.chromCol-1;this.col.start=m.startCol-1;this.col.end=m.endCol-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.")}}if(this.data_type=="vcf"){function l(o,p){for(var n=0;n<p.length;n++){if(p[n].match(o)){return n}}return -1}this.col.chrom=l("Chrom",m.column_names);this.col.start=l("Pos",m.column_names);this.col.end=null;if(this.col.chrom==-1||this.col.start==-1){console.log("TabularButtonTrackster : VCF-file metadata incomplete.")}}if(this.col.chrom===null){return}if(typeof k.model.attributes.id==="undefined"){console.log("TabularButtonTrackster : Dataset identification is missing.")}else{this.dataset_id=k.model.attributes.id}if(typeof k.model.attributes.url_viz==="undefined"){console.log("TabularButtonTrackster : Url for visualization controller is missing.")}else{this.url_viz=k.model.attributes.url_viz}if(typeof k.model.attributes.genome_build!=="undefined"){this.genome_build=k.model.attributes.genome_build}var i=new IconButtonView({model:new IconButton({title:"Visualize",icon_class:"chart_curve",id:"btn_viz"})});this.$el.append(i.render().$el);$("#btn_viz").hide()},events:{"mouseover tr":"btn_viz_show",mouseleave:"btn_viz_hide"},btn_viz_show:function(n){function m(s){return !isNaN(parseFloat(s))&&isFinite(s)}if(this.col.chrom===null){return}var r=$(n.target).parent();var o=r.children().eq(this.col.chrom).html();var i=r.children().eq(this.col.start).html();var k=this.col.end?r.children().eq(this.col.end).html():i;if(!o.match("^#")&&o!==""&&m(i)){var q={dataset_id:this.dataset_id,gene_region:o+":"+i+"-"+k};var l=r.offset();var j=l.left-10;var p=l.top-$(window).scrollTop();$("#btn_viz").css({position:"fixed",top:p+"px",left:j+"px"});$("#btn_viz").off("click");$("#btn_viz").click(this.create_trackster_action(this.url_viz,q,this.genome_build));$("#btn_viz").show()}else{$("#btn_viz").hide()}},btn_viz_hide:function(){$("#btn_viz").hide()},create_trackster_action:function(i,k,j){return function(){var l={};if(j){l["f-dbkey"]=j}$.ajax({url:i+"/list_tracks?"+$.param(l),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(m){var n=window.parent;n.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){n.Galaxy.modal.hide()},"View in saved visualization":function(){n.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:m,buttons:{Cancel:function(){n.Galaxy.modal.hide()},"Add to visualization":function(){$(n.document).find("input[name=id]:checked").each(function(){n.Galaxy.modal.hide();var o=$(this).val();k.id=o;n.Galaxy.frame.add({title:"Trackster",type:"url",content:i+"/trackster?"+$.param(k)})})}}})},"View in new visualization":function(){n.Galaxy.modal.hide();var o=i+"/trackster?"+$.param(k);n.Galaxy.frame.add({title:"Trackster",type:"url",content:o})}}})}});return false}}});var a=function(l,j,m,i){var k=new j({model:new l(m)});k.render();if(i){i.append(k.$el)}return k};var h=function(k,i){var j=$("<div/>").appendTo(i);return new f({el:j,model:new c(k)}).render()};return{Dataset:e,TabularDataset:c,DatasetCollection:g,TabularDatasetChunkedView:f,createTabularDatasetChunkedView:h}}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/mvc/upload/upload-model.js --- /dev/null +++ b/static/scripts/packed/mvc/upload/upload-model.js @@ -0,0 +1,1 @@ +define([],function(){var b=Backbone.Model.extend({defaults:{extension:"auto",genome:"?",url_paste:"",space_to_tabs:false,status:"init",info:null}});var a=Backbone.Collection.extend({model:b});return{Model:b,Collection:a}}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/mvc/upload/upload-row.js --- /dev/null +++ b/static/scripts/packed/mvc/upload/upload-row.js @@ -0,0 +1,1 @@ +define(["mvc/upload/upload-model"],function(a){return Backbone.View.extend({options:{padding:8},status_classes:{init:"symbol fa fa-trash-o",queued:"symbol fa fa-spinner fa-spin",success:"symbol fa fa-check",error:"symbol fa fa-exclamation-triangle"},initialize:function(e,c){this.app=e;var b=this;this.model=new a.Model(c);this.setElement(this._template(c));var d=this.$el;d.find("#symbol").on("click",function(){var f=b.model.get("status");if(f=="init"||f=="success"||f=="error"){b.app.collection.remove(b.model)}});d.find("#text-content").on("keyup",function(){var f=d.find("#text-content");var h=f.val();var g=h.length;d.find("#size").html(b._formatSize(g));b.model.set("url_paste",h)});d.find("#genome").on("change",function(f){b.model.set("genome",$(f.target).val())});d.find("#extension").on("change",function(f){b.model.set("extension",$(f.target).val())});d.find("#space_to_tabs").on("change",function(f){b.model.set("space_to_tabs",$(f.target).prop("checked"))});this.model.on("change:percentage",function(){b._refreshPercentage()});this.model.on("change:status",function(){b._refreshStatus()});this.model.on("change:info",function(){b._refreshInfo()});this.model.on("change:genome",function(){b._refreshGenome()});this.model.on("remove",function(){b.remove()});this.app.collection.on("reset",function(){b.remove()})},render:function(){var h=this.model.get("file_name");var c=this.model.get("file_size");var e=this.$el;e.find("#title").html(h);e.find("#size").html(this._formatSize(c));if(c==-1){var g=e.find("#text");var f=this.options.padding;var d=e.width()-2*f;var b=e.height()-f;g.css("width",d+"px");g.css("top",b+"px");e.height(b+g.height()+2*f);g.show()}},_refreshGenome:function(){var b=this.model.get("genome");this.$el.find("#genome").val(b)},_refreshInfo:function(){var b=this.model.get("info");if(b){this.$el.find("#info").html("<strong>Failed: </strong>"+b).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var b=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:b+"%"});if(b!=100){this.$el.find("#percentage").html(b+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var c=this.$el;var b=this.model.get("status");var e=this.status_classes[b];var d=this.$el.find("#symbol");d.removeClass();d.addClass(e);if(b=="init"){c.find("#text-content").attr("disabled",false);c.find("#genome").attr("disabled",false);c.find("#extension").attr("disabled",false);c.find("#space_to_tabs").attr("disabled",false)}else{c.find("#text-content").attr("disabled",true);c.find("#genome").attr("disabled",true);c.find("#extension").attr("disabled",true);c.find("#space_to_tabs").attr("disabled",true)}if(b=="success"){c.addClass("success");c.find("#percentage").html("100%")}if(b=="error"){c.addClass("danger");c.find(".progress").remove()}},_formatSize:function(b){var c="";if(b>=100000000000){b=b/100000000000;c="TB"}else{if(b>=100000000){b=b/100000000;c="GB"}else{if(b>=100000){b=b/100000;c="MB"}else{if(b>=100){b=b/100;c="KB"}else{if(b>0){b=b*10;c="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(b)/10)+"</strong> "+c},_template:function(d){var c=this;var b='<tr id="upload-item-'+d.id+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';b+='<td><select id="extension" class="extension">';for(key in c.app.select_extension){b+='<option value="'+c.app.select_extension[key][1]+'">'+c.app.select_extension[key][0]+"</option>"}b+="</select></td>";b+='<td><select id="genome" class="genome">';for(key in c.app.select_genome){b+='<option value="'+c.app.select_genome[key][1]+'">'+c.app.select_genome[key][0]+"</option>"}b+="</select></td>";b+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>';return b}})}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/mvc/upload/upload-view.js --- /dev/null +++ b/static/scripts/packed/mvc/upload/upload-view.js @@ -0,0 +1,1 @@ +define(["galaxy.modal","galaxy.masthead","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","utils/uploadbox"],function(a,d,e,c,b){return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new c.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(g){var f=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){f.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new d.GalaxyMastheadIcon({icon:"fa-arrow-circle-o-up",tooltip:"Upload Files",on_click:function(h){f._eventShow(h)},on_unload:function(){if(f.counter.running>0){return"Several uploads are still processing."}},with_number:true});Galaxy.masthead.prepend(this.button_show);var f=this;e.jsonFromUrl(galaxy_config.root+"api/datatypes",function(h){for(key in h){f.select_extension.push([h[key],h[key]])}});e.jsonFromUrl(galaxy_config.root+"api/genomes",function(h){var i=f.select_genome[0];f.select_genome=[];for(key in h){if(h[key].length>1){if(h[key][1]!==i[1]){f.select_genome.push(h[key])}}}f.select_genome.sort(function(k,j){return k[0]>j[0]?1:k[0]<j[0]?-1:0});f.select_genome.unshift(i)});if(g){this.options=_.defaults(g,this.options)}this.collection.on("remove",function(h){f._eventRemove(h)});this.collection.on("change:genome",function(i){var h=i.get("genome");f.collection.each(function(j){if(j.get("status")=="init"&&j.get("genome")=="?"){j.set("genome",h)}})})},_eventShow:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new a.GalaxyModal({title:"Upload files from your local drive",body:this._template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Create:function(){f._eventCreate()},Upload:function(){f._eventStart()},Pause:function(){f._eventStop()},Reset:function(){f._eventReset()},Close:function(){f.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({announce:function(h,i,j){f._eventAnnounce(h,i,j)},initialize:function(h,i,j){return f._eventInitialize(h,i,j)},progress:function(h,i,j){f._eventProgress(h,i,j)},success:function(h,i,j){f._eventSuccess(h,i,j)},error:function(h,i,j){f._eventError(h,i,j)},complete:function(){f._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(g){var f=g.get("status");if(f=="success"){this.counter.success--}else{if(f=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(g.id)},_eventAnnounce:function(f,g,i){this.counter.announce++;this._updateScreen();var h=new b(this,{id:f,file_name:g.name,file_size:g.size});this.collection.add(h.model);$(this.el).find("tbody:last").append(h.$el);h.render()},_eventInitialize:function(j,f,n){var h=this.collection.get(j);h.set("state","running");this.button_show.number(this.counter.announce);var g=h.get("extension");var k=h.get("file_name");var m=h.get("genome");var l=h.get("url_paste");var i=h.get("space_to_tabs");if(!l&&!(f.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=m;tool_input.file_type=g;tool_input["files_0|NAME"]=k;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=l;tool_input.space_to_tabs=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(g,h,f){var i=this.collection.get(g);i.set("percentage",f)},_eventSuccess:function(f,g,i){var h=this.collection.get(f);h.set("status","success");this.button_show.number("");this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(f,g,i){var h=this.collection.get(f);h.set("status","error");h.set("info",i);this.button_show.number("");this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(f){if(f.get("status")=="queued"){f.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}this.collection.each(function(f){if(f.get("status")=="init"){f.set("status","queued")}});this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset()}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_template:function(g,f){return'<div id="'+g+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+f+'" class="upload-info"></h6>'}})}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/utils/galaxy.uploadbox.js --- a/static/scripts/packed/utils/galaxy.uploadbox.js +++ /dev/null @@ -1,1 +0,0 @@ -(function(c){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:2048,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(k,l,m){alert(m)},complete:function(){},error_filesize:"File exceeds 2GB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in.",error_missing:"No upload content available."};var a={};var e={};var f=0;var j=0;var d=false;var g=false;var b=null;var i=null;c.fn.uploadbox=function(A){a=c.extend({},h,A);b=this;b.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');b.on("drop",o);b.on("dragover",p);b.on("dragleave",x);c("#uploadbox_input").change(function(B){z(B.target.files);c(this).val("")});function o(B){if(!B.dataTransfer){return}z(B.dataTransfer.files);B.preventDefault();return false}function p(B){B.preventDefault();a.dragover.call(B)}function x(B){B.stopPropagation();a.dragleave.call(B)}function k(B){if(B.lengthComputable){a.progress(this.index,this.file,Math.round((B.loaded*100)/B.total))}}function z(D){if(d){return}for(var C=0;C<D.length;C++){if(j>=a.maxfilenumber){break}var B=String(f++);e[B]=D[C];a.announce(B,e[B],"");j++}}function r(B){if(e[B]){delete e[B];j--}}function m(){if(j==0||g){g=false;d=false;a.complete();return}else{d=true}var D=-1;for(var F in e){D=F;break}var E=e[D];r(D);var C=E.size;var B=1048576*a.maxfilesize;if(C<B){var G=a.initialize(D,E);if(G){q(D,E,G)}else{u(D,E,a.error_missing)}}else{u(D,E,a.error_filesize)}}function q(B,D,E){var F=new FormData();for(var C in E){F.append(C,E[C])}if(D.size>0){F.append(a.paramname,D,D.name)}i=new XMLHttpRequest();i.open("POST",a.url,true);i.setRequestHeader("Accept","application/json");i.setRequestHeader("Cache-Control","no-cache");i.setRequestHeader("X-Requested-With","XMLHttpRequest");i.onreadystatechange=function(){if(i.readyState!=i.DONE){return}var G=null;if(i.responseText){try{G=jQuery.parseJSON(i.responseText)}catch(H){G=i.responseText}}if(i.status<200||i.status>299){var I=i.statusText;if(i.status==403){I=a.error_login}else{if(i.status==0){I=a.error_server}else{if(!I){I=a.error_default}}}u(B,D,I+" ("+i.status+")")}else{y(B,D,G)}};i.upload.index=B;i.upload.file=D;i.upload.addEventListener("progress",k,false);i.send(F)}function y(B,C,D){a.success(B,C,D);m()}function u(B,C,D){a.error(B,C,D);m()}function w(){c("#uploadbox_input").trigger("click")}function t(B){for(B in e){r(B)}}function l(){if(!d){d=true;m()}}function v(){g=true}function n(B){a=c.extend({},a,B);return a}function s(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:w,add:z,remove:r,start:l,stop:v,reset:t,configure:n,compatible:s}}})(jQuery); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/utils/galaxy.utils.js --- a/static/scripts/packed/utils/galaxy.utils.js +++ /dev/null @@ -1,1 +0,0 @@ -define(["libs/underscore"],function(c){function d(g,f,e){var h=new XMLHttpRequest();h.open("GET",g,true);h.setRequestHeader("Accept","application/json");h.setRequestHeader("Cache-Control","no-cache");h.setRequestHeader("X-Requested-With","XMLHttpRequest");h.onloadend=function(){var i=h.status;if(i==200){try{response=jQuery.parseJSON(h.responseText)}catch(j){response=h.responseText}f&&f(response)}else{e&&e(i)}};h.send()}function b(h,e){var f=$('<div class="'+h+'"></div>');f.appendTo(":eq(0)");var g=f.css(e);f.remove();return g}function a(e){if(!$('link[href^="'+e+'"]').length){$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}}return{cssLoadFile:a,cssGetAttribute:b,jsonFromUrl:d}}); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/utils/uploadbox.js --- /dev/null +++ b/static/scripts/packed/utils/uploadbox.js @@ -0,0 +1,1 @@ +(function(c){jQuery.event.props.push("dataTransfer");var h={url:"",paramname:"content",maxfilesize:2048,maxfilenumber:20,dragover:function(){},dragleave:function(){},announce:function(){},initialize:function(){},progress:function(){},success:function(){},error:function(k,l,m){alert(m)},complete:function(){},error_filesize:"File exceeds 2GB. Please use an FTP client.",error_default:"Please make sure the file is available.",error_server:"Upload request failed.",error_login:"Uploads require you to log in.",error_missing:"No upload content available."};var a={};var e={};var f=0;var j=0;var d=false;var g=false;var b=null;var i=null;c.fn.uploadbox=function(A){a=c.extend({},h,A);b=this;b.append('<input id="uploadbox_input" type="file" style="display: none" multiple>');b.on("drop",o);b.on("dragover",p);b.on("dragleave",x);c("#uploadbox_input").change(function(B){z(B.target.files);c(this).val("")});function o(B){if(!B.dataTransfer){return}z(B.dataTransfer.files);B.preventDefault();return false}function p(B){B.preventDefault();a.dragover.call(B)}function x(B){B.stopPropagation();a.dragleave.call(B)}function k(B){if(B.lengthComputable){a.progress(this.index,this.file,Math.round((B.loaded*100)/B.total))}}function z(D){if(d){return}for(var C=0;C<D.length;C++){if(j>=a.maxfilenumber){break}var B=String(f++);e[B]=D[C];a.announce(B,e[B],"");j++}}function r(B){if(e[B]){delete e[B];j--}}function m(){if(j==0||g){g=false;d=false;a.complete();return}else{d=true}var D=-1;for(var F in e){D=F;break}var E=e[D];r(D);var C=E.size;var B=1048576*a.maxfilesize;if(C<B){var G=a.initialize(D,E);if(G){q(D,E,G)}else{u(D,E,a.error_missing)}}else{u(D,E,a.error_filesize)}}function q(B,D,E){var F=new FormData();for(var C in E){F.append(C,E[C])}if(D.size>0){F.append(a.paramname,D,D.name)}i=new XMLHttpRequest();i.open("POST",a.url,true);i.setRequestHeader("Accept","application/json");i.setRequestHeader("Cache-Control","no-cache");i.setRequestHeader("X-Requested-With","XMLHttpRequest");i.onreadystatechange=function(){if(i.readyState!=i.DONE){return}var G=null;if(i.responseText){try{G=jQuery.parseJSON(i.responseText)}catch(H){G=i.responseText}}if(i.status<200||i.status>299){var I=i.statusText;if(i.status==403){I=a.error_login}else{if(i.status==0){I=a.error_server}else{if(!I){I=a.error_default}}}u(B,D,I+" ("+i.status+")")}else{y(B,D,G)}};i.upload.index=B;i.upload.file=D;i.upload.addEventListener("progress",k,false);i.send(F)}function y(B,C,D){a.success(B,C,D);m()}function u(B,C,D){a.error(B,C,D);m()}function w(){c("#uploadbox_input").trigger("click")}function t(B){for(B in e){r(B)}}function l(){if(!d){d=true;m()}}function v(){g=true}function n(B){a=c.extend({},a,B);return a}function s(){return window.File&&window.FormData&&window.XMLHttpRequest&&window.FileList}return{select:w,add:z,remove:r,start:l,stop:v,reset:t,configure:n,compatible:s}}})(jQuery); \ No newline at end of file diff -r 5b406edd8b4acfc1df3a4c6789f8270ac332ee86 -r 81342d9a312042042a233bf2ca268cd6985b6812 static/scripts/packed/utils/utils.js --- /dev/null +++ b/static/scripts/packed/utils/utils.js @@ -0,0 +1,1 @@ +define(["libs/underscore"],function(c){function d(g,f,e){var h=new XMLHttpRequest();h.open("GET",g,true);h.setRequestHeader("Accept","application/json");h.setRequestHeader("Cache-Control","no-cache");h.setRequestHeader("X-Requested-With","XMLHttpRequest");h.onloadend=function(){var i=h.status;if(i==200){try{response=jQuery.parseJSON(h.responseText)}catch(j){response=h.responseText}f&&f(response)}else{e&&e(i)}};h.send()}function b(h,e){var f=$('<div class="'+h+'"></div>');f.appendTo(":eq(0)");var g=f.css(e);f.remove();return g}function a(e){if(!$('link[href^="'+e+'"]').length){$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}}return{cssLoadFile:a,cssGetAttribute:b,jsonFromUrl:d}}); \ No newline at end of file This diff is so big that we needed to truncate the remainder. https://bitbucket.org/galaxy/galaxy-central/commits/4bbd9181622d/ Changeset: 4bbd9181622d User: saketkc Date: 2014-01-19 17:57:32 Summary: Merged galaxy/galaxy-central into default Affected #: 16 files diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/galaxy.frame.js --- a/static/scripts/galaxy.frame.js +++ b/static/scripts/galaxy.frame.js @@ -87,10 +87,11 @@ { icon : 'fa-th', tooltip : 'Enable/Disable Scratchbook', - on_click : function(e) { self._event_panel_active(e) }, - on_unload : function() { - if (self.frame_counter > 0) + onclick : function(e) { self._event_panel_active(e) }, + onunload : function() { + if (self.frame_counter > 0) { return "You opened " + self.frame_counter + " frame(s) which will be lost."; + } } }); @@ -102,7 +103,7 @@ { icon : 'fa-eye', tooltip : 'Show/Hide Scratchbook', - on_click : function(e) { self._event_panel_load(e) }, + onclick : function(e) { self._event_panel_load(e) }, with_number : true }); diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/galaxy.masthead.js --- a/static/scripts/galaxy.masthead.js +++ b/static/scripts/galaxy.masthead.js @@ -36,18 +36,18 @@ // loop through unload functions if the user attempts to unload the page var self = this; - window.onbeforeunload = function() - { + $(window).on('beforeunload', function() { var text = ""; - for (key in self.list) - if (self.list[key].options.on_unload) - { - var q = self.list[key].options.on_unload(); + for (key in self.list) { + if (self.list[key].options.onunload) { + var q = self.list[key].options.onunload(); if (q) text += q + " "; } - if (text != "") + } + if (text != "") { return text; - }; + } + }); }, // configure events @@ -159,8 +159,8 @@ icon : 'fa-cog', tooltip : '', with_number : false, - on_click : function() { alert ('clicked') }, - on_unload : null, + onclick : function() { alert ('clicked') }, + onunload : null, visible : true }, @@ -180,7 +180,7 @@ // configure icon var self = this; $(this.el).find('.icon').tooltip({title: this.options.tooltip, placement: 'bottom'}) - .on('mouseup', self.options.on_click); + .on('mouseup', self.options.onclick); // visiblity if (!this.options.visible) @@ -254,7 +254,7 @@ content : '', type : 'url', scratchbook : false, - on_unload : null, + onunload : null, visible : true, disabled : false, title_attribute : '' diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/mvc/upload/upload-row.js --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -12,6 +12,7 @@ status_classes : { init : 'symbol fa fa-trash-o', queued : 'symbol fa fa-spinner fa-spin', + running : 'symbol fa fa-spinner fa-spin', success : 'symbol fa fa-check', error : 'symbol fa fa-exclamation-triangle' }, @@ -58,6 +59,7 @@ // update url paste content self.model.set('url_paste', value); + self.model.set('file_size', count); }); // handle genome selection diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/mvc/upload/upload-view.js --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -1,18 +1,109 @@ // dependencies define(["galaxy.modal", - "galaxy.masthead", "utils/utils", "mvc/upload/upload-model", "mvc/upload/upload-row", + "mvc/ui", "utils/uploadbox"], - function( mod_modal, - mod_masthead, - mod_utils, + function( Modal, + Utils, UploadModel, UploadItem ) { +// create model +var ProgressButtonModel = Backbone.Model.extend({ + defaults: { + percentage : 0, + icon : 'fa-circle', + label : '', + status : '' + } +}); + +// progress bar button on ui +var ProgressButton = Backbone.View.extend({ + // model + model : null, + + // initialize + initialize : function(model) { + // link this + var self = this; + + // create model + this.model = model; + + // get options + this.options = this.model.attributes; + + // create new element + this.setElement(this._template(this.options)); + + // add event + $(this.el).on('click', this.options.onclick); + + // add tooltip + if (this.options.tooltip) { + $(this.el).tooltip({title: this.options.tooltip, placement: 'bottom'}); + } + + // events + this.model.on('change:percentage', function() { + self._percentage(self.model.get('percentage')); + }); + this.model.on('change:status', function() { + self._status(self.model.get('status')); + }); + + // unload event + var self = this; + $(window).on('beforeunload', function() { + var text = ""; + if (self.options.onunload) { + text = self.options.onunload(); + } + if (text != "") { + return text; + } + }); + }, + + // set status + _status: function(value) { + var $el = this.$el.find('.progress-bar'); + $el.removeClass(); + $el.addClass('progress-bar'); + $el.addClass('progress-bar-notransition'); + if (value != '') { + $el.addClass('progress-bar-' + value); + } + }, + + // set percentage + _percentage: function(value) { + var $el = this.$el.find('.progress-bar'); + if (value) { + // change to new percentage + $el.css({ width : value + '%' }); + } else { + // reset without transition + $el.css({ width : '0%' }); + } + }, + + // template + _template: function(options) { + return '<div class="progress-button">' + + '<div class="progress">' + + '<div class="progress-bar"></div>' + + '</div>' + + '<div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa ' + options.icon + '"></div> ' + options.label + '</div>' + + '</div>'; + } +}); + // galaxy upload return Backbone.View.extend( { @@ -28,6 +119,9 @@ // current history current_history: null, + // current upload size + upload_size: 0, + // extension types select_extension :[['Auto-detect', 'auto']], @@ -74,32 +168,36 @@ if (!Galaxy.currUser.get('id')) return; - // add activate icon - this.button_show = new mod_masthead.GalaxyMastheadIcon ( - { - icon : 'fa-arrow-circle-o-up', - tooltip : 'Upload Files', - on_click : function(e) { self._eventShow(e) }, - on_unload : function() { - if (self.counter.running > 0) + // create model + this.button_show = new ProgressButtonModel({ + icon : 'fa-upload', + tooltip : 'Upload files', + label : 'Upload', + onclick : function(e) { + if (e) { + self._eventShow(e) + } + }, + onunload : function() { + if (self.counter.running > 0) { return "Several uploads are still processing."; - }, - with_number : true + } + } }); - // add to masthead - Galaxy.masthead.prepend(this.button_show); + // define location + $('#left .unified-panel-header-inner').append((new ProgressButton(this.button_show)).$el); // load extension var self = this; - mod_utils.jsonFromUrl(galaxy_config.root + "api/datatypes", + Utils.jsonFromUrl(galaxy_config.root + "api/datatypes", function(datatypes) { for (key in datatypes) self.select_extension.push([datatypes[key], datatypes[key]]); }); // load genomes - mod_utils.jsonFromUrl(galaxy_config.root + "api/genomes", + Utils.jsonFromUrl(galaxy_config.root + "api/genomes", function(genomes) { // backup default var def = self.select_genome[0]; @@ -154,7 +252,7 @@ { // make modal var self = this; - this.modal = new mod_modal.GalaxyModal( + this.modal = new Modal.GalaxyModal( { title : 'Upload files from your local drive', body : this._template('upload-box', 'upload-info'), @@ -256,10 +354,7 @@ var it = this.collection.get(index); // update status - it.set('state', 'running'); - - // update on screen counter - this.button_show.number(this.counter.announce); + it.set('status', 'running'); // get configuration var file_type = it.get('extension'); @@ -297,8 +392,12 @@ // progress _eventProgress : function(index, file, percentage) { + // set progress for row var it = this.collection.get(index); it.set('percentage', percentage); + + // update ui button + this.button_show.set('percentage', this._upload_percentage(percentage, file.size)); }, // success @@ -308,8 +407,14 @@ var it = this.collection.get(index); it.set('status', 'success'); - // update on screen counter - this.button_show.number(''); + // file size + var file_size = it.get('file_size'); + + // update ui button + this.button_show.set('percentage', this._upload_percentage(100, file_size)); + + // update completed + this.upload_completed += file_size * 100; // update counter this.counter.announce--; @@ -332,8 +437,12 @@ it.set('status', 'error'); it.set('info', message); - // update on screen counter - this.button_show.number(''); + // update ui button + this.button_show.set('percentage', this._upload_percentage(100, file.size)); + this.button_show.set('status', 'danger'); + + // update completed + this.upload_completed += file.size * 100; // update counter this.counter.announce--; @@ -373,14 +482,23 @@ if (this.counter.announce == 0 || this.counter.running > 0) { return; } - + + // reset current size + var self = this; + this.upload_size = 0; + this.upload_completed = 0; // switch icons for new uploads this.collection.each(function(item) { if(item.get('status') == 'init') { item.set('status', 'queued'); + self.upload_size += item.get('file_size'); } }); + // reset progress + this.button_show.set('percentage', 0); + this.button_show.set('status', 'success'); + // backup current history this.current_history = Galaxy.currHistoryPanel.model.get('id'); @@ -398,7 +516,10 @@ if (this.counter.running == 0) { return; } - + + // show upload has paused + this.button_show.set('status', 'info'); + // request pause this.uploadbox.stop(); @@ -422,6 +543,9 @@ // remove from queue this.uploadbox.reset(); + + // reset button + this.button_show.set('percentage', 0); } }, @@ -488,6 +612,11 @@ $(this.el).find('table').hide(); }, + // calculate percentage of all queued uploads + _upload_percentage: function(percentage, size) { + return (this.upload_completed + (percentage * size)) / this.upload_size; + }, + // load html template _template: function(id, idInfo) { diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/packed/galaxy.frame.js --- a/static/scripts/packed/galaxy.frame.js +++ b/static/scripts/packed/galaxy.frame.js @@ -1,1 +1,1 @@ -define(["galaxy.masthead"],function(b){var a=Backbone.View.extend({el_main:"body",options:{frame:{cols:6,rows:3},rows:1000,cell:130,margin:5,scroll:5,top_min:40,frame_max:9},cols:0,top:0,top_max:0,frame_z:0,frame_counter:0,frame_counter_id:0,frame_list:[],frame_shadow:null,visible:false,active:false,button_active:null,button_load:null,initialize:function(d){var c=this;this.button_active=new b.GalaxyMastheadIcon({icon:"fa-th",tooltip:"Enable/Disable Scratchbook",on_click:function(f){c._event_panel_active(f)},on_unload:function(){if(c.frame_counter>0){return"You opened "+c.frame_counter+" frame(s) which will be lost."}}});Galaxy.masthead.append(this.button_active);this.button_load=new b.GalaxyMastheadIcon({icon:"fa-eye",tooltip:"Show/Hide Scratchbook",on_click:function(f){c._event_panel_load(f)},with_number:true});Galaxy.masthead.append(this.button_load);if(d){this.options=_.defaults(d,this.options)}this.top=this.top_max=this.options.top_min;this.setElement(this._template());$(this.el).append(this._template_background());$(this.el).append(this._template_menu());$(this.el_main).append($(this.el));var e="#frame-shadow";$(this.el).append(this._template_shadow(e.substring(1)));this.frame_shadow={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};this._frame_resize(this.frame_shadow,{width:0,height:0});this.frame_list[e]=this.frame_shadow;this._panel_refresh();var c=this;$(window).resize(function(){if(c.visible){c._panel_refresh()}})},add:function(d){var g={title:"",content:null,target:"",type:null,scratchbook:false};if(d){d=_.defaults(d,g)}else{d=g}if(!d.content){return}if(d.target=="_blank"){window.open(d.content);return}if(d.target=="_top"||d.target=="_parent"||d.target=="_self"){window.location=d.content;return}if(!this.active){var f=$(window.parent.document).find("#galaxy_main");if(d.target=="galaxy_main"||d.target=="center"){if(f.length==0){var c=d.content;if(c.indexOf("?")==-1){c+="?"}else{c+="&"}c+="use_panels=True";window.location=c}else{f.attr("src",d.content)}}else{window.location=d.content}return}if(this.frame_counter>=this.options.frame_max){alert("You have reached the maximum number of allowed frames ("+this.options.frame_max+").");return}var e="#frame-"+(this.frame_counter_id++);if($(e).length!==0){alert("This frame already exists. This page might contain multiple frame managers.");return}this.top=this.options.top_min;$(this.el).append(this._template_frame(e.substring(1),d.title,d.type,d.content));var h={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};d.width=this._to_pixel_coord("width",this.options.frame.cols);d.height=this._to_pixel_coord("height",this.options.frame.rows);this.frame_z=parseInt($(h.id).css("z-index"));this.frame_list[e]=h;this.frame_counter++;this._frame_resize(h,{width:d.width,height:d.height});this._frame_insert(h,{top:0,left:0},true);if(!this.visible){this._panel_show_hide()}},event:{type:null,target:null,xy:null},events:{mousemove:"_event_frame_mouse_move",mouseup:"_event_frame_mouse_up",mouseleave:"_event_frame_mouse_up",mousewheel:"_event_panel_scroll",DOMMouseScroll:"_event_panel_scroll","mousedown .frame":"_event_frame_mouse_down","mousedown .frame-background":"_event_panel_load","mousedown .frame-scroll-up":"_event_panel_scroll_up","mousedown .frame-scroll-down":"_event_panel_scroll_down","mousedown .f-close":"_event_frame_close","mousedown .f-pin":"_event_frame_lock"},_event_frame_mouse_down:function(c){if(this.event.type!==null){return}if($(c.target).hasClass("f-header")||$(c.target).hasClass("f-title")){this.event.type="drag"}if($(c.target).hasClass("f-resize")){this.event.type="resize"}if(this.event.type===null){return}c.preventDefault();this.event.target=this._frame_identify(c.target);if(this.event.target.grid_lock){this.event.type=null;return}this.event.xy={x:c.originalEvent.pageX,y:c.originalEvent.pageY};this._frame_drag_start(this.event.target)},_event_frame_mouse_move:function(i){if(this.event.type!="drag"&&this.event.type!="resize"){return}var g={x:i.originalEvent.pageX,y:i.originalEvent.pageY};var d={x:g.x-this.event.xy.x,y:g.y-this.event.xy.y};this.event.xy=g;var h=this._frame_screen(this.event.target);if(this.event.type=="resize"){h.width+=d.x;h.height+=d.y;var f=this.options.cell-this.options.margin-1;h.width=Math.max(h.width,f);h.height=Math.max(h.height,f);this._frame_resize(this.event.target,h);h.width=this._to_grid_coord("width",h.width)+1;h.height=this._to_grid_coord("height",h.height)+1;h.width=this._to_pixel_coord("width",h.width);h.height=this._to_pixel_coord("height",h.height);this._frame_resize(this.frame_shadow,h);this._frame_insert(this.frame_shadow,{top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)})}if(this.event.type=="drag"){h.left+=d.x;h.top+=d.y;this._frame_offset(this.event.target,h);var c={top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)};if(c.left!==0){c.left++}this._frame_insert(this.frame_shadow,c)}},_event_frame_mouse_up:function(c){if(this.event.type!="drag"&&this.event.type!="resize"){return}this._frame_drag_stop(this.event.target);this.event.type=null},_event_frame_close:function(d){if(this.event.type!==null){return}d.preventDefault();var f=this._frame_identify(d.target);var c=this;$(f.id).fadeOut("fast",function(){$(f.id).remove();delete c.frame_list[f.id];c.frame_counter--;c._panel_refresh(true);c._panel_animation_complete();if(c.visible&&c.frame_counter==0){c._panel_show_hide()}})},_event_frame_lock:function(c){if(this.event.type!==null){return}c.preventDefault();var d=this._frame_identify(c.target);if(d.grid_lock){d.grid_lock=false;$(d.id).find(".f-pin").removeClass("toggle");$(d.id).find(".f-header").removeClass("f-not-allowed");$(d.id).find(".f-title").removeClass("f-not-allowed");$(d.id).find(".f-resize").show();$(d.id).find(".f-close").show()}else{d.grid_lock=true;$(d.id).find(".f-pin").addClass("toggle");$(d.id).find(".f-header").addClass("f-not-allowed");$(d.id).find(".f-title").addClass("f-not-allowed");$(d.id).find(".f-resize").hide();$(d.id).find(".f-close").hide()}},_event_panel_load:function(c){if(this.event.type!==null){return}this._panel_show_hide()},_event_panel_active:function(c){if(this.event.type!==null){return}this._panel_active_disable()},_event_panel_scroll:function(c){if(this.event.type!==null||!this.visible){return}c.preventDefault();var d=c.originalEvent.detail?c.originalEvent.detail:c.originalEvent.wheelDelta/-3;this._panel_scroll(d)},_event_panel_scroll_up:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(-this.options.scroll)},_event_panel_scroll_down:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(this.options.scroll)},_frame_identify:function(c){return this.frame_list["#"+$(c).closest(".frame").attr("id")]},_frame_drag_start:function(d){this._frame_focus(d,true);var c=this._frame_screen(d);this._frame_resize(this.frame_shadow,c);this._frame_grid(this.frame_shadow,d.grid_location);d.grid_location=null;$(this.frame_shadow.id).show();$(".f-cover").show()},_frame_drag_stop:function(d){this._frame_focus(d,false);var c=this._frame_screen(this.frame_shadow);this._frame_resize(d,c);this._frame_grid(d,this.frame_shadow.grid_location,true);this.frame_shadow.grid_location=null;$(this.frame_shadow.id).hide();$(".f-cover").hide();this._panel_animation_complete()},_to_grid_coord:function(e,d){var c=(e=="width"||e=="height")?1:-1;if(e=="top"){d-=this.top}return parseInt((d+c*this.options.margin)/this.options.cell,10)},_to_pixel_coord:function(e,f){var c=(e=="width"||e=="height")?1:-1;var d=(f*this.options.cell)-c*this.options.margin;if(e=="top"){d+=this.top}return d},_to_grid:function(c){return{top:this._to_grid_coord("top",c.top),left:this._to_grid_coord("left",c.left),width:this._to_grid_coord("width",c.width),height:this._to_grid_coord("height",c.height)}},_to_pixel:function(c){return{top:this._to_pixel_coord("top",c.top),left:this._to_pixel_coord("left",c.left),width:this._to_pixel_coord("width",c.width),height:this._to_pixel_coord("height",c.height)}},_is_collision:function(e){function c(h,g){return !(h.left>g.left+g.width-1||h.left+h.width-1<g.left||h.top>g.top+g.height-1||h.top+h.height-1<g.top)}for(var d in this.frame_list){var f=this.frame_list[d];if(f.grid_location===null){continue}if(c(e,f.grid_location)){return true}}return false},_location_rank:function(c){return(c.top*this.cols)+c.left},_menu_refresh:function(){this.button_load.number(this.frame_counter);if(this.frame_counter==0){this.button_load.hide()}else{this.button_load.show()}if(this.top==this.options.top_min){$(".frame-scroll-up").hide()}else{$(".frame-scroll-up").show()}if(this.top==this.top_max){$(".frame-scroll-down").hide()}else{$(".frame-scroll-down").show()}},_panel_animation_complete:function(){var c=this;$(".frame").promise().done(function(){c._panel_scroll(0,true)})},_panel_refresh:function(c){this.cols=parseInt($(window).width()/this.options.cell,10)+1;this._frame_insert(null,null,c)},_panel_scroll:function(h,c){var e=this.top-this.options.scroll*h;e=Math.max(e,this.top_max);e=Math.min(e,this.options.top_min);if(this.top!=e){for(var d in this.frame_list){var g=this.frame_list[d];if(g.grid_location!==null){var f={top:g.screen_location.top-(this.top-e),left:g.screen_location.left};this._frame_offset(g,f,c)}}this.top=e}this._menu_refresh()},_panel_show_hide:function(){if(this.visible){this.visible=false;$(".frame").fadeOut("fast");this.button_load.icon("fa-eye-slash");this.button_load.untoggle();$(".frame-background").hide();$(".frame-menu").hide()}else{this.visible=true;$(".frame").fadeIn("fast");this.button_load.icon("fa-eye");this.button_load.toggle();$(this.frame_shadow.id).hide();$(".frame-background").show();this._panel_refresh()}},_panel_active_disable:function(){if(this.active){this.active=false;this.button_active.untoggle();if(this.visible){this._panel_show_hide()}}else{this.active=true;this.button_active.toggle()}},_frame_insert:function(j,c,e){var d=[];if(j){j.grid_location=null;d.push([j,this._location_rank(c)])}var g=null;for(g in this.frame_list){var h=this.frame_list[g];if(h.grid_location!==null&&!h.grid_lock){h.grid_location=null;d.push([h,h.grid_rank])}}d.sort(function(k,f){var m=k[1];var l=f[1];return m<l?-1:(m>l?1:0)});for(g=0;g<d.length;g++){this._frame_place(d[g][0],e)}this.top_max=0;for(var g in this.frame_list){var j=this.frame_list[g];if(j.grid_location!==null){this.top_max=Math.max(this.top_max,j.grid_location.top+j.grid_location.height)}}this.top_max=$(window).height()-this.top_max*this.options.cell-2*this.options.margin;this.top_max=Math.min(this.top_max,this.options.top_min);this._menu_refresh()},_frame_place:function(k,d){k.grid_location=null;var h=this._to_grid(this._frame_screen(k));var c=false;for(var f=0;f<this.options.rows;f++){for(var e=0;e<Math.max(1,this.cols-h.width);e++){h.top=f;h.left=e;if(!this._is_collision(h)){c=true;break}}if(c){break}}if(c){this._frame_grid(k,h,d)}else{console.log("Grid dimensions exceeded.")}},_frame_focus:function(e,c){var d=this.frame_z+(c?1:0);$(e.id).css("z-index",d)},_frame_offset:function(f,e,d){f.screen_location.left=e.left;f.screen_location.top=e.top;if(d){this._frame_focus(f,true);var c=this;$(f.id).animate({top:e.top,left:e.left},"fast",function(){c._frame_focus(f,false)})}else{$(f.id).css({top:e.top,left:e.left})}},_frame_resize:function(d,c){$(d.id).css({width:c.width,height:c.height});d.screen_location.width=c.width;d.screen_location.height=c.height},_frame_grid:function(e,c,d){e.grid_location=c;this._frame_offset(e,this._to_pixel(c),d);e.grid_rank=this._location_rank(c)},_frame_screen:function(d){var c=d.screen_location;return{top:c.top,left:c.left,width:c.width,height:c.height}},_template:function(){return'<div class="galaxy-frame"></div>'},_template_frame:function(f,e,c,d){if(!e){e=""}if(c=="url"){d='<iframe scrolling="auto" class="f-iframe" src="'+d+'"></iframe>'}return'<div id="'+f+'" class="frame corner"><div class="f-header corner"><span class="f-title">'+e+'</span><span class="f-icon f-pin fa fa-thumb-tack"></span><span class="f-icon f-close fa fa-trash-o"></span></div><div class="f-content">'+d+'<div class="f-cover"></div></div><span class="f-resize f-icon corner fa fa-resize-full"></span></div>'},_template_shadow:function(c){return'<div id="'+c+'" class="frame-shadow corner"></div>'},_template_background:function(){return'<div class="frame-background"></div>'},_template_menu:function(){return'<div class="frame-scroll-up frame-menu fa fa-chevron-up fa-2x"></div><div class="frame-scroll-down frame-menu fa fa-chevron-down fa-2x"></div>'}});return{GalaxyFrame:a}}); \ No newline at end of file +define(["galaxy.masthead"],function(b){var a=Backbone.View.extend({el_main:"body",options:{frame:{cols:6,rows:3},rows:1000,cell:130,margin:5,scroll:5,top_min:40,frame_max:9},cols:0,top:0,top_max:0,frame_z:0,frame_counter:0,frame_counter_id:0,frame_list:[],frame_shadow:null,visible:false,active:false,button_active:null,button_load:null,initialize:function(d){var c=this;this.button_active=new b.GalaxyMastheadIcon({icon:"fa-th",tooltip:"Enable/Disable Scratchbook",onclick:function(f){c._event_panel_active(f)},onunload:function(){if(c.frame_counter>0){return"You opened "+c.frame_counter+" frame(s) which will be lost."}}});Galaxy.masthead.append(this.button_active);this.button_load=new b.GalaxyMastheadIcon({icon:"fa-eye",tooltip:"Show/Hide Scratchbook",onclick:function(f){c._event_panel_load(f)},with_number:true});Galaxy.masthead.append(this.button_load);if(d){this.options=_.defaults(d,this.options)}this.top=this.top_max=this.options.top_min;this.setElement(this._template());$(this.el).append(this._template_background());$(this.el).append(this._template_menu());$(this.el_main).append($(this.el));var e="#frame-shadow";$(this.el).append(this._template_shadow(e.substring(1)));this.frame_shadow={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};this._frame_resize(this.frame_shadow,{width:0,height:0});this.frame_list[e]=this.frame_shadow;this._panel_refresh();var c=this;$(window).resize(function(){if(c.visible){c._panel_refresh()}})},add:function(d){var g={title:"",content:null,target:"",type:null,scratchbook:false};if(d){d=_.defaults(d,g)}else{d=g}if(!d.content){return}if(d.target=="_blank"){window.open(d.content);return}if(d.target=="_top"||d.target=="_parent"||d.target=="_self"){window.location=d.content;return}if(!this.active){var f=$(window.parent.document).find("#galaxy_main");if(d.target=="galaxy_main"||d.target=="center"){if(f.length==0){var c=d.content;if(c.indexOf("?")==-1){c+="?"}else{c+="&"}c+="use_panels=True";window.location=c}else{f.attr("src",d.content)}}else{window.location=d.content}return}if(this.frame_counter>=this.options.frame_max){alert("You have reached the maximum number of allowed frames ("+this.options.frame_max+").");return}var e="#frame-"+(this.frame_counter_id++);if($(e).length!==0){alert("This frame already exists. This page might contain multiple frame managers.");return}this.top=this.options.top_min;$(this.el).append(this._template_frame(e.substring(1),d.title,d.type,d.content));var h={id:e,screen_location:{},grid_location:{},grid_rank:null,grid_lock:false};d.width=this._to_pixel_coord("width",this.options.frame.cols);d.height=this._to_pixel_coord("height",this.options.frame.rows);this.frame_z=parseInt($(h.id).css("z-index"));this.frame_list[e]=h;this.frame_counter++;this._frame_resize(h,{width:d.width,height:d.height});this._frame_insert(h,{top:0,left:0},true);if(!this.visible){this._panel_show_hide()}},event:{type:null,target:null,xy:null},events:{mousemove:"_event_frame_mouse_move",mouseup:"_event_frame_mouse_up",mouseleave:"_event_frame_mouse_up",mousewheel:"_event_panel_scroll",DOMMouseScroll:"_event_panel_scroll","mousedown .frame":"_event_frame_mouse_down","mousedown .frame-background":"_event_panel_load","mousedown .frame-scroll-up":"_event_panel_scroll_up","mousedown .frame-scroll-down":"_event_panel_scroll_down","mousedown .f-close":"_event_frame_close","mousedown .f-pin":"_event_frame_lock"},_event_frame_mouse_down:function(c){if(this.event.type!==null){return}if($(c.target).hasClass("f-header")||$(c.target).hasClass("f-title")){this.event.type="drag"}if($(c.target).hasClass("f-resize")){this.event.type="resize"}if(this.event.type===null){return}c.preventDefault();this.event.target=this._frame_identify(c.target);if(this.event.target.grid_lock){this.event.type=null;return}this.event.xy={x:c.originalEvent.pageX,y:c.originalEvent.pageY};this._frame_drag_start(this.event.target)},_event_frame_mouse_move:function(i){if(this.event.type!="drag"&&this.event.type!="resize"){return}var g={x:i.originalEvent.pageX,y:i.originalEvent.pageY};var d={x:g.x-this.event.xy.x,y:g.y-this.event.xy.y};this.event.xy=g;var h=this._frame_screen(this.event.target);if(this.event.type=="resize"){h.width+=d.x;h.height+=d.y;var f=this.options.cell-this.options.margin-1;h.width=Math.max(h.width,f);h.height=Math.max(h.height,f);this._frame_resize(this.event.target,h);h.width=this._to_grid_coord("width",h.width)+1;h.height=this._to_grid_coord("height",h.height)+1;h.width=this._to_pixel_coord("width",h.width);h.height=this._to_pixel_coord("height",h.height);this._frame_resize(this.frame_shadow,h);this._frame_insert(this.frame_shadow,{top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)})}if(this.event.type=="drag"){h.left+=d.x;h.top+=d.y;this._frame_offset(this.event.target,h);var c={top:this._to_grid_coord("top",h.top),left:this._to_grid_coord("left",h.left)};if(c.left!==0){c.left++}this._frame_insert(this.frame_shadow,c)}},_event_frame_mouse_up:function(c){if(this.event.type!="drag"&&this.event.type!="resize"){return}this._frame_drag_stop(this.event.target);this.event.type=null},_event_frame_close:function(d){if(this.event.type!==null){return}d.preventDefault();var f=this._frame_identify(d.target);var c=this;$(f.id).fadeOut("fast",function(){$(f.id).remove();delete c.frame_list[f.id];c.frame_counter--;c._panel_refresh(true);c._panel_animation_complete();if(c.visible&&c.frame_counter==0){c._panel_show_hide()}})},_event_frame_lock:function(c){if(this.event.type!==null){return}c.preventDefault();var d=this._frame_identify(c.target);if(d.grid_lock){d.grid_lock=false;$(d.id).find(".f-pin").removeClass("toggle");$(d.id).find(".f-header").removeClass("f-not-allowed");$(d.id).find(".f-title").removeClass("f-not-allowed");$(d.id).find(".f-resize").show();$(d.id).find(".f-close").show()}else{d.grid_lock=true;$(d.id).find(".f-pin").addClass("toggle");$(d.id).find(".f-header").addClass("f-not-allowed");$(d.id).find(".f-title").addClass("f-not-allowed");$(d.id).find(".f-resize").hide();$(d.id).find(".f-close").hide()}},_event_panel_load:function(c){if(this.event.type!==null){return}this._panel_show_hide()},_event_panel_active:function(c){if(this.event.type!==null){return}this._panel_active_disable()},_event_panel_scroll:function(c){if(this.event.type!==null||!this.visible){return}c.preventDefault();var d=c.originalEvent.detail?c.originalEvent.detail:c.originalEvent.wheelDelta/-3;this._panel_scroll(d)},_event_panel_scroll_up:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(-this.options.scroll)},_event_panel_scroll_down:function(c){if(this.event.type!==null){return}c.preventDefault();this._panel_scroll(this.options.scroll)},_frame_identify:function(c){return this.frame_list["#"+$(c).closest(".frame").attr("id")]},_frame_drag_start:function(d){this._frame_focus(d,true);var c=this._frame_screen(d);this._frame_resize(this.frame_shadow,c);this._frame_grid(this.frame_shadow,d.grid_location);d.grid_location=null;$(this.frame_shadow.id).show();$(".f-cover").show()},_frame_drag_stop:function(d){this._frame_focus(d,false);var c=this._frame_screen(this.frame_shadow);this._frame_resize(d,c);this._frame_grid(d,this.frame_shadow.grid_location,true);this.frame_shadow.grid_location=null;$(this.frame_shadow.id).hide();$(".f-cover").hide();this._panel_animation_complete()},_to_grid_coord:function(e,d){var c=(e=="width"||e=="height")?1:-1;if(e=="top"){d-=this.top}return parseInt((d+c*this.options.margin)/this.options.cell,10)},_to_pixel_coord:function(e,f){var c=(e=="width"||e=="height")?1:-1;var d=(f*this.options.cell)-c*this.options.margin;if(e=="top"){d+=this.top}return d},_to_grid:function(c){return{top:this._to_grid_coord("top",c.top),left:this._to_grid_coord("left",c.left),width:this._to_grid_coord("width",c.width),height:this._to_grid_coord("height",c.height)}},_to_pixel:function(c){return{top:this._to_pixel_coord("top",c.top),left:this._to_pixel_coord("left",c.left),width:this._to_pixel_coord("width",c.width),height:this._to_pixel_coord("height",c.height)}},_is_collision:function(e){function c(h,g){return !(h.left>g.left+g.width-1||h.left+h.width-1<g.left||h.top>g.top+g.height-1||h.top+h.height-1<g.top)}for(var d in this.frame_list){var f=this.frame_list[d];if(f.grid_location===null){continue}if(c(e,f.grid_location)){return true}}return false},_location_rank:function(c){return(c.top*this.cols)+c.left},_menu_refresh:function(){this.button_load.number(this.frame_counter);if(this.frame_counter==0){this.button_load.hide()}else{this.button_load.show()}if(this.top==this.options.top_min){$(".frame-scroll-up").hide()}else{$(".frame-scroll-up").show()}if(this.top==this.top_max){$(".frame-scroll-down").hide()}else{$(".frame-scroll-down").show()}},_panel_animation_complete:function(){var c=this;$(".frame").promise().done(function(){c._panel_scroll(0,true)})},_panel_refresh:function(c){this.cols=parseInt($(window).width()/this.options.cell,10)+1;this._frame_insert(null,null,c)},_panel_scroll:function(h,c){var e=this.top-this.options.scroll*h;e=Math.max(e,this.top_max);e=Math.min(e,this.options.top_min);if(this.top!=e){for(var d in this.frame_list){var g=this.frame_list[d];if(g.grid_location!==null){var f={top:g.screen_location.top-(this.top-e),left:g.screen_location.left};this._frame_offset(g,f,c)}}this.top=e}this._menu_refresh()},_panel_show_hide:function(){if(this.visible){this.visible=false;$(".frame").fadeOut("fast");this.button_load.icon("fa-eye-slash");this.button_load.untoggle();$(".frame-background").hide();$(".frame-menu").hide()}else{this.visible=true;$(".frame").fadeIn("fast");this.button_load.icon("fa-eye");this.button_load.toggle();$(this.frame_shadow.id).hide();$(".frame-background").show();this._panel_refresh()}},_panel_active_disable:function(){if(this.active){this.active=false;this.button_active.untoggle();if(this.visible){this._panel_show_hide()}}else{this.active=true;this.button_active.toggle()}},_frame_insert:function(j,c,e){var d=[];if(j){j.grid_location=null;d.push([j,this._location_rank(c)])}var g=null;for(g in this.frame_list){var h=this.frame_list[g];if(h.grid_location!==null&&!h.grid_lock){h.grid_location=null;d.push([h,h.grid_rank])}}d.sort(function(k,f){var m=k[1];var l=f[1];return m<l?-1:(m>l?1:0)});for(g=0;g<d.length;g++){this._frame_place(d[g][0],e)}this.top_max=0;for(var g in this.frame_list){var j=this.frame_list[g];if(j.grid_location!==null){this.top_max=Math.max(this.top_max,j.grid_location.top+j.grid_location.height)}}this.top_max=$(window).height()-this.top_max*this.options.cell-2*this.options.margin;this.top_max=Math.min(this.top_max,this.options.top_min);this._menu_refresh()},_frame_place:function(k,d){k.grid_location=null;var h=this._to_grid(this._frame_screen(k));var c=false;for(var f=0;f<this.options.rows;f++){for(var e=0;e<Math.max(1,this.cols-h.width);e++){h.top=f;h.left=e;if(!this._is_collision(h)){c=true;break}}if(c){break}}if(c){this._frame_grid(k,h,d)}else{console.log("Grid dimensions exceeded.")}},_frame_focus:function(e,c){var d=this.frame_z+(c?1:0);$(e.id).css("z-index",d)},_frame_offset:function(f,e,d){f.screen_location.left=e.left;f.screen_location.top=e.top;if(d){this._frame_focus(f,true);var c=this;$(f.id).animate({top:e.top,left:e.left},"fast",function(){c._frame_focus(f,false)})}else{$(f.id).css({top:e.top,left:e.left})}},_frame_resize:function(d,c){$(d.id).css({width:c.width,height:c.height});d.screen_location.width=c.width;d.screen_location.height=c.height},_frame_grid:function(e,c,d){e.grid_location=c;this._frame_offset(e,this._to_pixel(c),d);e.grid_rank=this._location_rank(c)},_frame_screen:function(d){var c=d.screen_location;return{top:c.top,left:c.left,width:c.width,height:c.height}},_template:function(){return'<div class="galaxy-frame"></div>'},_template_frame:function(f,e,c,d){if(!e){e=""}if(c=="url"){d='<iframe scrolling="auto" class="f-iframe" src="'+d+'"></iframe>'}return'<div id="'+f+'" class="frame corner"><div class="f-header corner"><span class="f-title">'+e+'</span><span class="f-icon f-pin fa fa-thumb-tack"></span><span class="f-icon f-close fa fa-trash-o"></span></div><div class="f-content">'+d+'<div class="f-cover"></div></div><span class="f-resize f-icon corner fa fa-resize-full"></span></div>'},_template_shadow:function(c){return'<div id="'+c+'" class="frame-shadow corner"></div>'},_template_background:function(){return'<div class="frame-background"></div>'},_template_menu:function(){return'<div class="frame-scroll-up frame-menu fa fa-chevron-up fa-2x"></div><div class="frame-scroll-down frame-menu fa fa-chevron-down fa-2x"></div>'}});return{GalaxyFrame:a}}); \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/packed/galaxy.masthead.js --- a/static/scripts/packed/galaxy.masthead.js +++ b/static/scripts/packed/galaxy.masthead.js @@ -1,1 +1,1 @@ -define([],function(){var a=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e;$("body").off();this.setElement($(this._template(e)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var d=this;window.onbeforeunload=function(){var g="";for(key in d.list){if(d.list[key].options.on_unload){var f=d.list[key].options.on_unload();if(f){g+=f+" "}}}if(g!=""){return g}}},events:{click:"_click",mousedown:function(d){d.preventDefault()}},append:function(d){return this._add(d,true)},prepend:function(d){return this._add(d,false)},highlight:function(e){var d=$(this.el).find("#"+e+"> li");if(d){d.addClass("active")}},_add:function(g,e){var d=$(this.el).find("#"+g.location);if(d){var f=$(g.el);f.addClass("masthead-item");if(e){d.append(f)}else{d.prepend(f)}this.list.push(g)}return null},_click:function(g){var f=$(this.el).find(".popup");if(f){f.hide()}var d=$(g.target).closest(".masthead-item").find(".popup");if($(g.target).hasClass("head")){d.show();this.$background.show()}else{this.$background.hide()}},_template:function(d){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+d.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+d.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:false,on_click:function(){alert("clicked")},on_unload:null,visible:true},location:"iconbar",initialize:function(e){if(e){this.options=_.defaults(e,this.options)}this.setElement($(this._template(this.options)));var d=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",d.options.on_click);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(d){$(this.el).find(".icon").removeClass(this.options.icon).addClass(d);this.options.icon=d},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(d){$(this.el).find(".number").text(d)},_template:function(e){var d='<div id="'+e.id+'" class="symbol"><div class="icon fa fa-2x '+e.icon+'"></div>';if(e.with_number){d+='<div class="number"></div>'}d+="</div>";return d}});var c=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:false,on_unload:null,visible:true,disabled:false,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(d){if(d){this.options=_.defaults(d,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(this.options.disabled){$(this.el).find(".root").addClass("disabled");this._attachPopover()}if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(f){var g={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(f){g=_.defaults(f,g)}if(g.content&&g.content.indexOf("//")===-1){g.content=galaxy_config.root+g.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".popup")}var e=$(this._templateMenuItem(g));this.$menu.append(e);var d=this;e.on("click",function(h){h.preventDefault();if(d.options.target==="_blank"){return true}Galaxy.frame.add(f)});if(g.divider){this.$menu.append($(this._templateDivider()))}},_head:function(d){d.preventDefault();if(this.options.disabled){return}if(!this.$menu){Galaxy.frame.add(this.options)}},_attachPopover:function(){var d=$(this.el).find(".head");d.popover({html:true,content:'Please <a href="/user/login">log in</a> or <a href="/user/create">register</a> to use this feature.',placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){d.popover("hide")},5000)})},_templateMenuItem:function(d){return'<li><a href="'+d.content+'" target="'+d.target+'">'+d.title+"</a></li>"},_templateMenu:function(){return'<ul class="popup dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var d='<ul id="'+e.id+'" class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+e.target+'" href="'+e.content+'" title="'+e.title_attribute+'">'+e.title+'<b class="symbol"></b></a></li></ul>';return d}});return{GalaxyMasthead:a,GalaxyMastheadTab:c,GalaxyMastheadIcon:b}}); \ No newline at end of file +define([],function(){var a=Backbone.View.extend({el_masthead:"#everything",options:null,$background:null,list:[],initialize:function(e){this.options=e;$("body").off();this.setElement($(this._template(e)));$(this.el_masthead).append($(this.el));this.$background=$(this.el).find("#masthead-background");var d=this;$(window).on("beforeunload",function(){var g="";for(key in d.list){if(d.list[key].options.onunload){var f=d.list[key].options.onunload();if(f){g+=f+" "}}}if(g!=""){return g}})},events:{click:"_click",mousedown:function(d){d.preventDefault()}},append:function(d){return this._add(d,true)},prepend:function(d){return this._add(d,false)},highlight:function(e){var d=$(this.el).find("#"+e+"> li");if(d){d.addClass("active")}},_add:function(g,e){var d=$(this.el).find("#"+g.location);if(d){var f=$(g.el);f.addClass("masthead-item");if(e){d.append(f)}else{d.prepend(f)}this.list.push(g)}return null},_click:function(g){var f=$(this.el).find(".popup");if(f){f.hide()}var d=$(g.target).closest(".masthead-item").find(".popup");if($(g.target).hasClass("head")){d.show();this.$background.show()}else{this.$background.hide()}},_template:function(d){return'<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse"><div style="position: relative; right: -50%; float: left;"><div id="navbar" style="display: block; position: relative; right: 50%;"></div></div><div class="navbar-brand"><a href="'+d.logo_url+'"><img border="0" src="'+galaxy_config.root+'static/images/galaxyIcon_noText.png"><span id="brand"> Galaxy '+d.brand+'</span></a></div><div class="quota-meter-container"></div><div id="iconbar" class="iconbar"></div></div><div id="masthead-background" style="display: none; position: absolute; top: 33px; width: 100%; height: 100%; z-index: 1010"></div></div>'}});var b=Backbone.View.extend({options:{id:"",icon:"fa-cog",tooltip:"",with_number:false,onclick:function(){alert("clicked")},onunload:null,visible:true},location:"iconbar",initialize:function(e){if(e){this.options=_.defaults(e,this.options)}this.setElement($(this._template(this.options)));var d=this;$(this.el).find(".icon").tooltip({title:this.options.tooltip,placement:"bottom"}).on("mouseup",d.options.onclick);if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},icon:function(d){$(this.el).find(".icon").removeClass(this.options.icon).addClass(d);this.options.icon=d},toggle:function(){$(this.el).addClass("toggle")},untoggle:function(){$(this.el).removeClass("toggle")},number:function(d){$(this.el).find(".number").text(d)},_template:function(e){var d='<div id="'+e.id+'" class="symbol"><div class="icon fa fa-2x '+e.icon+'"></div>';if(e.with_number){d+='<div class="number"></div>'}d+="</div>";return d}});var c=Backbone.View.extend({options:{id:"",title:"",target:"_parent",content:"",type:"url",scratchbook:false,onunload:null,visible:true,disabled:false,title_attribute:""},location:"navbar",$menu:null,events:{"click .head":"_head"},initialize:function(d){if(d){this.options=_.defaults(d,this.options)}if(this.options.content&&this.options.content.indexOf("//")===-1){this.options.content=galaxy_config.root+this.options.content}this.setElement($(this._template(this.options)));if(this.options.disabled){$(this.el).find(".root").addClass("disabled");this._attachPopover()}if(!this.options.visible){this.hide()}},show:function(){$(this.el).css({visibility:"visible"})},hide:function(){$(this.el).css({visibility:"hidden"})},add:function(f){var g={title:"Title",content:"",type:"url",target:"_parent",scratchbook:false,divider:false};if(f){g=_.defaults(f,g)}if(g.content&&g.content.indexOf("//")===-1){g.content=galaxy_config.root+g.content}if(!this.$menu){$(this.el).find(".root").append(this._templateMenu());$(this.el).find(".symbol").addClass("caret");this.$menu=$(this.el).find(".popup")}var e=$(this._templateMenuItem(g));this.$menu.append(e);var d=this;e.on("click",function(h){h.preventDefault();if(d.options.target==="_blank"){return true}Galaxy.frame.add(f)});if(g.divider){this.$menu.append($(this._templateDivider()))}},_head:function(d){d.preventDefault();if(this.options.disabled){return}if(!this.$menu){Galaxy.frame.add(this.options)}},_attachPopover:function(){var d=$(this.el).find(".head");d.popover({html:true,content:'Please <a href="/user/login">log in</a> or <a href="/user/create">register</a> to use this feature.',placement:"bottom"}).on("shown.bs.popover",function(){setTimeout(function(){d.popover("hide")},5000)})},_templateMenuItem:function(d){return'<li><a href="'+d.content+'" target="'+d.target+'">'+d.title+"</a></li>"},_templateMenu:function(){return'<ul class="popup dropdown-menu"></ul>'},_templateDivider:function(){return'<li class="divider"></li>'},_template:function(e){var d='<ul id="'+e.id+'" class="nav navbar-nav" border="0" cellspacing="0"><li class="root dropdown" style=""><a class="head dropdown-toggle" data-toggle="dropdown" target="'+e.target+'" href="'+e.content+'" title="'+e.title_attribute+'">'+e.title+'<b class="symbol"></b></a></li></ul>';return d}});return{GalaxyMasthead:a,GalaxyMastheadTab:c,GalaxyMastheadIcon:b}}); \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/packed/mvc/upload/upload-row.js --- a/static/scripts/packed/mvc/upload/upload-row.js +++ b/static/scripts/packed/mvc/upload/upload-row.js @@ -1,1 +1,1 @@ -define(["mvc/upload/upload-model"],function(a){return Backbone.View.extend({options:{padding:8},status_classes:{init:"symbol fa fa-trash-o",queued:"symbol fa fa-spinner fa-spin",success:"symbol fa fa-check",error:"symbol fa fa-exclamation-triangle"},initialize:function(e,c){this.app=e;var b=this;this.model=new a.Model(c);this.setElement(this._template(c));var d=this.$el;d.find("#symbol").on("click",function(){var f=b.model.get("status");if(f=="init"||f=="success"||f=="error"){b.app.collection.remove(b.model)}});d.find("#text-content").on("keyup",function(){var f=d.find("#text-content");var h=f.val();var g=h.length;d.find("#size").html(b._formatSize(g));b.model.set("url_paste",h)});d.find("#genome").on("change",function(f){b.model.set("genome",$(f.target).val())});d.find("#extension").on("change",function(f){b.model.set("extension",$(f.target).val())});d.find("#space_to_tabs").on("change",function(f){b.model.set("space_to_tabs",$(f.target).prop("checked"))});this.model.on("change:percentage",function(){b._refreshPercentage()});this.model.on("change:status",function(){b._refreshStatus()});this.model.on("change:info",function(){b._refreshInfo()});this.model.on("change:genome",function(){b._refreshGenome()});this.model.on("remove",function(){b.remove()});this.app.collection.on("reset",function(){b.remove()})},render:function(){var h=this.model.get("file_name");var c=this.model.get("file_size");var e=this.$el;e.find("#title").html(h);e.find("#size").html(this._formatSize(c));if(c==-1){var g=e.find("#text");var f=this.options.padding;var d=e.width()-2*f;var b=e.height()-f;g.css("width",d+"px");g.css("top",b+"px");e.height(b+g.height()+2*f);g.show()}},_refreshGenome:function(){var b=this.model.get("genome");this.$el.find("#genome").val(b)},_refreshInfo:function(){var b=this.model.get("info");if(b){this.$el.find("#info").html("<strong>Failed: </strong>"+b).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var b=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:b+"%"});if(b!=100){this.$el.find("#percentage").html(b+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var c=this.$el;var b=this.model.get("status");var e=this.status_classes[b];var d=this.$el.find("#symbol");d.removeClass();d.addClass(e);if(b=="init"){c.find("#text-content").attr("disabled",false);c.find("#genome").attr("disabled",false);c.find("#extension").attr("disabled",false);c.find("#space_to_tabs").attr("disabled",false)}else{c.find("#text-content").attr("disabled",true);c.find("#genome").attr("disabled",true);c.find("#extension").attr("disabled",true);c.find("#space_to_tabs").attr("disabled",true)}if(b=="success"){c.addClass("success");c.find("#percentage").html("100%")}if(b=="error"){c.addClass("danger");c.find(".progress").remove()}},_formatSize:function(b){var c="";if(b>=100000000000){b=b/100000000000;c="TB"}else{if(b>=100000000){b=b/100000000;c="GB"}else{if(b>=100000){b=b/100000;c="MB"}else{if(b>=100){b=b/100;c="KB"}else{if(b>0){b=b*10;c="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(b)/10)+"</strong> "+c},_template:function(d){var c=this;var b='<tr id="upload-item-'+d.id+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';b+='<td><select id="extension" class="extension">';for(key in c.app.select_extension){b+='<option value="'+c.app.select_extension[key][1]+'">'+c.app.select_extension[key][0]+"</option>"}b+="</select></td>";b+='<td><select id="genome" class="genome">';for(key in c.app.select_genome){b+='<option value="'+c.app.select_genome[key][1]+'">'+c.app.select_genome[key][0]+"</option>"}b+="</select></td>";b+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>';return b}})}); \ No newline at end of file +define(["mvc/upload/upload-model"],function(a){return Backbone.View.extend({options:{padding:8},status_classes:{init:"symbol fa fa-trash-o",queued:"symbol fa fa-spinner fa-spin",running:"symbol fa fa-spinner fa-spin",success:"symbol fa fa-check",error:"symbol fa fa-exclamation-triangle"},initialize:function(e,c){this.app=e;var b=this;this.model=new a.Model(c);this.setElement(this._template(c));var d=this.$el;d.find("#symbol").on("click",function(){var f=b.model.get("status");if(f=="init"||f=="success"||f=="error"){b.app.collection.remove(b.model)}});d.find("#text-content").on("keyup",function(){var f=d.find("#text-content");var h=f.val();var g=h.length;d.find("#size").html(b._formatSize(g));b.model.set("url_paste",h);b.model.set("file_size",g)});d.find("#genome").on("change",function(f){b.model.set("genome",$(f.target).val())});d.find("#extension").on("change",function(f){b.model.set("extension",$(f.target).val())});d.find("#space_to_tabs").on("change",function(f){b.model.set("space_to_tabs",$(f.target).prop("checked"))});this.model.on("change:percentage",function(){b._refreshPercentage()});this.model.on("change:status",function(){b._refreshStatus()});this.model.on("change:info",function(){b._refreshInfo()});this.model.on("change:genome",function(){b._refreshGenome()});this.model.on("remove",function(){b.remove()});this.app.collection.on("reset",function(){b.remove()})},render:function(){var h=this.model.get("file_name");var c=this.model.get("file_size");var e=this.$el;e.find("#title").html(h);e.find("#size").html(this._formatSize(c));if(c==-1){var g=e.find("#text");var f=this.options.padding;var d=e.width()-2*f;var b=e.height()-f;g.css("width",d+"px");g.css("top",b+"px");e.height(b+g.height()+2*f);g.show()}},_refreshGenome:function(){var b=this.model.get("genome");this.$el.find("#genome").val(b)},_refreshInfo:function(){var b=this.model.get("info");if(b){this.$el.find("#info").html("<strong>Failed: </strong>"+b).show()}else{this.$el.find("#info").hide()}},_refreshPercentage:function(){var b=parseInt(this.model.get("percentage"));this.$el.find(".progress-bar").css({width:b+"%"});if(b!=100){this.$el.find("#percentage").html(b+"%")}else{this.$el.find("#percentage").html("Adding to history...")}},_refreshStatus:function(){var c=this.$el;var b=this.model.get("status");var e=this.status_classes[b];var d=this.$el.find("#symbol");d.removeClass();d.addClass(e);if(b=="init"){c.find("#text-content").attr("disabled",false);c.find("#genome").attr("disabled",false);c.find("#extension").attr("disabled",false);c.find("#space_to_tabs").attr("disabled",false)}else{c.find("#text-content").attr("disabled",true);c.find("#genome").attr("disabled",true);c.find("#extension").attr("disabled",true);c.find("#space_to_tabs").attr("disabled",true)}if(b=="success"){c.addClass("success");c.find("#percentage").html("100%")}if(b=="error"){c.addClass("danger");c.find(".progress").remove()}},_formatSize:function(b){var c="";if(b>=100000000000){b=b/100000000000;c="TB"}else{if(b>=100000000){b=b/100000000;c="GB"}else{if(b>=100000){b=b/100000;c="MB"}else{if(b>=100){b=b/100;c="KB"}else{if(b>0){b=b*10;c="b"}else{return"<strong>-</strong>"}}}}}return"<strong>"+(Math.round(b)/10)+"</strong> "+c},_template:function(d){var c=this;var b='<tr id="upload-item-'+d.id+'" class="upload-item"><td><div style="position: relative;"><div id="title" class="title"></div><div id="text" class="text"><div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div><textarea id="text-content" class="text-content form-control"></textarea></div></div></td><td><div id="size" class="size"></div></td>';b+='<td><select id="extension" class="extension">';for(key in c.app.select_extension){b+='<option value="'+c.app.select_extension[key][1]+'">'+c.app.select_extension[key][0]+"</option>"}b+="</select></td>";b+='<td><select id="genome" class="genome">';for(key in c.app.select_genome){b+='<option value="'+c.app.select_genome[key][1]+'">'+c.app.select_genome[key][0]+"</option>"}b+="</select></td>";b+='<td><input id="space_to_tabs" type="checkbox"></input></td><td><div id="info" class="info"><div class="progress"><div class="progress-bar progress-bar-success"></div><div id="percentage" class="percentage">0%</div></div></div></td><td><div id="symbol" class="'+this.status_classes.init+'"></div></td></tr>';return b}})}); \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/packed/mvc/upload/upload-view.js --- a/static/scripts/packed/mvc/upload/upload-view.js +++ b/static/scripts/packed/mvc/upload/upload-view.js @@ -1,1 +1,1 @@ -define(["galaxy.modal","galaxy.masthead","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","utils/uploadbox"],function(a,d,e,c,b){return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new c.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(g){var f=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){f.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new d.GalaxyMastheadIcon({icon:"fa-arrow-circle-o-up",tooltip:"Upload Files",on_click:function(h){f._eventShow(h)},on_unload:function(){if(f.counter.running>0){return"Several uploads are still processing."}},with_number:true});Galaxy.masthead.prepend(this.button_show);var f=this;e.jsonFromUrl(galaxy_config.root+"api/datatypes",function(h){for(key in h){f.select_extension.push([h[key],h[key]])}});e.jsonFromUrl(galaxy_config.root+"api/genomes",function(h){var i=f.select_genome[0];f.select_genome=[];for(key in h){if(h[key].length>1){if(h[key][1]!==i[1]){f.select_genome.push(h[key])}}}f.select_genome.sort(function(k,j){return k[0]>j[0]?1:k[0]<j[0]?-1:0});f.select_genome.unshift(i)});if(g){this.options=_.defaults(g,this.options)}this.collection.on("remove",function(h){f._eventRemove(h)});this.collection.on("change:genome",function(i){var h=i.get("genome");f.collection.each(function(j){if(j.get("status")=="init"&&j.get("genome")=="?"){j.set("genome",h)}})})},_eventShow:function(g){g.preventDefault();if(!this.modal){var f=this;this.modal=new a.GalaxyModal({title:"Upload files from your local drive",body:this._template("upload-box","upload-info"),buttons:{Select:function(){f.uploadbox.select()},Create:function(){f._eventCreate()},Upload:function(){f._eventStart()},Pause:function(){f._eventStop()},Reset:function(){f._eventReset()},Close:function(){f.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var f=this;this.uploadbox=this.$el.uploadbox({announce:function(h,i,j){f._eventAnnounce(h,i,j)},initialize:function(h,i,j){return f._eventInitialize(h,i,j)},progress:function(h,i,j){f._eventProgress(h,i,j)},success:function(h,i,j){f._eventSuccess(h,i,j)},error:function(h,i,j){f._eventError(h,i,j)},complete:function(){f._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(g){var f=g.get("status");if(f=="success"){this.counter.success--}else{if(f=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(g.id)},_eventAnnounce:function(f,g,i){this.counter.announce++;this._updateScreen();var h=new b(this,{id:f,file_name:g.name,file_size:g.size});this.collection.add(h.model);$(this.el).find("tbody:last").append(h.$el);h.render()},_eventInitialize:function(j,f,n){var h=this.collection.get(j);h.set("state","running");this.button_show.number(this.counter.announce);var g=h.get("extension");var k=h.get("file_name");var m=h.get("genome");var l=h.get("url_paste");var i=h.get("space_to_tabs");if(!l&&!(f.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=m;tool_input.file_type=g;tool_input["files_0|NAME"]=k;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=l;tool_input.space_to_tabs=i;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(g,h,f){var i=this.collection.get(g);i.set("percentage",f)},_eventSuccess:function(f,g,i){var h=this.collection.get(f);h.set("status","success");this.button_show.number("");this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(f,g,i){var h=this.collection.get(f);h.set("status","error");h.set("info",i);this.button_show.number("");this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(f){if(f.get("status")=="queued"){f.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}this.collection.each(function(f){if(f.get("status")=="init"){f.set("status","queued")}});this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset()}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_template:function(g,f){return'<div id="'+g+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+f+'" class="upload-info"></h6>'}})}); \ No newline at end of file +define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");if(h){g.css({width:h+"%"})}else{g.css({width:"0%"})}},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label" style="position: absolute; top: 0px; width: inherit; text-align: center;"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Upload files",label:"Upload",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Upload files from your local drive",body:this._template("upload-box","upload-info"),buttons:{Select:function(){g.uploadbox.select()},Create:function(){g._eventCreate()},Upload:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900"});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="Drag&drop files into this box or click 'Select' to select files!"}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Upload' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Upload")}else{this.modal.disableButton("Upload")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Select");this.modal.enableButton("Create")}else{this.modal.disableButton("Select");this.modal.disableButton("Create")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})}); \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/packed/utils/utils.js --- a/static/scripts/packed/utils/utils.js +++ b/static/scripts/packed/utils/utils.js @@ -1,1 +1,1 @@ -define(["libs/underscore"],function(c){function d(g,f,e){var h=new XMLHttpRequest();h.open("GET",g,true);h.setRequestHeader("Accept","application/json");h.setRequestHeader("Cache-Control","no-cache");h.setRequestHeader("X-Requested-With","XMLHttpRequest");h.onloadend=function(){var i=h.status;if(i==200){try{response=jQuery.parseJSON(h.responseText)}catch(j){response=h.responseText}f&&f(response)}else{e&&e(i)}};h.send()}function b(h,e){var f=$('<div class="'+h+'"></div>');f.appendTo(":eq(0)");var g=f.css(e);f.remove();return g}function a(e){if(!$('link[href^="'+e+'"]').length){$('<link href="'+galaxy_config.root+e+'" rel="stylesheet">').appendTo("head")}}return{cssLoadFile:a,cssGetAttribute:b,jsonFromUrl:d}}); \ No newline at end of file +define(["libs/underscore"],function(c){function d(h,g,f){var i=new XMLHttpRequest();i.open("GET",h,true);i.setRequestHeader("Accept","application/json");i.setRequestHeader("Cache-Control","no-cache");i.setRequestHeader("X-Requested-With","XMLHttpRequest");i.onloadend=function(){var j=i.status;if(j==200){try{response=jQuery.parseJSON(i.responseText)}catch(k){response=i.responseText}g&&g(response)}else{f&&f(j)}};i.send()}function b(i,f){var g=$('<div class="'+i+'"></div>');g.appendTo(":eq(0)");var h=g.css(f);g.remove();return h}function a(f){if(!$('link[href^="'+f+'"]').length){$('<link href="'+galaxy_config.root+f+'" rel="stylesheet">').appendTo("head")}}function e(f,g){if(f){return c.defaults(f,g)}else{return g}}return{cssLoadFile:a,cssGetAttribute:b,jsonFromUrl:d,merge:e}}); \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/packed/viz/trackster.js --- a/static/scripts/packed/viz/trackster.js +++ b/static/scripts/packed/viz/trackster.js @@ -1,1 +1,1 @@ -var ui=null;var view=null;var browser_router=null;require(["utils/galaxy.utils","libs/jquery/jstorage","libs/jquery/jquery.event.drag","libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel","libs/jquery/jquery-ui","libs/jquery/select2","libs/farbtastic","libs/jquery/jquery.form","libs/jquery/jquery.rating","mvc/ui"],function(a){a.cssLoadFile("static/style/jquery.rating.css");a.cssLoadFile("static/style/autocomplete_tagging.css");a.cssLoadFile("static/style/jquery-ui/smoothness/jquery-ui.css");a.cssLoadFile("static/style/library.css");a.cssLoadFile("static/style/trackster.css")});define(["libs/backbone/backbone","viz/visualization","viz/trackster_ui"],function(c,a,b){var d=Backbone.View.extend({initialize:function(){ui=new b.TracksterUI(galaxy_config.root);ui.createButtonMenu();ui.buttonMenu.$el.attr("style","float: right");$("#center .unified-panel-header-inner").append(ui.buttonMenu.$el);$("#right .unified-panel-title").append("Bookmarks");$("#right .unified-panel-icons").append("<a id='add-bookmark-button' class='icon-button menu-button plus-button' href='javascript:void(0);' title='Add bookmark'></a>");$("#right-border").click(function(){view.resize_window()});force_right_panel("hide");if(galaxy_config.app.id){this.view_existing()}else{this.view_new()}},set_up_router:function(e){browser_router=new a.TrackBrowserRouter(e);Backbone.history.start()},view_existing:function(){var e=galaxy_config.app.viz_config;view=ui.create_visualization({container:$("#center .unified-panel-body"),name:e.title,vis_id:e.vis_id,dbkey:e.dbkey},e.viewport,e.tracks,e.bookmarks,true);this.init_editor()},view_new:function(){var e=this;$.ajax({url:galaxy_config.root+"api/genomes?chrom_info=True",data:{},error:function(){alert("Couldn't create new browser.")},success:function(f){Galaxy.modal.show({title:"New Visualization",body:e.template_view_new(f),buttons:{Cancel:function(){window.location=galaxy_config.root+"visualization/list"},Create:function(){e.create_browser($("#new-title").val(),$("#new-dbkey").val());Galaxy.modal.hide()}}});if(galaxy_config.app.default_dbkey){$("#new-dbkey").val(galaxy_config.app.default_dbkey)}$("#new-title").focus();$("select[name='dbkey']").select2();$("#overlay").css("overflow","auto")}})},template_view_new:function(e){var g='<form id="new-browser-form" action="javascript:void(0);" method="post" onsubmit="return false;"><div class="form-row"><label for="new-title">Browser name:</label><div class="form-row-input"><input type="text" name="title" id="new-title" value="Unnamed"></input></div><div style="clear: both;"></div></div><div class="form-row"><label for="new-dbkey">Reference genome build (dbkey): </label><div class="form-row-input"><select name="dbkey" id="new-dbkey">';for(var f=0;f<e.length;f++){g+='<option value="'+e[f][1]+'">'+e[f][0]+"</option>"}g+='</select></div><div style="clear: both;"></div></div><div class="form-row">Is the build not listed here? <a href="'+galaxy_config.root+'user/dbkeys?use_panels=True">Add a Custom Build</a></div></form>';return g},create_browser:function(f,e){$(document).trigger("convert_to_values");view=ui.create_visualization({container:$("#center .unified-panel-body"),name:f,dbkey:e},galaxy_config.app.gene_region);this.init_editor();view.editor=true},init_editor:function(){$("#center .unified-panel-title").text(view.prefs.name+" ("+view.dbkey+")");if(galaxy_config.app.add_dataset){$.ajax({url:galaxy_config.root+"api/datasets/"+galaxy_config.app.add_dataset,data:{hda_ldda:"hda",data_type:"track_config"},dataType:"json",success:function(e){view.add_drawable(b.object_from_template(e,view,view))}})}$("#add-bookmark-button").click(function(){var f=view.chrom+":"+view.low+"-"+view.high,e="Bookmark description";return ui.add_bookmark(f,e,true)});ui.init_keyboard_nav(view);this.set_up_router({view:view})}});return{GalaxyApp:d}}); \ No newline at end of file +var ui=null;var view=null;var browser_router=null;require(["utils/utils","libs/jquery/jstorage","libs/jquery/jquery.event.drag","libs/jquery/jquery.event.hover","libs/jquery/jquery.mousewheel","libs/jquery/jquery-ui","libs/jquery/select2","libs/farbtastic","libs/jquery/jquery.form","libs/jquery/jquery.rating","mvc/ui"],function(a){a.cssLoadFile("static/style/jquery.rating.css");a.cssLoadFile("static/style/autocomplete_tagging.css");a.cssLoadFile("static/style/jquery-ui/smoothness/jquery-ui.css");a.cssLoadFile("static/style/library.css");a.cssLoadFile("static/style/trackster.css")});define(["libs/backbone/backbone","viz/visualization","viz/trackster_ui"],function(c,a,b){var d=Backbone.View.extend({initialize:function(){ui=new b.TracksterUI(galaxy_config.root);ui.createButtonMenu();ui.buttonMenu.$el.attr("style","float: right");$("#center .unified-panel-header-inner").append(ui.buttonMenu.$el);$("#right .unified-panel-title").append("Bookmarks");$("#right .unified-panel-icons").append("<a id='add-bookmark-button' class='icon-button menu-button plus-button' href='javascript:void(0);' title='Add bookmark'></a>");$("#right-border").click(function(){view.resize_window()});force_right_panel("hide");if(galaxy_config.app.id){this.view_existing()}else{this.view_new()}},set_up_router:function(e){browser_router=new a.TrackBrowserRouter(e);Backbone.history.start()},view_existing:function(){var e=galaxy_config.app.viz_config;view=ui.create_visualization({container:$("#center .unified-panel-body"),name:e.title,vis_id:e.vis_id,dbkey:e.dbkey},e.viewport,e.tracks,e.bookmarks,true);this.init_editor()},view_new:function(){var e=this;$.ajax({url:galaxy_config.root+"api/genomes?chrom_info=True",data:{},error:function(){alert("Couldn't create new browser.")},success:function(f){Galaxy.modal.show({title:"New Visualization",body:e.template_view_new(f),buttons:{Cancel:function(){window.location=galaxy_config.root+"visualization/list"},Create:function(){e.create_browser($("#new-title").val(),$("#new-dbkey").val());Galaxy.modal.hide()}}});if(galaxy_config.app.default_dbkey){$("#new-dbkey").val(galaxy_config.app.default_dbkey)}$("#new-title").focus();$("select[name='dbkey']").select2();$("#overlay").css("overflow","auto")}})},template_view_new:function(e){var g='<form id="new-browser-form" action="javascript:void(0);" method="post" onsubmit="return false;"><div class="form-row"><label for="new-title">Browser name:</label><div class="form-row-input"><input type="text" name="title" id="new-title" value="Unnamed"></input></div><div style="clear: both;"></div></div><div class="form-row"><label for="new-dbkey">Reference genome build (dbkey): </label><div class="form-row-input"><select name="dbkey" id="new-dbkey">';for(var f=0;f<e.length;f++){g+='<option value="'+e[f][1]+'">'+e[f][0]+"</option>"}g+='</select></div><div style="clear: both;"></div></div><div class="form-row">Is the build not listed here? <a href="'+galaxy_config.root+'user/dbkeys?use_panels=True">Add a Custom Build</a></div></form>';return g},create_browser:function(f,e){$(document).trigger("convert_to_values");view=ui.create_visualization({container:$("#center .unified-panel-body"),name:f,dbkey:e},galaxy_config.app.gene_region);this.init_editor();view.editor=true},init_editor:function(){$("#center .unified-panel-title").text(view.prefs.name+" ("+view.dbkey+")");if(galaxy_config.app.add_dataset){$.ajax({url:galaxy_config.root+"api/datasets/"+galaxy_config.app.add_dataset,data:{hda_ldda:"hda",data_type:"track_config"},dataType:"json",success:function(e){view.add_drawable(b.object_from_template(e,view,view))}})}$("#add-bookmark-button").click(function(){var f=view.chrom+":"+view.low+"-"+view.high,e="Bookmark description";return ui.add_bookmark(f,e,true)});ui.init_keyboard_nav(view);this.set_up_router({view:view})}});return{GalaxyApp:d}}); \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/utils/utils.js --- a/static/scripts/utils/utils.js +++ b/static/scripts/utils/utils.js @@ -63,11 +63,20 @@ $('<link href="' + galaxy_config.root + url + '" rel="stylesheet">').appendTo('head'); }; +// merge +function merge (options, optionsDefault) { + if (options) + return _.defaults(options, optionsDefault); + else + return optionsDefault; +}; + // return return { cssLoadFile : cssLoadFile, cssGetAttribute : cssGetAttribute, - jsonFromUrl : jsonFromUrl + jsonFromUrl : jsonFromUrl, + merge : merge }; }); diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/scripts/viz/trackster.js --- a/static/scripts/viz/trackster.js +++ b/static/scripts/viz/trackster.js @@ -7,7 +7,7 @@ require( [ // load js libraries - 'utils/galaxy.utils', + 'utils/utils', 'libs/jquery/jstorage', 'libs/jquery/jquery.event.drag', 'libs/jquery/jquery.event.hover', diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/style/blue/base.css --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -1250,6 +1250,10 @@ .galaxy-frame .frame .f-close{right:5px;top:3px} .galaxy-frame .frame .f-pin{left:6px;top:3px} .galaxy-frame .frame .f-resize{background:#fff;width:16px;height:16px;color:#2c3143;right:0px;bottom:0px;text-align:center;line-height:16px;border:0px} +.progress-button{position:absolute;width:100px;right:10px;top:6px;cursor:pointer;height:19px;border:1px solid #aaa;-moz-border-radius:3px;border-radius:3px}.progress-button .progress-bar-danger{background:#f9c7c5} +.progress-button .progress-bar-success{background:#aff1af;border:0px} +.progress-button .progress-bar-info{background:#ffc} +.progress-button .progress-bar-notransition{-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none} .upload-info{font-weight:normal;text-align:center} .upload-box{width:100%;height:95%;text-align:center;overflow:scroll;font-size:12px;line-height:1.33;-moz-border-radius:5px;border-radius:5px;border:1px dashed #bfbfbf;padding:10px;overflow-x:hidden;-ms-overflow-style:none}.upload-box .table{width:100%} .upload-box .table th{text-align:center;white-space:nowrap} @@ -1262,7 +1266,7 @@ .upload-box .size{width:60px;white-space:nowrap} .upload-box .info{width:130px;font-size:11px}.upload-box .info .progress{top:1px;position:relative;width:100%;padding:0px;margin:0px}.upload-box .info .progress .progress-bar{border-radius:inherit;-moz-border-radius:inherit} .upload-box .info .progress .percentage{position:absolute;text-align:center;width:100%;color:#fff} -.upload-box .symbol{cursor:pointer} +.upload-box .symbol{font-size:1.2em;cursor:pointer} .libraryRow{background-color:#ebd9b2} .datasetHighlighted{background-color:#f9f9f9} .libraryItemDeleted-True{font-style:italic} diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 static/style/src/less/upload.less --- a/static/style/src/less/upload.less +++ b/static/style/src/less/upload.less @@ -1,3 +1,37 @@ +.progress-button { + position: absolute; + width: 100px; + right: 10px; + top: 6px; + cursor: pointer; + height: 19px; + border: 1px solid @input-border; + -moz-border-radius: @border-radius-base; + border-radius: @border-radius-base; + + .progress-bar-danger { + background: @state-danger-bg; + } + + .progress-bar-success { + background: @state-success-bg; + + border : 0px; + } + + .progress-bar-info { + background: @state-running-bg; + } + + .progress-bar-notransition { + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; + } +} + .upload-info { font-weight: normal; @@ -99,6 +133,7 @@ } .symbol { + font-size: 1.2em; cursor: pointer; } } \ No newline at end of file diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 templates/webapps/galaxy/galaxy.masthead.mako --- a/templates/webapps/galaxy/galaxy.masthead.mako +++ b/templates/webapps/galaxy/galaxy.masthead.mako @@ -102,7 +102,7 @@ }); ## add upload plugin - ##Galaxy.upload = new GalaxyUpload(masthead_config); + Galaxy.upload = new GalaxyUpload(masthead_config); ## set up the quota meter (And fetch the current user data from trans) ## add quota meter to masthead diff -r 81342d9a312042042a233bf2ca268cd6985b6812 -r 4bbd9181622d659381084fc3475cb583ab661fd2 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 @@ -1002,7 +1002,7 @@ params[ 'time_last_tested' ] = 'This entry will result in this value being set via the Tool Shed API.' url = '%s' % ( suc.url_join( galaxy_tool_shed_url,'api', 'repository_revisions', str( metadata_revision_id ) ) ) log.debug( 'url: %s' % str( url ) ) - log.degug( 'params: %s' % str( params ) ) + log.debug( 'params: %s' % str( params ) ) try: return update( tool_shed_api_key, url, params, return_formatted=False ) except Exception, e: https://bitbucket.org/galaxy/galaxy-central/commits/ec536dc87560/ Changeset: ec536dc87560 User: saketkc Date: 2014-01-19 19:59:22 Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central Affected #: 2 files diff -r d634429a04504eb51a39315d947e4626633f2b32 -r ec536dc87560d680f9387b3dedf6e2e22ba60732 lib/tool_shed/util/common_util.py --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -183,7 +183,11 @@ def tool_shed_get( app, tool_shed_url, uri ): """Make contact with the tool shed via the uri provided.""" registry = app.tool_shed_registry - urlopener = urllib2.build_opener() + ## urllib2 auto-detects system proxies, when passed a Proxyhandler + ## Refer: http://docs.python.org/2/howto/urllib2.html#proxies + proxy = urllib2.ProxyHandler() + urlopener = urllib2.build_opener(proxy) + urllib2.install_opener(urlopener) password_mgr = registry.password_manager_for_url( tool_shed_url ) if password_mgr is not None: auth_handler = urllib2.HTTPBasicAuthHandler( password_mgr ) diff -r d634429a04504eb51a39315d947e4626633f2b32 -r ec536dc87560d680f9387b3dedf6e2e22ba60732 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -3,6 +3,9 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> + $.fn.outerHTML = function(s) { + return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); + }; $( function() { function show_tool_body(title){ title.parent().show().css('border-bottom-width', '1px'); @@ -129,7 +132,34 @@ select.after(filter); select.width(new_width); }); + // Editable Workflow + $(".edit").on("click",function(){ + var state = $(this).attr("name"); + var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); + var split_name=stepToolBox.attr("name").split("|"); + var step_id = split_name[0]; + var step_name = split_name[2]; + hidden_html = "<input type='hidden' name='"+step_id+"|__runtime__"+step_name+"' value='true' />"; + if (state === "edit"){ + stepToolBoxClone = stepToolBox.clone(); + stepToolBoxClone.attr({"name":step_id+"|"+step_name}); + stepToolBoxClone.show() + $(this).parent().find(".editable").show(); + $(this).parent().parent().find(".uneditable_field").hide(); + $(this).parent().find(".editable").html(stepToolBoxClone.outerHTML()+hidden_html); + $(this).attr("name","revert"); + $(this).val("Revert") + } + else{ + $(this).parent().find(".editable").html(""); + $(this).parent().find(".display").show() + $(".uneditable_field").show(); + $(this).attr("name","edit"); + $(this).val("Edit") + stepToolBox.hide(); + } + }); // Augment hidden fields with icons. // http://stackoverflow.com/a/2088430 $(function(){ @@ -217,6 +247,9 @@ .workflow-annotation { margin-bottom: 1em; } + .editable { + display: none; + } </style></%def> @@ -353,7 +386,19 @@ <span class="p_text_wrapper">${p_text}</span><input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> %else: - ${param.value_to_display_text( value, app )} + <span class="workflow_parameters"> + <span class="uneditable_field"> + ${param.value_to_display_text( value, app )} + </span> + <span class="editable_field"> + <span class="editable"> + ${param.get_html_field( t, value, other_values).get_html( str(step.id) + "|" + "editable" + "|"+ prefix )} + </span> + + <input type="button" name="edit" value="Edit" class="edit"/> + <input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}" + </span> + </span> %endif %endif </div> https://bitbucket.org/galaxy/galaxy-central/commits/30a280eafaaf/ Changeset: 30a280eafaaf User: saketkc Date: 2014-01-19 20:00:04 Summary: Merge from upstream Affected #: 0 files https://bitbucket.org/galaxy/galaxy-central/commits/e0adcd17c331/ Changeset: e0adcd17c331 User: saketkc Date: 2014-01-20 20:02:55 Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central Affected #: 2 files diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r e0adcd17c3317eed99c45eb7051b9c425e904f52 lib/tool_shed/util/common_util.py --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -183,11 +183,11 @@ def tool_shed_get( app, tool_shed_url, uri ): """Make contact with the tool shed via the uri provided.""" registry = app.tool_shed_registry - # urllib2 auto-detects system proxies, when passed a Proxyhandler. - # Refer: http://docs.python.org/2/howto/urllib2.html#proxies + ## urllib2 auto-detects system proxies, when passed a Proxyhandler + ## Refer: http://docs.python.org/2/howto/urllib2.html#proxies proxy = urllib2.ProxyHandler() - urlopener = urllib2.build_opener( proxy ) - urllib2.install_opener( urlopener ) + urlopener = urllib2.build_opener(proxy) + urllib2.install_opener(urlopener) password_mgr = registry.password_manager_for_url( tool_shed_url ) if password_mgr is not None: auth_handler = urllib2.HTTPBasicAuthHandler( password_mgr ) diff -r 99f5d55b02a26e2e3af2936888820fcd91f7c945 -r e0adcd17c3317eed99c45eb7051b9c425e904f52 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -3,6 +3,9 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> + $.fn.outerHTML = function(s) { + return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); + }; $( function() { function show_tool_body(title){ title.parent().show().css('border-bottom-width', '1px'); @@ -129,7 +132,34 @@ select.after(filter); select.width(new_width); }); + // Editable Workflow + $(".edit").on("click",function(){ + var state = $(this).attr("name"); + var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); + var split_name=stepToolBox.attr("name").split("|"); + var step_id = split_name[0]; + var step_name = split_name[2]; + hidden_html = "<input type='hidden' name='"+step_id+"|__runtime__"+step_name+"' value='true' />"; + if (state === "edit"){ + stepToolBoxClone = stepToolBox.clone(); + stepToolBoxClone.attr({"name":step_id+"|"+step_name}); + stepToolBoxClone.show() + $(this).parent().find(".editable").show(); + $(this).parent().parent().find(".uneditable_field").hide(); + $(this).parent().find(".editable").html(stepToolBoxClone.outerHTML()+hidden_html); + $(this).attr("name","revert"); + $(this).val("Revert") + } + else{ + $(this).parent().find(".editable").html(""); + $(this).parent().find(".display").show() + $(".uneditable_field").show(); + $(this).attr("name","edit"); + $(this).val("Edit") + stepToolBox.hide(); + } + }); // Augment hidden fields with icons. // http://stackoverflow.com/a/2088430 $(function(){ @@ -217,6 +247,9 @@ .workflow-annotation { margin-bottom: 1em; } + .editable { + display: none; + } </style></%def> @@ -353,7 +386,19 @@ <span class="p_text_wrapper">${p_text}</span><input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> %else: - ${param.value_to_display_text( value, app )} + <span class="workflow_parameters"> + <span class="uneditable_field"> + ${param.value_to_display_text( value, app )} + </span> + <span class="editable_field"> + <span class="editable"> + ${param.get_html_field( t, value, other_values).get_html( str(step.id) + "|" + "editable" + "|"+ prefix )} + </span> + + <input type="button" name="edit" value="Edit" class="edit"/> + <input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}" + </span> + </span> %endif %endif </div> https://bitbucket.org/galaxy/galaxy-central/commits/38e11f3bbeb3/ Changeset: 38e11f3bbeb3 User: saketkc Date: 2014-01-20 20:05:58 Summary: Formatting changes Affected #: 1 file diff -r e0adcd17c3317eed99c45eb7051b9c425e904f52 -r 38e11f3bbeb31a5f69ccb7825f4b709c294149e5 lib/tool_shed/util/common_util.py --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -183,11 +183,11 @@ def tool_shed_get( app, tool_shed_url, uri ): """Make contact with the tool shed via the uri provided.""" registry = app.tool_shed_registry - ## urllib2 auto-detects system proxies, when passed a Proxyhandler - ## Refer: http://docs.python.org/2/howto/urllib2.html#proxies + # urllib2 auto-detects system proxies, when passed a Proxyhandler + # Refer: http://docs.python.org/2/howto/urllib2.html#proxies proxy = urllib2.ProxyHandler() - urlopener = urllib2.build_opener(proxy) - urllib2.install_opener(urlopener) + urlopener = urllib2.build_opener( proxy ) + urllib2.install_opener( urlopener ) password_mgr = registry.password_manager_for_url( tool_shed_url ) if password_mgr is not None: auth_handler = urllib2.HTTPBasicAuthHandler( password_mgr ) https://bitbucket.org/galaxy/galaxy-central/commits/793c540720b9/ Changeset: 793c540720b9 User: saketkc Date: 2014-01-20 20:16:41 Summary: Formatting changes Affected #: 1 file diff -r 38e11f3bbeb31a5f69ccb7825f4b709c294149e5 -r 793c540720b96162c775ee555dbdb3ee738c87a2 lib/tool_shed/util/common_util.py --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -183,7 +183,7 @@ def tool_shed_get( app, tool_shed_url, uri ): """Make contact with the tool shed via the uri provided.""" registry = app.tool_shed_registry - # urllib2 auto-detects system proxies, when passed a Proxyhandler + # urllib2 auto-detects system proxies, when passed a Proxyhandler. # Refer: http://docs.python.org/2/howto/urllib2.html#proxies proxy = urllib2.ProxyHandler() urlopener = urllib2.build_opener( proxy ) https://bitbucket.org/galaxy/galaxy-central/commits/abb9c605b96b/ Changeset: abb9c605b96b User: saketkc Date: 2014-01-21 00:12:05 Summary: Fix broken javascript calls Affected #: 1 file diff -r 793c540720b96162c775ee555dbdb3ee738c87a2 -r abb9c605b96b7f6d0405c09fe66c41a693600e57 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -139,7 +139,7 @@ var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); var split_name=stepToolBox.attr("name").split("|"); var step_id = split_name[0]; - var step_name = split_name[2]; + var step_name = split_name[split_name.length-1]; hidden_html = "<input type='hidden' name='"+step_id+"|__runtime__"+step_name+"' value='true' />"; if (state === "edit"){ stepToolBoxClone = stepToolBox.clone(); @@ -152,9 +152,8 @@ $(this).val("Revert") } else{ - $(this).parent().find(".editable").html(""); - $(this).parent().find(".display").show() - $(".uneditable_field").show(); + $(this).parent().find(".editable").hide(); + $(this).parent().parent().find(".uneditable_field").show(); $(this).attr("name","edit"); $(this).val("Edit") stepToolBox.hide(); @@ -396,7 +395,7 @@ </span><input type="button" name="edit" value="Edit" class="edit"/> - <input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}" + <input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}"/></span></span> %endif https://bitbucket.org/galaxy/galaxy-central/commits/2e7eb9d8a12a/ Changeset: 2e7eb9d8a12a User: jmchilton Date: 2014-01-21 02:52:45 Summary: Use icons instead of button to enable workflow parameter editing. Affected #: 1 file diff -r abb9c605b96b7f6d0405c09fe66c41a693600e57 -r 2e7eb9d8a12af7d2dd36b9ee8111a3b83cc9ba75 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -134,7 +134,25 @@ }); // Editable Workflow - $(".edit").on("click",function(){ + var readyParameter = function(icon) { + icon.attr("name", "edit"); + icon.attr('title', "Modify default value for this workflow parameter."); + icon.removeClass("workflow-edit-button-editing"); + icon.addClass("workflow-edit-button-ready"); + icon.addClass("fa-edit"); + icon.removeClass("fa-undo"); + }; + + var editingParameter = function(icon) { + icon.attr("name", "revert"); + icon.attr('title', "Restore workflow default value for this parameter."); + icon.addClass("workflow-edit-button-editing"); + icon.removeClass("workflow-edit-button-ready"); + icon.removeClass("fa-edit"); + icon.addClass("fa-undo"); + }; + + $(".workflow-edit-button").on("click",function(){ var state = $(this).attr("name"); var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); var split_name=stepToolBox.attr("name").split("|"); @@ -148,17 +166,19 @@ $(this).parent().find(".editable").show(); $(this).parent().parent().find(".uneditable_field").hide(); $(this).parent().find(".editable").html(stepToolBoxClone.outerHTML()+hidden_html); - $(this).attr("name","revert"); - $(this).val("Revert") + editingParameter($(this)); } else{ $(this).parent().find(".editable").hide(); $(this).parent().parent().find(".uneditable_field").show(); - $(this).attr("name","edit"); - $(this).val("Edit") + $(this).attr("name", "edit"); stepToolBox.hide(); + readyParameter($(this)); } + }).each(function(i, icon) { + readyParameter($(icon)); }); + // Augment hidden fields with icons. // http://stackoverflow.com/a/2088430 $(function(){ @@ -249,6 +269,19 @@ .editable { display: none; } + + .workflow-edit-button-editing { + color: black; + } + + .workflow-edit-button-default { + color: Gray; + } + + .workflow-edit-button:hover { + color: green; // TODO: Use a history panel green. + } + </style></%def> @@ -394,7 +427,7 @@ ${param.get_html_field( t, value, other_values).get_html( str(step.id) + "|" + "editable" + "|"+ prefix )} </span> - <input type="button" name="edit" value="Edit" class="edit"/> + <i class="fa workflow-edit-button"></i><input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}"/></span></span> https://bitbucket.org/galaxy/galaxy-central/commits/3865362e2b33/ Changeset: 3865362e2b33 User: jmchilton Date: 2014-01-21 03:11:20 Summary: Do not allow editing conditional test param. In most cases this will change the structure of remaining parameters - leaving the set of parameters vlues are defined for and their values invalid for that step. Affected #: 1 file diff -r 2e7eb9d8a12af7d2dd36b9ee8111a3b83cc9ba75 -r 3865362e2b338e5f859871c31563e3e8d34e9e9a templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -176,7 +176,10 @@ readyParameter($(this)); } }).each(function(i, icon) { - readyParameter($(icon)); + var conditionalStart = $(this).closest(".form-row").prev().hasClass("conditional-start"); + if(! conditionalStart ) { + readyParameter($(icon)); + } }); // Augment hidden fields with icons. @@ -338,6 +341,7 @@ <% current_case = group_values['__current_case__'] %><% new_prefix = prefix + input.name + "|" %><% group_errors = errors.get( input.name, {} ) %> + <span class="conditional-start"></span> ${row_for_param( input.test_param, group_values[ input.test_param.name ], other_values, group_errors, prefix, step, already_used )} ${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, new_prefix, step, other_values, already_used )} %else: https://bitbucket.org/galaxy/galaxy-central/commits/53e3c7d4ed30/ Changeset: 53e3c7d4ed30 User: saketkc Date: 2014-01-21 03:58:28 Summary: Add a hack to collapse all steps onLoad Added a hack that causes all steps to collapse all steps on load. Personally, this causes the experience to be not so smooth and needs to be edited. Affected #: 1 file diff -r 3865362e2b338e5f859871c31563e3e8d34e9e9a -r 53e3c7d4ed30cb1cc5aaf7330a029a3616527633 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -229,6 +229,8 @@ }); return true; }); + // Hack to hide all steps onLoad + $("#hide_all_tool_body").trigger("click"); }); </script></%def> https://bitbucket.org/galaxy/galaxy-central/commits/f499fba4ebba/ Changeset: f499fba4ebba User: saketkc Date: 2014-01-21 04:05:23 Summary: Doc change, steps are 'collapsed' Affected #: 1 file diff -r 53e3c7d4ed30cb1cc5aaf7330a029a3616527633 -r f499fba4ebba6ea2df3eeae2a8bef38260256dd7 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -229,7 +229,7 @@ }); return true; }); - // Hack to hide all steps onLoad + // Hack to collapse all steps onLoad $("#hide_all_tool_body").trigger("click"); }); </script> https://bitbucket.org/galaxy/galaxy-central/commits/0e74bfbdbec4/ Changeset: 0e74bfbdbec4 User: saketkc Date: 2014-01-21 20:52:59 Summary: Add new class to distinguish runtime parameters, remove hack to collapse all steps Affected #: 1 file diff -r f499fba4ebba6ea2df3eeae2a8bef38260256dd7 -r 0e74bfbdbec4dde284de9c3b958afab9a964ab59 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -229,8 +229,8 @@ }); return true; }); - // Hack to collapse all steps onLoad - $("#hide_all_tool_body").trigger("click"); + // hide parameters that are not runtime inputs + $("div.toolFormBody:not(:has(.runtime-form-row))").hide().parent().css('border-bottom-width', '0px'); }); </script></%def> @@ -381,12 +381,16 @@ %> %if step.type == 'data_input': ##Input Dataset Step, wrap for multiinput. - <span class='multiinput_wrap'> - <input class="multi-mode" type="hidden" name="${str(step.id)}|multi_mode" id="${str(step.id)}|multi_mode" value="matched" /> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <span class="runtime-form-row"> + <span class='multiinput_wrap'> + <input class="multi-mode" type="hidden" name="${str(step.id)}|multi_mode" id="${str(step.id)}|multi_mode" value="matched" /> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + </span></span> %else: - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <span class="runtime-form-row"> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + </span> %endif <input type="hidden" name="${step.id}|__force_update__${prefix}${param.name}" value="true" /> @@ -406,8 +410,10 @@ if not enable_unique_defaults: del already_used[:] %> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} - <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> + <span class="runtime-form-row"> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> + </span> %else: <% p_text = param.value_to_display_text( value, app ) @@ -434,7 +440,6 @@ </span><i class="fa workflow-edit-button"></i> - <input type="hidden" name="fallback" class="fallback" value="${param.value_to_display_text( value, app )}"/></span></span> %endif https://bitbucket.org/galaxy/galaxy-central/commits/3938fbd2b9bb/ Changeset: 3938fbd2b9bb User: saketkc Date: 2014-01-21 22:50:39 Summary: Remove redundant code Affected #: 1 file diff -r 0e74bfbdbec4dde284de9c3b958afab9a964ab59 -r 3938fbd2b9bb740cd65f1895717e99f3209e8ea6 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -60,7 +60,7 @@ } else { // Collapse non-interactive run-workflow panels by default. - $("div.toolFormBody:not(:has(select, textarea, input[type!=hidden], .wfpspan))").hide().parent().css('border-bottom-width', '0px'); + $("div.toolFormBody:not(:has(.runtime-form-row))").hide().parent().css('border-bottom-width', '0px'); } $("#show_all_tool_body").click(function(){ $("div.toolFormTitle").each(function(){ @@ -229,8 +229,6 @@ }); return true; }); - // hide parameters that are not runtime inputs - $("div.toolFormBody:not(:has(.runtime-form-row))").hide().parent().css('border-bottom-width', '0px'); }); </script></%def> https://bitbucket.org/galaxy/galaxy-central/commits/01d48c2f45a5/ Changeset: 01d48c2f45a5 User: saketkc Date: 2014-01-21 22:55:23 Summary: Automated merge with ssh://bitbucket.org/galaxy/galaxy-central Affected #: 2 files diff -r 13114825942ff71c6dac143bba6ed31a7cb8d584 -r 01d48c2f45a5c7150b2fa277f2b9c697de510e6f templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -3,6 +3,9 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> + $.fn.outerHTML = function(s) { + return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); + }; $( function() { function show_tool_body(title){ title.parent().show().css('border-bottom-width', '1px'); @@ -57,7 +60,7 @@ } else { // Collapse non-interactive run-workflow panels by default. - $("div.toolFormBody:not(:has(select, textarea, input[type!=hidden], .wfpspan))").hide().parent().css('border-bottom-width', '0px'); + $("div.toolFormBody:not(:has(.runtime-form-row))").hide().parent().css('border-bottom-width', '0px'); } $("#show_all_tool_body").click(function(){ $("div.toolFormTitle").each(function(){ @@ -129,6 +132,55 @@ select.after(filter); select.width(new_width); }); + // Editable Workflow + + var readyParameter = function(icon) { + icon.attr("name", "edit"); + icon.attr('title', "Modify default value for this workflow parameter."); + icon.removeClass("workflow-edit-button-editing"); + icon.addClass("workflow-edit-button-ready"); + icon.addClass("fa-edit"); + icon.removeClass("fa-undo"); + }; + + var editingParameter = function(icon) { + icon.attr("name", "revert"); + icon.attr('title', "Restore workflow default value for this parameter."); + icon.addClass("workflow-edit-button-editing"); + icon.removeClass("workflow-edit-button-ready"); + icon.removeClass("fa-edit"); + icon.addClass("fa-undo"); + }; + + $(".workflow-edit-button").on("click",function(){ + var state = $(this).attr("name"); + var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); + var split_name=stepToolBox.attr("name").split("|"); + var step_id = split_name[0]; + var step_name = split_name[split_name.length-1]; + hidden_html = "<input type='hidden' name='"+step_id+"|__runtime__"+step_name+"' value='true' />"; + if (state === "edit"){ + stepToolBoxClone = stepToolBox.clone(); + stepToolBoxClone.attr({"name":step_id+"|"+step_name}); + stepToolBoxClone.show() + $(this).parent().find(".editable").show(); + $(this).parent().parent().find(".uneditable_field").hide(); + $(this).parent().find(".editable").html(stepToolBoxClone.outerHTML()+hidden_html); + editingParameter($(this)); + } + else{ + $(this).parent().find(".editable").hide(); + $(this).parent().parent().find(".uneditable_field").show(); + $(this).attr("name", "edit"); + stepToolBox.hide(); + readyParameter($(this)); + } + }).each(function(i, icon) { + var conditionalStart = $(this).closest(".form-row").prev().hasClass("conditional-start"); + if(! conditionalStart ) { + readyParameter($(icon)); + } + }); // Augment hidden fields with icons. // http://stackoverflow.com/a/2088430 @@ -217,6 +269,22 @@ .workflow-annotation { margin-bottom: 1em; } + .editable { + display: none; + } + + .workflow-edit-button-editing { + color: black; + } + + .workflow-edit-button-default { + color: Gray; + } + + .workflow-edit-button:hover { + color: green; // TODO: Use a history panel green. + } + </style></%def> @@ -273,6 +341,7 @@ <% current_case = group_values['__current_case__'] %><% new_prefix = prefix + input.name + "|" %><% group_errors = errors.get( input.name, {} ) %> + <span class="conditional-start"></span> ${row_for_param( input.test_param, group_values[ input.test_param.name ], other_values, group_errors, prefix, step, already_used )} ${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, new_prefix, step, other_values, already_used )} %else: @@ -310,12 +379,16 @@ %> %if step.type == 'data_input': ##Input Dataset Step, wrap for multiinput. - <span class='multiinput_wrap'> - <input class="multi-mode" type="hidden" name="${str(step.id)}|multi_mode" id="${str(step.id)}|multi_mode" value="matched" /> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <span class="runtime-form-row"> + <span class='multiinput_wrap'> + <input class="multi-mode" type="hidden" name="${str(step.id)}|multi_mode" id="${str(step.id)}|multi_mode" value="matched" /> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + </span></span> %else: - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <span class="runtime-form-row"> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + </span> %endif <input type="hidden" name="${step.id}|__force_update__${prefix}${param.name}" value="true" /> @@ -335,8 +408,10 @@ if not enable_unique_defaults: del already_used[:] %> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} - <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> + <span class="runtime-form-row"> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> + </span> %else: <% p_text = param.value_to_display_text( value, app ) @@ -353,7 +428,18 @@ <span class="p_text_wrapper">${p_text}</span><input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> %else: - ${param.value_to_display_text( value, app )} + <span class="workflow_parameters"> + <span class="uneditable_field"> + ${param.value_to_display_text( value, app )} + </span> + <span class="editable_field"> + <span class="editable"> + ${param.get_html_field( t, value, other_values).get_html( str(step.id) + "|" + "editable" + "|"+ prefix )} + </span> + + <i class="fa workflow-edit-button"></i> + </span> + </span> %endif %endif </div> https://bitbucket.org/galaxy/galaxy-central/commits/1547fc52588c/ Changeset: 1547fc52588c User: saketkc Date: 2014-01-21 23:46:28 Summary: wfpspan elements should be behave like runtime-form-row Affected #: 1 file diff -r 01d48c2f45a5c7150b2fa277f2b9c697de510e6f -r 1547fc52588c4085899ca51c2f890e14f539ff55 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -419,7 +419,7 @@ if isinstance(p_text, basestring): for rematch in re.findall('\$\{.+?\}', p_text): replacements.append('wf_parm__%s' % rematch[2:-1]) - p_text = p_text.replace(rematch, '<span style="background-color:%s" class="wfpspan wf_parm__%s">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1])) + p_text = p_text.replace(rematch, '<span style="background-color:%s" class="runtime-form-row wfpspan wf_parm__%s">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1])) %> %if replacements: <span style="display:none" class="parm_wrap ${' '.join(replacements)}"> https://bitbucket.org/galaxy/galaxy-central/commits/a29218d9f232/ Changeset: a29218d9f232 User: dannon Date: 2014-01-22 00:11:48 Summary: Merged in saketkc/galaxy-central-gsoc2013 (pull request #301) Add ability to edit workflows on the go Affected #: 2 files diff -r 75ba612879be9957502d46a4b243eaefee9a9d93 -r a29218d9f232c5e275b2dfe6e7d14d45102f4771 templates/webapps/galaxy/workflow/run.mako --- a/templates/webapps/galaxy/workflow/run.mako +++ b/templates/webapps/galaxy/workflow/run.mako @@ -3,6 +3,9 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> + $.fn.outerHTML = function(s) { + return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); + }; $( function() { function show_tool_body(title){ title.parent().show().css('border-bottom-width', '1px'); @@ -57,7 +60,7 @@ } else { // Collapse non-interactive run-workflow panels by default. - $("div.toolFormBody:not(:has(select, textarea, input[type!=hidden], .wfpspan))").hide().parent().css('border-bottom-width', '0px'); + $("div.toolFormBody:not(:has(.runtime-form-row))").hide().parent().css('border-bottom-width', '0px'); } $("#show_all_tool_body").click(function(){ $("div.toolFormTitle").each(function(){ @@ -129,6 +132,55 @@ select.after(filter); select.width(new_width); }); + // Editable Workflow + + var readyParameter = function(icon) { + icon.attr("name", "edit"); + icon.attr('title', "Modify default value for this workflow parameter."); + icon.removeClass("workflow-edit-button-editing"); + icon.addClass("workflow-edit-button-ready"); + icon.addClass("fa-edit"); + icon.removeClass("fa-undo"); + }; + + var editingParameter = function(icon) { + icon.attr("name", "revert"); + icon.attr('title', "Restore workflow default value for this parameter."); + icon.addClass("workflow-edit-button-editing"); + icon.removeClass("workflow-edit-button-ready"); + icon.removeClass("fa-edit"); + icon.addClass("fa-undo"); + }; + + $(".workflow-edit-button").on("click",function(){ + var state = $(this).attr("name"); + var stepToolBox = $(this).parent().find('input:not([class]), select:not([class])'); + var split_name=stepToolBox.attr("name").split("|"); + var step_id = split_name[0]; + var step_name = split_name[split_name.length-1]; + hidden_html = "<input type='hidden' name='"+step_id+"|__runtime__"+step_name+"' value='true' />"; + if (state === "edit"){ + stepToolBoxClone = stepToolBox.clone(); + stepToolBoxClone.attr({"name":step_id+"|"+step_name}); + stepToolBoxClone.show() + $(this).parent().find(".editable").show(); + $(this).parent().parent().find(".uneditable_field").hide(); + $(this).parent().find(".editable").html(stepToolBoxClone.outerHTML()+hidden_html); + editingParameter($(this)); + } + else{ + $(this).parent().find(".editable").hide(); + $(this).parent().parent().find(".uneditable_field").show(); + $(this).attr("name", "edit"); + stepToolBox.hide(); + readyParameter($(this)); + } + }).each(function(i, icon) { + var conditionalStart = $(this).closest(".form-row").prev().hasClass("conditional-start"); + if(! conditionalStart ) { + readyParameter($(icon)); + } + }); // Augment hidden fields with icons. // http://stackoverflow.com/a/2088430 @@ -217,6 +269,22 @@ .workflow-annotation { margin-bottom: 1em; } + .editable { + display: none; + } + + .workflow-edit-button-editing { + color: black; + } + + .workflow-edit-button-default { + color: Gray; + } + + .workflow-edit-button:hover { + color: green; // TODO: Use a history panel green. + } + </style></%def> @@ -273,6 +341,7 @@ <% current_case = group_values['__current_case__'] %><% new_prefix = prefix + input.name + "|" %><% group_errors = errors.get( input.name, {} ) %> + <span class="conditional-start"></span> ${row_for_param( input.test_param, group_values[ input.test_param.name ], other_values, group_errors, prefix, step, already_used )} ${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, new_prefix, step, other_values, already_used )} %else: @@ -310,12 +379,16 @@ %> %if step.type == 'data_input': ##Input Dataset Step, wrap for multiinput. - <span class='multiinput_wrap'> - <input class="multi-mode" type="hidden" name="${str(step.id)}|multi_mode" id="${str(step.id)}|multi_mode" value="matched" /> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <span class="runtime-form-row"> + <span class='multiinput_wrap'> + <input class="multi-mode" type="hidden" name="${str(step.id)}|multi_mode" id="${str(step.id)}|multi_mode" value="matched" /> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + </span></span> %else: - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <span class="runtime-form-row"> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + </span> %endif <input type="hidden" name="${step.id}|__force_update__${prefix}${param.name}" value="true" /> @@ -335,8 +408,10 @@ if not enable_unique_defaults: del already_used[:] %> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} - <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> + <span class="runtime-form-row"> + ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + <input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> + </span> %else: <% p_text = param.value_to_display_text( value, app ) @@ -344,7 +419,7 @@ if isinstance(p_text, basestring): for rematch in re.findall('\$\{.+?\}', p_text): replacements.append('wf_parm__%s' % rematch[2:-1]) - p_text = p_text.replace(rematch, '<span style="background-color:%s" class="wfpspan wf_parm__%s">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1])) + p_text = p_text.replace(rematch, '<span style="background-color:%s" class="runtime-form-row wfpspan wf_parm__%s">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1])) %> %if replacements: <span style="display:none" class="parm_wrap ${' '.join(replacements)}"> @@ -353,7 +428,18 @@ <span class="p_text_wrapper">${p_text}</span><input type="hidden" name="${step.id}|__runtime__${prefix}${param.name}" value="true" /> %else: - ${param.value_to_display_text( value, app )} + <span class="workflow_parameters"> + <span class="uneditable_field"> + ${param.value_to_display_text( value, app )} + </span> + <span class="editable_field"> + <span class="editable"> + ${param.get_html_field( t, value, other_values).get_html( str(step.id) + "|" + "editable" + "|"+ prefix )} + </span> + + <i class="fa workflow-edit-button"></i> + </span> + </span> %endif %endif </div> 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.
participants (1)
-
commits-noreply@bitbucket.org