lunedì 12 maggio 2014

VMware: vCloud tenants reports using jQuery Mobile and PowerCLI

In this post we will create a simple HTML report using PowerCLI for Tenants and jQuery Mobile. jQuery Mobile provides an HTML5 user interface designed to allow the creation of web pages specifically suited for mobile devices with smaller screen compared to classic desktop/laptop PCs.

From PowerCLI perspective the following script is really simple, it retrieve some data from the vCloud environment then generates the HTML report by iterating HTML code (precisely <li> blocks) in order to create vApps list then finally it outputs the result as a single HTML by concatenating the composing elements.

As for jQuery Mobile perspective this is not complex at all, the resulting page structure is linear. In the header section there is the declaration of jQuery Mobile usage:

 <link rel="stylesheet" href="" />  
 <script src=""></script>  
 <script src=""></script>  

The body is constructed in a block approach: several blocks with different functions while the body block is the main elements that is filled by different informations regarding cloud organization:

 <div data-role="page" id="home"> --Page  
   <div data-role="header">  
   <div data-role="content">  
   <div data-role="footer">  

The PowerCLI script is intended to be run by vCloud tenants, having enough privileges on the organization they manage, against a vCloud Director server. The expected output will be an HTML page that can be consumed by any HTML5 capable browser, but, as previously said, jQuery Mobile does its best when used on a mobile device like a tablet or a smartphone.

Results will be similar to these:

The PowerCLI code to create this report is the following. As usual you can also find it in my GitHub repository: Tenants Mobile Reports.ps1

That's all!!

Nessun commento:

Posta un commento