Display port link between router and extra network

A port link between router and extra network was not displayed
with demo account. This commit fixed the bug. Also remove dead
link when port has no link.

fixes bug 1131082

Change-Id: I50c469e55e0b8435b95f03b191a04e27017fc37e
This commit is contained in:
Toshiyuki Hayashi 2013-03-11 11:14:30 -07:00
parent 2b5e55c74f
commit 9fcbbe39bd
3 changed files with 21 additions and 11 deletions

View File

@ -240,10 +240,15 @@ horizon.network_topology = {
port_html port_html
.append(ip_html) .append(ip_html)
.css({'background-color':self.network_color(port.network_id)}) .css({'background-color':self.network_color(port.network_id)})
.click(function (e){ .click(function (e) {
e.stopPropagation(); e.stopPropagation();
window.location.href = port.url; if(port.url != undefined) {
window.location.href = port.url;
}
}); });
if(port.url == undefined) {
port_html.addClass("nourl");
}
return port_html; return port_html;
}, },
port_css: function(port_html, position, network_a, network_b){ port_css: function(port_html, position, network_a, network_b){

View File

@ -40,9 +40,10 @@ class JSONView(View):
continue continue
resource['url'] = reverse(view, None, [str(resource['id'])]) resource['url'] = reverse(view, None, [str(resource['id'])])
def _select_port_by_network_id(self, ports, network_id): def _check_router_external_port(self, ports, router_id, network_id):
for port in ports: for port in ports:
if port['network_id'] == network_id: if (port['network_id'] == network_id
and port['device_id'] == router_id):
return True return True
return False return False
@ -72,7 +73,7 @@ class JSONView(View):
self.add_resource_url('horizon:project:networks:ports:detail', self.add_resource_url('horizon:project:networks:ports:detail',
data['ports']) data['ports'])
data['routers'] = routers.get('routers', []) data['routers'] = routers.get('routers', [])
# user can't see port on shared network. so we are # user can't see port on external network. so we are
# adding fake port based on router information # adding fake port based on router information
for router in data['routers']: for router in data['routers']:
external_gateway_info = router.get('external_gateway_info') external_gateway_info = router.get('external_gateway_info')
@ -82,15 +83,12 @@ class JSONView(View):
'network_id') 'network_id')
if not external_network: if not external_network:
continue continue
if self._select_port_by_network_id(data['ports'], if self._check_router_external_port(data['ports'],
external_network): router['id'],
external_network):
continue continue
fake_port = {'id': 'fake%s' % external_network, fake_port = {'id': 'fake%s' % external_network,
'network_id': external_network, 'network_id': external_network,
'url': reverse(
'horizon:project:networks:detail',
None,
[external_network]),
'device_id': router['id'], 'device_id': router['id'],
'fixed_ips': []} 'fixed_ips': []}
data['ports'].append(fake_port) data['ports'].append(fake_port)

View File

@ -2035,6 +2035,13 @@ div.network {
-o-animation: progress-bar-stripes 0.3s linear infinite; -o-animation: progress-bar-stripes 0.3s linear infinite;
animation: progress-bar-stripes 0.3s linear infinite; animation: progress-bar-stripes 0.3s linear infinite;
} }
&.nourl {
cursor: auto;
background-image:none;
&:hover {
background-image:none;
}
}
} }
border-color: #222; border-color: #222;
&:after { &:after {