Plugin and Badge

Hi All,

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.

Is this possible at the moment?


I’d try do this with javascript. I think it would be possible.

You would need to test, but as that is a tab, the HTML that makes it up is rendered on page load to the browser regardless of the display status.

So a piece of javascript that runs on page load could potentially add another div with your content to the incident stats div (see below)

You’d add that script in your view (*.hbs file).

If you get this working please share your script with the community, it is an interesting idea and use case.

ChatGPT will take you most of the way.

    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