I have written a SLURM accounting script to pull data in a given date range and plot it using google charts embedded within the info.html.erb file. It works great, but when more than one card is present in the interactive sessions app, it hides everything other the last app I have ran… This only happens when the job status is ‘complete’ and the app session has closed.
For instance…
I run a second instance of this app:
It works as it should when the info.html.erb file is removed. Here’s a video capture to show the behavior.
It sems it due to the app running in pun but having different data sources associated with each job staging dir. It cannot handle multiple sources and that trips it up.
The simplest workaround I can think of is to just delete the session when done, but if there’s another option I would like to entertain that first.
I imagine it’s got something to do with how you attach those change handlers. I couldn’t see the javascript a lot, but you seem to have static ids in #1 and #2 and so on.
Each card has a unique Id - you should also be using unique ids or javascript that can attach handlers to the specific div and or handlers that can figure out what to do based on the event that’s been passed to them (specifically event.target).
Here’s a git diff that may help. I didn’t set it all up to pull actual files, so there could be something missing, but <%= id %> is unique. It’s likely better than adding logic to figure out where you are based off of event.target.
Nailed it! You’re the man, thanks Jeff.
I had to figure out the hard way here that the function gets overwritten with each call of the script, so I needed to feed it the unique ids to grab the correct data and plot it where it belongs.