Commit 0fc2dfa2 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

ui: Floating ip fixes

- Fix progress indicator display
- Reset model state if attach api call fails
parent 8c06c123
......@@ -1440,7 +1440,9 @@
this.call('firewallProfile', success, error, data);
},
connect_floating_ip: function(ip, cb) {
connect_floating_ip: function(ip, cb, error) {
var self = this;
var from_status = this.get('status');
this.set({'status': 'CONNECTING'});
synnefo.storage.ports.create({
port: {
......@@ -1448,7 +1450,11 @@
device_id: this.id,
fixed_ips: [{'ip_address': ip.get('floating_ip_address')}]
}
}, {complete: cb, skip_api_error: false})
}, {
success: cb,
error: function() { error && error() },
skip_api_error: false
});
},
// action helper
......
......@@ -143,7 +143,9 @@
var overlay = this.parent_view.connect_view;
overlay.set_in_progress();
_.each(vms, function(vm) {
vm.connect_floating_ip(this.model, this.connect_complete);
vm.connect_floating_ip(this.model,
_.bind(this.connect_complete,this),
_.bind(this.connect_error, this));
}, this);
},
......@@ -154,6 +156,12 @@
this.model.set({'status': 'CONNECTING'});
},
connect_error: function() {
var overlay = this.parent_view.connect_view;
overlay.hide();
overlay.unset_in_progress();
},
remove: function(model, e) {
e && e.stopPropagation();
this.model.do_destroy();
......
......@@ -10,12 +10,14 @@
<img data-rv-show="model.in_progress"
src="{{ SYNNEFO_IMAGES_URL }}icons/indicators/small/progress.gif"
class="progress-indicator" />
<span data-rv-show="model.device_id" class="key">MAC:</span>
<span data-rv-show="model.device_id" class="value" data-rv-text="model.mac_address"></span>
<span data-rv-hide="model.device_id" class="value no-device">
No device assigned.
Detach IP, in order to be able to reattach it to a machine.
</span>
<div data-rv-hide="model.in_progress">
<span data-rv-show="model.mac_address" class="key">MAC:</span>
<span data-rv-show="model.mac_address" class="value" data-rv-text="model.mac_address"></span>
<span data-rv-hide="model.device_id" class="value no-device">
No device assigned.
Detach IP, in order to be able to reattach it to a machine.
</span>
</div>
</h5>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment