ginger icon indicating copy to clipboard operation
ginger copied to clipboard

Firmware update contains hardcoded UI timer in its logic

Open danielhb opened this issue 8 years ago • 3 comments

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.

danielhb avatar Jul 06 '16 18:07 danielhb

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).

lcorreia avatar Jul 06 '16 19:07 lcorreia

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

samhenri avatar Jul 07 '16 16:07 samhenri

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

danielhb avatar Sep 22 '16 19:09 danielhb