Predefine enterprise properties for the UI

Author: @Xavier Thevenot

Introduction to enterprise properties

Administrators can set enterprise properties in the UI when they create or modify an enterprise, and create or modify the properties of an existing enterprise through the API (see EnterprisesResource).

To facilitate data entry and assure that users enter the relevant data, administrators can predefine properties and default values in the UI configuration files

Then in Abiquo, administrators can modify existing properties or add new properties when they create or edit the enterprise. 

The maximum length of enterprise property elements is:

  • key of 255 characters

  • value of 255 characters

Create an enterprise and add properties
Create an enterprise and add properties

Create a list of preset enterprise properties

To define preset enterprise properties, enter a list of your custom property definitions in the client-config-custom.json file. 

Use the UI configuration property defined in the client-config-default.json file. By default, the preset list will be empty and the property is the following.

"config.enterprise.properties" : []
Preset enterprise property types
Preset enterprise property types

The preset property types you can define are described in the following sections and can be the following:

  • input

  • combo

  • multiple


Define an input property

To enable the user to edit a text value for a key, use the Input type.

{"type": "input", "key":"property_input", "value":"value", "required":true}

The object must have the type value as input. Then you have to define key and value attributes (these are mandatory, otherwise the property will fail in UI). You can also add the required attribute, set to true if you want to force this property value to be added to enterprise properties.


Define a Combo selection property

To enable the user to set a value by selecting one of the set of elements defined in the values attributes, use the combo type.

{"type": "combo", "key":"property_combo", "value": "first", "values":[ {"name":"First property", "value":"first"}, {"name":"Second property", "value":"second"}, {"name":"Third property", "value":"third"} ] }

Set the type value of the object to combo. Then define key  and value attributes, which are mandatory or the property will fail in UI, and a list of values. Each object must have a name (displayed in the combo-box) and a value (used as value in the key/value property). You can also add the required attribute set to true if you want to force this property to be added to enterprise properties.

 


Define a multi-selection property

To enable the user to edit a list of values by selecting one or more values from the set of elements displayed in a multi-selection grid, use the multi type.

Set the type value of the object to multi. Then define key  and value attributes, which are mandatory or the property will fail in UI, and a list of values. Each object must have a name and a value (which will be used as the value in the key/value property). You can also add the required attribute and set it to true if you want to force this property to be added to enterprise properties.

 


Full example

Putting all the above examples together, the client property will have the following value.

Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved