[Kimchi-devel] [PATCH V2] Fix Add Network window
Aline Manera
alinefm at linux.vnet.ibm.com
Wed Feb 26 17:54:11 UTC 2014
On 02/26/2014 02:15 PM, Aline Manera wrote:
> On 02/26/2014 11:02 AM, Rodrigo Trujillo wrote:
>> VLans and Interfaces must only be available for selection if network
>> type Bridge is selected. This restriction was not implemented in the UI.
>> This patch fixes this problem.
>>
>> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
>> ---
>> ui/js/src/kimchi.network.js | 21 ++++++++++++++++++++-
>> 1 file changed, 20 insertions(+), 1 deletion(-)
>>
>> diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
>> index faf1285..0f8575b 100644
>> --- a/ui/js/src/kimchi.network.js
>> +++ b/ui/js/src/kimchi.network.js
>> @@ -210,11 +210,27 @@ kimchi.openNetworkDialog = function(okCallback) {
>> $("#networkConfig").dialog("open");
>> };
>>
>> +kimchi.enableBridgeOptions = function(enable) {
>> + $("#enableVlan").prop("disabled", !enable);
>> + $("#networkInterface").prop("disabled", !enable);
>> +
>> + if (!enable) {
>> + $("#enableVlan").attr("checked", false);
>> + $("#networkVlanID").prop("disabled", true);
>> + $("#networkVlanID").val("");
>> + $("#networkInterface").val("");
>> + } else if (!$("#networkInterface").val()){
>> + $("#networkInterface").prop("selectedIndex", 0);
>> + }
>> +};
>> +
>
> I'd rather do not display the fields until Bridged option is selected.
>
> Using .hide() and .slideDown() it is easy to do
I suggest put the both div elements (destination and VLAN) in the same
parent div and slideDown() the parent
<div id=bridge-options>
<div class=destination>
</div>
<div class=VLAN>
</div>
</div>
$('#bridge-options').slideDown() or $('#bridge-options').hide()
>
>> kimchi.setDefaultNetworkType = function(isInterfaceAvail) {
>> $("#networkTypeBri").prop("checked", isInterfaceAvail);
>> $("#networkTypeBri").prop("disabled", !isInterfaceAvail);
>> - $("#networkInterface").prop("disabled", !isInterfaceAvail);
>> $("#networkTypeNat").prop("checked", !isInterfaceAvail);
>> + if (!isInterfaceAvail) {
>> + kimchi.enableBridgeOptions(false);
>> + }
>> };
>>
>> kimchi.getNetworkDialogValues = function() {
>> @@ -250,12 +266,15 @@ kimchi.setupNetworkFormEvent = function() {
>> });
>> $("#networkTypeIso").on("click", function(event) {
>> $("#networkInterface").prop("disabled", true);
>> + kimchi.enableBridgeOptions(false);
>> });
>> $("#networkTypeNat").on("click", function(event) {
>> $("#networkInterface").prop("disabled", true);
>> + kimchi.enableBridgeOptions(false);
>> });
>> $("#networkTypeBri").on("click", function(event) {
>> $("#networkInterface").prop("disabled", false);
>> + kimchi.enableBridgeOptions(true);
>> });
>> };
>>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>
More information about the Kimchi-devel
mailing list