From: Tom Clegg Date: Wed, 5 Jul 2017 15:39:13 +0000 (-0400) Subject: Merge branch '8784-dir-listings' X-Git-Tag: 1.1.0~155 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/0eb72b526bf8bbb011551ecf019f604e17a534f1?hp=-c Merge branch '8784-dir-listings' refs #8784 Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- 0eb72b526bf8bbb011551ecf019f604e17a534f1 diff --combined apps/workbench/app/controllers/collections_controller.rb index 99065947b8,625a6a8f61..f8fcf5108f --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@@ -1,7 -1,3 +1,7 @@@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require "arvados/keep" require "arvados/collection" require "uri" @@@ -24,7 -20,7 +24,7 @@@ class CollectionsController < Applicati RELATION_LIMIT = 5 def show_pane_list - panes = %w(Files Upload Provenance_graph Used_by Advanced) + panes = %w(Files Upload Tags Provenance_graph Used_by Advanced) panes = panes - %w(Upload) unless (@object.editable? rescue false) panes end @@@ -115,6 -111,10 +115,10 @@@ end def show_file_links + if Rails.configuration.keep_web_url || Rails.configuration.keep_web_download_url + # show_file will redirect to keep-web's directory listing + return show_file + end Thread.current[:reader_tokens] = [params[:reader_token]] return if false.equal?(find_object_by_uuid) render layout: false @@@ -283,7 -283,12 +287,12 @@@ helper_method :download_link def download_link - collections_url + "/download/#{@object.uuid}/#{@search_sharing.first.api_token}/" + token = @search_sharing.first.api_token + if Rails.configuration.keep_web_url || Rails.configuration.keep_web_download_url + keep_web_url(@object.uuid, nil, {path_token: token}) + else + collections_url + "/download/#{@object.uuid}/#{token}/" + end end def share @@@ -349,30 -354,6 +358,30 @@@ end end + def tags + render + end + + def save_tags + tags_param = params['tag_data'] + if tags_param + if tags_param.is_a?(String) && tags_param == "empty" + tags = {} + else + tags = tags_param + end + end + + if tags + if @object.update_attributes properties: tags + @saved_tags = true + render + else + self.render_error status: 422 + end + end + end + protected def find_usable_token(token_list) @@@ -444,7 -425,7 +453,7 @@@ uri.path += 't=' + opts[:path_token] + '/' end uri.path += '_/' - uri.path += URI.escape(file) + uri.path += URI.escape(file) if file query = Hash[URI.decode_www_form(uri.query || '')] { query_token: 'api_token', diff --combined apps/workbench/test/integration/collection_upload_test.rb index e54a5c2185,f2a638f316..608cd521de --- a/apps/workbench/test/integration/collection_upload_test.rb +++ b/apps/workbench/test/integration/collection_upload_test.rb @@@ -1,7 -1,3 +1,7 @@@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'integration_helper' class CollectionUploadTest < ActionDispatch::IntegrationTest @@@ -96,11 -92,11 +96,11 @@@ test "Report network error" do need_selenium "to make file uploads work" use_token :admin do - # Even if you somehow do port>2^16, surely nx.example.net won't + # Even if port 0 is a thing, surely nx.example.net won't # respond KeepService.where(service_type: 'proxy').first. update_attributes(service_host: 'nx.example.net', - service_port: 99999) + service_port: 0) end visit page_with_token 'active', sandbox_path diff --combined apps/workbench/test/integration/download_test.rb index 37faef9c3d,1098240c96..407458b62b --- a/apps/workbench/test/integration/download_test.rb +++ b/apps/workbench/test/integration/download_test.rb @@@ -1,13 -1,11 +1,15 @@@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'integration_helper' require 'helpers/download_helper' class DownloadTest < ActionDispatch::IntegrationTest include KeepWebConfig + @@wrote_test_data = false + setup do use_keep_web_config @@@ -17,10 -15,13 +19,13 @@@ # Keep data isn't populated by fixtures, so we have to write any # data we expect to read. - ['foo', 'w a z', "Hello world\n"].each do |data| - md5 = `echo -n #{data.shellescape} | arv-put --no-progress --raw -` - assert_match /^#{Digest::MD5.hexdigest(data)}/, md5 - assert $?.success?, $? + if !@@wrote_test_data + ['foo', 'w a z', "Hello world\n"].each do |data| + md5 = `echo -n #{data.shellescape} | arv-put --no-progress --raw -` + assert_match /^#{Digest::MD5.hexdigest(data)}/, md5 + assert $?.success?, $? + end + @@wrote_test_data = true end end @@@ -29,7 -30,7 +34,7 @@@ uuid_or_pdh = api_fixture('collections')['foo_file'][id_type] token = api_fixture('api_client_authorizations')['active_all_collections']['api_token'] visit "/collections/download/#{uuid_or_pdh}/#{token}/" - within "#collection_files" do + within 'ul' do click_link 'foo' end assert_no_selector 'a' diff --combined sdk/python/tests/run_test_server.py index f571bdbfdd,8a8f7ad577..57efb97c48 --- a/sdk/python/tests/run_test_server.py +++ b/sdk/python/tests/run_test_server.py @@@ -1,7 -1,3 +1,7 @@@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + from __future__ import print_function from __future__ import division from builtins import str @@@ -497,14 -493,15 +497,15 @@@ def run_keep(blob_signing_key=None, enf 'keep_disk': {'keep_service_uuid': svc['uuid'] } }).execute() - # If keepproxy is running, send SIGHUP to make it discover the new - # keepstore services. - proxypidfile = _pidfile('keepproxy') - if os.path.exists(proxypidfile): - try: - os.kill(int(open(proxypidfile).read()), signal.SIGHUP) - except OSError: - os.remove(proxypidfile) + # If keepproxy and/or keep-web is running, send SIGHUP to make + # them discover the new keepstore services. + for svc in ('keepproxy', 'keep-web'): + pidfile = _pidfile('keepproxy') + if os.path.exists(pidfile): + try: + os.kill(int(open(pidfile).read()), signal.SIGHUP) + except OSError: + os.remove(pidfile) def _stop_keep(n): kill_server_pid(_pidfile('keep{}'.format(n)))