-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui: fix considerlasthost for start vm #10602
Conversation
Fixes apache#10601 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
@@ -237,7 +237,7 @@ export default { | |||
id: this.resource.id | |||
} | |||
for (const key in values) { | |||
if (values[key]) { | |||
if (values[key] || values[key] === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we simply remove this if condition? I don't see how a form's field value could be null
or undefined
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bernardodemarco It may be there because some fields may have an empty value which we shouldn't pass to the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Specifically in this form, in which all fields are select components (except for the considerlasthost
), the UI does not allow the values to be empty.
However, I think that's a great idea to keep the if statement how you proposed, since that we could, in the future, add more fields to the form that can accept empty/nullable values
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 4.19 #10602 +/- ##
=========================================
Coverage 15.16% 15.16%
- Complexity 11326 11328 +2
=========================================
Files 5414 5414
Lines 474804 474811 +7
Branches 57909 57911 +2
=========================================
+ Hits 72002 72016 +14
+ Misses 394749 394743 -6
+ Partials 8053 8052 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
UI build: ✔️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shwstppr, I think that we should also tackle this bug when starting VMs through group actions.
I debugged the current behavior of the AutogenView
component. On this block of code:
cloudstack/ui/src/views/AutogenView.vue
Lines 1443 to 1447 in 6c40a7b
const paramsList = this.currentAction.groupMap(this.selectedRowKeys, values, this.items) | |
for (const params of paramsList) { | |
var resourceName = itemsNameMap[params.id] | |
// Using a method for this since it's an async call and don't want wrong prarms to be passed | |
this.promises.push(this.callGroupApi(params, resourceName)) |
The paramsList
variable contains the considerlasthost
parameter as undefined
and, thus, it is not sent within the API request. To handle that, we could, in the following groupMap
field:
cloudstack/ui/src/config/section/compute.js
Lines 116 to 124 in 6c40a7b
api: 'startVirtualMachine', | |
icon: 'caret-right-outlined', | |
label: 'label.action.start.instance', | |
message: 'message.action.start.instance', | |
docHelp: 'adminguide/virtual_machines.html#stopping-and-starting-vms', | |
dataView: true, | |
groupAction: true, | |
popup: true, | |
groupMap: (selection, values) => { return selection.map(x => { return { id: x, considerlasthost: values.considerlasthost } }) }, |
Check whether values.considerlasthost
is undefined
. If so, the considerlasthost
field could be set as false
.
Edit: The bug when starting VMs through group actions occurs when the form is opened, and the considerlasthost
field is not changed. If the field is set to true
and switched back to false
, then the UI sets the considerlasthost
parameter correctly to false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
makes sense to pass the value "false" to API
good point. |
Thanks guys for group action pointers. Will check and update. |
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
UI build: ✔️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested with devtools in qa , parameter is passed
Description
Fixes #10601
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?