Commit e7af3a10 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

ui: Disconnect action in vm ips icon subview

parent 0082bb0d
......@@ -3317,6 +3317,11 @@ div.reboot-dialog button.details:hover {
border-bottom: 1px solid #75A9C1;
}
.machine .info-content.ips .port-item img.in-progress {
margin: 4px 2px;
margin-right: 20px;
}
.machine .info-content.ips .port-item img {
float: left;
position: relative;
......@@ -3738,6 +3743,10 @@ div.machine a.manage-metadata:hover {
padding: 0;
}
.single .ips-content.toggler-content .action-container {
display: none !important;
}
.single .toggler-content {
background-color: #84B7D0;
clear: both;
......@@ -6765,6 +6774,15 @@ input.has-errors {
position: relative;
}
.model-item .actions-content.inline {
padding-top: 6px;
position: absolute;
right: 0px;
font-size: 1.2em;
height: 26px;
width: 182px;
}
.pane-view .collection-list-view .model-view .main-content .actions-content {
width: 80px;
float: left;
......@@ -6900,8 +6918,8 @@ input.has-errors {
.model-item .actions-content .action-container.selected:hover {
background-color: transparent;
border-left: 5px solid #7DB4CD;
margin-left: 5px;
border-left: 4px solid #7DB4CD;
margin-left: 6px;
}
.model-item .actions-content .action-container:hover a {
......@@ -6910,8 +6928,8 @@ input.has-errors {
.model-item .actions-content .action-container:hover {
background-color: #A1C8DB;
border-left: 5px solid #7DB4CD;
margin-left: 5px;
border-left: 4px solid #7DB4CD;
margin-left: 6px;
}
.model-item .actions-content .action-container.selected {
......@@ -6924,7 +6942,7 @@ input.has-errors {
.model-item .actions-content .action-container {
padding: 2px;
margin-bottom: 5px;
padding-left: 5px;
padding-left: 4px;
margin-left: 10px;
cursor: pointer;
}
......
......@@ -332,6 +332,7 @@
},
update_ips: function() {
var self = this;
var ips = _.map(this.get('fixed_ips'), function(ip_obj) {
var ip = _.clone(ip_obj);
var type = "v4";
......@@ -341,6 +342,7 @@
ip.id = ip.ip_address;
ip.type = type;
ip.subnet_id = ip.subnet;
ip.port_id = self.id;
delete ip.subnet;
return ip;
});
......@@ -383,7 +385,7 @@
],
'in_progress': [
['ext_status'], function() {
return _.contains(["DISCONNECTING", "CONNECTING"], this.get("status"))
return _.contains(["DISCONNECTING", "CONNECTING"], this.get("ext_status"))
}
],
'firewall_running': [
......
......@@ -761,6 +761,35 @@
views.VMPortView = views.ext.ModelView.extend({
tpl: '#vm-port-view-tpl',
classes: 'port-item clearfix',
update_in_progress: function() {
if (this.model.get("in_progress")) {
this.set_in_progress();
} else {
this.unset_in_progress();
}
},
set_in_progress: function() {
this.el.find(".type").hide();
this.el.find(".in-progress").show();
},
unset_in_progress: function() {
this.el.find(".type").show();
this.el.find(".in-progress").hide();
},
disconnect_port: function(model, e) {
e && e.stopPropagation();
var network = this.model.get("network");
this.model.actions.reset_pending();
this.model.disconnect(_.bind(this.disconnect_port_complete, this));
},
disconnect_port_complete: function() {
},
get_network_name: function() {
var network = this.model.get('network');
var name = network && network.get('name');
......@@ -790,7 +819,8 @@
});
views.VMPortIpView = views.ext.ModelView.extend({
tpl: '#vm-port-ip-tpl'
tpl: '#vm-port-ip-tpl',
css_classes: "clearfix"
});
views.VMPortIpsView = views.ext.CollectionView.extend({
......
......@@ -58,6 +58,9 @@
var options = _.extend({}, options);
options.parent_view = this;
var view = new view_cls(options);
if (view.css_classes) {
view.el.addClass(view.css_classes)
}
return view;
},
......
......@@ -67,16 +67,33 @@
</div>
</div>
<div id="vm-port-ip-tpl" class="hidden clearfix port-ip-item">
<div class="type" data-rv-text="model.type|prefix IP "></div>
<div id="vm-port-ip-tpl" class="hidden port-ip-item">
<img src="{{ SYNNEFO_IMAGES_URL }}/icons/indicators/medium/progress.gif" class="in-progress" />
<div class="type" data-rv-text="model.type|prefix IP"></div>
<div class="ip" data-rv-text="model.ip_address"></div>
</div>
<div id="vm-port-view-tpl">
<div id="vm-port-view-tpl" class="hidden">
<div class="ips" data-rv-collection-view="model.ips|VMPortIpsView"></div>
<div class="clearfix network-header">
<span data-rv-show="model.in_progress|update_in_progress"></span>
<img data-rv-src="model.network.is_public|get_network_icon" />
<div class="port" data-rv-text="model.network.name|get_network_name"></div>
<div class="actions-content inline">
<div class="action-container disconnect warn"
data-rv-class-isactive="model.can_disconnect"
data-rv-class-selected="model.actions.disconnect|intEq 1"
data-rv-on-click="view.set_disconnect_confirm">
<a>Disconnect</a>
<div class="confirm-single clearfix">
<span class="yes"
data-rv-on-click="view.disconnect_port">
{% trans "Confirm" %}
</span>
<span class="no" data-rv-on-click="view.unset_disconnect_confirm">X</span>
</div>
</div>
</div>
</div>
</div>
......
......@@ -60,7 +60,6 @@
<div class="clearfix vms-list">
<ul class="options-list three">
</ul>
<div class="empty-message">{% trans "No available machines to connect" %}</div>
</div>
<div class="form-actions clearfix">
<span class="form-action create">{% trans "connect machines" %}</span>
......
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