Resolves: MTV-4481 | Add appliance management UI input for OVA providers#2229
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2229 +/- ##
===========================================
- Coverage 36.81% 14.58% -22.23%
===========================================
Files 158 1127 +969
Lines 2548 20175 +17627
Branches 599 3767 +3168
===========================================
+ Hits 938 2943 +2005
- Misses 1428 17222 +15794
+ Partials 182 10 -172 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e3233c8 to
4305cce
Compare
|
LGTM |
|
Why is it that in the create provider form there is no ability to upload local OVA files but in the details after creation there is? |
|
Also, why not contain the OVA local file upload within the edit more for |
| {t('Enabled')} | ||
| </Label> | ||
| ) : ( | ||
| <Label isCompact status="info"> |
There was a problem hiding this comment.
I'm not sure it makes sense to have "info" status for something labeled as "Disabled". Do we do this elsewhere? Otherwise I would suggest a default status.
| const obj = await k8sPatch({ | ||
| data: [ | ||
| { | ||
| op: currentValue ? REPLACE : ADD, |
There was a problem hiding this comment.
I'm not exactly sure why the Modal utils possess REPLACE/ADD/REMOVE operations for k8sPatch operations (something we might want to consider moving to a place for this just pertaining to k8s operations), but either way, it looks like REMOVE is an option, and wouldn't that make more sense to use when appliance management is "disabled" vs REPLACE?
There was a problem hiding this comment.
It cluters a bit the code, I made the changes what do you think?
| provider: V1beta1Provider, | ||
| enabled: boolean, | ||
| ): Promise<V1beta1Provider> => { | ||
| const currentValue = getApplianceManagement(provider); |
There was a problem hiding this comment.
nit: since this is used to determine replace vs add, I wonder if its a better read to convert to value returned to a boolean and call it something like isAppManagementEnabled?
There was a problem hiding this comment.
I added this selector because it makes sense, but in this specific case I want to see if I have any value in there (including false value) so I would know the patch operation should replace or delete
e2dbc99 to
7840390
Compare
the service to upload the OVA files is created only after the provider creation, not during.
Not sure if we should hide this upload if I remember they wanted it exposed in a way a user would not miss it, but I do think that's just temporary just to make them aware of it, so we can ask Margot about this |
| const [enabled, setEnabled] = useState(isApplianceManagementEnabled(provider)); | ||
|
|
||
| const onSubmit = async (): Promise<void> => { | ||
| await onUpdateApplianceManagement(provider, enabled); |
There was a problem hiding this comment.
nit: no point of awaiting here. can just return onUpdateApplianceManagement(provider, enabled);
| const currentValue = getApplianceManagement(provider); | ||
| const getOpAndValue = () => { | ||
| if (currentValue === enabled.toString()) return undefined; | ||
| if (isEmpty(currentValue) && enabled) return { op: ADD, value: TRUE_VALUE }; |
There was a problem hiding this comment.
Isn't currentValue just a string? Do we need to use isEmpty on strings? I thought it was mainly for objects and arrays.
There was a problem hiding this comment.
it can be also used with strings, any reason not to?
this function is meant to replace the one in loadsh: https://lodash.com/docs/#isEmpty (we wanted to avoid adding the entire package for just some bits of the package)
| const getOpAndValue = () => { | ||
| if (currentValue === enabled.toString()) return undefined; | ||
| if (isEmpty(currentValue) && enabled) return { op: ADD, value: TRUE_VALUE }; | ||
| if (!isEmpty(currentValue) && enabled) return { op: REPLACE, value: TRUE_VALUE }; |
There was a problem hiding this comment.
nit: I personally think this is less readable with all if statements being single lines with their return statements
jpuzz0
left a comment
There was a problem hiding this comment.
Few minor comments, but otherwise LGTM
Add checkbox field to enable appliance management when creating OVA providers and in the provider details page. This setting controls whether users can upload OVA files directly to the provider. Changes: - Add checkbox in create provider form for OVA type - Add details item with edit capability in OVA provider details page - Add E2E test verification for appliance management setting Resolves: MTV-4481 Signed-off-by: Aviv Turgeman <[email protected]>
7840390 to
780e66c
Compare
|
|
/backport release-2.11 |
|
🔄 Backport Status Starting backport of PR #2229 to |
|
✅ Backport Completed Successfully PR #2229 has been successfully backported to A new pull request should have been created with the backported changes. |






📝 Links
📝 Description
Add UI input for the
applianceManagementsetting on OVA providers, which controls whether users can upload OVA files directly to the provider.Changes:
When enabled, the "Upload local OVA files" section becomes visible on the provider details page.
🎥 Demo
📝 CC://