Chapter 7. Improving Workflows with Presentation

In the previous chapters, we developed a workflow that creates a new VM and mounts a CD-ROM so that a new OS can be installed on it. Our first attempts were extremely manual. Over the last chapters we have now improved it quite a bit and made it much more user-friendly. Now, we will make it not only look and feel better, but also much less error-prone. We will use workflow presentation to do this.

In this chapter, we will learn the following:

  • Basic presentation properties
  • Working with arrays
  • Linking presentation properties to other elements

Presentation basics

In the previous chapters, we concentrated on the workflow content and how to improve our scripting. In the chapters that we have covered so far, we also discussed the problems that wrong user input, such as the OS name, may cause and how we can intercept it by using JavaScript. Now, we will go a step further and make sure that a user cannot enter values that are wrong or not allowed.

Descriptions

We will start with something simple that has actually quite a massive effect, and that is, the description. A good description helps the user of a workflow better understand what they should enter in the fields.

  1. By using the Orchestrator Client, edit the InstallFreshVM workflow.
  2. Click on Presentation. You will see all the input parameters displayed.
  3. Click on vmMemGB. The General area will now show the content of the description of the vmMemGB parameter. At this moment, only the name of the parameter is shown, as we have just added this parameter.
  4. Now, replace vmMemGB with Memory in GB to tell the user what they should enter:
    Descriptions

Check out the other input parameters and decide on better descriptions. The result of your efforts becomes visible as soon as you run the workflow.

Descriptions

Mandatory

There are more options to look into, and we will now start discussing them. First, we will make sure that a user has to provide a value. Currently, a user can just submit the workflow without entering anything, which will lead to an error.

We will now make a value mandatory by performing the following steps:

  1. In Presentation, select the vmMemGB input parameter.
  2. Click on Properties.
  3. Now, click on Add Property.
  4. Select Mandatory input and click on OK.
  5. The property is added to the list, and you can decide whether this Input-parameter should be mandatory.
    Mandatory

Try it out and think about which other parameters should be made mandatory.

Min and max values

We are now sure that the user has to enter a value, but he still could go ahead and enter, for instance, -1 CPUs or 1.000 GB memory, which isn't really that helpful. So, let's fix this by using min and max values, as follows:

  1. Select the presentation properties of the vmMemGB input parameter.
  2. Click on Add Property and select Minimum number value.
  3. Now, add the Maximum number value.
  4. In the Properties list, you can now enter the values that you want. For example, you can limit the amount of memory to between 1 and 32 GB.
  5. Run the workflow and try entering a value less and more than the limits that you set.
    Min and max values

After locking in these values, think about which other values could benefit from a min and max value.

Have a look at the properties for the vmName. Check whether you can fix the length of the string entered. This can be quite useful, for instance, a hostname (not the FQDN but the name of the host) should have at least 2 characters, and it should not be longer than 15 characters. Have a go at it!

Default value

We have fixed the range of the values that can be entered, but when the user starts the workflow, it is still empty. It is a good idea to provide the user with some ideas or settings, such as a default value.

We can add a default value by performing the following steps:

  1. Select the presentation properties of the vmMemGB input parameter.
  2. Click on Add Property and select Default Value.
  3. Select a default value of 4 and run the workflow.

Have a look at the other input parameters and think about which could benefit from a default value.

There are several more useful properties, but before we can go on, we need to learn about arrays.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset