From b7955a50dc6226c0cf7c5ef99c27195aac7f7cf2 Mon Sep 17 00:00:00 2001 From: Christopher Souza Date: Mon, 11 Sep 2023 09:52:15 -0300 Subject: [PATCH] Add the upload-only option to the Horizon upgrade orchestration UI This change adds the new DC upgrade orchestration upload-only option to the upgrade orchestration UI. A new 'Upload Only' checkbox was added to the 'Create Strategy' form when the selected strategy type is 'Upgrade'. In the 'Orchestration Strategy' tab, if the current strategy is a upgrade strategy, a new field 'Upload Only' with its current value is now shown so that the user can know if an existing strategy is using this option. Test Plan: 1. PASS - Verify that the 'Upload Only' checkbox appears correctly inside of the create strategy form only when the selected strategy type is equal to 'Upgrade'; 2. PASS - Create a upgrade strategy with and without the upload-only option and verify that it gets created successfully; 3. PASS - Verify that the interface shows the 'Upload Only' field and its current value on the 'Orchestration Strategy' page only when using the patch and upgrade strategy type; 4. PASS - Create and delete another orchestration type (e.g. Kubernetes upgrade) through Horizon and verify that it still works as expected; Depends-On: https://review.opendev.org/c/starlingx/distcloud-client/+/894169 Story: 2010676 Task: 48771 Change-Id: Id20dd42939165947eb377965557e9618e3b6b7ea Signed-off-by: Christopher Souza --- .../dashboards/dc_admin/dc_orchestration/forms.py | 7 ++++--- .../dc_orchestration/_cloud_strategy_orchestration.html | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py index a1a103a1..bd0a8590 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/forms.py @@ -204,12 +204,13 @@ class CreateCloudStrategyForm(forms.SelfHandlingForm): label=_("Upload Only"), initial=False, required=False, - help_text=_('Stops strategy after uploading patches to subclouds'), + help_text=_('Stops strategy after uploading releases to subclouds'), widget=forms.CheckboxInput( attrs={ 'class': 'switched', 'data-switch-on': 'strategy_types', - 'data-strategy_types-patch': _("Upload Only") + 'data-strategy_types-patch': _("Upload Only"), + 'data-strategy_types-upgrade': _("Upload Only") } ) ) @@ -319,7 +320,7 @@ class CreateCloudStrategyForm(forms.SelfHandlingForm): del data['to-version'] del data['force-kubernetes'] - if data['type'] == 'patch': + if data['type'] == 'patch' or data['type'] == 'upgrade': data['upload-only'] = str(data['upload-only']).lower() else: del data['upload-only'] diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/templates/dc_orchestration/_cloud_strategy_orchestration.html b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/templates/dc_orchestration/_cloud_strategy_orchestration.html index 29a6d7ce..c7d93fca 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/templates/dc_orchestration/_cloud_strategy_orchestration.html +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_orchestration/templates/dc_orchestration/_cloud_strategy_orchestration.html @@ -18,7 +18,8 @@
{% trans "Stop On Failure" %}
{{ strategy.stop_on_failure }}
{% if strategy.extra_args %} - {% if strategy.strategy_type == 'patch' %} + + {% if strategy.strategy_type == 'patch' or strategy.strategy_type == 'upgrade' %}
{% trans "Upload Only" %}
{{ strategy.extra_args|get_value:"upload-only" }}
{% elif strategy.strategy_type == 'prestage' %}