Skip to content

Commit

Permalink
[webui][api] Show kiwi packages list
Browse files Browse the repository at this point in the history
Add packages list for the package groups with `image` type and
`onlyRequired` pattern type to the Kiwi::Image show page.

Mob-programmed by @mdeniz, @DavidKang and @Ana06.
  • Loading branch information
Ana06 committed Jul 18, 2017
1 parent ce7f736 commit a91c611
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@
#kiwi_repository_update_form_save {
margin-left: 1em;
}

.kiwi_packages_table {
width: 98%
}
4 changes: 3 additions & 1 deletion src/api/app/models/kiwi/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Kiwi::Image < ApplicationRecord
#### Associations macros (Belongs to, Has one, Has many)
has_one :package, foreign_key: 'kiwi_image_id', class_name: '::Package', dependent: :nullify, inverse_of: :kiwi_image
has_many :repositories, -> { order(order: :asc) }, dependent: :destroy, index_errors: true
has_many :package_groups, dependent: :destroy, index_errors: true
has_many :package_groups, -> { order(:id) }, dependent: :destroy, index_errors: true
has_many :kiwi_packages, -> { where(kiwi_package_groups: { kiwi_type: Kiwi::PackageGroup.kiwi_types[:image], pattern_type: 'onlyRequired' }) },
through: :package_groups, source: :packages

#### Callbacks macros: before_save, after_save, etc.

Expand Down
8 changes: 8 additions & 0 deletions src/api/app/views/webui/kiwi/images/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@
- @image.repositories.each do |repository|
= render partial: 'repository_entry', locals: {repository: repository}
= button_to('Edit', edit_kiwi_image_path(@image), method: :get)

%h3 Packages
- if @image.kiwi_packages.empty?
%p There are no packages.
- else
%p
%strong
= @image.kiwi_packages.pluck(:name).join(', ')

0 comments on commit a91c611

Please sign in to comment.