Commit 90cbc8e7 by Tấn Trần Thanh

Show error link in view

parent a81ca957
Pipeline #1595 canceled with stages
in 0 seconds
......@@ -49,7 +49,7 @@ class WorkflowReportController < ApplicationController
WorkflowReport.build_report(params[:year].to_i, params[:month].to_i, project_ids)
end
respond_to do |format|
format.js { render 'build_table', locals: { result: result, thead: TABLE_HEADER } }
format.js { render 'build_table', locals: { result: result[:workflow_report], error_links: result[:error_links], thead: TABLE_HEADER } }
end
end
......
- if result.present?
table[border="1"]
tr.header_table--visible
......@@ -32,3 +33,7 @@
td = result[i][index]
- else
h1.text-center There is no data for the 'workflow report' table.
.mt-10
- if error_links.present?
- error_links.each do |link|
p.red.error_link = link
$("#data_workflow").html("<%= escape_javascript(render partial: 'table_workflow_report', locals: { result: result, thead: thead } ) %>")
$("#data_workflow").html("<%= escape_javascript(render partial: 'table_workflow_report', locals: { result: result ,error_links: error_links ,thead: thead } ) %>")
<% if result.present? %>
$('button.export-button').removeClass('d-none')
<% else %>
......
#data_workflow {
#data_workflow > table, #data_workflow > h1{
overflow: auto;
height: 100vh;
}
......@@ -77,3 +77,8 @@ button.export-button {
#user_ids {
margin-right: 8px;
}
p.error_link{
padding: 4px 12px;
color: white;
}
......@@ -11,6 +11,7 @@ module WorkflowReport
class << self
def build_report(year, month, project_ids)
github = Github.new oauth_token: $workflow_report_config['github_token']
error_links = []
result = TABLE_HEADER.length.times.map { [] }
root_ids = WorkflowReportIssue.find_root_ids(year, month, project_ids)
return unless root_ids.length.positive?
......@@ -57,9 +58,7 @@ module WorkflowReport
result[12] << number_of_est_changes
result[13] << notes
else
result[11] << ''
result[12] << ''
result[13] << ''
(11..13).each { |i| result[i] << '' }
end
pull_request = ''
jp_request = ''
......@@ -105,7 +104,7 @@ module WorkflowReport
end
rescue => e
p "Error in ISSUE link #{jp_request}"
error_links << "Error occurred during the build with the ISSUE link: #{jp_request}"
result[33].push('')
end
else
......@@ -132,7 +131,7 @@ module WorkflowReport
pr[:pr_changed_files] += pr_detail.changed_files
end
rescue => e
p "Error in PR link #{link}"
error_links << "Error occurred during the build with the PR link: #{link}"
end
end
end
......@@ -141,7 +140,7 @@ module WorkflowReport
end
end
result
{ workflow_report: result, error_links: error_links }
end
private
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment