All Apps and Add-ons

How to format the HTML in automatic simple xml dashboard?

Sukisen1981
Champion

Hi,
I have a small question on simple xml html panels. Below is my code
<panel>
<html>
<div style="text-align: left;">
<h3>Duration</h3>
<div class="custom-result-value">$duration$</div>
</div>
<div style="text-align: center;">
<h3>Start Time</h3>
<div class="custom-result-value">$starttime$</div>
</div>
<div style="text-align: right;">
<h3>Result Rows</h3>
<div class="custom-result-value">$resultcount$</div>
</div>
</html>
</panel>

So what is happening is that duration.start time and result rows are picked from the token values. Now. the values are correctly coming aligned left,center and right as stated in the above code, however they are line breaks between them, please refer
alt text

I am not that good in HTML and need some help 🙂 🙂

0 Karma
1 Solution

poete
Builder

Hello @Sukisen1981,

I created a html table from your input, and here it is.

<html> 
<table style="width:100%">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
  </tr>
  <tr>
    <td style="text-align: center;">$duration$</td>
    <td style="text-align: center;">$starttime$</td>
    <td style="text-align: center;">$resultcount$</td>
  </tr>
</table>
</html>

View solution in original post

manish_singh_77
Builder

Hi Sukisen,

HTML table would be perfect fit for this case. We can use Css for style and alignment along with HTMl table for this requirement.

Find below the source code and let me know in case of any queries.

<dashboard>
  <label>Test</label>
     <row>
    <panel>
   <html>
     <style>
     #sla_table {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

#sla_table td, #sla_table th {
    border: 1px solid #ddd;
    padding: 2px;
}

#sla_table th {
    padding-top: 2px;
    padding-bottom: 2px;
    text-align: left;
    background-color: #C0C0C0;
    color: black;
}

</style>
    <table id = "sla_table">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
     </tr>
  <tr>
    <td>$duration$</td>
    <td>$starttime$</td>
    <td>$resultcount$</td>
      </tr>
  </table>
  </html>
  </panel>
  </row>
</dashboard>

Sukisen1981
Champion

Hi @manish_singh_777 thanks for your detailed answer, the answer provided by @poete works and I have accepted it, nevertheless many thanks for your detailed reply 🙂

0 Karma

poete
Builder

Hello @Sukisen1981,

I created a html table from your input, and here it is.

<html> 
<table style="width:100%">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
  </tr>
  <tr>
    <td style="text-align: center;">$duration$</td>
    <td style="text-align: center;">$starttime$</td>
    <td style="text-align: center;">$resultcount$</td>
  </tr>
</table>
</html>

Sukisen1981
Champion

Gratefully accepted and I can understand the issue as well. I am sorry, I know this is a simple issue but I honestly did not have time to explore stuff, given my limited HTML knowledge. Thanks again

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...