-
Notifications
You must be signed in to change notification settings - Fork 265
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
feat(xo-web): ability to block/unblock migration #8129
base: master
Are you sure you want to change the base?
Conversation
1a9ec93
to
41daaa7
Compare
} | ||
|
||
export const vmAllowMigration = async vm => { | ||
const reason = 'VM migration is blocked during backup' |
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.
As this value is shared by the two functions you added, it should probably be put in a constant outside the function.
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.
I changed the TabButton to Toggle, this code was completely removed.
@@ -780,6 +784,13 @@ export default class TabAdvanced extends Component { | |||
labelId='vmWarmMigration' | |||
tooltip={isWarmMigrationAvailable ? undefined : _('availableXoaPremium')} | |||
/> | |||
<TabButton | |||
btnStyle='warning' | |||
handler={isMigrationAllowed ? vmBlockMigration : vmAllowMigration} |
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.
As I understand this, it would let users click the "Allow migration" button even when migrations are blocked for another reason (i.e. when vm.blockedOperations.migrate_send === 'another reason than "VM migration is blocked during backup"'
), which means clicking the button won't change anything.
Maybe we can gray out the button in such case, or display an information message?
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.
We don't want to prevent the user from unblocking the migration, even if it has been blocked by the backup.
For instance, there might be an issue with the backup which prevented it from unblocking the operation at then end, and we want users to be able to bypass this.
But I think it would make sense to display the current reason it is blocked before unblocking, maybe by showing a modal (and only if the reason is not trivial, i.e. 'true'
).
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.
@julien-f Can we already ship the feature like this, and maybe improve it later?
Or do you want it to be improved now?
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.
I fear that doing it in two steps will in fact make it more work and take longer.
IMHO that adding a quick confirm should be quick, what do you think @pdonias (of both the idea and how to implement it)?
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.
I agree. It gives more feedback and doesn't prevent the user from doing anything while keeping it safe. I think a simple confirm modal in vmAllowMigration
that shows the reason is enough.
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.
@pdonias Do you think that someone could help on the front-side?
41daaa7
to
330965a
Compare
handlerParam={vm} | ||
icon='vm-allow-migration' | ||
labelId={isMigrationAllowed ? 'vmBlockMigration' : 'vmAllowMigration'} | ||
/> |
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.
It seems I lost a comment there: use a toggle button like other blocked operations.
What I previously meant is: do not create a function that will switch the state as it can behave strangely if the cache is not up-to-date, the customer should be able to see whether it will block or unblock when clicking on the button.
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.
That's what I did: I split my toogle function into two different functions, and the button indicates whether it is used to block or unblock (as shown on the screenshots at the top of the PR).
What's wrong for you?
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.
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.
@julien-f OK it's clearer with a picture! I'll change that.
da1b169
to
12d859b
Compare
12d859b
to
4742eaa
Compare
Description
VM : add ability to block / unblock migration
XO-389
https://project.vates.tech/vates-global/projects/70ab2907-1ac3-4e7d-831f-a8752c36474d/issues/b8c25c6d-40ba-4cb6-8a6c-33d887692525
UPDATED : change TabButton to Toggle
UPDATED : add confirm modal on Toggle
Checklist
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
CHANGELOG.unreleased.md
Review process
Notes: