katello 4.5.0.rc2 → 4.6.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +10 -0
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -0
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +7 -0
- data/app/controllers/katello/api/v2/alternate_content_sources_controller.rb +52 -22
- data/app/controllers/katello/api/v2/content_exports_controller.rb +33 -3
- data/app/controllers/katello/api/v2/content_uploads_controller.rb +2 -0
- data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_views_controller.rb +1 -1
- data/app/controllers/katello/api/v2/debs_controller.rb +42 -10
- data/app/controllers/katello/api/v2/host_collections_controller.rb +5 -1
- data/app/controllers/katello/api/v2/host_errata_controller.rb +1 -0
- data/app/controllers/katello/api/v2/host_module_streams_controller.rb +9 -1
- data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +8 -1
- data/app/controllers/katello/api/v2/organizations_controller.rb +3 -1
- data/app/controllers/katello/api/v2/simple_content_access_controller.rb +8 -0
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +34 -11
- data/app/controllers/katello/concerns/organizations_controller_extensions.rb +7 -16
- data/app/lib/actions/katello/alternate_content_source/alternate_content_source_common.rb +16 -0
- data/app/lib/actions/katello/alternate_content_source/create.rb +11 -5
- data/app/lib/actions/katello/alternate_content_source/destroy.rb +3 -4
- data/app/lib/actions/katello/alternate_content_source/refresh.rb +3 -5
- data/app/lib/actions/katello/alternate_content_source/update.rb +57 -13
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +2 -2
- data/app/lib/actions/katello/content_view/promote_to_environment.rb +4 -2
- data/app/lib/actions/katello/content_view/publish.rb +5 -2
- data/app/lib/actions/katello/organization/environment_contents_refresh.rb +20 -0
- data/app/lib/actions/katello/organization/manifest_refresh.rb +10 -4
- data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +1 -9
- data/app/lib/actions/katello/repository/create.rb +9 -0
- data/app/lib/actions/katello/repository/destroy.rb +21 -0
- data/app/lib/actions/katello/repository/errata_mail.rb +3 -3
- data/app/lib/actions/katello/repository/refresh_repository.rb +3 -0
- data/app/lib/actions/katello/repository/update.rb +33 -0
- data/app/lib/actions/katello/repository/update_redhat_repository.rb +1 -1
- data/app/lib/actions/pulp3/alternate_content_source/create.rb +5 -4
- data/app/lib/actions/pulp3/alternate_content_source/create_remote.rb +5 -4
- data/app/lib/actions/pulp3/alternate_content_source/delete.rb +4 -4
- data/app/lib/actions/pulp3/alternate_content_source/delete_remote.rb +4 -4
- data/app/lib/actions/pulp3/alternate_content_source/refresh.rb +4 -4
- data/app/lib/actions/pulp3/alternate_content_source/update.rb +4 -4
- data/app/lib/actions/pulp3/alternate_content_source/update_remote.rb +5 -5
- data/app/lib/actions/pulp3/capsule_content/reclaim_space.rb +1 -0
- data/app/lib/actions/pulp3/content_view_version/create_export_history.rb +3 -1
- data/app/lib/actions/pulp3/content_view_version/create_exporter.rb +9 -2
- data/app/lib/actions/pulp3/content_view_version/create_syncable_export_history.rb +45 -0
- data/app/lib/actions/pulp3/content_view_version/destroy_exporter.rb +6 -1
- data/app/lib/actions/pulp3/content_view_version/export.rb +8 -3
- data/app/lib/actions/pulp3/orchestration/alternate_content_source/create.rb +3 -3
- data/app/lib/actions/pulp3/orchestration/alternate_content_source/delete.rb +6 -7
- data/app/lib/actions/pulp3/orchestration/alternate_content_source/refresh.rb +2 -2
- data/app/lib/actions/pulp3/orchestration/alternate_content_source/refresh_remote.rb +18 -0
- data/app/lib/actions/pulp3/orchestration/alternate_content_source/update.rb +3 -3
- data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +28 -13
- data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +6 -4
- data/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb +6 -3
- data/app/lib/actions/pulp3/orchestration/content_view_version/syncable_export.rb +82 -0
- data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +1 -1
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +25 -12
- data/app/lib/katello/errors.rb +1 -1
- data/app/lib/katello/resources/candlepin/owner.rb +9 -2
- data/app/lib/katello/validators/alternate_content_source_products_validator.rb +17 -0
- data/app/models/katello/alternate_content_source.rb +39 -8
- data/app/models/katello/alternate_content_source_product.rb +13 -0
- data/app/models/katello/authorization/repository.rb +4 -2
- data/app/models/katello/concerns/host_managed_extensions.rb +12 -2
- data/app/models/katello/concerns/pulp_database_unit.rb +2 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +5 -6
- data/app/models/katello/content_view.rb +50 -32
- data/app/models/katello/content_view_deb_filter.rb +51 -0
- data/app/models/katello/content_view_deb_filter_rule.rb +24 -0
- data/app/models/katello/content_view_filter.rb +10 -3
- data/app/models/katello/glue/candlepin/owner.rb +0 -1
- data/app/models/katello/installed_package.rb +1 -0
- data/app/models/katello/product.rb +3 -0
- data/app/models/katello/repository.rb +5 -3
- data/app/models/katello/rpm.rb +1 -0
- data/app/models/katello/smart_proxy_alternate_content_source.rb +6 -0
- data/app/services/cert/certs.rb +8 -16
- data/app/services/katello/organization_creator.rb +18 -7
- data/app/services/katello/pulp/server.rb +2 -2
- data/app/services/katello/pulp3/alternate_content_source.rb +22 -4
- data/app/services/katello/pulp3/api/apt.rb +12 -0
- data/app/services/katello/pulp3/api/core.rb +8 -0
- data/app/services/katello/pulp3/api/generic.rb +0 -4
- data/app/services/katello/pulp3/content_view_version/export.rb +61 -17
- data/app/services/katello/pulp3/content_view_version/import.rb +12 -5
- data/app/services/katello/pulp3/content_view_version/importable_repositories.rb +20 -5
- data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +3 -1
- data/app/services/katello/pulp3/content_view_version/syncable_format_export.rb +34 -0
- data/app/services/katello/pulp3/deb.rb +3 -1
- data/app/services/katello/pulp3/pulp_content_unit.rb +2 -0
- data/app/services/katello/pulp3/repository/apt.rb +186 -2
- data/app/services/katello/pulp3/repository.rb +5 -4
- data/app/services/katello/pulp3/service_common.rb +1 -1
- data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
- data/app/views/foreman/job_templates/install_errata_by_search_query.erb +4 -3
- data/app/views/foreman/smart_proxies/show.html.erb +3 -3
- data/app/views/katello/api/v2/alternate_content_sources/base.json.rabl +18 -3
- data/app/views/katello/api/v2/alternate_content_sources/show.json.rabl +20 -0
- data/app/views/katello/api/v2/ansible_collections/compare.json.rabl +10 -0
- data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +1 -1
- data/app/views/katello/api/v2/content_view_filters/base.json.rabl +5 -0
- data/app/views/katello/api/v2/module_streams/compare.json.rabl +10 -0
- data/app/views/katello/api/v2/organizations/show.json.rabl +1 -1
- data/app/views/katello/api/v2/repository_sets/show.json.rabl +4 -0
- data/app/views/katello/layouts/foreman_with_bastion.html.erb +1 -1
- data/app/views/katello/layouts/react.html.erb +1 -1
- data/app/views/overrides/organizations/_edit_override.html.erb +5 -8
- data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
- data/app/views/overrides/organizations/_step_1_override.html.erb +5 -0
- data/ca/redhat-uep.pem +18 -23
- data/config/katello.yaml.example +0 -2
- data/config/routes/api/v2.rb +2 -0
- data/config/routes/overrides.rb +1 -0
- data/db/migrate/20201116161820_create_content_view_deb_filter_rules.rb +17 -0
- data/db/migrate/20211220185935_clean_duplicate_content_units.rb +11 -9
- data/db/migrate/20220524132259_remove_last_refreshed_from_katello_alternate_content_sources.rb +5 -0
- data/db/migrate/20220601163911_add_vendor_to_katello_installed_packages.rb +5 -0
- data/db/migrate/20220610165621_add_repositories_and_products_to_acs.rb +23 -0
- data/engines/bastion/app/views/bastion/layouts/application.html.erb +1 -1
- data/engines/bastion/app/views/bastion/layouts/application_ie.html.erb +1 -1
- data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.routes.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +11 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-applicable.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/environment-content.controller.js +2 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/environment.controller.js +2 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-content-views.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.controller.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/views/environments.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +4 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +0 -3
- data/engines/bastion_katello/lib/bastion_katello/engine.rb +0 -1
- data/lib/katello/engine.rb +1 -2
- data/lib/katello/permission_creator.rb +2 -2
- data/lib/katello/permissions/host_permissions.rb +1 -0
- data/lib/katello/plugin.rb +6 -12
- data/lib/katello/tasks/refresh_alternate_content_sources.rake +9 -4
- data/lib/katello/tasks/refresh_repos.rake +8 -0
- data/lib/katello/version.rb +1 -1
- data/locale/action_names.rb +49 -46
- data/locale/bn/katello.po +361 -53
- data/locale/cs/katello.po +361 -53
- data/locale/de/katello.po +366 -58
- data/locale/en/katello.po +361 -53
- data/locale/es/katello.po +364 -56
- data/locale/fr/katello.po +374 -66
- data/locale/gu/katello.po +361 -53
- data/locale/hi/katello.po +361 -53
- data/locale/it/katello.po +361 -53
- data/locale/ja/katello.po +374 -66
- data/locale/katello.pot +1626 -1079
- data/locale/kn/katello.po +361 -53
- data/locale/ko/katello.po +361 -53
- data/locale/mr/katello.po +361 -53
- data/locale/or/katello.po +361 -53
- data/locale/pa/katello.po +361 -53
- data/locale/pt/katello.po +361 -53
- data/locale/pt_BR/katello.po +364 -56
- data/locale/ru/katello.po +361 -53
- data/locale/ta/katello.po +361 -53
- data/locale/te/katello.po +361 -53
- data/locale/zh_CN/katello.po +374 -66
- data/locale/zh_TW/katello.po +361 -53
- data/webpack/components/EditableTextInput/EditableTextInput.js +3 -16
- data/webpack/components/EditableTextInput/PencilEditButton.js +33 -0
- data/webpack/components/Errata/index.js +18 -3
- data/webpack/components/Loading.js +1 -1
- data/webpack/components/RoutedTabs/index.js +1 -17
- data/webpack/components/Search/Search.js +0 -1
- data/webpack/components/Search/__tests__/search.test.js +1 -2
- data/webpack/components/SelectAllCheckbox/index.js +7 -4
- data/webpack/components/SelectableDropdown/SelectableDropdown.js +1 -0
- data/webpack/components/Table/EmptyStateMessage.js +77 -2
- data/webpack/components/Table/MainTable.js +46 -4
- data/webpack/components/Table/TableHooks.js +8 -4
- data/webpack/components/Table/TableWrapper.js +14 -8
- data/webpack/components/TypeAhead/TypeAhead.js +26 -11
- data/webpack/components/TypeAhead/pf3Search/TypeAheadItems.js +1 -1
- data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.js +1 -0
- data/webpack/components/extensions/HostDetails/ActionsBar/index.js +8 -1
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ChangeHostCVModal.js +2 -1
- data/webpack/components/extensions/HostDetails/Cards/HostCollectionsCard/HostCollectionsModal.js +9 -4
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeActions.js +37 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.js +175 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard.scss +6 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeConstants.js +6 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js +301 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeSelectors.js +25 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeCard.test.js +109 -0
- data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/__tests__/SystemPurposeEditModal.test.js +161 -0
- data/webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js +12 -12
- data/webpack/components/extensions/HostDetails/DetailsTabCards/HwPropertiesCard.js +103 -0
- data/webpack/components/extensions/HostDetails/DetailsTabCards/InstalledProductsCard.js +1 -0
- data/webpack/components/extensions/HostDetails/DetailsTabCards/RegistrationCard.js +1 -0
- data/webpack/components/extensions/HostDetails/DetailsTabCards/SystemPropertiesCardExtensions.js +26 -4
- data/webpack/components/extensions/HostDetails/HostDetailsConstants.js +3 -1
- data/webpack/components/extensions/HostDetails/HostDetailsReducer.js +14 -0
- data/webpack/components/extensions/HostDetails/HostDetailsSelectors.js +8 -2
- data/webpack/components/extensions/HostDetails/Tabs/ErrataTab/ErrataTab.js +9 -1
- data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +23 -8
- data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +11 -9
- data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +58 -8
- data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +2 -0
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +30 -3
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySets.fixtures.json +3 -0
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/repositorySetsTab.test.js +48 -20
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +1 -10
- data/webpack/components/extensions/HostDetails/hostDetailsHelpers.js +1 -1
- data/webpack/components/extensions/RegistrationCommands/index.js +49 -17
- data/webpack/containers/Application/config.js +5 -10
- data/webpack/global_index.js +19 -7
- data/webpack/global_test_setup.js +14 -2
- data/webpack/ouia_id_check.js +95 -0
- data/webpack/redux/actions/RedHatRepositories/helpers.js +2 -0
- data/webpack/redux/reducers/index.js +2 -4
- data/webpack/scenes/AlternateContentSources/ACSActions.js +36 -3
- data/webpack/scenes/AlternateContentSources/ACSConstants.js +3 -0
- data/webpack/scenes/AlternateContentSources/ACSSelectors.js +15 -6
- data/webpack/scenes/AlternateContentSources/Create/ACSCreateWizard.js +73 -42
- data/webpack/scenes/AlternateContentSources/Create/Steps/ACSCreateFinish.js +26 -10
- data/webpack/scenes/AlternateContentSources/Create/Steps/ACSProducts.js +44 -0
- data/webpack/scenes/AlternateContentSources/Create/Steps/ACSReview.js +59 -45
- data/webpack/scenes/AlternateContentSources/Create/Steps/ACSSmartProxies.js +4 -3
- data/webpack/scenes/AlternateContentSources/Create/Steps/AcsUrlPaths.js +0 -1
- data/webpack/scenes/AlternateContentSources/Create/Steps/SelectSource.js +35 -19
- data/webpack/scenes/AlternateContentSources/Create/__tests__/acsCreate.test.js +120 -13
- data/webpack/scenes/AlternateContentSources/Create/__tests__/products.fixtures.json +92 -0
- data/webpack/scenes/AlternateContentSources/Details/ACSExpandableDetails.js +459 -0
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditCredentials.js +354 -0
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditDetails.js +104 -0
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditProducts.js +120 -0
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditSmartProxies.js +118 -0
- data/webpack/scenes/AlternateContentSources/Details/EditModals/ACSEditURLPaths.js +118 -0
- data/webpack/scenes/AlternateContentSources/Details/__tests__/ACSEdits.test.js +242 -0
- data/webpack/scenes/AlternateContentSources/Details/__tests__/ACSExpandableDetails.test.js +106 -0
- data/webpack/scenes/AlternateContentSources/Details/__tests__/acsDetails.fixtures.json +49 -0
- data/webpack/scenes/AlternateContentSources/Details/__tests__/acsProducts.fixtures.json +95 -0
- data/webpack/scenes/AlternateContentSources/Details/__tests__/simplifiedAcsDetails.fixtures.json +39 -0
- data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.js +215 -87
- data/webpack/scenes/AlternateContentSources/MainTable/ACSTable.scss +3 -0
- data/webpack/scenes/AlternateContentSources/MainTable/__tests__/acsTable.test.js +1 -2
- data/webpack/scenes/Content/__tests__/contentTable.test.js +1 -2
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +15 -4
- data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -0
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +113 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +89 -0
- data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +32 -9
- data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterAdd.test.js +13 -3
- data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +39 -27
- data/webpack/scenes/ContentViews/Details/Filters/CVDebFilterContent.js +236 -0
- data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +1 -0
- data/webpack/scenes/ContentViews/Details/Filters/CVFilterDetailType.js +10 -0
- data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -0
- data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -1
- data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +17 -4
- data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +1 -0
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +34 -22
- data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/CVDebMatchContentModal.js +97 -0
- data/webpack/scenes/ContentViews/Details/Filters/MatchContentModal/__tests__/CVRpmMatchContentModal.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Filters/Rules/DebPackage/AddEditDebPackageRuleModal.js +128 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVContainerImageFilterContent.test.js +56 -3
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/CVRpmFilterContent.test.js +62 -8
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/ContentViewPackageGroupFilter.test.js +1 -5
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilterDetails.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +32 -2
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvErrataIDFilter.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/cvModuleStreamFilter.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/emptyCVContainerImageFilterContent.fixtures.json +13 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/emptyCVPackageFilterRules.fixtures.json +13 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/emptyContentViewFilters.fixtures.json +13 -0
- data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +5 -1
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/BulkDeleteModal.test.js +3 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompare.js +143 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompare.scss +51 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +314 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareHeader.js +186 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareTable.js +74 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/AnsibleCollectionsCompareAllContentData.fixtures.json +63 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionCompare.test.js +657 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/CVVersionEmptyContentCompareData.fixtures.json +14 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/ContainerTagsCompareAllContentData.fixtures.json +95 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/DebPackagesCompareAllContentData.fixtures.json +87 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/ErrataCompareAllContentData.fixtures.json +319 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/ErrataCompareThreeContentTypesData.fixtures.json +131 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/FilesCompareAllContentData.fixtures.json +51 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/FilesCompareThreeContentTypesData.fixtures.json +48 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/ModuleStreamsCompareAllContentData.fixtures.json +239 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/PackageGroupsCompareAllContentData.fixtures.json +51 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/PythonPackagesCompareAllContentData.fixtures.json +315 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/RPMPackagesCompareAllContentData.fixtures.json +470 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/RPMPackagesCompareThreeContentTypesData.fixtures.json +475 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/contentViewDetails.fixtures.json +160 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/contentViewVersionOneDetials.fixtures.json +161 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/contentViewVersionThreeDetails.fixtures.json +154 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/contentViewVersionTwoDetails.fixtures.json +211 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/contentViewVersions.fixtures.json +1013 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/emptyStateCVVersionOneDetails.fixtures.json +145 -0
- data/webpack/scenes/ContentViews/Details/Versions/Compare/__tests__/emptyStateCVVersionTwoDetails.fixtures.json +145 -0
- data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +102 -36
- data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +4 -2
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsEmpty.test.js +1 -2
- data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +113 -40
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +96 -81
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +1 -2
- data/webpack/scenes/ContentViews/__tests__/mockDetails.fixtures.json +7 -2
- data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +1 -1
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +0 -30
- data/webpack/test-utils/nockWrapper.js +7 -0
- metadata +83 -181
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +0 -34
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +0 -751
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-deletion.controller.js +0 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-activation-keys.controller.js +0 -81
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-confirm.controller.js +0 -65
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +0 -82
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-environments.controller.js +0 -76
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion.controller.js +0 -160
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/content-view-deletion.html +0 -58
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-activation-keys.html +0 -94
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-confirm.html +0 -76
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-content-hosts.html +0 -88
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-environments.html +0 -73
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/content-view-component.factory.js +0 -32
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/content-view-composite-available-content-views.controller.js +0 -75
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/content-view-composite-content-views-list.controller.js +0 -68
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-available-content-views.html +0 -81
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-content-views-list.html +0 -81
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite.html +0 -24
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-deb-repositories.controller.js +0 -50
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-docker-repositories.controller.js +0 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-file-repositories.controller.js +0 -50
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-ostree-repositories.controller.js +0 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-repositories.controller.js +0 -45
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-deb-repositories-list.controller.js +0 -48
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +0 -100
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-docker-repositories-list.controller.js +0 -49
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-file-repositories-list.controller.js +0 -48
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-ostree-repositories-list.controller.js +0 -49
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-promotion.controller.js +0 -129
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-publish.controller.js +0 -46
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-repositories-list.controller.js +0 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-repositories.service.js +0 -91
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-versions.controller.js +0 -240
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/available-errata-filter.controller.js +0 -115
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/available-module-stream-filter.controller.js +0 -68
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/available-package-group-filter.controller.js +0 -66
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/date-type-errata-filter.controller.js +0 -77
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/docker-tag-filter.controller.js +0 -137
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/edit-filter.controller.js +0 -36
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter-list.controller.js +0 -78
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js +0 -74
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-content-type.filter.js +0 -21
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +0 -34
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-helper.service.js +0 -30
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-repositories.controller.js +0 -86
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-rule-matching-package-modal.controller.js +0 -37
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-type.filter.js +0 -21
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter.factory.js +0 -66
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filters.controller.js +0 -85
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/module-stream-list-filter.controller.js +0 -73
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/new-filter.controller.js +0 -100
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/package-filter.controller.js +0 -179
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/package-group-list-filter.controller.js +0 -75
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/rule.factory.js +0 -21
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/date-type-errata-filter.html +0 -9
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/date-type-errata.html +0 -75
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/docker-filter.html +0 -28
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/docker-tag-filter-details.html +0 -65
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/edit-filter.html +0 -19
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter-details.html +0 -63
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter.html +0 -50
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-details.html +0 -9
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-repositories.html +0 -121
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-rule-matching-package-modal.html +0 -43
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filters.html +0 -85
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +0 -58
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter.html +0 -43
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/new-filter.html +0 -62
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +0 -182
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter.html +0 -28
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-group-filter-details.html +0 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-group-filter.html +0 -43
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/partials/filter-repositories-count.html +0 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/content-view-history.controller.js +0 -47
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/content-view-history.factory.js +0 -22
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/views/content-view-history.html +0 -36
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-copy.html +0 -20
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-deb-repositories.html +0 -87
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details-tasks.html +0 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +0 -144
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-docker-repositories.html +0 -114
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-file-repositories.html +0 -87
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +0 -63
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-ostree-repositories.html +0 -87
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-promotion.html +0 -59
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +0 -58
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-repositories.html +0 -116
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +0 -126
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js +0 -78
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +0 -127
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +0 -138
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.controller.js +0 -59
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-apt.html +0 -25
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-components.html +0 -19
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-deb.html +0 -19
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +0 -15
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-docker.html +0 -23
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-errata.html +0 -48
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-file.html +0 -21
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-module-streams.html +0 -8
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-package-groups.html +0 -21
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-packages.html +0 -27
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-yum.html +0 -42
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +0 -83
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +0 -74
- data/lib/katello/tasks/reset.rake.bak +0 -67
- data/locale/bn/LC_MESSAGES/katello.mo +0 -0
- data/locale/cs/LC_MESSAGES/katello.mo +0 -0
- data/locale/de/LC_MESSAGES/katello.mo +0 -0
- data/locale/en/LC_MESSAGES/katello.mo +0 -0
- data/locale/es/LC_MESSAGES/katello.mo +0 -0
- data/locale/fr/LC_MESSAGES/katello.mo +0 -0
- data/locale/gu/LC_MESSAGES/katello.mo +0 -0
- data/locale/hi/LC_MESSAGES/katello.mo +0 -0
- data/locale/it/LC_MESSAGES/katello.mo +0 -0
- data/locale/ja/LC_MESSAGES/katello.mo +0 -0
- data/locale/kn/LC_MESSAGES/katello.mo +0 -0
- data/locale/ko/LC_MESSAGES/katello.mo +0 -0
- data/locale/mr/LC_MESSAGES/katello.mo +0 -0
- data/locale/or/LC_MESSAGES/katello.mo +0 -0
- data/locale/pa/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt/LC_MESSAGES/katello.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
- data/locale/ru/LC_MESSAGES/katello.mo +0 -0
- data/locale/ta/LC_MESSAGES/katello.mo +0 -0
- data/locale/te/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
- data/webpack/scenes/AnsibleCollections/AnsibleCollectionsActions.js +0 -30
- data/webpack/scenes/AnsibleCollections/AnsibleCollectionsConstants.js +0 -3
- data/webpack/scenes/AnsibleCollections/AnsibleCollectionsPage.js +0 -80
- data/webpack/scenes/AnsibleCollections/AnsibleCollectionsReducer.js +0 -39
- data/webpack/scenes/AnsibleCollections/AnsibleCollectionsTableSchema.js +0 -60
- data/webpack/scenes/AnsibleCollections/AnsibleCollectionsTables.scss +0 -0
- data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetails.js +0 -94
- data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetailsActions.js +0 -23
- data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetailsConstants.js +0 -3
- data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetailsReducer.js +0 -30
- data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionsSchema.js +0 -35
- data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetailInfo.test.js +0 -16
- data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetails.fixtures.js +0 -25
- data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetails.test.js +0 -27
- data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetailsActions.test.js +0 -41
- data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetailsReducer.test.js +0 -33
- data/webpack/scenes/AnsibleCollections/Details/__tests__/__snapshots__/AnsibleCollectionDetailInfo.test.js.snap +0 -83
- data/webpack/scenes/AnsibleCollections/Details/__tests__/__snapshots__/AnsibleCollectionDetails.test.js.snap +0 -190
- data/webpack/scenes/AnsibleCollections/Details/__tests__/__snapshots__/AnsibleCollectionDetailsActions.test.js.snap +0 -58
- data/webpack/scenes/AnsibleCollections/Details/__tests__/__snapshots__/AnsibleCollectionDetailsReducer.test.js.snap +0 -50
- data/webpack/scenes/AnsibleCollections/Details/index.js +0 -17
- data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionPage.test.js +0 -23
- data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollections.fixtures.js +0 -52
- data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsActions.test.js +0 -48
- data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js +0 -46
- data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsTable.test.js +0 -25
- data/webpack/scenes/AnsibleCollections/__tests__/__snapshots__/AnsibleCollectionPage.test.js.snap +0 -73
- data/webpack/scenes/AnsibleCollections/__tests__/__snapshots__/AnsibleCollectionsTable.test.js.snap +0 -81
- data/webpack/scenes/AnsibleCollections/index.js +0 -17
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +0 -123
data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeEditModal.js
ADDED
@@ -0,0 +1,301 @@
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
2
|
+
import { useSelector, useDispatch } from 'react-redux';
|
3
|
+
import { isEqual } from 'lodash';
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import { STATUS } from 'foremanReact/constants';
|
6
|
+
import { propsToCamelCase } from 'foremanReact/common/helpers';
|
7
|
+
import {
|
8
|
+
Modal,
|
9
|
+
Button,
|
10
|
+
Form,
|
11
|
+
FormGroup,
|
12
|
+
FormSelect,
|
13
|
+
FormSelectOption,
|
14
|
+
Select,
|
15
|
+
SelectOption,
|
16
|
+
SelectVariant,
|
17
|
+
} from '@patternfly/react-core';
|
18
|
+
import { FormattedMessage } from 'react-intl';
|
19
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
20
|
+
import { selectOrganizationStatus, selectOrganization, selectAvailableReleaseVersions, selectAvailableReleaseVersionsStatus } from './SystemPurposeSelectors';
|
21
|
+
import { getAvailableReleaseVersions, getOrganization, updateSystemPurposeAttributes } from './SystemPurposeActions';
|
22
|
+
import HOST_DETAILS_KEY from '../../HostDetailsConstants';
|
23
|
+
import { defaultUsages, defaultRoles, defaultServiceLevels } from './SystemPurposeConstants';
|
24
|
+
|
25
|
+
const SystemPurposeEditModal = ({
|
26
|
+
closeModal, hostName, purposeRole, purposeUsage, purposeAddons,
|
27
|
+
serviceLevel, releaseVersion, isOpen, orgId, hostId,
|
28
|
+
}) => {
|
29
|
+
const initialPurposeRole = purposeRole ?? '';
|
30
|
+
const initialServiceLevel = serviceLevel ?? '';
|
31
|
+
const initialPurposeUsage = purposeUsage ?? '';
|
32
|
+
const initialReleaseVersion = releaseVersion ?? '';
|
33
|
+
const initialPurposeAddons = purposeAddons ?? [];
|
34
|
+
const [selectedRole, setSelectedRole] = useState(initialPurposeRole);
|
35
|
+
const [selectedServiceLevel, setSelectedServiceLevel] = useState(initialServiceLevel);
|
36
|
+
const [selectedUsage, setSelectedUsage] = useState(initialPurposeUsage);
|
37
|
+
const [addonSelectOpen, setAddonSelectOpen] = useState(false);
|
38
|
+
const [selectedAddons, setSelectedAddons] = useState(initialPurposeAddons);
|
39
|
+
const [selectedReleaseVersion, setSelectedReleaseVersion] = useState(initialReleaseVersion);
|
40
|
+
|
41
|
+
const unmodified = (
|
42
|
+
selectedRole === initialPurposeRole &&
|
43
|
+
selectedServiceLevel === initialServiceLevel &&
|
44
|
+
selectedUsage === initialPurposeUsage &&
|
45
|
+
selectedReleaseVersion === initialReleaseVersion &&
|
46
|
+
isEqual(selectedAddons, initialPurposeAddons)
|
47
|
+
);
|
48
|
+
const dispatch = useDispatch();
|
49
|
+
|
50
|
+
const orgStatus = useSelector(state => selectOrganizationStatus(state, orgId));
|
51
|
+
const organizationDetails = useSelector(state => selectOrganization(state, orgId));
|
52
|
+
const orgDetails = propsToCamelCase(organizationDetails ?? { systemPurposes: {} });
|
53
|
+
const availableSyspurposeAttributes = orgDetails?.systemPurposes ?? {};
|
54
|
+
const availableServiceLevels = orgDetails?.serviceLevels ?? [];
|
55
|
+
const { addons: availableAddons, roles: availableRoles, usage: availableUsages }
|
56
|
+
= availableSyspurposeAttributes;
|
57
|
+
|
58
|
+
const availableReleaseVersionsStatus
|
59
|
+
= useSelector(state => selectAvailableReleaseVersionsStatus(state, orgId));
|
60
|
+
const availableReleaseVersions = useSelector(state =>
|
61
|
+
selectAvailableReleaseVersions(state, hostId))?.results ?? [];
|
62
|
+
useEffect(() => {
|
63
|
+
if (orgId && orgStatus !== STATUS.RESOLVED) {
|
64
|
+
dispatch(getOrganization({ orgId }));
|
65
|
+
}
|
66
|
+
}, [orgId, orgStatus, dispatch]);
|
67
|
+
|
68
|
+
useEffect(() => {
|
69
|
+
if (hostId && availableReleaseVersionsStatus !== STATUS.RESOLVED) {
|
70
|
+
dispatch(getAvailableReleaseVersions({ hostId }));
|
71
|
+
}
|
72
|
+
}, [hostId, availableReleaseVersionsStatus, dispatch]);
|
73
|
+
|
74
|
+
const toggleAddonSelect = isOpenState => setAddonSelectOpen(isOpenState);
|
75
|
+
|
76
|
+
const onAddonSelect = (_event, selected) => {
|
77
|
+
const newSelectedAddons = new Set(selectedAddons);
|
78
|
+
if (!selected) return;
|
79
|
+
if (newSelectedAddons.has(selected)) {
|
80
|
+
newSelectedAddons.delete(selected);
|
81
|
+
} else {
|
82
|
+
newSelectedAddons.add(selected);
|
83
|
+
}
|
84
|
+
setSelectedAddons([...newSelectedAddons]);
|
85
|
+
};
|
86
|
+
|
87
|
+
const refreshHostDetails = () => dispatch({
|
88
|
+
type: 'API_GET',
|
89
|
+
payload: {
|
90
|
+
key: HOST_DETAILS_KEY,
|
91
|
+
url: `/api/hosts/${hostName}`,
|
92
|
+
},
|
93
|
+
});
|
94
|
+
|
95
|
+
// Building the dropdown options is a bit complex because they come from several sources:
|
96
|
+
// 1. The hard-coded set of default values (defaultOptions)
|
97
|
+
// 2. The set of available values from the API (additionalOptions)
|
98
|
+
// 3. The value actually set on the host (initialOption - this need not be a value from 1 or 2)
|
99
|
+
// We then need to combine these values into a single set of options, and ensure that
|
100
|
+
// (a) (unset) appears first;
|
101
|
+
// (b) there are no duplicate options;
|
102
|
+
// (c) that the currently selected option always appears (currentSelected); and
|
103
|
+
// (d) that the order of the items doesn't change unexpectedly.
|
104
|
+
const buildOptions = (defaultOptions, additionalOptions, currentSelected, initialOption) => {
|
105
|
+
const optionToObject = option => ({ label: option || __('(unset)'), value: option });
|
106
|
+
const uniqOptions = new Set(['', ...defaultOptions ?? [], ...additionalOptions ?? [], currentSelected, initialOption]);
|
107
|
+
uniqOptions.delete(null);
|
108
|
+
uniqOptions.delete(undefined);
|
109
|
+
return [...[...uniqOptions]?.map(optionToObject)];
|
110
|
+
};
|
111
|
+
|
112
|
+
const roleOptions =
|
113
|
+
buildOptions(defaultRoles, availableRoles, selectedRole, purposeRole);
|
114
|
+
const usageOptions =
|
115
|
+
buildOptions(defaultUsages, availableUsages, selectedUsage, purposeUsage);
|
116
|
+
|
117
|
+
// addons may be present on the host but not available from subscriptions,
|
118
|
+
// so we combine the options here
|
119
|
+
const addonToObject = addon => ({ label: addon, value: addon });
|
120
|
+
const addonsOptions =
|
121
|
+
[...new Set([ // don't repeat addons if they are already selected
|
122
|
+
...purposeAddons.map(addonToObject), ...availableAddons?.map(addonToObject) ?? [],
|
123
|
+
])];
|
124
|
+
|
125
|
+
const serviceLevelOptions =
|
126
|
+
buildOptions(defaultServiceLevels, availableServiceLevels, selectedServiceLevel, serviceLevel);
|
127
|
+
|
128
|
+
const releaseVersionOptions =
|
129
|
+
buildOptions([], availableReleaseVersions, selectedReleaseVersion, releaseVersion);
|
130
|
+
|
131
|
+
const handleSave = (event) => {
|
132
|
+
event.preventDefault();
|
133
|
+
closeModal();
|
134
|
+
const optionsToValue = (options, stateValue) =>
|
135
|
+
options.find(option => option.value === stateValue)?.value;
|
136
|
+
dispatch(updateSystemPurposeAttributes({
|
137
|
+
hostId,
|
138
|
+
attributes: {
|
139
|
+
autoheal: true,
|
140
|
+
purpose_role: optionsToValue(roleOptions, selectedRole),
|
141
|
+
purpose_usage: optionsToValue(usageOptions, selectedUsage),
|
142
|
+
purpose_addons: selectedAddons,
|
143
|
+
release_version: optionsToValue(releaseVersionOptions, selectedReleaseVersion),
|
144
|
+
service_level: optionsToValue(serviceLevelOptions, selectedServiceLevel),
|
145
|
+
},
|
146
|
+
refreshHostDetails,
|
147
|
+
}));
|
148
|
+
};
|
149
|
+
|
150
|
+
const handleCancel = () => {
|
151
|
+
setSelectedRole(initialPurposeRole);
|
152
|
+
setSelectedServiceLevel(initialServiceLevel);
|
153
|
+
setSelectedUsage(initialPurposeUsage);
|
154
|
+
setSelectedAddons(initialPurposeAddons);
|
155
|
+
setSelectedReleaseVersion(initialReleaseVersion);
|
156
|
+
closeModal();
|
157
|
+
};
|
158
|
+
|
159
|
+
const modalActions = ([
|
160
|
+
<Button ouiaId="save-syspurpose" key="save-syspurpose" variant="primary" onClick={handleSave} isDisabled={unmodified}>
|
161
|
+
{__('Save')}
|
162
|
+
</Button>,
|
163
|
+
<Button ouiaId="cancel-syspurpose" key="cancel" variant="link" onClick={handleCancel}>
|
164
|
+
{__('Cancel')}
|
165
|
+
</Button>,
|
166
|
+
]);
|
167
|
+
|
168
|
+
|
169
|
+
return (
|
170
|
+
<Modal
|
171
|
+
isOpen={isOpen}
|
172
|
+
onClose={handleCancel}
|
173
|
+
title={__('Edit system purpose attributes')}
|
174
|
+
width="40%"
|
175
|
+
position="top"
|
176
|
+
actions={modalActions}
|
177
|
+
id="syspurpose-edit-modal"
|
178
|
+
>
|
179
|
+
<FormattedMessage
|
180
|
+
className="syspurpose-edit-modal-blurb"
|
181
|
+
id="syspurpose-edit-modal-blurb"
|
182
|
+
defaultMessage={__('Select system purpose attributes for host {hostName}.')}
|
183
|
+
values={{
|
184
|
+
hostName: <strong>{hostName}</strong>,
|
185
|
+
}}
|
186
|
+
/>
|
187
|
+
<Form isHorizontal style={{ marginTop: '1.3rem' }}>
|
188
|
+
<FormGroup label={__('Role')} fieldId="role">
|
189
|
+
<FormSelect
|
190
|
+
id="role"
|
191
|
+
name="role"
|
192
|
+
value={selectedRole}
|
193
|
+
onChange={setSelectedRole}
|
194
|
+
>
|
195
|
+
{roleOptions.map(option => (
|
196
|
+
<FormSelectOption
|
197
|
+
key={option.value}
|
198
|
+
value={option.value}
|
199
|
+
label={option.label}
|
200
|
+
/>
|
201
|
+
))}
|
202
|
+
</FormSelect>
|
203
|
+
</FormGroup>
|
204
|
+
<FormGroup label={__('SLA')} fieldId="serviceLevel">
|
205
|
+
<FormSelect
|
206
|
+
id="serviceLevel"
|
207
|
+
name="serviceLevel"
|
208
|
+
value={selectedServiceLevel}
|
209
|
+
onChange={setSelectedServiceLevel}
|
210
|
+
>
|
211
|
+
{serviceLevelOptions.map(option => (
|
212
|
+
<FormSelectOption
|
213
|
+
key={option.value}
|
214
|
+
value={option.value}
|
215
|
+
label={option.label}
|
216
|
+
/>
|
217
|
+
))}
|
218
|
+
</FormSelect>
|
219
|
+
</FormGroup>
|
220
|
+
<FormGroup label={__('Usage')} fieldId="usage">
|
221
|
+
<FormSelect
|
222
|
+
id="usage"
|
223
|
+
name="usage"
|
224
|
+
value={selectedUsage}
|
225
|
+
onChange={setSelectedUsage}
|
226
|
+
>
|
227
|
+
{usageOptions.map(option => (
|
228
|
+
<FormSelectOption
|
229
|
+
key={option.value}
|
230
|
+
value={option.value}
|
231
|
+
label={option.label}
|
232
|
+
/>
|
233
|
+
))}
|
234
|
+
</FormSelect>
|
235
|
+
</FormGroup>
|
236
|
+
<FormGroup label={__('Release version')} fieldId="releaseVersion">
|
237
|
+
<FormSelect
|
238
|
+
id="release_version"
|
239
|
+
name="release_version"
|
240
|
+
value={selectedReleaseVersion}
|
241
|
+
onChange={setSelectedReleaseVersion}
|
242
|
+
>
|
243
|
+
{releaseVersionOptions.map(option => (
|
244
|
+
<FormSelectOption
|
245
|
+
key={option.value}
|
246
|
+
value={option.value}
|
247
|
+
label={option.label}
|
248
|
+
/>
|
249
|
+
))}
|
250
|
+
</FormSelect>
|
251
|
+
</FormGroup>
|
252
|
+
<FormGroup label={__('Add-ons')} fieldId="addons">
|
253
|
+
<span id="syspurpose-addons-title" hidden>
|
254
|
+
Checkbox Title
|
255
|
+
</span>
|
256
|
+
<Select
|
257
|
+
variant={SelectVariant.typeaheadMulti}
|
258
|
+
aria-label="syspurpose-addons"
|
259
|
+
onToggle={toggleAddonSelect}
|
260
|
+
onSelect={onAddonSelect}
|
261
|
+
selections={selectedAddons}
|
262
|
+
isOpen={addonSelectOpen}
|
263
|
+
placeholderText={__('Select add-ons')}
|
264
|
+
aria-labelledby="syspurpose-addons-title"
|
265
|
+
menuAppendTo="parent"
|
266
|
+
>
|
267
|
+
{addonsOptions.map(option => (
|
268
|
+
<SelectOption
|
269
|
+
key={option.value}
|
270
|
+
value={option.value}
|
271
|
+
label={option.label}
|
272
|
+
/>
|
273
|
+
))}
|
274
|
+
</Select>
|
275
|
+
</FormGroup>
|
276
|
+
</Form>
|
277
|
+
</Modal>
|
278
|
+
);
|
279
|
+
};
|
280
|
+
|
281
|
+
export default SystemPurposeEditModal;
|
282
|
+
|
283
|
+
SystemPurposeEditModal.propTypes = {
|
284
|
+
closeModal: PropTypes.func.isRequired,
|
285
|
+
hostName: PropTypes.string,
|
286
|
+
purposeRole: PropTypes.string.isRequired,
|
287
|
+
purposeUsage: PropTypes.string.isRequired,
|
288
|
+
purposeAddons: PropTypes.arrayOf(PropTypes.string).isRequired,
|
289
|
+
serviceLevel: PropTypes.string.isRequired,
|
290
|
+
releaseVersion: PropTypes.string,
|
291
|
+
isOpen: PropTypes.bool.isRequired,
|
292
|
+
orgId: PropTypes.number,
|
293
|
+
hostId: PropTypes.number,
|
294
|
+
};
|
295
|
+
|
296
|
+
SystemPurposeEditModal.defaultProps = {
|
297
|
+
hostName: '',
|
298
|
+
orgId: null,
|
299
|
+
hostId: null,
|
300
|
+
releaseVersion: '',
|
301
|
+
};
|
data/webpack/components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeSelectors.js
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
import {
|
2
|
+
selectAPIStatus,
|
3
|
+
selectAPIError,
|
4
|
+
selectAPIResponse,
|
5
|
+
} from 'foremanReact/redux/API/APISelectors';
|
6
|
+
import { STATUS } from 'foremanReact/constants';
|
7
|
+
|
8
|
+
export const selectOrganization = (state, orgId) =>
|
9
|
+
selectAPIResponse(state, `ORGANIZATION_${orgId}`) ?? {};
|
10
|
+
|
11
|
+
export const selectOrganizationStatus = (state, orgId) =>
|
12
|
+
selectAPIStatus(state, `ORGANIZATION_${orgId}`) ?? STATUS.PENDING;
|
13
|
+
|
14
|
+
export const selectOrganizationError = (state, orgId) =>
|
15
|
+
selectAPIError(state, `ORGANIZATION_${orgId}`);
|
16
|
+
|
17
|
+
export const selectAvailableReleaseVersions = (state, hostId) =>
|
18
|
+
selectAPIResponse(state, `AVAILABLE_RELEASE_VERSIONS_${hostId}`) ?? {};
|
19
|
+
|
20
|
+
export const selectAvailableReleaseVersionsStatus = (state, hostId) =>
|
21
|
+
selectAPIStatus(state, `AVAILABLE_RELEASE_VERSIONS_${hostId}`) ??
|
22
|
+
STATUS.PENDING;
|
23
|
+
|
24
|
+
export const selectAvailableReleaseVersionsError = (state, hostId) =>
|
25
|
+
selectAPIError(state, `AVAILABLE_RELEASE_VERSIONS_${hostId}`);
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { renderWithRedux, act } from 'react-testing-lib-wrapper';
|
3
|
+
import HOST_DETAILS from '../../../HostDetailsConstants';
|
4
|
+
import SystemPurposeCard from '../SystemPurposeCard';
|
5
|
+
import katelloApi, { foremanApi } from '../../../../../../services/api';
|
6
|
+
import { assertNockRequest, nockInstance } from '../../../../../../test-utils/nockWrapper';
|
7
|
+
|
8
|
+
const organizationDetails = katelloApi.getApiUrl('/organizations/1');
|
9
|
+
const availableReleaseVersions = foremanApi.getApiUrl('/hosts/1/subscriptions/available_release_versions');
|
10
|
+
|
11
|
+
const baseHostDetails = {
|
12
|
+
id: 1,
|
13
|
+
organization_id: 1,
|
14
|
+
permissions: {
|
15
|
+
edit_hosts: true,
|
16
|
+
},
|
17
|
+
subscription_facet_attributes: {
|
18
|
+
purpose_addons: ['Addon1', 'Addon2'],
|
19
|
+
purpose_role: 'Red Hat Enterprise Linux Server',
|
20
|
+
purpose_usage: 'Production',
|
21
|
+
service_level: 'Premium',
|
22
|
+
release_version: '8',
|
23
|
+
uuid: '12345',
|
24
|
+
},
|
25
|
+
};
|
26
|
+
|
27
|
+
const renderOptions = () => ({
|
28
|
+
apiNamespace: HOST_DETAILS,
|
29
|
+
initialState: {
|
30
|
+
API: {
|
31
|
+
HOST_DETAILS: {
|
32
|
+
response: {
|
33
|
+
id: 1,
|
34
|
+
name: 'test-host',
|
35
|
+
...baseHostDetails,
|
36
|
+
},
|
37
|
+
status: 'RESOLVED',
|
38
|
+
},
|
39
|
+
},
|
40
|
+
},
|
41
|
+
});
|
42
|
+
|
43
|
+
test('shows system purpose details', async (done) => {
|
44
|
+
const orgScope = nockInstance
|
45
|
+
.get(organizationDetails)
|
46
|
+
.reply(200, {
|
47
|
+
id: 1,
|
48
|
+
});
|
49
|
+
const availableReleaseVersionsScope = nockInstance
|
50
|
+
.get(availableReleaseVersions)
|
51
|
+
.reply(200, []);
|
52
|
+
|
53
|
+
const { getByText }
|
54
|
+
= renderWithRedux(<SystemPurposeCard hostDetails={baseHostDetails} />, renderOptions());
|
55
|
+
expect(getByText('Red Hat Enterprise Linux Server')).toBeInTheDocument();
|
56
|
+
expect(getByText('Production')).toBeInTheDocument();
|
57
|
+
expect(getByText('Premium')).toBeInTheDocument();
|
58
|
+
expect(getByText('Addon1')).toBeInTheDocument();
|
59
|
+
expect(getByText('Addon2')).toBeInTheDocument();
|
60
|
+
expect(getByText('8')).toBeInTheDocument();
|
61
|
+
|
62
|
+
assertNockRequest(orgScope);
|
63
|
+
assertNockRequest(availableReleaseVersionsScope, done);
|
64
|
+
});
|
65
|
+
|
66
|
+
|
67
|
+
test('shows edit button for a user with edit_hosts permission', async (done) => {
|
68
|
+
const orgScope = nockInstance
|
69
|
+
.get(organizationDetails)
|
70
|
+
.reply(200, {
|
71
|
+
id: 1,
|
72
|
+
});
|
73
|
+
const availableReleaseVersionsScope = nockInstance
|
74
|
+
.get(availableReleaseVersions)
|
75
|
+
.reply(200, []);
|
76
|
+
|
77
|
+
const { queryByText }
|
78
|
+
= renderWithRedux(<SystemPurposeCard hostDetails={baseHostDetails} />, renderOptions());
|
79
|
+
expect(queryByText('Edit')).toBeInTheDocument();
|
80
|
+
|
81
|
+
assertNockRequest(orgScope);
|
82
|
+
assertNockRequest(availableReleaseVersionsScope, done);
|
83
|
+
});
|
84
|
+
|
85
|
+
test('does not show edit button for a user without edit_hosts permission', (done) => {
|
86
|
+
const orgScope = nockInstance
|
87
|
+
.get(organizationDetails)
|
88
|
+
.reply(200, {
|
89
|
+
id: 1,
|
90
|
+
});
|
91
|
+
const availableReleaseVersionsScope = nockInstance
|
92
|
+
.get(availableReleaseVersions)
|
93
|
+
.reply(200, []);
|
94
|
+
|
95
|
+
const limitedUser = {
|
96
|
+
...baseHostDetails,
|
97
|
+
permissions: {
|
98
|
+
edit_hosts: false,
|
99
|
+
},
|
100
|
+
};
|
101
|
+
|
102
|
+
const { queryByText }
|
103
|
+
= renderWithRedux(<SystemPurposeCard hostDetails={limitedUser} />);
|
104
|
+
expect(queryByText('Edit')).not.toBeInTheDocument();
|
105
|
+
|
106
|
+
assertNockRequest(orgScope);
|
107
|
+
assertNockRequest(availableReleaseVersionsScope, done);
|
108
|
+
act(done);
|
109
|
+
});
|
@@ -0,0 +1,161 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { propsToCamelCase } from 'foremanReact/common/helpers';
|
3
|
+
import { renderWithRedux, patientlyWaitFor, fireEvent } from 'react-testing-lib-wrapper';
|
4
|
+
import HOST_DETAILS from '../../../HostDetailsConstants';
|
5
|
+
import SystemPurposeEditModal from '../SystemPurposeEditModal';
|
6
|
+
import { assertNockRequest, nockInstance } from '../../../../../../test-utils/nockWrapper';
|
7
|
+
import katelloApi, { foremanApi } from '../../../../../../services/api';
|
8
|
+
|
9
|
+
const organizationDetails = katelloApi.getApiUrl('/organizations/1');
|
10
|
+
const availableReleaseVersions = foremanApi.getApiUrl('/hosts/1/subscriptions/available_release_versions');
|
11
|
+
const hostEditUrl = foremanApi.getApiUrl('/hosts/1');
|
12
|
+
const hostDetailsGetUrl = '/api/hosts/test-host';
|
13
|
+
|
14
|
+
const baseHostDetails = {
|
15
|
+
id: 1,
|
16
|
+
organization_id: 1,
|
17
|
+
permissions: {
|
18
|
+
edit_hosts: true,
|
19
|
+
},
|
20
|
+
subscription_facet_attributes: {
|
21
|
+
purpose_addons: ['Addon1', 'Addon2'],
|
22
|
+
purpose_role: 'Red Hat Enterprise Linux Server',
|
23
|
+
purpose_usage: 'Production',
|
24
|
+
service_level: 'Premium',
|
25
|
+
release_version: '8',
|
26
|
+
},
|
27
|
+
};
|
28
|
+
|
29
|
+
const facetAttributes = propsToCamelCase(baseHostDetails.subscription_facet_attributes);
|
30
|
+
const baseAttributes = {
|
31
|
+
hostName: 'test-host',
|
32
|
+
closeModal: jest.fn(),
|
33
|
+
isOpen: true,
|
34
|
+
orgId: 1,
|
35
|
+
hostId: 1,
|
36
|
+
};
|
37
|
+
|
38
|
+
const renderOptions = () => ({
|
39
|
+
apiNamespace: HOST_DETAILS,
|
40
|
+
initialState: {
|
41
|
+
API: {
|
42
|
+
HOST_DETAILS: {
|
43
|
+
response: {
|
44
|
+
id: 1,
|
45
|
+
name: 'test-host',
|
46
|
+
...baseHostDetails,
|
47
|
+
},
|
48
|
+
status: 'RESOLVED',
|
49
|
+
},
|
50
|
+
},
|
51
|
+
},
|
52
|
+
});
|
53
|
+
|
54
|
+
describe('SystemPurposeEditModal', () => {
|
55
|
+
test('Shows currently selected attributes as defaults', (done) => {
|
56
|
+
const orgScope = nockInstance
|
57
|
+
.get(organizationDetails)
|
58
|
+
.reply(200, {
|
59
|
+
id: 1,
|
60
|
+
});
|
61
|
+
const availableReleaseVersionsScope = nockInstance
|
62
|
+
.get(availableReleaseVersions)
|
63
|
+
.reply(200, []);
|
64
|
+
|
65
|
+
const { getByText }
|
66
|
+
= renderWithRedux(<SystemPurposeEditModal
|
67
|
+
{...baseAttributes}
|
68
|
+
{...facetAttributes}
|
69
|
+
/>, renderOptions());
|
70
|
+
|
71
|
+
expect(getByText('Red Hat Enterprise Linux Server')).toBeInTheDocument();
|
72
|
+
expect(getByText('Production')).toBeInTheDocument();
|
73
|
+
expect(getByText('Premium')).toBeInTheDocument();
|
74
|
+
expect(getByText('Addon1')).toBeInTheDocument();
|
75
|
+
expect(getByText('Addon2')).toBeInTheDocument();
|
76
|
+
expect(getByText('8')).toBeInTheDocument();
|
77
|
+
|
78
|
+
assertNockRequest(orgScope);
|
79
|
+
assertNockRequest(availableReleaseVersionsScope, done);
|
80
|
+
});
|
81
|
+
|
82
|
+
test('Shows blank options as (unset)', () => {
|
83
|
+
const orgScope = nockInstance
|
84
|
+
.get(organizationDetails)
|
85
|
+
.reply(200, {
|
86
|
+
id: 1,
|
87
|
+
});
|
88
|
+
const availableReleaseVersionsScope = nockInstance
|
89
|
+
.get(availableReleaseVersions)
|
90
|
+
.reply(200, []);
|
91
|
+
const { getAllByText }
|
92
|
+
= renderWithRedux(<SystemPurposeEditModal
|
93
|
+
{...
|
94
|
+
{
|
95
|
+
...baseAttributes,
|
96
|
+
purposeRole: '',
|
97
|
+
}}
|
98
|
+
{...facetAttributes}
|
99
|
+
/>, renderOptions());
|
100
|
+
|
101
|
+
expect(getAllByText('(unset)')[0]).toBeVisible();
|
102
|
+
|
103
|
+
assertNockRequest(orgScope);
|
104
|
+
assertNockRequest(availableReleaseVersionsScope);
|
105
|
+
});
|
106
|
+
test('Calls API and changes syspurpose values', async (done) => {
|
107
|
+
const orgScope = nockInstance
|
108
|
+
.get(organizationDetails)
|
109
|
+
.reply(200, {
|
110
|
+
id: 1,
|
111
|
+
});
|
112
|
+
const availableReleaseVersionsScope = nockInstance
|
113
|
+
.get(availableReleaseVersions)
|
114
|
+
.reply(200, []);
|
115
|
+
const hostEditScope = nockInstance
|
116
|
+
.put(hostEditUrl, {
|
117
|
+
id: 1,
|
118
|
+
host: {
|
119
|
+
subscription_facet_attributes: {
|
120
|
+
autoheal: true,
|
121
|
+
// we're going to change role from 'Server' to 'Workstation'
|
122
|
+
purpose_role: 'Red Hat Enterprise Linux Workstation',
|
123
|
+
purpose_usage: 'Production',
|
124
|
+
purpose_addons: ['Addon1', 'Addon2'],
|
125
|
+
release_version: '8',
|
126
|
+
service_level: 'Premium',
|
127
|
+
},
|
128
|
+
},
|
129
|
+
})
|
130
|
+
.reply(200);
|
131
|
+
const hostDetailsScope = nockInstance
|
132
|
+
.get(hostDetailsGetUrl)
|
133
|
+
.reply(200);
|
134
|
+
|
135
|
+
const { getByLabelText, getByRole }
|
136
|
+
= renderWithRedux(<SystemPurposeEditModal
|
137
|
+
{...baseAttributes}
|
138
|
+
{...facetAttributes}
|
139
|
+
/>, renderOptions());
|
140
|
+
|
141
|
+
const saveButton = getByRole('button', { name: 'Save' });
|
142
|
+
// Save button should be disabled if no values have been changed
|
143
|
+
expect(saveButton).toHaveAttribute('aria-disabled', 'true');
|
144
|
+
|
145
|
+
const roleDropdown = getByLabelText('Role');
|
146
|
+
fireEvent.change(roleDropdown, { target: { value: 'Red Hat Enterprise Linux Workstation' } });
|
147
|
+
|
148
|
+
// Save button should now be enabled
|
149
|
+
expect(saveButton).toHaveAttribute('aria-disabled', 'false');
|
150
|
+
fireEvent.click(saveButton);
|
151
|
+
|
152
|
+
await patientlyWaitFor(() => {
|
153
|
+
expect(baseAttributes.closeModal).toHaveBeenCalled();
|
154
|
+
});
|
155
|
+
|
156
|
+
[orgScope, availableReleaseVersionsScope, hostEditScope].forEach((scope) => {
|
157
|
+
assertNockRequest(scope);
|
158
|
+
});
|
159
|
+
assertNockRequest(hostDetailsScope, done);
|
160
|
+
});
|
161
|
+
});
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { render } from 'react-testing-lib-wrapper';
|
2
|
+
import { render, renderWithRedux } from 'react-testing-lib-wrapper';
|
3
3
|
import ErrataOverviewCard from '../ErrataOverviewCard';
|
4
|
-
import nock from '../../../../../test-utils/nockWrapper';
|
5
4
|
|
6
5
|
const baseHostDetails = {
|
7
6
|
id: 2,
|
@@ -9,12 +8,17 @@ const baseHostDetails = {
|
|
9
8
|
uuid: '123',
|
10
9
|
},
|
11
10
|
};
|
12
|
-
|
11
|
+
const renderOptions = {
|
12
|
+
initialState: {
|
13
|
+
// This is the API state that your tests depend on for their data
|
14
|
+
// You can cross reference the needed useSelectors from your tested components
|
15
|
+
// with the data found within the redux chrome add-on to help determine this fixture data.
|
16
|
+
katello: {
|
17
|
+
hostDetails: {},
|
18
|
+
},
|
19
|
+
},
|
20
|
+
};
|
13
21
|
describe('Without errata', () => {
|
14
|
-
afterEach(() => {
|
15
|
-
nock.cleanAll();
|
16
|
-
});
|
17
|
-
|
18
22
|
test('shows zero counts when there are 0 installable errata', () => {
|
19
23
|
const hostDetails = {
|
20
24
|
...baseHostDetails,
|
@@ -52,7 +56,7 @@ describe('Without errata', () => {
|
|
52
56
|
},
|
53
57
|
};
|
54
58
|
/* eslint-disable max-len */
|
55
|
-
const { queryByLabelText, getByText } =
|
59
|
+
const { queryByLabelText, getByText } = renderWithRedux(<ErrataOverviewCard hostDetails={hostDetails} />, renderOptions);
|
56
60
|
/* eslint-enable max-len */
|
57
61
|
expect(queryByLabelText('errataChart')).not.toBeInTheDocument();
|
58
62
|
expect(getByText('All errata up-to-date')).toBeInTheDocument();
|
@@ -80,10 +84,6 @@ describe('Without errata', () => {
|
|
80
84
|
});
|
81
85
|
|
82
86
|
describe('With errata', () => {
|
83
|
-
afterEach(() => {
|
84
|
-
nock.cleanAll();
|
85
|
-
});
|
86
|
-
|
87
87
|
test('shows links when there are errata', () => {
|
88
88
|
const hostDetails = {
|
89
89
|
...baseHostDetails,
|