Skip to content

Commit

Permalink
Show the Workflow run's scm status reports
Browse files Browse the repository at this point in the history
We need to create a new tab to collect the SCM responses when we send the
status reports.
  • Loading branch information
danidoni committed May 30, 2022
1 parent 3b8aeb2 commit 03b986d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/api/app/components/workflow_run_detail_component.html.haml
Expand Up @@ -3,6 +3,10 @@
%a.nav-link.active{ id: "incoming-webhook-tab#{id}", data: { toggle: 'tab' }, href: "#incoming-webhook-tab-content#{id}",
role: 'tab', aria: { controls: "incoming-webhook-tab-content#{id}", selected: 'true' } }
Webhook from #{scm_vendor}
%li.nav-item{ role: 'presentation' }
%a.nav-link{ id: "scm-reports-tab#{id}", data: { toggle: 'tab' }, href: "#scm-reports-tab-content#{id}",
role: 'tab', aria: { controls: "scm-reports-tab-content#{id}", selected: 'false' } }
Reports to the SCM
%li.nav-item{ role: 'presentation' }
%a.nav-link{ id: "artifacts#{id}", data: { toggle: 'tab' }, href: "#artifacts-tab-content#{id}",
role: 'tab', aria: { controls: "artifacts-tab-content#{id}", selected: 'false' } }
Expand All @@ -22,6 +26,24 @@
%h5 Webhook Request Payload
%pre.border.p-2#request-payload
= pretty_request_payload
.tab-pane.fade{ id: "scm-reports-tab-content#{id}", role: 'tabpanel',
aria: { labelledby: "scm-reports-tab#{id}" } }
- if status_reports.any?
.list-group.list-group-flush
- status_reports.each do |status_report|
.list-group-item
%h6 Response body
%p
%span.badge{ class: status_report.status_class }= status_report.status&.humanize
%pre.border.p-2#status-report-response-body
= status_report.response_body
%h6 Request parameters
%pre.border.p-2#status-report-request-parameters
= status_report.pretty_request_parameters
%small.text-nowrap{ title: l(status_report.created_at.utc) }
Sent #{time_ago_in_words(status_report.created_at)} ago
- else
No status reports
.tab-pane.fade{ id: "artifacts-tab-content#{id}", role: 'tabpanel',
aria: { labelledby: "artifacts#{id}" } }
%h5 Artifacts
Expand Down
3 changes: 2 additions & 1 deletion src/api/app/components/workflow_run_detail_component.rb
@@ -1,7 +1,7 @@
class WorkflowRunDetailComponent < ApplicationComponent
attr_reader :id, :request_headers, :pretty_request_payload,
:response_url, :response_body, :artifacts,
:scm_vendor
:scm_vendor, :status_reports

def initialize(workflow_run:)
super
Expand All @@ -12,6 +12,7 @@ def initialize(workflow_run:)
@response_body = workflow_run.response_body
@artifacts = workflow_run.artifacts # collection of WorkflowArtifactsPerStep
@scm_vendor = workflow_run.scm_vendor.to_s.humanize
@status_reports = workflow_run.scm_status_reports
end

private
Expand Down

0 comments on commit 03b986d

Please sign in to comment.