kappnav / issues

kAppNav global issues
0 stars 0 forks source link

UI display command action complete notifications #81

Closed cvignola closed 4 years ago

cvignola commented 4 years ago

See #79 Idea is to detect 'command action complete' notification and display a toaster popup message. Would be nice if popup offers user a link to the joblog.

The 'command action complete' notification is actually just a query for commands that have completed after the specified time. E.g.

// at UI initialization 
jobsAfterThisTime=time-now-in-millis # prime time stamp
...
// driven by timer event: 

handleJobCompletions(jobsAfterThisTime) # check for job completions 
...

// millis in, millis out 
function handleJobCompletions(jobsAfterThisTime) { 
     GET .../resource/command?user=current&time=jobsAfterThisTime
     for each job { 
           /* handle job completion */ 
           if last job then mostRecentCompletionTime= job.status.completionTime
     } 
     return mostRecentCompletionTime # time in millis 
}
k8vance88 commented 4 years ago

The current flow for submitting actions is:

We no longer need the ActionMessageModal as we want to show these results on a toaster notification. Currently, the ActionMessageModal does 2 things:

  1. Displays a toaster widget on successful submission
  2. Displays an error modal on failed submission. When submission fails, an action is never created.

To complete this work item we need the following:

  1. Create a static method to pop up toaster widgets. We have been putting common static methods in Common.js. Test this by sending a lot of toast messages. Make sure we do not have a leak of dom nodes.
  2. Setup a timer in the secondary header to make a call every 30 seconds to check if any jobs have finished in the last 30 seconds. Display a toaster if one has finished. Use setInterval in the componentDidMound and cearInterval in the componentWillUnmount. setInterval should wakeup every 30 seconds and ask for the current completed actions. It should grab the current time and use that as the end time. Save it. It will be the next interval start time. If there is no start time saved, then use the current time - 30 seconds as the start time.

Related work, but can be moved to a separate work item. This will help reduce our code and remove a build warning.

  1. Move the toaster widget on successful submission from the ActionMessageModal to the ActionModal submit. (use your new static method)
  2. Instead of showing the failed submission on the ActionMessageModal, display the error on the ActionModal. This might be tricky. Make sure to test this really well.
  3. Remove all ActoinMessageModal code
kinueng commented 4 years ago

Closing this issue since the forward development has been delivered. Currently, there is an ongoing issue #124 related to this issue.