Skip to content

Commit

Permalink
Merge pull request #6396 from krauselukas/feature/boostrap/package_list
Browse files Browse the repository at this point in the history
Migrate project package table to bootstrap.
  • Loading branch information
krauselukas authored Dec 4, 2018
2 parents 4584b12 + 94aad6a commit c03b493
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/api/app/helpers/webui/project_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,12 @@ def escape_list(list)
"']".html_safe
end.join(',').html_safe
end

def show_package_actions?
return false if @is_maintenance_project
return false if @project.defines_remote_instance?
return true unless @is_incident_project && @packages.present? &&
@has_patchinfo && @open_release_requests.empty?
false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.card-body
- if inherited_packages.present?
.obs-dataTable
%table.table.table-fixed.table-striped.table-bordered#inherited-packages-table
%thead
%tr
%th.w-75 Name
%th From
%tbody
- inherited_packages.each do |package|
%tr
%td
= link_to(package.first, package_show_path(package: package.first, project: package.second))
%td
= package.second
30 changes: 30 additions & 0 deletions src/api/app/views/webui2/webui/project/_project_packages.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.card-body
- if packages.present?
.obs-dataTable
%table.table.table-fixed.table-striped.table-bordered#packages-table
%thead
%tr
%th.w-75 Name
%th.w-25 Changed
%tbody
- packages.each do |package|
%tr
%td
= link_to(package.first, package_show_path(package: package.first, project: project))
%td
= time_ago_in_words(Time.at(package.second.to_i))
- else
%p This project does not contain any packages

- if User.current.can_modify?(project)
- if show_package_actions?
.pt-4
%ul.list-inline
%li.list-inline-item
= link_to(project_new_package_path(project: project)) do
%i.fas.fa-plus-circle.text-primary
Create package
%li.list-inline-item
= link_to(project_new_package_branch_path(project: project)) do
%i.fas.fa-code-branch.text-primary
Branch existing package
27 changes: 20 additions & 7 deletions src/api/app/views/webui2/webui/project/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,26 @@
= render partial: 'webui2/shared/buildresult_box', locals: { project: @project.name }
.list
.card
%h5.card-header
Packages
= "(#{@packages.length})"
= render partial: 'project_packages'
.bg-light
%ul.nav.nav-tabs.pt-2.px-3.flex-nowrap#packages-tabs{ role: 'tablist' }
%li.nav-item
%a.nav-link.active#packages-tab{ href: '#packages', role: 'tab', data: { toggle: 'tab' },
aria: { controls: 'packages', selected: 'true' } }
Packages (#{@packages.length})
- if @ipackages.present?
%li.nav-item
%a.nav-link#inherited-packages-tab{ href: '#inherited-packages', role: 'tab', data: { toggle: 'tab' },
aria: { controls: 'inherited-packages', selected: 'false' } }
Inherited Packages (#{@ipackages.length})
.tab-content#packages-tabs-content
.tab-pane.fade.show.active#packages{ role: 'tabpanel', aria: { labelledby: 'packages-tab' } }
= render partial: 'project_packages', locals: { project: @project, packages: @packages }
.tab-pane.fade#inherited-packages{ role: 'tabpanel', aria: { labelledby: 'inherited-packages-tab' } }
= render partial: 'project_inherited_packages', locals: { inherited_packages: @ipackages }
.comments
.card
%h5.card-header
Comments for
= @project
(#{ @comments.length})
Comments for #{@project} (#{@comments.length})
.card-body#comments
= render partial: 'webui2/webui/comment/show', locals: { commentable: @project }

Expand All @@ -67,3 +77,6 @@
- elsif [email protected]_locked?
= render partial: 'webui2/webui/request/add_role_request_dialog', locals: { project: @project }
= render partial: 'webui2/webui/request/delete_request_dialog', locals: { project: @project }

= content_for :ready_function do
initializeDataTable('#packages-table, #inherited-packages-table');
2 changes: 1 addition & 1 deletion src/api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def self.public_or_about_path?(request)
get 'project/attributes/:project', to: redirect('/attribs/%{project}'), constraints: cons
post 'project/new_incident' => :new_incident
get 'project/new_package/:project' => :new_package, constraints: cons, as: 'project_new_package'
get 'project/new_package_branch/:project' => :new_package_branch, constraints: cons
get 'project/new_package_branch/:project' => :new_package_branch, constraints: cons, as: 'project_new_package_branch'
get 'project/incident_request_dialog' => :incident_request_dialog
post 'project/new_incident_request' => :new_incident_request
get 'project/release_request_dialog' => :release_request_dialog
Expand Down

0 comments on commit c03b493

Please sign in to comment.