Commit 3f3bbd83 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Configurable grouped public network view name

parent 82a59426
......@@ -149,6 +149,12 @@ UI_NETWORK_ALLOW_DUPLICATE_VM_NICS = False
# virtual machines from the network.
UI_NETWORK_STRICT_DESTROY = True
# Whether or not to group public networks nics in a single network view
UI_GROUP_PUBLIC_NETWORKS = True
# The name of the grouped network view
UI_GROUPED_NETWORK_NAME = 'Internet'
###############
# UI EXTENSIONS
......
......@@ -1011,6 +1011,12 @@
remove: function() {
$(this.el).remove();
},
get_name: function() {
var net_name = this.network.get('name');
if (net_name == "public") { net_name = "Internet" };
return net_name;
},
update_layout: function() {
// has vms ???
......@@ -1022,8 +1028,7 @@
//
this.$(".machines-count").text(this.get_nics().length);
var net_name = this.network.get("name");
if (net_name == "public") { net_name = "Internet" }
var net_name = this.get_name();
this.$(".name-div span.name").text(net_name);
if (this.rename_view) {
......@@ -1123,7 +1128,11 @@
network,
view);
},
get_name: function() {
return synnefo.config.grouped_network_name || views.GroupedPublicNetworkView.__super__.get_name.call(this);
},
nic_in_network: function(nic) {
var nic_net = nic.get_network();
return _.filter(this.networks, function(n) {
......
......@@ -627,6 +627,7 @@
synnefo.config.network_strict_destroy = {{ network_strict_destroy }};
synnefo.config.network_allow_multiple_destory = {{ network_allow_multiple_destroy }};
synnefo.config.group_public_networks = {{ group_public_networks }};
synnefo.config.grouped_network_name = {{ grouped_network_name|safe }};
synnefo.auth_client = new synnefo.auth.AstakosClient({
login_url: synnefo.config.login_redirect,
......
......@@ -137,6 +137,7 @@ NETWORK_STRICT_DESTROY = getattr(settings,
NETWORK_ALLOW_MULTIPLE_DESTROY = getattr(settings,
'UI_NETWORK_ALLOW_MULTIPLE_DESTROY', False)
GROUP_PUBLIC_NETWORKS = getattr(settings, 'UI_GROUP_PUBLIC_NETWORKS', True)
GROUPED_NETWORK_NAME = getattr(settings, 'UI_GROUPED_NETWORK_NAME', 'Internet')
def template(name, request, context):
template_path = os.path.join(os.path.dirname(__file__), "templates/")
......@@ -196,6 +197,7 @@ def home(request):
'network_allow_duplicate_vm_nics': json.dumps(NETWORK_DUPLICATE_NICS),
'network_strict_destroy': json.dumps(NETWORK_STRICT_DESTROY),
'network_allow_multiple_destroy': json.dumps(NETWORK_ALLOW_MULTIPLE_DESTROY),
'grouped_network_name': json.dumps(GROUPED_NETWORK_NAME),
'group_public_networks': json.dumps(GROUP_PUBLIC_NETWORKS),
'diagnostics_update_interval': json.dumps(DIAGNOSTICS_UPDATE_INTERVAL)
}
......
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