Skip to content

Commit

Permalink
Implement request diff for webui2 view
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Feb 1, 2019
1 parent 17a6f6b commit 8bd1c06
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 13 deletions.
@@ -1,5 +1,5 @@
.position-relative
= render partial: 'revision_diff_detail_buttons',
= render partial: 'webui2/webui/package/revision_diff_detail_buttons',
locals: { project: project,
package: package,
filename: filename,
Expand Down
41 changes: 41 additions & 0 deletions src/api/app/views/webui2/webui/request/_sourcediff_tab.html.haml
@@ -0,0 +1,41 @@
.row
.col
%b
= request_action_header(action, request_creator)
- if action[:type] == :maintenance_incident && action[:releaseproject]
%i
Release in #{action[:releaseproject]}
%hr
.row
- (action[:sourcediff] || []).each do |sourcediff|
.col-md-8
- if sourcediff[:error]
%p
%i.error
= sourcediff[:error]
- else
- if action[:sourcediff].length > 1
%h4
#{diff_label(sourcediff['new'])} – #{diff_label(sourcediff['old'])}
- files = sourcediff['files']
- diff = diff_data(action[:type], sourcediff)
- if sourcediff['filenames'].present?
- sourcediff['filenames'].each_with_index do |filename, file_index|
.mb-2
= render partial: 'webui2/webui/package/revision_diff_detail',
locals: { project: diff[:project],
package: diff[:package],
filename: filename,
file: files[filename],
diff_content: files[filename].dig('diff', '_content'),
revision: diff[:rev],
index: file_index,
last: sourcediff['filenames'].last == filename }
- else
.mb-2
%p.lead
No source changes.
.col-md-4
= render partial: 'webui2/shared/buildresult_box', locals: { project: action[:sprj], package: action[:spkg], index: index }
- if sourcediff['issues'].present?
= render partial: 'issues_table', locals: { issues: sourcediff['issues'] }
28 changes: 16 additions & 12 deletions src/api/app/views/webui2/webui/request/show.html.haml
@@ -1,23 +1,27 @@
- content_for(:content_for_head, javascript_include_tag('webui2/cm2/index-diff'))

- if @not_full_diff
= render partial: 'webui2/shared/truncated_diff_hint',
locals: { path: request_show_path(number: @number, full_diff: true) }

.card.mb-3
.card-header.d-flex.justify-content-between
%h5
Overview
.card-body
-# description content
.card.mb-3
.card-header.d-flex.justify-content-between
%h5
Diff
.bg-light
%ul.nav.nav-tabs{ role: 'tablist' }
- @actions.each_with_index do |action, index|
%li.nav-item
= link_to(action[:name], "##{valid_xml_id(action[:name])}", class: "nav-link text-nowrap #{('active' if index.zero?)}",
data: { toggle: 'tab' }, role: 'tab')
.card-body
- @actions.each_with_index do |action, action_index|
- action[:sourcediff].each do |sourcediff|
.row
.col-md-8
Diff content
.col-md-4
= render partial: 'webui2/shared/buildresult_box', locals: { project: action[:sprj], package: action[:spkg], index: action_index }
- if sourcediff['issues'].present?
= render partial: 'issues_table', locals: { issues: sourcediff['issues'] }
.tab-content
- @actions.each_with_index do |action, index|
.tab-pane.fade.show{ id: valid_xml_id(action[:name]), class: ('active' if index.zero?) }
= render('sourcediff_tab', action: action, request_creator: @bs_request.creator, index: index)
.row
.col-md-8
.card
Expand Down

0 comments on commit 8bd1c06

Please sign in to comment.