Category Archives: vCheck

Change vCheck Style to have Collapsible Sections

A colleague requested me to do this and I thought it was cool enough and easy enough to share.

He wanted to have the vCheck reports have collapsible sections. Makes sense, you know you have 1 billion VMs that are out of date on Vmtools cause you are doing upgrades, and you definitely don’t want to scroll, because effort, and stuff.

Anyway, it is pretty quick to do and hopefully it might help.

vCheck uses Style files for how the vCheck is displayed, that is what we want to edit.

So in the vCheck folder, go to Styles, then pick the style folder you are currently using. If you aren’t sure, check the GlobalVariables file, it should be listed there.

Alright so after you are in your specific style folder. Edit the Style.ps1 file and scroll down to the Very bottom.

On the line that has _TITLE_ we want to add this line, right before _TITLE_

<a onclick=”toggleRow(this);”>

(This is next couple of lines are for the Clarity style specifically)

So this

<table class=”table”><tr><td class=”left”><b>_TITLE_</b></td></tr>

becomes

<table class=”table”><tr><td class=”left”><a onclick=”toggleRow(this);”><b>_TITLE_</b></td></tr>

The <b> is to bold the title, so I drop the entry right before it. On the other styles that line can go in directly before _TITLE_

The second part is even easier. Just a few lines lower, you will see:

clip_image001

Just drop this in between those two lines

<script>

function toggleRow(e) {

var subRow = e.parentNode.parentNode.nextElementSibling.nextElementSibling;

subRow.style.display = subRow.style.display === ‘none’ ? ‘table-row’ : ‘none’;

}

</script>

That’s it! Now when you run vCheck, you can collapse sections you don’t want to see.

If for some reason you want every section to start hidden. On the _PLUGINCONTENT_  line  change

<tr>

To

<tr style=”display: none;”>

Then all the sections will start collapsed if you are into that.

It is possible there is a better way to do this because I am definitely not a JS or HTML guy, but this seems to work for me. It is also possible your browser may complain about a script trying to run, just allow for the collapsible sections to work.

 

Webp.net-gifmaker

And a quick clip of what it looks like when multiple sections are collapsed

image