diff --git a/app/assets/images/logos/life_monitor_logo_no_text.png b/app/assets/images/logos/life_monitor_logo_no_text.png new file mode 100644 index 0000000000..d7f323e91f Binary files /dev/null and b/app/assets/images/logos/life_monitor_logo_no_text.png differ diff --git a/app/assets/stylesheets/styles.scss b/app/assets/stylesheets/styles.scss index 77a93addd1..b530fe046c 100644 --- a/app/assets/stylesheets/styles.scss +++ b/app/assets/stylesheets/styles.scss @@ -781,3 +781,9 @@ div#super_tag_cloud { .disabled[data-tooltip] { pointer-events: inherit; } + +.lifemonitor-status { + .lifemonitor-logo { + height: 16px; + } +} \ No newline at end of file diff --git a/app/helpers/workflows_helper.rb b/app/helpers/workflows_helper.rb index d6de9a9493..3f37106371 100644 --- a/app/helpers/workflows_helper.rb +++ b/app/helpers/workflows_helper.rb @@ -41,7 +41,8 @@ def maturity_badge(level) class: "maturity-level label #{level == :released ? 'label-success' : 'label-warning'}") end - def test_status_badge(status) + def test_status_badge(resource) + status = resource.test_status case status when :all_passing label_class = 'label-success' @@ -56,7 +57,13 @@ def test_status_badge(status) label_class = 'label-default' label = t('test_status.not_available') end - content_tag(:span, "Tests: #{label}", class: "test-status label #{label_class}") + url = LifeMonitor::Rest::Client.status_page_url(resource) + link_to(url, class: 'lifemonitor-status btn btn-default', target: '_blank', rel: 'noopener', + 'data-tooltip' => 'Click to view in LifeMonitor') do + image('life_monitor_icon', class: 'icon lifemonitor-logo') + + 'Tests ' + + content_tag(:span, label, class: "test-status label #{label_class}") + end end def run_workflow_url(workflow_version) diff --git a/app/jobs/life_monitor_status_job.rb b/app/jobs/life_monitor_status_job.rb index 6d1b5c8920..a561634dfa 100644 --- a/app/jobs/life_monitor_status_job.rb +++ b/app/jobs/life_monitor_status_job.rb @@ -9,6 +9,7 @@ def perform(offset = 0) response['items'].each do |wf| workflow = Workflow.find_by_uuid(wf['uuid']) if workflow + Rails.cache.write("lifemonitor-results-#{workflow.cache_key}", { date: Time.now, response: wf }) wf['versions'].each do |wfv| workflow_version = workflow.find_version(wfv['version']) if workflow_version diff --git a/app/views/workflows/_resource_list_item.html.erb b/app/views/workflows/_resource_list_item.html.erb index bc3ef4075a..3a2bb6415c 100644 --- a/app/views/workflows/_resource_list_item.html.erb +++ b/app/views/workflows/_resource_list_item.html.erb @@ -4,7 +4,7 @@ <% end %> <% if resource.test_status %> - <%= test_status_badge(resource.test_status) %> + <%= test_status_badge(resource) %> <% end %> diff --git a/app/views/workflows/show.html.erb b/app/views/workflows/show.html.erb index 30e6e40962..39ef357533 100644 --- a/app/views/workflows/show.html.erb +++ b/app/views/workflows/show.html.erb @@ -21,7 +21,7 @@ <% end %> <% if @display_workflow.test_status %> - <%= test_status_badge(@display_workflow.test_status) %> + <%= test_status_badge(@display_workflow) %> <% end %> diff --git a/config/image_files/image_file_dictionary.yml b/config/image_files/image_file_dictionary.yml index 3ecdfe8b94..431edddf93 100644 --- a/config/image_files/image_file_dictionary.yml +++ b/config/image_files/image_file_dictionary.yml @@ -39,6 +39,7 @@ edit: 'famfamfam_silk/page_white_edit.png' edit_off: 'stop_edit.png' eosc-life-logo: 'logos/eosc-life.svg' elixir_aai_login: 'logos/elixir-aai-login-button-blue-small.png' +life_monitor_icon: 'logos/life_monitor_logo_no_text.png' ls_aai_login: 'logos/ls-login-small.png' embl: 'famfamfam_silk/script_go.png' endnote: 'famfamfam_silk/script_go.png' diff --git a/lib/life_monitor/rest/client.rb b/lib/life_monitor/rest/client.rb index dfb7325803..8f99e884ba 100644 --- a/lib/life_monitor/rest/client.rb +++ b/lib/life_monitor/rest/client.rb @@ -55,6 +55,10 @@ def list_workflows perform("/registries/current/workflows?status=true&versions=true", :get, content_type: :json) end + def self.status_page_url(workflow, base: Seek::Config.life_monitor_url) + URI.join(base, "/workflow;uuid=#{workflow.uuid}").to_s + end + private def perform(path, method, opts = {}) diff --git a/test/functional/workflows_controller_test.rb b/test/functional/workflows_controller_test.rb index baf696e5b1..b452baa3ea 100644 --- a/test/functional/workflows_controller_test.rb +++ b/test/functional/workflows_controller_test.rb @@ -1755,4 +1755,15 @@ def bad_generator.write_graph(struct) assert_response :success assert_select '#citation', text: /van der Real Person, O\. T\./, count: 1 end + + test 'display test status with link to LifeMonitor on show page' do + wf = FactoryBot.create(:public_workflow) + disable_authorization_checks do + wf.update_test_status(:all_passing, wf.version) + end + + get :show, params: { id: wf } + + assert_select 'a.lifemonitor-status[href=?]', "https://localhost:8443/workflow;uuid=#{wf.uuid}" + end end