diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
commit | 3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 (patch) | |
tree | 3bc4a40e0ee51ec27eabf917c537033c0c5b14d4 /app/views/projects/branches/_branch.html.haml | |
parent | 9bba14be3f2c211bf79e15769cd9b77bc73a13bc (diff) |
Add latest changes from gitlab-org/gitlab@16-1-stable-eev16.1.0-rc42
Diffstat (limited to 'app/views/projects/branches/_branch.html.haml')
-rw-r--r-- | app/views/projects/branches/_branch.html.haml | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index dbc1fe24d96..adff64fad5a 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -1,51 +1,62 @@ - merged = local_assigns.fetch(:merged, false) - commit = @repository.commit(branch.dereferenced_target) -- merge_project = merge_request_source_project_for_project(@project) -%li{ class: "branch-item gl-py-3! js-branch-item js-branch-#{branch.name}", data: { name: branch.name, qa_selector: 'branch_container', qa_name: branch.name } } - .branch-item-content.gl-display-flex.gl-align-items-center.gl-px-3.gl-py-2 - .branch-info - .gl-display-flex.gl-align-items-center - = sprite_icon('branch', size: 12, css_class: 'gl-flex-shrink-0') - = link_to project_tree_path(@project, branch.name), class: 'item-title str-truncated-100 ref-name gl-ml-3', data: { qa_selector: 'branch_link' } do - = branch.name - = clipboard_button(text: branch.name, title: _("Copy branch name")) - - if branch.name == @repository.root_ref - = gl_badge_tag s_('DefaultBranchLabel|default'), { variant: :info, size: :sm }, { class: 'gl-ml-2', data: { qa_selector: 'badge_content' } } - - elsif merged - = gl_badge_tag s_('Branches|merged'), { variant: :info, size: :sm }, { class: 'gl-ml-2', title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref }, data: { toggle: 'tooltip', container: 'body', qa_selector: 'badge_content' } } - - if protected_branch?(@project, branch) - = gl_badge_tag s_('Branches|protected'), { variant: :success, size: :sm }, { class: 'gl-ml-2', data: { qa_selector: 'badge_content' } } - - = render_if_exists 'projects/branches/diverged_from_upstream', branch: branch - - .block-truncated - - if commit - = render 'projects/branches/commit', commit: commit, project: @project - - else - = s_('Branches|Can’t find HEAD commit for this branch') - - - if branch.name != @repository.root_ref - .js-branch-divergence-graph - - .controls.d-none.d-md-block< - - if commit_status - = render 'ci/status/icon', size: 24, status: commit_status, option_css_classes: 'gl-display-inline-flex gl-vertical-align-middle gl-mr-5' - - elsif show_commit_status - .gl-display-inline-flex.gl-vertical-align-middle.gl-mr-5 - %svg.s24 - - - if merge_project && create_mr_button?(from: branch.name, source_project: @project) - = render Pajamas::ButtonComponent.new(href: create_mr_path(from: branch.name, source_project: @project)) do - = _('Merge request') - - - if branch.name != @repository.root_ref - = link_to project_compare_index_path(@project, from: @repository.root_ref, to: branch.name), - class: "gl-button btn btn-default js-onboarding-compare-branches #{'gl-ml-3' unless merge_project}", - method: :post, - title: s_('Branches|Compare') do - = s_('Branches|Compare') - - = render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name], class: 'gl-vertical-align-top' - - - if can?(current_user, :push_code, @project) - = render 'projects/branches/delete_branch_modal_button', project: @project, branch: branch, merged: merged +- related_merge_request = @related_merge_requests[branch.name]&.first +- mr_status = merge_request_status(related_merge_request) +- is_default_branch = branch.name == @repository.root_ref + +%li{ class: "branch-item gl-display-flex! gl-align-items-center! js-branch-item js-branch-#{branch.name} gl-pl-3!", data: { name: branch.name, qa_selector: 'branch_container', qa_name: branch.name } } + .branch-info + .gl-display-flex.gl-align-items-center + = link_to project_tree_path(@project, branch.name), class: 'item-title str-truncated-100 ref-name', data: { qa_selector: 'branch_link' } do + = branch.name + = clipboard_button(text: branch.name, title: _("Copy branch name")) + - if is_default_branch + = gl_badge_tag s_('DefaultBranchLabel|default'), { variant: :neutral, size: :sm }, { class: 'gl-ml-2', data: { qa_selector: 'badge_content' } } + - if protected_branch?(@project, branch) + = gl_badge_tag s_('Branches|protected'), { variant: :muted, size: :sm }, { class: 'gl-ml-2', data: { qa_selector: 'badge_content' } } + + = render_if_exists 'projects/branches/diverged_from_upstream', branch: branch + + .block-truncated + - if commit + = render 'projects/branches/commit', commit: commit, project: @project + - else + = s_('Branches|Can’t find HEAD commit for this branch') + + - if branch.name != @repository.root_ref + .js-branch-divergence-graph + + .pipeline-status.d-none.d-md-block< + - if commit_status + = render 'ci/status/icon', size: 16, status: commit_status, option_css_classes: 'gl-display-inline-flex gl-vertical-align-middle gl-mr-5' + - elsif show_commit_status + .gl-display-inline-flex.gl-vertical-align-middle.gl-mr-5 + %svg.s16 + + + - if mr_status.present? + .issuable-reference.gl-display-flex.gl-justify-content-end.gl-min-w-10.gl-ml-5.gl-mr-4 + = gl_badge_tag issuable_reference(related_merge_request), + { icon: mr_status[:icon], variant: mr_status[:variant], size: :md, href: merge_request_path(related_merge_request) }, + { class: 'gl-mr-2', title: mr_status[:title], data: { toggle: 'tooltip', container: 'body', qa_selector: 'badge_content' } } + + .controls.d-none.d-md-block< + - if mr_status.nil? && create_mr_button?(from: branch.name, source_project: @project) + = render Pajamas::ButtonComponent.new(icon: 'merge-request', href: create_mr_path(from: branch.name, source_project: @project), button_options: { class: 'has-tooltip gl-mr-2!', title: _('New merge request') }) do + = _('New') + + = render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name], css_class: 'gl-mr-1!' + + - if !is_default_branch + .js-branch-more-actions{ data: { + branch_name: branch.name, + default_branch_name: @repository.root_ref, + can_delete_branch: user_access(@project).can_delete_branch?(branch.name).to_s, + is_protected_branch: protected_branch?(@project, branch).to_s, + merged: merged.to_s, + compare_path: project_compare_index_path(@project, from: @repository.root_ref, to: branch.name), + delete_path: project_branch_path(@project, branch.name), + } } + - else + .gl-display-inline-flex.gl-w-7 + |