app/lib/actions/pulp/repository/presenters/ostree_presenter.rb in katello-3.3.2 vs app/lib/actions/pulp/repository/presenters/ostree_presenter.rb in katello-3.4.0.rc1
- old
+ new
@@ -5,27 +5,40 @@
class OstreePresenter < AbstractSyncPresenter
def progress
return 0.01 unless task_progress_details
completion = 0.0
- completion += 0.4 if content_completed?(details("import_create_repository"))
- completion += 0.3 if content_completed?(details("import_pull"))
+ completion += 0.2 if content_completed?(details("import_create_repository"))
+
+ if content_completed?(details("import_pull"))
+ completion += 0.5
+ end
completion += 0.3 if content_completed?(details("import_add_unit"))
completion
end
private
+ def fetch_pull_ratio(content_details)
+ # looks like "details": "fetching 24980/46836 53%",
+ fetch_details_line = content_details["details"]
+ ret = "0"
+ if fetch_details_line[-1] == "%"
+ ret = fetch_details_line.split[-2] # "24980/46836"
+ end
+ ret
+ end
+
def humanized_details
ret = []
ret << _("Cancelled") if cancelled?
if pending?
ret << case current_step["step_type"]
when "import_create_repository"
_("Creating local repository")
when "import_pull"
- _("Pulling remote branches")
+ _("Pulling remote branches. Downloaded %s units." % fetch_pull_ratio(details("import_pull")))
when "import_add_unit"
_("Adding content units")
end
end