[Kimchi-devel] [PATCH] UI bug fix: Set vlan_id value only if 'Enable VLAN' is checked

Yu Xin Huo huoyuxin at linux.vnet.ibm.com
Thu Jan 16 06:01:11 UTC 2014


On 1/16/2014 9:46 AM, Mark Wu wrote:
> On 01/15/2014 07:26 PM, Aline Manera wrote:
>> On 01/15/2014 08:04 AM, Yu Xin Huo wrote:
>>> the vlan id need to be validated, it must be numeric and within 1 <= 
>>> vlan id <= 4094.
>>
>> ACK. I will add it in V3.
>
> Could you please also consider to include the following fix:
>
>      $("#enableVlan").on("click", function() {
>          $("#networkVlanID").prop("disabled", !this.checked);
> +        if (!this.checked) {
> +            $("#networkVlanID").val("");
> +        }
>
> to reset the text when the checkbox is unchecked.
>
> It looks that I should not touch UI code any more.
Please feel free to touch UI code, I strongly support mutual learning 
between frontend and backend. If any difficulty, I would like to help.
>
>>
>>>
>>> I dislike the UI design, please change it.
>>
>> This specific patch is to fix bug instead of redesign.
>> So please, send a patch to redesign this view.
>>
>> I also would like to suggest more improvements to this network 
>> creation window.
>>
>> 1. To select a network type I need to select the circle itself, which 
>> is boring.
>>    In other views selecting the text select the item. You need to do 
>> it here too.
>>
>> 2. The additional input boxes for bridged network should only appear 
>> when selecting this option.
>>    So in a first moment, we only show the 2 options.
>>    When selecting "Briged" option we display:
>>
>>     Destination: | <iface> |
>>     * Enable VLAN
>>
>>     When only when selecting "Enable VLAN" we display the vlan_id 
>> input box.
>>
>>>
>>>
>>>
>>> On 1/15/2014 7:57 AM, Aline Manera wrote:
>>>> From: Aline Manera<alinefm at br.ibm.com>
>>>>
>>>> Commit 2f54aaba added a checkbox to provide choice of enabling vlan tagging
>>>> while creating a bridged network, but it doesn't check the checkbox before
>>>> setting the vlan_id to send server request.
>>>>
>>>> Because that when the user tries to create a bridged network without enabling
>>>> VLAN the following error is raised:
>>>> Invalid parameter: 'None is not of type u'integer''
>>>>
>>>> Fix it by setting vlan_id only if the vlan checkbox is checked.
>>>>
>>>> Signed-off-by: Aline Manera<alinefm at br.ibm.com>
>>>> ---
>>>>   ui/js/src/kimchi.network.js |    5 +++--
>>>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
>>>> index 65479b2..eb64e03 100644
>>>> --- a/ui/js/src/kimchi.network.js
>>>> +++ b/ui/js/src/kimchi.network.js
>>>> @@ -136,12 +136,13 @@ kimchi.initNetworkCreation = function() {
>>>>               var data = {
>>>>                   name : network.name,
>>>>                   connection: network.type,
>>>> -                vlan_id: network.vlan_id,
>>>>               };
>>>>               if (network.type === kimchi.NETWORK_TYPE_BRIDGE) {
>>>>                   data.connection = "bridge";
>>>>                   data.interface = network.interface;
>>>> -                data.vlan_id = network.vlan_id;
>>>> +                if ($("#enableVlan").prop("checked")) {
>>>> +                    data.vlan_id = network.vlan_id;
>>>> +                }
>>>>               }
>>>>               kimchi.createNetwork(data, function(result) {
>>>>                   network.state = result.state === "active" ? "up" : "down";
>>>
>>>
>>>
>>> _______________________________________________
>>> Kimchi-devel mailing list
>>> Kimchi-devel at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
>>
>>
>> _______________________________________________
>> Kimchi-devel mailing list
>> Kimchi-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140116/cae22614/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 15863 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140116/cae22614/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 15687 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140116/cae22614/attachment-0001.png>


More information about the Kimchi-devel mailing list