UI form dialog: Support dynamic unit conversion for fields
UI form dialog: Support dynamic unit conversion for fields

Adds a new dialog field type called 'has_units'. This field has an
input box side by side with a select box. The select box is populated
with predefined units (MB, GB, TB, for example) and uses (also
predefined) conversion functions to allow automatic updating of the
input box value when the units select box is changed.

Original author: Chris Suich <chris.suich@netapp.com>
Reviewed by: Brian Federle <brian.federle@citrix.com>

Example:

fields: {
    ...
    size: {
        ...
        has_units: true,
        units: [
            {
                id: 'gb',
                text: 'GB',
                fromBase: function(val) { ... return val; },
                toBase: function(val) { ... return val; }
            },
            ...
        ]
    }
}

resmo/cloudstack,DaanHoogland/cloudstack,DaanHoogland/cloudstack,wido/cloudstack,DaanHoogland/cloudstack,wido/cloudstack,resmo/cloudstack,GabrielBrascher/cloudstack,GabrielBrascher/cloudstack,jcshen007/cloudstack,GabrielBrascher/cloudstack,jcshen007/cloudstack,resmo/cloudstack,resmo/cloudstack,jcshen007/cloudstack,GabrielBrascher/cloudstack,wido/cloudstack,resmo/cloudstack,jcshen007/cloudstack,GabrielBrascher/cloudstack,DaanHoogland/cloudstack,jcshen007/cloudstack,resmo/cloudstack,jcshen007/cloudstack,DaanHoogland/cloudstack,jcshen007/cloudstack,wido/cloudstack,resmo/cloudstack,DaanHoogland/cloudstack,wido/cloudstack,GabrielBrascher/cloudstack,DaanHoogland/cloudstack,wido/cloudstack,wido/cloudstack,GabrielBrascher/cloudstack