-
Notifications
You must be signed in to change notification settings - Fork 27
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
Added dashboard for Ben Murrell #1180
Conversation
Please provide at least a short description to let me know what is the context of this PR. |
Also, maybe I missed that during the meetings, any specific reason to put the javascript snippet in a shortcode file? |
Link for issue, I have added in the description. The purpose of the javascript was to get last updated date for the plots. To be consistent with other dashboards I used shortcode as per suggested by senthil. |
To be consistent with other dashboards. |
- Switched from XMLHttpRequest to fetch API (more modern replacement). - Used async syntax (eliminates the need for callbacks and .then() chains, marginal here but still good practice). - Removed `onreadystatechange`: with Fetch API we can simply wait for the fetch promise to resolve. - Simplified error handling by using a `try/catch` block. - Removed redundant `var` declarations for `const` and `let` variable declarations (modern javascript). - Extracted a helper function `updateModifiedDateElement` to reduce code duplication. - Early `return` in the `if (commits.length === 0)` block to avoid executing the rest of the function. - Removed unnecessary `else` clause since we're returning early in the `if (commits.length === 0)` block.
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've refactored the javascript shortcode for higher readability, reusability, and maintainability. If you want to have a final look (I left explaining comments in the commit description).
On my side everything is okay :)
Link to task:
https://scilifelab.atlassian.net/browse/FREYA-888