Commit 42ea07f9 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

ui: Private network view improvements

display subnet cidr when available
parent 649fa61d
......@@ -6552,7 +6552,7 @@ input.has-errors {
}
.pane-view .collection-list-view .model-view .main-content .entry {
width: 310px;
width: 290px;
padding-top: 5px;
margin-left: 10px;
float: left;
......
......@@ -68,8 +68,18 @@
return this.get('router:external') || this.get('public')
}
],
'cidr': [
['subnet'], function() {
var subnet = this.get('subnet');
if (subnet && subnet.get('cidr')) {
return subnet.get('cidr')
} else {
return undefined
}
}
],
'ext_status': [
['status'], function(st) {
['status', 'cidr'], function(st) {
if (this.get('ext_status') == 'REMOVING') {
return 'REMOVING'
}
......@@ -78,7 +88,7 @@
} else if (this.pending_disconnects) {
return 'DISCONNECTING'
} else {
return st
return this.get('status')
}
}],
'in_progress': [
......@@ -91,6 +101,13 @@
]
},
storage_attrs: {
'subnets': ['subnets', 'subnet', function(model, attr) {
var subnets = model.get(attr);
if (subnets.length) { return subnets[0] }
}]
},
// call rename api
rename: function(new_name, cb) {
this.sync("update", this, {
......@@ -113,14 +130,13 @@
pending_disconnects: 0,
initialize: function() {
models.Network.__super__.initialize.apply(this, arguments);
var self = this;
this.subnets = new Backbone.FilteredCollection(undefined, {
collection: synnefo.storage.subnets,
collectionFilter: function(m) {
return self.id == m.get('network_id')
}
});
}});
models.Network.__super__.initialize.apply(this, arguments);
this.ports = new Backbone.FilteredCollection(undefined, {
collection: synnefo.storage.ports,
collectionFilter: function(m) {
......@@ -186,7 +202,8 @@
'status': 'ACTIVE',
'router:external': true,
'shared': false,
'rename_disabled': true
'rename_disabled': true,
'subnets': []
},
initialize: function() {
......
......@@ -441,8 +441,12 @@
return "Internet"
}
status = this.status_map[this.model.get('ext_status')];
return status;
var cidr = this.model.get('cidr');
var status = this.model.get('ext_status');
if (status != 'REMOVING' && cidr) {
return cidr
}
return this.status_map[status];
},
connect_vms: function(vms, cb) {
......@@ -462,9 +466,11 @@
e && e.stopPropagation();
this.model.actions.reset_pending();
this.model.destroy({
complete: _.bind(function() {
this.model.set({status: 'REMOVING'})
this.model.set({ext_status: 'REMOVING'})
success: _.bind(function() {
this.model.set({status: 'REMOVING'});
this.model.set({ext_status: 'REMOVING'});
// force status display update
this.model.set({cidr: 'REMOVING'});
}, this),
silent: true
});
......
......@@ -184,9 +184,9 @@
</div>
</div>
<div class="entry-right">
<div data-rv-class="model.status|status_cls" class="status">
<div data-rv-class="model.ext_status|status_cls" class="status">
<div class="status-title">
<span data-rv-text="model.status|status_display">STATUS</span>
<span data-rv-text="model.cidr|status_display">STATUS</span>
<span data-rv-show="model.in_progress">...</span>
</div>
<div class="status-indicator clearfix">
......
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