Skip to content

Commit

Permalink
Fixed initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Sep 26, 2019
1 parent 4880607 commit b36dcc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/installation/clients/inst_complex_welcome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def available_base_products
raise "control.xml does not define any base products!" if @available_base_products.empty?
when :offline
url = InstURL.installInf2Url("")
@products = Y2Packager::ProductLocation.scan(url).select{|p| p.details&.base}.sort(&::Y2Packager::PRODUCT_SORTER)
log.info "Found base products on the offline medium: #{@products.pretty_inspect}"
@available_base_products = Y2Packager::ProductLocation.scan(url).select{|p| p.details&.base}.sort(&::Y2Packager::PRODUCT_SORTER)
log.info "Found base products on the offline medium: #{@available_base_products.pretty_inspect}"
else
@available_base_products = Y2Packager::Product.available_base_products
end
Expand Down
9 changes: 7 additions & 2 deletions src/lib/installation/widgets/product_selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProductSelector < CWM::RadioButtons
# @param skip_validation [Boolean] Skip value validation
def initialize(products, skip_validation: false)
@products = products
@items = products.map { |p| [item_id(p), p.label] }
@items = products.map { |p| [item_id(p), item_label(p)] }
@skip_validation = skip_validation
textdomain "installation"
end
Expand All @@ -34,7 +34,7 @@ def label
end

def init
selected = products.find(&:selected?)
selected = products.find{ |p| p.respond_to?(:selected?) && p.selected? }
disable if registered?
return unless selected

Expand Down Expand Up @@ -97,8 +97,13 @@ def registered?
end

def item_id(prod)
return prod.dir if prod.is_a?(Y2Packager::ProductLocation)
"#{prod.name}-#{prod.version}-#{prod.arch}"
end

def item_label(prod)
prod.is_a?(Y2Packager::ProductLocation) ? prod.summary : prod.label
end
end
end
end

0 comments on commit b36dcc6

Please sign in to comment.