ginger
ginger copied to clipboard
Firmware update contains hardcoded UI timer in its logic
in model/firmware.py, we're using a sleep(3) to make sure that the user can get a notification of the host being rebooted due to the firmware update process. This works because at this moment the UI is fetching the notifications every 2 seconds, so with a 3 second sleep it's guaranteed that the user will see the message before the update command.
However, for several reasons (UI constraint in backend breaks MVC, an increase in the UI timer will break this code ...) we need to get rid of it in a way that
- the user will not miss this message
- the backend can stay oblivious of any UI specific behavior
I'll ask for the inputs of @lcorreia and @samhenri here because I am aware of UI alternatives (asynchronous notifications, HTML5 embedded notification system) that can help ups here.
With the infrastructure Wok has now, we can fix it in UI by showing a hardcoded message identical to the notification just after user clicks on button "Update". That way, it's possible to remove the sleep and the notification from the backend. As a drawback, the notification will always be showed, not only when command update_flash is run (there are some verifications that may fail prior to run the command).
We can use Promises API but it won't work with IE (only Edge). This would also solve other issues with asynchronous tasks that we have: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Promise
If we still have to support IE, then we would have to use this polyfill (a workaround for old browsers): https://github.com/taylorhakes/promise-polyfill
Browser support: http://caniuse.com/#search=promises
Given that this fix will require UI investigation and we do not have enough time to do it before the release, I'll change the milestone to Backlog