commit 4792afbef6d61e1c9569b270e6bd62f3b5acf1d7
Author: Kostas Papadimitriou <kpap@grnet.gr>
Date:   Tue Aug 28 18:12:12 2012 +0300

    Networks view fixes and improvements
    
    - Do not display vms in building state in connect overlay
    - Propose vm reboot after firewall changed (functionality which was broken
      after major networks api changes)
    - Hide custom subnet input field when dhcp checkbox is not checked
    - Proper reset of stored destroy actions after network has been removed
      (caused multiple network actions to appear for networks that where
      already removed from the networks view)

diff --git a/snf-cyclades-app/synnefo/ui/static/snf/js/models.js b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js
index 99b65a8..c566c05 100644
--- a/snf-cyclades-app/synnefo/ui/static/snf/js/models.js
+++ b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js
@@ -626,7 +626,7 @@
 
         get_connectable_vms: function() {
             return storage.vms.filter(function(vm){
-                return !vm.in_error_state();
+                return !vm.in_error_state() && !vm.is_building();
             })
         },
 
@@ -2017,6 +2017,7 @@
             
             this.set({'pending_firewall': value});
             this.set({'pending_firewall_sending': true});
+            this.set({'pending_firewall_from': this.get('firewallProfile')});
 
             var success_cb = function() {
                 if (callback) {
@@ -2034,11 +2035,14 @@
 
         reset_pending_firewall: function() {
             this.set({'pending_firewall': false});
+            this.set({'pending_firewall': false});
         },
 
         check_firewall: function() {
             var firewall = this.get('firewallProfile');
             var pending = this.get('pending_firewall');
+            var previous = this.get('pending_firewall_from');
+            if (previous != firewall) { this.get_vm().require_reboot() };
             this.reset_pending_firewall();
         }
         
diff --git a/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js
index 29fc349..806876b 100644
--- a/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js
+++ b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_networks_view.js
@@ -818,7 +818,13 @@
                 } else {
                     this.cancel_destroy();
                 }
-            }, this))
+            }, this));
+            
+
+            // reset pending destory action after successful removal
+            self.network.bind("remove", _.bind(function(net){
+                net.get("actions").remove_all("destroy");
+            }));
 
             this.$(".net-actions button.no").click(function(e){
                 e.preventDefault();
@@ -1030,7 +1036,8 @@
             }
 
             if (synnefo.config.network_strict_destroy) {
-                if (this.network.get_nics().length == 0) {
+                if (this.network.get_nics().length == 0 && 
+                        !this.network.in_progress()) {
                     this.el.removeClass("disable-destroy");
                 } else {
                     this.el.addClass("disable-destroy");
@@ -1190,6 +1197,7 @@
             if (this.private_list.find(".network").length == 0) {
                 this.private_list.hide();
             }
+            
         },
 
         network_added: function(net) {
diff --git a/snf-cyclades-app/synnefo/ui/templates/partials/networks.html b/snf-cyclades-app/synnefo/ui/templates/partials/networks.html
index 535791a..d9cd202 100644
--- a/snf-cyclades-app/synnefo/ui/templates/partials/networks.html
+++ b/snf-cyclades-app/synnefo/ui/templates/partials/networks.html
@@ -51,16 +51,18 @@
                   virtual machines. {% endblocktrans %}
             </p>
             </div>
-            <div class="form-field fixpos" id="network-create-dhcp-fields">
-              <label for="network-type">Network subnet:</label>
-              <select id="network-create-subnet">
-                <option selected class="auto" value="auto">Auto</option>
-                <option value="custom" class="manual">Manual...</option>
-              </select>
-            </div>
-            <div class="form-field">
-              <label class="hidden" for="network-custom-subnet">Custom subnet:</label>
-              <input type="text" id="network-create-subnet-custom"/>
+            <div id="network-create-dhcp-fields">
+              <div class="form-field fixpos">
+                <label for="network-type">Network subnet:</label>
+                <select id="network-create-subnet">
+                  <option selected class="auto" value="auto">Auto</option>
+                  <option value="custom" class="manual">Manual...</option>
+                </select>
+              </div>
+              <div class="form-field">
+                <label class="hidden" for="network-custom-subnet">Custom subnet:</label>
+                <input type="text" id="network-create-subnet-custom"/>
+              </div>
             </div>
           </div>
             <div class="form-actions plain clearfix">
