.row
  .col
    - if diff_not_cached
      .clearfix.mb-2.text-center
        .btn.btn-outline-primary.cache-refresh{ title: 'Refresh results', onclick: "loadChanges()" }
          Crunching the latest data. Refresh again in a few seconds
          %i.fas.fa-sync-alt{ id: "cache#0-reload" }
        = render partial: 'webui/shared/loading', locals: { text: 'Loading changes...', wrapper_css: ['loading', 'invisible'] }
    - else
      - @webui_sourcediff.each do |sourcediff|
        - if expandable?(sourcediff)
          .alert.alert-warning
            Some of the changes are collapsed due to size.
            = link_to(request_changes_path(@bs_request, @action, tarlimit: 0)) do
              Expand changes
        - source_rev = sourcediff.dig('new', 'srcmd5') || @action.source_rev
        - target_rev = sourcediff.dig('old', 'srcmd5')
        .clearfix.mb-2
          - if sourcediff['filenames'].present?
            .btn-group.float-end
              %button.btn.btn-outline-secondary.expand-diffs{ data: { object: @action.source_package } }
                Expand all
              %button.btn.btn-outline-secondary.collapse-diffs{ data: { object: @action.source_package } }
                Collapse all
          - else
            %p No source changes.

        - if sourcediff[:error]
          %p
            %i.error
              = sourcediff[:error]
        - else
          - if @webui_sourcediff.length > 1
            %h4
              #{diff_label(sourcediff['new'])} – #{diff_label(sourcediff['old'])}
          - if sourcediff['filenames'].present?
            = render(DiffListComponent.new(diff_list: diff_list(sourcediff), view_id: @action.source_package,
                                           commentable: commentable, commented_lines: @commented_lines,
                                           source_package: source_package, target_package: target_package,
                                           source_rev: source_rev, target_rev: target_rev))
