foreman_patch 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +38 -0
- data/Rakefile +53 -0
- data/app/assets/javascript/foreman_patch/plan_edit_windows.js +9 -0
- data/app/assets/stylesheets/foreman_patch/cycle_plans.scss +6 -0
- data/app/assets/stylesheets/foreman_patch/foreman_patch.css +4 -0
- data/app/controllers/concerns/foreman_patch/parameters/ticket_field.rb +26 -0
- data/app/controllers/foreman_patch/api/v2/base_controller.rb +12 -0
- data/app/controllers/foreman_patch/api/v2/cycles_controller.rb +78 -0
- data/app/controllers/foreman_patch/api/v2/groups_controller.rb +70 -0
- data/app/controllers/foreman_patch/api/v2/host_groups_controller.rb +13 -0
- data/app/controllers/foreman_patch/api/v2/invocations_controller.rb +70 -0
- data/app/controllers/foreman_patch/api/v2/plans_controller.rb +79 -0
- data/app/controllers/foreman_patch/api/v2/rounds_controller.rb +77 -0
- data/app/controllers/foreman_patch/api/v2/window_plans_controller.rb +73 -0
- data/app/controllers/foreman_patch/api/v2/windows_controller.rb +85 -0
- data/app/controllers/foreman_patch/concerns/api/v2/hosts_controller_extensions.rb +21 -0
- data/app/controllers/foreman_patch/concerns/hosts_controller_extensions.rb +61 -0
- data/app/controllers/foreman_patch/cycles_controller.rb +34 -0
- data/app/controllers/foreman_patch/groups_controller.rb +68 -0
- data/app/controllers/foreman_patch/invocations_controller.rb +51 -0
- data/app/controllers/foreman_patch/plans_controller.rb +59 -0
- data/app/controllers/foreman_patch/rounds_controller.rb +18 -0
- data/app/controllers/foreman_patch/ticket_fields_controller.rb +37 -0
- data/app/controllers/foreman_patch/window_plans_controller.rb +60 -0
- data/app/controllers/foreman_patch/windows_controller.rb +58 -0
- data/app/helpers/concerns/foreman_patch/hosts_helper_extensions.rb +13 -0
- data/app/helpers/foreman_patch/cycles_helper.rb +19 -0
- data/app/helpers/foreman_patch/hosts_helper.rb +52 -0
- data/app/helpers/foreman_patch/patching_helper.rb +116 -0
- data/app/helpers/foreman_patch/plans_helper.rb +45 -0
- data/app/helpers/foreman_patch/ticket_helper.rb +11 -0
- data/app/helpers/foreman_patch/window_patching_helper.rb +20 -0
- data/app/helpers/foreman_patch/window_plans_helper.rb +13 -0
- data/app/helpers/foreman_patch/windows_helper.rb +17 -0
- data/app/lib/actions/foreman_patch/cycle/complete.rb +41 -0
- data/app/lib/actions/foreman_patch/cycle/create.rb +69 -0
- data/app/lib/actions/foreman_patch/cycle/initiate.rb +68 -0
- data/app/lib/actions/foreman_patch/cycle/plan.rb +73 -0
- data/app/lib/actions/foreman_patch/cycle/prepare_content.rb +123 -0
- data/app/lib/actions/foreman_patch/host/reschedule.rb +32 -0
- data/app/lib/actions/foreman_patch/invocation/action.rb +135 -0
- data/app/lib/actions/foreman_patch/invocation/ensure_services.rb +47 -0
- data/app/lib/actions/foreman_patch/invocation/patch.rb +93 -0
- data/app/lib/actions/foreman_patch/invocation/reschedule.rb +21 -0
- data/app/lib/actions/foreman_patch/invocation/restart.rb +101 -0
- data/app/lib/actions/foreman_patch/invocation/update_packages.rb +52 -0
- data/app/lib/actions/foreman_patch/invocation/wait_for_host.rb +103 -0
- data/app/lib/actions/foreman_patch/round/add_missing_hosts.rb +21 -0
- data/app/lib/actions/foreman_patch/round/create.rb +37 -0
- data/app/lib/actions/foreman_patch/round/patch.rb +81 -0
- data/app/lib/actions/foreman_patch/round/plan.rb +33 -0
- data/app/lib/actions/foreman_patch/round/resolve_hosts.rb +45 -0
- data/app/lib/actions/foreman_patch/window/create.rb +41 -0
- data/app/lib/actions/foreman_patch/window/patch.rb +72 -0
- data/app/lib/actions/foreman_patch/window/plan.rb +43 -0
- data/app/lib/actions/foreman_patch/window/publish.rb +32 -0
- data/app/lib/actions/foreman_patch/window/resolve_hosts.rb +31 -0
- data/app/lib/actions/helpers/failure_notification.rb +20 -0
- data/app/lib/actions/helpers/with_feature_action.rb +102 -0
- data/app/lib/actions/middleware/check_exit_status.rb +31 -0
- data/app/mailers/foreman_patch/cycle_mailer.rb +17 -0
- data/app/mailers/foreman_patch/group_mailer.rb +41 -0
- data/app/mailers/foreman_patch/invocation_mailer.rb +19 -0
- data/app/models/foreman_patch/concerns/group_facet_host_extensions.rb +35 -0
- data/app/models/foreman_patch/concerns/host_managed_extensions.rb +17 -0
- data/app/models/foreman_patch/cycle.rb +49 -0
- data/app/models/foreman_patch/group.rb +43 -0
- data/app/models/foreman_patch/host/group_facet.rb +13 -0
- data/app/models/foreman_patch/invocation.rb +60 -0
- data/app/models/foreman_patch/plan.rb +110 -0
- data/app/models/foreman_patch/plan_task_group.rb +11 -0
- data/app/models/foreman_patch/round.rb +68 -0
- data/app/models/foreman_patch/ticket_field.rb +23 -0
- data/app/models/foreman_patch/window.rb +123 -0
- data/app/models/foreman_patch/window_plan.rb +77 -0
- data/app/models/foreman_patch/window_task_group.rb +11 -0
- data/app/models/setting/patching.rb +57 -0
- data/app/services/foreman_patch/cycle_name_generator.rb +38 -0
- data/app/services/foreman_patch/ticket/affected_items.rb +110 -0
- data/app/services/foreman_patch/ticket/api.rb +68 -0
- data/app/services/foreman_patch/ticket/change_request.rb +92 -0
- data/app/services/foreman_patch/ticket/field_render.rb +21 -0
- data/app/services/foreman_patch/ticket/payload.rb +136 -0
- data/app/services/foreman_patch/ticket.rb +14 -0
- data/app/views/dashboard/_foreman_patch_widget.html.erb +2 -0
- data/app/views/foreman_patch/api/v2/cycles/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/cycles/create.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/cycles/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/cycles/show.json.rabl +9 -0
- data/app/views/foreman_patch/api/v2/cycles/update.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/group_facet/base.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/group_facet/base_with_root.json.rabl +4 -0
- data/app/views/foreman_patch/api/v2/group_facet/show.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/groups/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/groups/create.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/groups/index.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/groups/show.json.rabl +14 -0
- data/app/views/foreman_patch/api/v2/groups/update.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/invocations/base.json.rabl +6 -0
- data/app/views/foreman_patch/api/v2/invocations/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/invocations/phase.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/invocations/show.json.rabl +7 -0
- data/app/views/foreman_patch/api/v2/plans/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/plans/create.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/plans/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/plans/show.json.rabl +9 -0
- data/app/views/foreman_patch/api/v2/plans/update.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/rounds/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/rounds/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/rounds/show.json.rabl +17 -0
- data/app/views/foreman_patch/api/v2/rounds/status.json.rabl +11 -0
- data/app/views/foreman_patch/api/v2/window_plans/base.json.rabl +4 -0
- data/app/views/foreman_patch/api/v2/window_plans/create.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/window_plans/index.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/window_plans/show.json.rabl +14 -0
- data/app/views/foreman_patch/api/v2/window_plans/update.json.rabl +2 -0
- data/app/views/foreman_patch/api/v2/windows/base.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/windows/index.json.rabl +3 -0
- data/app/views/foreman_patch/api/v2/windows/schedule.json.rabl +13 -0
- data/app/views/foreman_patch/api/v2/windows/show.json.rabl +13 -0
- data/app/views/foreman_patch/api/v2/windows/update.json.rabl +3 -0
- data/app/views/foreman_patch/cycle_mailer/_details.html.erb +4 -0
- data/app/views/foreman_patch/cycle_mailer/_round.html.erb +12 -0
- data/app/views/foreman_patch/cycle_mailer/_summary.html.erb +6 -0
- data/app/views/foreman_patch/cycle_mailer/_window.html.erb +4 -0
- data/app/views/foreman_patch/cycle_mailer/planned.html.erb +7 -0
- data/app/views/foreman_patch/cycles/_form.html.erb +9 -0
- data/app/views/foreman_patch/cycles/edit.html.erb +41 -0
- data/app/views/foreman_patch/cycles/index.html.erb +45 -0
- data/app/views/foreman_patch/cycles/show.html.erb +26 -0
- data/app/views/foreman_patch/group_mailer/_dashboard.html.erb +31 -0
- data/app/views/foreman_patch/group_mailer/_list.html.erb +17 -0
- data/app/views/foreman_patch/group_mailer/completed.html.erb +16 -0
- data/app/views/foreman_patch/group_mailer/initiated.html.erb +4 -0
- data/app/views/foreman_patch/groups/_form.html.erb +9 -0
- data/app/views/foreman_patch/groups/edit.html.erb +3 -0
- data/app/views/foreman_patch/groups/index.html.erb +40 -0
- data/app/views/foreman_patch/groups/new.html.erb +3 -0
- data/app/views/foreman_patch/hosts/hosts/new_action.html.erb +1 -0
- data/app/views/foreman_patch/hosts/new_action.html.erb +1 -0
- data/app/views/foreman_patch/invocation_mailer/_output_line_set.html.erb +6 -0
- data/app/views/foreman_patch/invocation_mailer/_output_line_set.text.erb +3 -0
- data/app/views/foreman_patch/invocation_mailer/failure.html.erb +50 -0
- data/app/views/foreman_patch/invocation_mailer/failure.text.erb +10 -0
- data/app/views/foreman_patch/invocations/_output_line_set.html.erb +8 -0
- data/app/views/foreman_patch/invocations/_phase.html.erb +17 -0
- data/app/views/foreman_patch/invocations/_primary.html.erb +1 -0
- data/app/views/foreman_patch/invocations/_refresh.js.erb +7 -0
- data/app/views/foreman_patch/invocations/show.html.erb +44 -0
- data/app/views/foreman_patch/invocations/show.js.erb +17 -0
- data/app/views/foreman_patch/layouts/react.html.erb +17 -0
- data/app/views/foreman_patch/plans/_form.html.erb +12 -0
- data/app/views/foreman_patch/plans/edit.html.erb +6 -0
- data/app/views/foreman_patch/plans/index.html.erb +32 -0
- data/app/views/foreman_patch/plans/new.html.erb +3 -0
- data/app/views/foreman_patch/plans/show.html.erb +19 -0
- data/app/views/foreman_patch/rounds/show.html.erb +54 -0
- data/app/views/foreman_patch/ticket_fields/_fields.html.erb +66 -0
- data/app/views/foreman_patch/ticket_fields/edit.html.erb +6 -0
- data/app/views/foreman_patch/ticket_fields/index.html.erb +26 -0
- data/app/views/foreman_patch/ticket_fields/new.html.erb +6 -0
- data/app/views/foreman_patch/window_plans/_form.html.erb +11 -0
- data/app/views/foreman_patch/window_plans/_hidden_layout.html.erb +7 -0
- data/app/views/foreman_patch/window_plans/edit.html.erb +3 -0
- data/app/views/foreman_patch/window_plans/new.html.erb +3 -0
- data/app/views/foreman_patch/windows/_form.html.erb +21 -0
- data/app/views/foreman_patch/windows/_groups.html.erb +2 -0
- data/app/views/foreman_patch/windows/_rounds.html.erb +24 -0
- data/app/views/foreman_patch/windows/_schedule.html.erb +16 -0
- data/app/views/foreman_patch/windows/_ticket.html.erb +12 -0
- data/app/views/foreman_patch/windows/edit.html.erb +3 -0
- data/app/views/foreman_patch/windows/new.html.erb +3 -0
- data/app/views/foreman_patch/windows/show.html.erb +27 -0
- data/app/views/foreman_patch/windows/show.json.erb +4 -0
- data/app/views/hosts/select_multiple_patch_group.html.erb +12 -0
- data/app/views/overrides/patch_groups/_host_patch_group_select.html.erb +9 -0
- data/app/views/templates/ensure_services.erb +28 -0
- data/config/api_routes.rb +37 -0
- data/config/initializers/pagelets.rb +6 -0
- data/config/initializers/safemode_jail.rb +4 -0
- data/config/routes/mount_engine.rb +3 -0
- data/config/routes/overrides.rb +10 -0
- data/config/routes.rb +47 -0
- data/db/migrate/20210202161304_create_foreman_patch_plans.rb +32 -0
- data/db/migrate/20210202163323_create_foreman_patch_cycles.rb +38 -0
- data/db/migrate/20210202164301_create_foreman_patch_groups.rb +37 -0
- data/db/migrate/20210226134103_add_name_to_cycles.rb +31 -0
- data/db/migrate/20210226162824_rename_default_window.rb +5 -0
- data/db/migrate/20210302165058_add_task_to_window_groups.rb +7 -0
- data/db/migrate/20210304141111_create_invocation.rb +16 -0
- data/db/migrate/20210519163923_add_cycle_end_date.rb +29 -0
- data/db/migrate/20210525154113_expand_window_groups.rb +27 -0
- data/db/migrate/20210723160142_add_cycle_plan_task_group.rb +7 -0
- data/db/migrate/20210831160044_cycle_plan_start_correction.rb +5 -0
- data/db/migrate/20210907104645_rename_group_priority.rb +5 -0
- data/db/migrate/20210909130118_remove_old_references.rb +14 -0
- data/db/migrate/20210910141428_rename_round.rb +7 -0
- data/db/migrate/20210910163542_rename_plan.rb +8 -0
- data/db/migrate/20211014212415_round_group_reference.rb +9 -0
- data/db/migrate/20220105224803_add_group_label.rb +25 -0
- data/db/migrate/20220114153808_plan_add_name_generator.rb +5 -0
- data/db/migrate/20220117103808_remove_cycle_description.rb +5 -0
- data/db/migrate/20220406110705_add_window_state.rb +37 -0
- data/db/migrate/20220407161120_add_round_status.rb +9 -0
- data/db/migrate/20220902134800_add_invocation_status.rb +28 -0
- data/db/seeds.d/100-assign_features_with_templates.rb +16 -0
- data/db/seeds.d/160-mail_notifications.rb +38 -0
- data/db/seeds.d/75-job_templates.rb +16 -0
- data/lib/foreman_patch/engine.rb +87 -0
- data/lib/foreman_patch/plugin.rb +47 -0
- data/lib/foreman_patch/version.rb +3 -0
- data/lib/foreman_patch.rb +4 -0
- data/lib/tasks/foreman_patch_tasks.rake +47 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_patch.po +19 -0
- data/locale/foreman_patch.pot +19 -0
- data/locale/gemspec.rb +2 -0
- data/package.json +35 -0
- data/public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss +6 -0
- data/public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css +1 -0
- data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css.gz +0 -0
- data/public/assets/foreman_patch/foreman_patch.json +1 -0
- data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js +1 -0
- data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.css +1 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.css.gz +0 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js +6 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js.gz +0 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js.map +1 -0
- data/public/webpack/foreman_patch/bundle-200e97f4e2ad9ed413ea.js.map.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.css +1 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.css.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js +6 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js.gz +0 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js.map +1 -0
- data/public/webpack/foreman_patch/foreman_patch-1e4f2d5e6f040a27aa7a.js.map.gz +0 -0
- data/public/webpack/foreman_patch/manifest.json +26 -0
- data/public/webpack/foreman_patch/manifest.json.gz +0 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js +2 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz +0 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map +1 -0
- data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz +0 -0
- data/test/factories/foreman_patch_factories.rb +5 -0
- data/test/test_plugin_helper.rb +6 -0
- data/test/unit/foreman_patch_test.rb +11 -0
- data/webpack/components/Cycle/Cycle.js +57 -0
- data/webpack/components/Cycle/CycleActions.js +21 -0
- data/webpack/components/Cycle/CycleConstants.js +2 -0
- data/webpack/components/Cycle/CycleHelpers.js +3 -0
- data/webpack/components/Cycle/CycleSelectors.js +10 -0
- data/webpack/components/Cycle/Window.js +32 -0
- data/webpack/components/Cycle/index.js +41 -0
- data/webpack/components/Groups/Group.js +20 -0
- data/webpack/components/Groups/Groups.js +46 -0
- data/webpack/components/Groups/GroupsHelpers.js +11 -0
- data/webpack/components/Groups/Priority.js +51 -0
- data/webpack/components/Invocation/Invocation.js +47 -0
- data/webpack/components/Invocation/InvocationActions.js +8 -0
- data/webpack/components/Invocation/InvocationConsts.js +1 -0
- data/webpack/components/Invocation/InvocationSelectors.js +14 -0
- data/webpack/components/Invocation/index.js +36 -0
- data/webpack/components/Invocations/Invocations.js +55 -0
- data/webpack/components/Invocations/InvocationsConstants.js +1 -0
- data/webpack/components/Invocations/InvocationsHelpers.js +11 -0
- data/webpack/components/Invocations/InvocationsPage.js +66 -0
- data/webpack/components/Invocations/InvocationsPage.scss +3 -0
- data/webpack/components/Invocations/InvocationsSelectors.js +21 -0
- data/webpack/components/Invocations/components/InvocationItem.js +66 -0
- data/webpack/components/Invocations/components/InvocationStatus.js +51 -0
- data/webpack/components/Invocations/index.js +99 -0
- data/webpack/components/Plan/Plan.js +90 -0
- data/webpack/components/Plan/PlanActions.js +12 -0
- data/webpack/components/Plan/PlanConstants.js +1 -0
- data/webpack/components/Plan/PlanSelectors.js +9 -0
- data/webpack/components/Plan/Window.js +33 -0
- data/webpack/components/Plan/index.js +36 -0
- data/webpack/components/PlanWindow/PlanWindow.js +55 -0
- data/webpack/components/PlanWindow/index.js +32 -0
- data/webpack/components/RoundProgress/AggregateStatus.js +58 -0
- data/webpack/components/RoundProgress/RoundProgress.js +48 -0
- data/webpack/components/RoundProgress/RoundProgressActions.js +9 -0
- data/webpack/components/RoundProgress/RoundProgressConstants.js +1 -0
- data/webpack/components/RoundProgress/RoundProgressSelectors.js +24 -0
- data/webpack/components/RoundProgress/index.js +44 -0
- data/webpack/components/Rounds/Rounds.js +57 -0
- data/webpack/components/Rounds/RoundsActions.js +8 -0
- data/webpack/components/Rounds/RoundsConsts.js +1 -0
- data/webpack/components/Rounds/RoundsSelectors.js +14 -0
- data/webpack/components/Rounds/components/RoundItem.js +52 -0
- data/webpack/components/Rounds/components/RoundStatus.js +40 -0
- data/webpack/components/Rounds/index.js +37 -0
- data/webpack/components/common/Calendar/Calendar.js +86 -0
- data/webpack/components/common/Calendar/Calendar.scss +76 -0
- data/webpack/components/common/Calendar/CalendarConstants.js +1 -0
- data/webpack/components/common/Calendar/CalendarHelpers.js +77 -0
- data/webpack/components/common/Calendar/Day/index.js +9 -0
- data/webpack/components/common/Calendar/Event.js +25 -0
- data/webpack/components/common/Calendar/Month/Day.js +51 -0
- data/webpack/components/common/Calendar/Month/Header.js +77 -0
- data/webpack/components/common/Calendar/Month/Month.js +47 -0
- data/webpack/components/common/Calendar/Month/index.js +1 -0
- data/webpack/components/common/Calendar/View.js +20 -0
- data/webpack/components/common/Calendar/Week/index.js +13 -0
- data/webpack/components/common/Calendar/index.js +2 -0
- data/webpack/components/common/Terminal/OutputLine.js +26 -0
- data/webpack/components/common/Terminal/Terminal.js +115 -0
- data/webpack/components/common/Terminal/Terminal.scss +47 -0
- data/webpack/index.js +20 -0
- metadata +438 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Icon } from 'patternfly-react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
|
6
|
+
const InvocationStatus = ({ status }) => {
|
7
|
+
switch (status) {
|
8
|
+
case 'error':
|
9
|
+
return (
|
10
|
+
<div>
|
11
|
+
<Icon type="pf" name="error-circle-o" /> {__('failed')}
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
case 'warning':
|
15
|
+
return (
|
16
|
+
<div>
|
17
|
+
<Icon type="pf" name="warning-triangle-o" /> {__('warning')}
|
18
|
+
</div>
|
19
|
+
);
|
20
|
+
case 'success':
|
21
|
+
return (
|
22
|
+
<div>
|
23
|
+
<Icon type="pf" name="ok" /> {__('success')}
|
24
|
+
</div>
|
25
|
+
);
|
26
|
+
case 'cancelled':
|
27
|
+
return (
|
28
|
+
<div>
|
29
|
+
<Icon type="fa" name="ban" /> {__('cancelled')}
|
30
|
+
</div>
|
31
|
+
);
|
32
|
+
case 'running':
|
33
|
+
return (
|
34
|
+
<div>
|
35
|
+
<Icon type="pf" name="in-progress" /> {__('running')}
|
36
|
+
</div>
|
37
|
+
);
|
38
|
+
default:
|
39
|
+
return (
|
40
|
+
<div>
|
41
|
+
<Icon type="pf" name="pending" /> {__('pending')}
|
42
|
+
</div>
|
43
|
+
);
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
InvocationStatus.propTypes = {
|
48
|
+
status: PropTypes.string.isRequired,
|
49
|
+
};
|
50
|
+
|
51
|
+
export default InvocationStatus;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import { useSelector, useDispatch } from 'react-redux';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
|
5
|
+
import {
|
6
|
+
withInterval,
|
7
|
+
stopInterval
|
8
|
+
} from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
9
|
+
import { get } from 'foremanReact/redux/API';
|
10
|
+
import { useForemanSettings } from 'foremanReact/Root/Context/ForemanContext';
|
11
|
+
|
12
|
+
import {
|
13
|
+
selectItems,
|
14
|
+
selectTotal,
|
15
|
+
selectAutoRefresh,
|
16
|
+
selectStatus,
|
17
|
+
selectIntervalExists,
|
18
|
+
} from './InvocationsSelectors';
|
19
|
+
import { getUrl } from './InvocationsHelpers';
|
20
|
+
import { INVOCATIONS } from './InvocationsConstants';
|
21
|
+
import InvocationsPage from './InvocationsPage';
|
22
|
+
|
23
|
+
const WrappedInvocations = ({ round }) => {
|
24
|
+
const dispatch = useDispatch();
|
25
|
+
const { perPage, perPageOptions } = useForemanSettings();
|
26
|
+
|
27
|
+
const items = useSelector(selectItems);
|
28
|
+
const total = useSelector(selectTotal);
|
29
|
+
const autoRefresh = useSelector(selectAutoRefresh);
|
30
|
+
const status = useSelector(selectStatus);
|
31
|
+
const [searchQuery, setSearchQuery] = useState('');
|
32
|
+
const [pagination, setPagination] = useState({
|
33
|
+
page: 1,
|
34
|
+
perPage,
|
35
|
+
perPageOptions,
|
36
|
+
});
|
37
|
+
const [url, setUrl] = useState(getUrl(round, searchQuery, pagination));
|
38
|
+
const intervalExists = useSelector(selectIntervalExists);
|
39
|
+
|
40
|
+
const handleSearch = query => {
|
41
|
+
const defaultPagination = { page: 1, perPage: pagination.perPage };
|
42
|
+
stopApiInterval();
|
43
|
+
|
44
|
+
setUrl(getUrl(round, query, defaultPagination));
|
45
|
+
setSearchQuery(query);
|
46
|
+
setPagination(defaultPagination);
|
47
|
+
};
|
48
|
+
|
49
|
+
const handlePagination = args => {
|
50
|
+
stopApiInterval();
|
51
|
+
setPagination(args);
|
52
|
+
setUrl(getUrl(round, searchQuery, args));
|
53
|
+
};
|
54
|
+
|
55
|
+
const stopApiInterval = () => {
|
56
|
+
if (intervalExists) {
|
57
|
+
dispatch(stopInterval(INVOCATIONS));
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
const getData = url => withInterval(get({
|
62
|
+
key: INVOCATIONS,
|
63
|
+
url,
|
64
|
+
handleError: () => {
|
65
|
+
dispatch(stopInterval(INVOCATIONS));
|
66
|
+
},
|
67
|
+
}), 5000);
|
68
|
+
|
69
|
+
useEffect(() => {
|
70
|
+
dispatch(getData(url));
|
71
|
+
|
72
|
+
if (!autoRefresh) {
|
73
|
+
dispatch(stopInterval(INVOCATIONS));
|
74
|
+
}
|
75
|
+
|
76
|
+
return () => {
|
77
|
+
dispatch(stopInterval(INVOCATIONS));
|
78
|
+
};
|
79
|
+
}, [dispatch, url, autoRefresh]);
|
80
|
+
|
81
|
+
return (
|
82
|
+
<InvocationsPage
|
83
|
+
status={status}
|
84
|
+
items={items}
|
85
|
+
total={total}
|
86
|
+
searchQuery={searchQuery}
|
87
|
+
handleSearch={handleSearch}
|
88
|
+
pagination={pagination}
|
89
|
+
handlePagination={handlePagination}
|
90
|
+
/>
|
91
|
+
);
|
92
|
+
};
|
93
|
+
|
94
|
+
WrappedInvocations.propTypes = {
|
95
|
+
round: PropTypes.number.isRequired,
|
96
|
+
};
|
97
|
+
|
98
|
+
export default WrappedInvocations;
|
99
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { LoadingState, Alert } from 'patternfly-react';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
import { STATUS } from 'foremanReact/constants';
|
6
|
+
|
7
|
+
import Window from './Window';
|
8
|
+
import Calendar from '../common/Calendar';
|
9
|
+
|
10
|
+
const Plan = ({
|
11
|
+
id,
|
12
|
+
name,
|
13
|
+
description,
|
14
|
+
start_date,
|
15
|
+
end_date,
|
16
|
+
interval,
|
17
|
+
units,
|
18
|
+
correction,
|
19
|
+
activeCount,
|
20
|
+
window_plans,
|
21
|
+
moveWindow,
|
22
|
+
status,
|
23
|
+
}) => {
|
24
|
+
if (status === STATUS.ERROR) {
|
25
|
+
return (
|
26
|
+
<Alert type="error">
|
27
|
+
{__(
|
28
|
+
'There is an error while loading the cycle, try refreshing the page.'
|
29
|
+
)}
|
30
|
+
</Alert>
|
31
|
+
);
|
32
|
+
}
|
33
|
+
|
34
|
+
const start = new Date(start_date + 'T00:00:00.000');
|
35
|
+
const end = new Date(end_date + 'T23:59:59.999');
|
36
|
+
|
37
|
+
const onEventMoved = (event) => {
|
38
|
+
const window = {
|
39
|
+
id: event.id,
|
40
|
+
start_day: Math.floor((event.start.getTime() - start.getTime()) / (24 * 60 * 60 * 1000)),
|
41
|
+
duration: (event.end.getTime() - event.start.getTime()) / 1000,
|
42
|
+
start_time: event.start,
|
43
|
+
};
|
44
|
+
|
45
|
+
moveWindow(window);
|
46
|
+
};
|
47
|
+
|
48
|
+
|
49
|
+
const events = window_plans.map(window => {
|
50
|
+
const start = new Date(window.start_time);
|
51
|
+
const end = new Date(start.getTime() + window.duration * 1000);
|
52
|
+
|
53
|
+
return {
|
54
|
+
id: window.id,
|
55
|
+
start: start,
|
56
|
+
end: end,
|
57
|
+
title: <Window {...window} />
|
58
|
+
};
|
59
|
+
});
|
60
|
+
|
61
|
+
return (
|
62
|
+
<LoadingState loading={status === STATUS.PENDING} >
|
63
|
+
<Calendar start={start} end={end} events={events} onEventMoved={onEventMoved} />
|
64
|
+
</LoadingState>
|
65
|
+
);
|
66
|
+
};
|
67
|
+
|
68
|
+
Plan.propTypes = {
|
69
|
+
id: PropTypes.number.isRequired,
|
70
|
+
name: PropTypes.string.isRequired,
|
71
|
+
description: PropTypes.string,
|
72
|
+
start_date: PropTypes.string.isRequired,
|
73
|
+
end_date: PropTypes.string.isRequired,
|
74
|
+
interval: PropTypes.number.isRequired,
|
75
|
+
units: PropTypes.oneOf(['days', 'weeks', 'months']).isRequired,
|
76
|
+
correction: PropTypes.string,
|
77
|
+
activeCount: PropTypes.number.isRequired,
|
78
|
+
window_plans: PropTypes.array,
|
79
|
+
moveWindow: PropTypes.func,
|
80
|
+
status: PropTypes.string.isRequired,
|
81
|
+
};
|
82
|
+
|
83
|
+
Plan.defaultProps = {
|
84
|
+
description: null,
|
85
|
+
correction: null,
|
86
|
+
window_plans: [],
|
87
|
+
moveWindow: (window) => {},
|
88
|
+
};
|
89
|
+
|
90
|
+
export default Plan;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { APIActions } from 'foremanReact/redux/API';
|
2
|
+
import { PLAN, WINDOW } from './PlanConstants';
|
3
|
+
|
4
|
+
export const getPlan = (id) => APIActions.get({ key: PLAN, url: `/foreman_patch/api/plans/${id}` });
|
5
|
+
|
6
|
+
export const moveWindow = ({id, ...object}) => APIActions.put({
|
7
|
+
key: WINDOW,
|
8
|
+
url: `/foreman_patch/api/window_plans/${id}`,
|
9
|
+
params: {
|
10
|
+
window_plan: object,
|
11
|
+
}
|
12
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export const PLAN = 'PLAN';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import {
|
2
|
+
selectAPIStatus,
|
3
|
+
selectAPIResponse,
|
4
|
+
} from 'foremanReact/redux/API/APISelectors';
|
5
|
+
import { PLAN } from './PlanConstants';
|
6
|
+
|
7
|
+
export const selectPlan = state => selectAPIResponse(state, PLAN) || {};
|
8
|
+
|
9
|
+
export const selectStatus = state => selectAPIStatus(state, PLAN);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
|
4
|
+
const Window = ({id, name, description, start_day, start_time, locale, hour12}) => {
|
5
|
+
const time = Intl.DateTimeFormat(locale, {
|
6
|
+
hour: 'numeric', minute: 'numeric', hour12: hour12
|
7
|
+
}).format(new Date(start_time));
|
8
|
+
|
9
|
+
return (
|
10
|
+
<div className="ellipsis">
|
11
|
+
<a href={`/foreman_patch/window_plans/${id}/edit`}>{time} {name}</a>
|
12
|
+
</div>
|
13
|
+
);
|
14
|
+
};
|
15
|
+
|
16
|
+
Window.propTypes = {
|
17
|
+
id: PropTypes.number.isRequired,
|
18
|
+
name: PropTypes.string.isRequired,
|
19
|
+
description: PropTypes.string,
|
20
|
+
start_day: PropTypes.number.isRequired,
|
21
|
+
start_time: PropTypes.instanceOf(Date).isRequired,
|
22
|
+
duration: PropTypes.number.isRequired,
|
23
|
+
locale: PropTypes.string,
|
24
|
+
hour12: PropTypes.bool,
|
25
|
+
};
|
26
|
+
|
27
|
+
Window.defaultProps = {
|
28
|
+
description: null,
|
29
|
+
locale: 'en-US',
|
30
|
+
hour12: true,
|
31
|
+
};
|
32
|
+
|
33
|
+
export default Window;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { useSelector, useDispatch } from 'react-redux';
|
4
|
+
|
5
|
+
import Plan from './Plan';
|
6
|
+
import {
|
7
|
+
selectPlan,
|
8
|
+
selectStatus,
|
9
|
+
} from './PlanSelectors';
|
10
|
+
import {
|
11
|
+
getPlan,
|
12
|
+
moveWindow,
|
13
|
+
} from './PlanActions';
|
14
|
+
|
15
|
+
const WrappedPlan = ({ id }) => {
|
16
|
+
const dispatch = useDispatch();
|
17
|
+
|
18
|
+
const plan = useSelector(selectPlan);
|
19
|
+
const status = useSelector(selectStatus);
|
20
|
+
|
21
|
+
const updateWindow = (window) => {
|
22
|
+
dispatch(moveWindow(window));
|
23
|
+
};
|
24
|
+
|
25
|
+
useEffect(() => {
|
26
|
+
dispatch(getPlan(id));
|
27
|
+
}, [dispatch]);
|
28
|
+
|
29
|
+
return (<Plan {...plan} moveWindow={updateWindow} status={status} />);
|
30
|
+
};
|
31
|
+
|
32
|
+
WrappedPlan.propTypes = {
|
33
|
+
id: PropTypes.number.isRequired,
|
34
|
+
};
|
35
|
+
|
36
|
+
export default WrappedPlan;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { LoadingState, Alert } from 'patternfly-react';
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
import { STATUS } from 'foremanReact/constants';
|
6
|
+
|
7
|
+
const PlanWindow = ({
|
8
|
+
id,
|
9
|
+
name,
|
10
|
+
description,
|
11
|
+
start_day,
|
12
|
+
start_time,
|
13
|
+
duration,
|
14
|
+
plan_id,
|
15
|
+
plan,
|
16
|
+
groups,
|
17
|
+
status
|
18
|
+
}) => {
|
19
|
+
if (status === STATUS.ERROR) {
|
20
|
+
return (
|
21
|
+
<Alert type="error">
|
22
|
+
{__(
|
23
|
+
'There was an error while loading the window, try refreshing the page.'
|
24
|
+
)}
|
25
|
+
</Alert>
|
26
|
+
);
|
27
|
+
}
|
28
|
+
|
29
|
+
return (
|
30
|
+
<LoadingState loading={status === STATUS.PENDING}>
|
31
|
+
<PlanWindowCards {...props} />
|
32
|
+
<hr/>
|
33
|
+
<Groups groups={groups} />
|
34
|
+
</LoadingState>
|
35
|
+
);
|
36
|
+
};
|
37
|
+
|
38
|
+
PlanWindow.propTypes = {
|
39
|
+
id: PropTypes.number,
|
40
|
+
name: PropTypes.string,
|
41
|
+
description: PropTypes.string,
|
42
|
+
start_day: PropTypes.number,
|
43
|
+
start_time: PropTypes.string,
|
44
|
+
duration: PropTypes.number,
|
45
|
+
plan_id: PropTypes.number,
|
46
|
+
plan: PropTypes.object,
|
47
|
+
groups: PropTypes.array,
|
48
|
+
status: PropTypes.string.isRequired,
|
49
|
+
};
|
50
|
+
|
51
|
+
PlanWindow.defaultProps = {
|
52
|
+
groups: [],
|
53
|
+
};
|
54
|
+
|
55
|
+
export default PlanWindow;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { useSelector, useDispatch } from 'react-redux';
|
4
|
+
|
5
|
+
import PlanWindow from './PlanWindow';
|
6
|
+
import {
|
7
|
+
selectPlanWindow,
|
8
|
+
selectStatus,
|
9
|
+
} from './PlanWindowSelectors';
|
10
|
+
import {
|
11
|
+
getPlanWindow,
|
12
|
+
moveGroup,
|
13
|
+
} from './PlanWindowActions';
|
14
|
+
|
15
|
+
const WrappedPlanWindow = ({ id }) => {
|
16
|
+
const dispatch = useDispatch();
|
17
|
+
|
18
|
+
const planWindow = useSelector(selectPlanWindow);
|
19
|
+
const status = useSelector(selectStatus);
|
20
|
+
|
21
|
+
useEffect(() => {
|
22
|
+
dispatch(getPlanWindow(id));
|
23
|
+
}, [dispatch]);
|
24
|
+
|
25
|
+
return (<PlanWindow {...planWindow} status={status} />);
|
26
|
+
};
|
27
|
+
|
28
|
+
WrappedPlanWindow.propTypes = {
|
29
|
+
id: PropTypes.number.isRequired,
|
30
|
+
};
|
31
|
+
|
32
|
+
export default WrappedPlanWindow;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
|
4
|
+
const AggregateStatus = ({ progress }) => (
|
5
|
+
<div id="aggregate_statuses">
|
6
|
+
<p className="card-pf-aggregate-status-notifications">
|
7
|
+
<span className="card-pf-aggregate-status-notification">
|
8
|
+
<span id="success_count">
|
9
|
+
<span className="pficon pficon-ok" />
|
10
|
+
{progress.success}
|
11
|
+
</span>
|
12
|
+
</span>
|
13
|
+
<span className="card-pf-aggregate-status-notification">
|
14
|
+
<span id="warning_count">
|
15
|
+
<span className="pficon pficon-warning-triangle-o" />
|
16
|
+
{progress.warning}
|
17
|
+
</span>
|
18
|
+
</span>
|
19
|
+
<span className="card-pf-aggregate-status-notification">
|
20
|
+
<span id="failed_count">
|
21
|
+
<span className="pficon pficon-error-circle-o" />
|
22
|
+
{progress.failed}
|
23
|
+
</span>
|
24
|
+
</span>
|
25
|
+
<span className="card-pf-aggregate-status-notification">
|
26
|
+
<span id="running_count">
|
27
|
+
<span className="pficon pficon-running" />
|
28
|
+
{progress.running}
|
29
|
+
</span>
|
30
|
+
</span>
|
31
|
+
<span className="card-pf-aggregate-status-notification">
|
32
|
+
<span id="pending_count">
|
33
|
+
<span className="pficon pficon-pending" />
|
34
|
+
{progress.pending}
|
35
|
+
</span>
|
36
|
+
</span>
|
37
|
+
<span className="card-pf-aggregate-status-notification">
|
38
|
+
<span id="cancelled_count">
|
39
|
+
<span className="pficon pficon-close" />
|
40
|
+
{progress.cancelled}
|
41
|
+
</span>
|
42
|
+
</span>
|
43
|
+
</p>
|
44
|
+
</div>
|
45
|
+
);
|
46
|
+
|
47
|
+
AggregateStatus.propTypes = {
|
48
|
+
progress: PropTypes.shape({
|
49
|
+
success: PropTypes.number,
|
50
|
+
warning: PropTypes.number,
|
51
|
+
failed: PropTypes.number,
|
52
|
+
running: PropTypes.number,
|
53
|
+
pending: PropTypes.number,
|
54
|
+
cancelled: PropTypes.number,
|
55
|
+
}).isRequired,
|
56
|
+
};
|
57
|
+
|
58
|
+
export default AggregateStatus;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import Immutable from 'seamless-immutable';
|
4
|
+
|
5
|
+
import DonutChart from 'foremanReact/components/common/charts/DonutChart';
|
6
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
7
|
+
|
8
|
+
import AggregateStatus from './AggregateStatus';
|
9
|
+
|
10
|
+
const RoundProgress = ({ progress }) => {
|
11
|
+
const data = [
|
12
|
+
[__('Success'), progress.success, '#5CB85C'],
|
13
|
+
[__('Warning'), progress.warning, '#DB843D'],
|
14
|
+
[__('Failed'), progress.failed, '#D9534F'],
|
15
|
+
[__('Running'), progress.running, '#3D96AE'],
|
16
|
+
[__('Pending'), progress.pending, '#DEDEDE'],
|
17
|
+
[__('Cancelled'), progress.cancelled, '#B7312D'],
|
18
|
+
];
|
19
|
+
|
20
|
+
const iMax = data.reduce((im, e, i, arr) =>
|
21
|
+
(e[1] > arr[im][i] ? i : im), 0);
|
22
|
+
|
23
|
+
return (
|
24
|
+
<div id="round_progress">
|
25
|
+
<DonutChart
|
26
|
+
data={Immutable.asMutable(data)}
|
27
|
+
title={{
|
28
|
+
type: 'percent',
|
29
|
+
secondary: (data[iMax] || [])[0],
|
30
|
+
}}
|
31
|
+
/>
|
32
|
+
<AggregateStatus progress={progress} />
|
33
|
+
</div>
|
34
|
+
);
|
35
|
+
};
|
36
|
+
|
37
|
+
RoundProgress.propTypes = {
|
38
|
+
progress: PropTypes.shape({
|
39
|
+
success: PropTypes.number,
|
40
|
+
warning: PropTypes.number,
|
41
|
+
failed: PropTypes.number,
|
42
|
+
running: PropTypes.number,
|
43
|
+
pending: PropTypes.number,
|
44
|
+
cancelled: PropTypes.number,
|
45
|
+
}).isRequired,
|
46
|
+
};
|
47
|
+
|
48
|
+
export default RoundProgress;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { get } from 'foremanReact/redux/API';
|
2
|
+
import { withInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
3
|
+
|
4
|
+
import { ROUND_PROGRESS } from './RoundProgressConstants';
|
5
|
+
|
6
|
+
export const getProgress = (round) => withInterval(get({
|
7
|
+
key: ROUND_PROGRESS,
|
8
|
+
url: `/foreman_patch/api/rounds/${round}/status`,
|
9
|
+
}), 5000);
|
@@ -0,0 +1 @@
|
|
1
|
+
export const ROUND_PROGRESS = 'ROUND_PROGRESS';
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import {
|
2
|
+
selectAPIStatus,
|
3
|
+
selectAPIResponse,
|
4
|
+
} from 'foremanReact/redux/API/APISelectors';
|
5
|
+
|
6
|
+
import { ROUND_PROGRESS } from './RoundProgressConstants';
|
7
|
+
|
8
|
+
const defaultProgress = {
|
9
|
+
success: 0,
|
10
|
+
warning: 0,
|
11
|
+
failed: 0,
|
12
|
+
running: 0,
|
13
|
+
pending: 0,
|
14
|
+
cancelled: 0,
|
15
|
+
};
|
16
|
+
|
17
|
+
export const selectProgress = state =>
|
18
|
+
selectAPIResponse(state, ROUND_PROGRESS).progress || defaultProgress;
|
19
|
+
|
20
|
+
export const selectAutoRefresh = state =>
|
21
|
+
!selectAPIResponse(state, ROUND_PROGRESS).complete;
|
22
|
+
|
23
|
+
export const selectStatus = state =>
|
24
|
+
selectAPIStatus(state, ROUND_PROGRESS);
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import { useSelector, useDispatch } from 'react-redux';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
|
5
|
+
import { stopInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
6
|
+
|
7
|
+
import {
|
8
|
+
selectProgress,
|
9
|
+
selectAutoRefresh,
|
10
|
+
selectStatus,
|
11
|
+
} from './RoundProgressSelectors';
|
12
|
+
import { getProgress } from './RoundProgressActions';
|
13
|
+
import { ROUND_PROGRESS } from './RoundProgressConstants';
|
14
|
+
import RoundProgress from './RoundProgress';
|
15
|
+
|
16
|
+
const WrappedRoundProgress = ({ round }) => {
|
17
|
+
const dispatch = useDispatch();
|
18
|
+
|
19
|
+
const progress = useSelector(selectProgress);
|
20
|
+
const autoRefresh = useSelector(selectAutoRefresh);
|
21
|
+
const status = useSelector(selectStatus);
|
22
|
+
|
23
|
+
useEffect(() => {
|
24
|
+
dispatch(getProgress(round));
|
25
|
+
|
26
|
+
if (!autoRefresh) {
|
27
|
+
dispatch(stopInterval(ROUND_PROGRESS));
|
28
|
+
}
|
29
|
+
|
30
|
+
return () => {
|
31
|
+
dispatch(stopInterval(ROUND_PROGRESS));
|
32
|
+
};
|
33
|
+
}, [dispatch, autoRefresh]);
|
34
|
+
|
35
|
+
return (
|
36
|
+
<RoundProgress progress={progress} />
|
37
|
+
);
|
38
|
+
};
|
39
|
+
|
40
|
+
WrappedRoundProgress.propTypes = {
|
41
|
+
round: PropTypes.number.isRequired,
|
42
|
+
};
|
43
|
+
|
44
|
+
export default WrappedRoundProgress;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
4
|
+
import { LoadingState, Alert } from 'patternfly-react';
|
5
|
+
import { STATUS } from 'foremanReact/constants';
|
6
|
+
import RoundItem from './components/RoundItem';
|
7
|
+
|
8
|
+
const Rounds = ({ status, items }) => {
|
9
|
+
if (status === STATUS.ERROR) {
|
10
|
+
return (
|
11
|
+
<Alert type="error">
|
12
|
+
{__(
|
13
|
+
'There was an error while updating the status, try refreshing the page.'
|
14
|
+
)}
|
15
|
+
</Alert>
|
16
|
+
);
|
17
|
+
}
|
18
|
+
|
19
|
+
return (
|
20
|
+
<LoadingState loading={!items.length && status === STATUS.PENDING}>
|
21
|
+
<div>
|
22
|
+
<table className="table table-bordered table-striped table-hover">
|
23
|
+
<thead>
|
24
|
+
<tr>
|
25
|
+
<th>{__('Round')}</th>
|
26
|
+
<th>{__('Priority')}</th>
|
27
|
+
<th>{__('Hosts Count')}</th>
|
28
|
+
<th>{__('Status')}</th>
|
29
|
+
<th>{__('Actions')}</th>
|
30
|
+
</tr>
|
31
|
+
</thead>
|
32
|
+
<tbody>
|
33
|
+
{items.map(round => (
|
34
|
+
<RoundItem
|
35
|
+
key={round.name}
|
36
|
+
name={round.name}
|
37
|
+
link={round.link}
|
38
|
+
priority={round.priority}
|
39
|
+
hostsCount={round.hostsCount}
|
40
|
+
hostsLink={round.hostsLink}
|
41
|
+
status={round.status}
|
42
|
+
actions={round.actions}
|
43
|
+
/>
|
44
|
+
))}
|
45
|
+
</tbody>
|
46
|
+
</table>
|
47
|
+
</div>
|
48
|
+
</LoadingState>
|
49
|
+
);
|
50
|
+
};
|
51
|
+
|
52
|
+
Rounds.propTypes = {
|
53
|
+
status: PropTypes.string.isRequired,
|
54
|
+
items: PropTypes.array.isRequired,
|
55
|
+
};
|
56
|
+
|
57
|
+
export default Rounds;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { getURI } from 'foremanReact/common/urlHelpers';
|
2
|
+
import { get } from 'foremanReact/redux/API';
|
3
|
+
import { withInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
4
|
+
import { ROUNDS } from './RoundsConsts';
|
5
|
+
|
6
|
+
const url = getURI().addQuery('format', 'json');
|
7
|
+
export const getData = () =>
|
8
|
+
withInterval(get({ key: ROUNDS, url }), 1000);
|
@@ -0,0 +1 @@
|
|
1
|
+
export const ROUNDS = 'ROUNDS';
|