VMware Cloud Community
pizzle85
Expert
Expert

Using Arrays or External Values for Data Grid Types

A long time ago we decided to build all our VM deployment blueprints in XaaS to provide flexible form functionality to filter data based on the requestor's information. That process in turn submits an IaaS request to build a VM. We'd like to simplify the process and use IaaS custom forms. I can do pretty much everything i currently do in my XaaS forms but i want to update the way in which users requests disks and NICs. Right now i have dedicated disk and NIC pages where the user optionally fills out information for 5 disks and 5 NICs. I wanted to consolidate this into a data grid element where the user could dynamically allocate the appropriate number of disks without me having to present and manage multiple individual disk rows in the form. The data grid element type presents me two issues and i wanted to see if anyone had a work around or suggestion to get my process working.

1. We provide several tiers of storage, we want the users to be able to select from a list of predefined options for the Storage Reservation Policy. IE: Gold, Silver, Bronze

2. We sell the different storage tiers in different block sizes and would like to step or iterate the size of disks in those block sizes based on the selected tier. IE: Gold = 20GB blocks, Silver = 100GB blocks, Bronze = 1000GB blocks.

We'd like to do something similar with the NICs section where the Network field is a drop down list generated by an external script that presents only networks that are defined in the vRA reservation assigned to the requestor's group in the defined datacenter field elsewhere in the form.

Reply
0 Kudos
1 Reply
AnotherPassword
Enthusiast
Enthusiast

Returning an array of networks for a reservationID:

var host = Server.findAllForType("VCACCAFE:VCACHost")[1] //may be a different index

var reservation = vCACCAFEEntitiesFinder.getReservation(host , reservationID);

var extensionData = reservation.getExtensionData();

var availableNetworks = [];

if(extensionData) {

     var networks = extensionData.get("reservationNetworks");

     if(networks) {

          for each(var network in networks.getValue()) {

               var path = network.getValue().get("networkPath");

               availableNetworks.push((path.label))

          }

} else {

     availableNetworks.push('0.0.0.0');

}

}

System.log(availableNetworks)

Reply
0 Kudos