I’ve written an instance tab plugin that pulls some data from a restapi but I would like to be able to display a badge alongside the performance badges, Health, Last Backup, Availability etc, that is green or red depending on the data in the custom tab.
<script>
document.addEventListener("DOMContentLoaded", function() {
// Function to add a div with class "stats-container" and text "your content here"
function addStatsContainer() {
// Find the div with class "incident-stats"
var incidentStatsDiv = document.querySelector('.incident-stats');
// Check if the div is found
if (incidentStatsDiv) {
// Create a new div element
var statsContainerDiv = document.createElement('div');
// Add class "stats-container" to the new div
statsContainerDiv.className = 'stats-container';
// Set the text content of the new div
statsContainerDiv.textContent = 'your content here';
// Insert the new div as the third child of the "incident-stats" div
incidentStatsDiv.insertBefore(statsContainerDiv, incidentStatsDiv.children[2]);
}
}
// Call the function to add the div when the page is fully loaded
addStatsContainer();
});
</script>