-
Notifications
You must be signed in to change notification settings - Fork 303
Fixes #38901 - Refactor sync status page with React #11565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jeremylenz
wants to merge
14
commits into
Katello:master
Choose a base branch
from
jeremylenz:38901-sync-status-react
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,070
−218
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5a0650e
Fixes #38901 - Redesign sync status page with React
jeremylenz d0459c5
Refs #38901 - Add redirect and improve test coverage
jeremylenz 1eba675
Refs #38901 - Fix test failures by removing unsupported ouiaId props
jeremylenz 4ec2ac3
Refs #38901 - Implement UX review feedback for sync status page
jeremylenz d864fde
Refs #38901 - Update tests for UX review changes
jeremylenz d006f78
Refs #38901 - Address AI code review feedback
jeremylenz ffd34f2
Refs #38901 - Improve sync status UX and checkbox handling
jeremylenz d3bdd3d
Refs #38901 - Fix progress bar overflow in Firefox
jeremylenz e48c357
Refs #38901 - Fix sync status error tooltips
jeremylenz 03e7db9
Refs #38901 - Use Patternfly z-index variables for sticky elements
jeremylenz f90b44e
Refs #38901 - Fix test failures in sync_management_helper_spec
jeremylenz 0a33fa0
Refs #38901 - Remove obsolete sync_management controller and fix perm…
jeremylenz 7a19bb5
Refs #38901 - Fix SelectAllCheckbox dropdown z-index
jeremylenz 217646d
Refs #38901 - Use RABL templates for sync_status controller
jeremylenz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| module Katello | ||
| class Api::V2::SyncStatusController < Api::V2::ApiController | ||
| include SyncManagementHelper::RepoMethods | ||
|
|
||
| before_action :find_optional_organization, :only => [:index, :poll, :sync] | ||
| before_action :find_repository, :only => [:destroy] | ||
|
|
||
| api :GET, "/sync_status", N_("Get sync status for all repositories in an organization") | ||
| param :organization_id, :number, :desc => N_("ID of an organization"), :required => false | ||
| def index | ||
| org = @organization || current_organization_object | ||
| fail HttpErrors::NotFound, _("Organization required") if org.nil? | ||
|
|
||
| products = org.library.products.readable | ||
| redhat_products, custom_products = products.partition(&:redhat?) | ||
| redhat_products.sort_by! { |p| p.name.downcase } | ||
| custom_products.sort_by! { |p| p.name.downcase } | ||
|
|
||
| sorted_products = redhat_products + custom_products | ||
|
|
||
| @product_tree = collect_repos(sorted_products, org.library, false) | ||
|
|
||
| # Filter out products and intermediate nodes with no repositories | ||
| @product_tree = filter_empty_nodes(@product_tree) | ||
|
|
||
| @repo_statuses = collect_all_repo_statuses(sorted_products, org.library) | ||
|
|
||
| respond_for_index(:collection => {:products => @product_tree, :repo_statuses => @repo_statuses}) | ||
| end | ||
|
|
||
| api :GET, "/sync_status/poll", N_("Poll sync status for specified repositories") | ||
| param :repository_ids, Array, :desc => N_("List of repository IDs to poll"), :required => true | ||
| param :organization_id, :number, :desc => N_("ID of an organization"), :required => false | ||
| def poll | ||
| repos = Repository.where(:id => params[:repository_ids]).readable | ||
| statuses = repos.map { |repo| format_sync_progress(repo) } | ||
|
|
||
| respond_for_index(:collection => statuses) | ||
| end | ||
|
|
||
| api :POST, "/sync_status/sync", N_("Synchronize repositories") | ||
| param :repository_ids, Array, :desc => N_("List of repository IDs to sync"), :required => true | ||
| param :organization_id, :number, :desc => N_("ID of an organization"), :required => false | ||
| def sync | ||
| collected = [] | ||
| repos = Repository.where(:id => params[:repository_ids]).syncable | ||
|
|
||
| repos.each do |repo| | ||
| if latest_task(repo).try(:state) != 'running' | ||
| ForemanTasks.async_task(::Actions::Katello::Repository::Sync, repo) | ||
| end | ||
| collected << format_sync_progress(repo) | ||
| end | ||
|
|
||
| respond_for_index(:collection => collected) | ||
| end | ||
|
|
||
| api :DELETE, "/sync_status/:id", N_("Cancel repository synchronization") | ||
| param :id, :number, :desc => N_("Repository ID"), :required => true | ||
| def destroy | ||
| @repository.cancel_dynflow_sync | ||
| render :json => {:message => _("Sync canceled")} | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def find_repository | ||
| @repository = Repository.where(:id => params[:id]).syncable.first | ||
| fail HttpErrors::NotFound, _("Repository not found or not syncable") if @repository.nil? | ||
| end | ||
|
|
||
| def format_sync_progress(repo) | ||
| ::Katello::SyncStatusPresenter.new(repo, latest_task(repo)).sync_progress | ||
| end | ||
|
|
||
| def latest_task(repo) | ||
| repo.latest_dynflow_sync | ||
| end | ||
|
|
||
| def collect_all_repo_statuses(products, env) | ||
| statuses = {} | ||
| products.each do |product| | ||
| product.repos(env).each do |repo| | ||
| statuses[repo.id] = format_sync_progress(repo) | ||
| end | ||
| end | ||
| statuses | ||
| end | ||
| end | ||
| end |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| object false | ||
|
|
||
| node :products do | ||
| @product_tree | ||
| end | ||
|
|
||
| node :repo_statuses do | ||
| @repo_statuses | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| collection @collection | ||
|
|
||
| node do |item| | ||
| item | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| collection @collection | ||
|
|
||
| node do |item| | ||
| item | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.