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 ...@@ -49,7 +49,7 @@ class WorkflowReportController < ApplicationController
WorkflowReport.build_report(params[:year].to_i, params[:month].to_i, project_ids) WorkflowReport.build_report(params[:year].to_i, params[:month].to_i, project_ids)
end end
respond_to do |format| 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
end end
......
- if result.present? - if result.present?
table[border="1"] table[border="1"]
tr.header_table--visible tr.header_table--visible
...@@ -32,3 +33,7 @@ ...@@ -32,3 +33,7 @@
td = result[i][index] td = result[i][index]
- else - else
h1.text-center There is no data for the 'workflow report' table. 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? %> <% if result.present? %>
$('button.export-button').removeClass('d-none') $('button.export-button').removeClass('d-none')
<% else %> <% else %>
......
#data_workflow { #data_workflow > table, #data_workflow > h1{
overflow: auto; overflow: auto;
height: 100vh; height: 100vh;
} }
...@@ -77,3 +77,8 @@ button.export-button { ...@@ -77,3 +77,8 @@ button.export-button {
#user_ids { #user_ids {
margin-right: 8px; margin-right: 8px;
} }
p.error_link{
padding: 4px 12px;
color: white;
}
...@@ -11,6 +11,7 @@ module WorkflowReport ...@@ -11,6 +11,7 @@ module WorkflowReport
class << self class << self
def build_report(year, month, project_ids) def build_report(year, month, project_ids)
github = Github.new oauth_token: $workflow_report_config['github_token'] github = Github.new oauth_token: $workflow_report_config['github_token']
error_links = []
result = TABLE_HEADER.length.times.map { [] } result = TABLE_HEADER.length.times.map { [] }
root_ids = WorkflowReportIssue.find_root_ids(year, month, project_ids) root_ids = WorkflowReportIssue.find_root_ids(year, month, project_ids)
return unless root_ids.length.positive? return unless root_ids.length.positive?
...@@ -57,9 +58,7 @@ module WorkflowReport ...@@ -57,9 +58,7 @@ module WorkflowReport
result[12] << number_of_est_changes result[12] << number_of_est_changes
result[13] << notes result[13] << notes
else else
result[11] << '' (11..13).each { |i| result[i] << '' }
result[12] << ''
result[13] << ''
end end
pull_request = '' pull_request = ''
jp_request = '' jp_request = ''
...@@ -105,7 +104,7 @@ module WorkflowReport ...@@ -105,7 +104,7 @@ module WorkflowReport
end end
rescue => e 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('') result[33].push('')
end end
else else
...@@ -132,7 +131,7 @@ module WorkflowReport ...@@ -132,7 +131,7 @@ module WorkflowReport
pr[:pr_changed_files] += pr_detail.changed_files pr[:pr_changed_files] += pr_detail.changed_files
end end
rescue => e rescue => e
p "Error in PR link #{link}" error_links << "Error occurred during the build with the PR link: #{link}"
end end
end end
end end
...@@ -141,7 +140,7 @@ module WorkflowReport ...@@ -141,7 +140,7 @@ module WorkflowReport
end end
end end
result { workflow_report: result, error_links: error_links }
end end
private 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