HPE Morpheus Enterprise Software
1856400 Members
6120 Online
104112 Solutions
New Discussion

Plugin and Badge

 
kevkerr1
Advisor

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?

Thanks

3 REPLIES 3
Ollie-Phillips
HPE Pro

Re: Plugin and Badge

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



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Ollie-Phillips
HPE Pro

Re: Plugin and Badge

ChatGPT will take you most of the way.

<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>


I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Ollie-Phillips
HPE Pro

Re: Plugin and Badge

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).



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo