From 707f3f3ab754ee583259fd6c0c379503ee51d92c Mon Sep 17 00:00:00 2001 From: Doug Fish Date: Thu, 16 Oct 2014 13:09:47 -0500 Subject: [PATCH] Make labels in Network Topology translatable Fix the button and object labels in the network topology pop ups to be translatable and concatenation-free. Use "None" as the not found value to be consistent with the network ports detail screen. This patch excludes fixing the status values. Partial-Bug: #1323599 Change-Id: Ia0c92842703109401d758d5ac3ccefab9ccf6971 --- .../horizon/js/horizon.networktopology.js | 22 ++++++++++--------- .../client_side/_balloon_container.html | 2 +- .../client_side/_balloon_port.html | 2 +- .../static/dashboard/scss/horizon.scss | 22 ------------------- 4 files changed, 14 insertions(+), 34 deletions(-) diff --git a/horizon/static/horizon/js/horizon.networktopology.js b/horizon/static/horizon/js/horizon.networktopology.js index 2179fbc4ae..5578830cef 100644 --- a/horizon/static/horizon/js/horizon.networktopology.js +++ b/horizon/static/horizon/js/horizon.networktopology.js @@ -508,17 +508,17 @@ horizon.network_topology = { try { ip_address = port.fixed_ips[0].ip_address; }catch(e){ - ip_address = 'no info'; + ip_address = gettext('None'); } var device_owner = ''; try { device_owner = port.device_owner.replace('network:',''); }catch(e){ - device_owner = 'no info'; + device_owner = gettext('None'); } object.ip_address = ip_address; object.device_owner = device_owner; - object.is_interface = (device_owner === 'router_interface') ? true : false; + object.is_interface = (device_owner === 'router_interface'); ports.push(object); }); var html_data = { @@ -527,19 +527,19 @@ horizon.network_topology = { url:d.url, name:d.name, type:d.type, - type_capital:d.type.replace(/^\w/, function($0) { - return $0.toUpperCase(); - }), + delete_label: gettext("Delete"), status:d.status, status_class:(d.status === "ACTIVE")? 'active' : 'down', status_label: gettext("STATUS"), id_label: gettext("ID"), interfaces_label: gettext("Interfaces"), - interface_label: gettext("Interface"), - open_console_label: gettext("open console"), - view_details_label: interpolate(gettext("view %s details"), [d.type]) + delete_interface_label: gettext("Delete Interface"), + open_console_label: gettext("Open Console"), + view_details_label: gettext("View Details") }; if (d.type === 'router') { + html_data.delete_label = gettext("Delete Router"); + html_data.view_details_label = gettext("View Router Details"); html_data.port = ports; html_data.add_interface_url = d.url + 'addinterface'; html_data.add_interface_label = gettext("Add Interface"); @@ -548,6 +548,8 @@ horizon.network_topology = { table2:(ports.length > 0) ? port_tmpl : null }); } else if (d.type === 'instance') { + html_data.delete_label = gettext("Terminate Instance"); + html_data.view_details_label = gettext("View Instance Details") html_data.console_id = d.id; html_data.console = d.console; html = balloon_tmpl.render(html_data,{ @@ -582,7 +584,7 @@ horizon.network_topology = { } $balloon.find('.delete-device').click(function(e){ var $this = $(this); - $this.addClass('deleting'); + $this.prop('disabled', true); d3.select('#id_' + $this.data('device-id')).classed('loading',true); self.delete_device($this.data('type'),$this.data('device-id')); }); diff --git a/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_container.html b/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_container.html index bbf163c093..10c8c35603 100644 --- a/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_container.html +++ b/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_container.html @@ -24,7 +24,7 @@ [[add_interface_label]]
- +
diff --git a/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_port.html b/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_port.html index 05a9250d72..1f4a7c7144 100644 --- a/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_port.html +++ b/openstack_dashboard/dashboards/project/network_topology/templates/network_topology/client_side/_balloon_port.html @@ -22,7 +22,7 @@ [[#is_interface]] - + [[/is_interface]] diff --git a/openstack_dashboard/static/dashboard/scss/horizon.scss b/openstack_dashboard/static/dashboard/scss/horizon.scss index d799d3b57e..7cff84bf3a 100644 --- a/openstack_dashboard/static/dashboard/scss/horizon.scss +++ b/openstack_dashboard/static/dashboard/scss/horizon.scss @@ -2033,22 +2033,6 @@ label.log-length { .delete { padding-right: 0; text-align: right; - .btn { - &:before { - content:"Delete "; - } - &.deleting:before { - content:"Deleting "; - } - } - .btn.instance { - &:before { - content:"Terminate "; - } - &.deleting:before { - content:"Terminating "; - } - } } } table.detailInfoTable { @@ -2092,12 +2076,6 @@ label.log-length { .btn { line-height: 1.4; } - .btn:before { - content:"Delete "; - } - .btn.deleting:before { - content:"Deleting "; - } } font-size: 11px; @include box-shadow(0px 1px 6px #777);