Skip to content

Commit

Permalink
Merge pull request seek4science#1504 from seek4science/lifemonitor-br…
Browse files Browse the repository at this point in the history
…anding

LifeMonitor branding
  • Loading branch information
fbacall authored Jul 10, 2023
2 parents 9b33fe5 + e36f448 commit b8b62a7
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -781,3 +781,9 @@ div#super_tag_cloud {
.disabled[data-tooltip] {
pointer-events: inherit;
}

.lifemonitor-status {
.lifemonitor-logo {
height: 16px;
}
}
11 changes: 9 additions & 2 deletions app/helpers/workflows_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/life_monitor_status_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/workflows/_resource_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% end %>
<% if resource.test_status %>
<%= test_status_badge(resource.test_status) %>
<%= test_status_badge(resource) %>
<% end %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/workflows/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% end %>
<% if @display_workflow.test_status %>
<%= test_status_badge(@display_workflow.test_status) %>
<%= test_status_badge(@display_workflow) %>
<% end %>
</div>

Expand Down
1 change: 1 addition & 0 deletions config/image_files/image_file_dictionary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions lib/life_monitor/rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down
11 changes: 11 additions & 0 deletions test/functional/workflows_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b8b62a7

Please sign in to comment.