diff options
author | Andy Chong <andycjw@gmail.com> | 2012-03-05 12:55:16 +0800 |
---|---|---|
committer | Andy Chong <andycjw@gmail.com> | 2012-03-13 16:13:16 +0800 |
commit | 588c782067fbc4df77a360fc1ee20e2a4ff872de (patch) | |
tree | b1b8c222d2dc2b419a55277c4165918e0c6887f7 /horizon/api/nova.py | |
parent | e206ba6a4cb136dad2574ce1ffc475c0f7d9c60b (diff) | |
download | tuskar-ui-588c782067fbc4df77a360fc1ee20e2a4ff872de.tar.gz |
add source group rule interface in security groups edit
* fixes bug 860780
* continues from abandoned https://review.openstack.org/3268
* implements UI https://nebula.notableapp.com/posts/391efe1b94711ec4527b6f72a61e789b6a4a54b7
* modified test to accomodate change
* fix .form-field width from 96% to 90% to prevent weird overlap
Change-Id: I77af442ea4c0408556bfed8c2d1669b860219f66
Diffstat (limited to 'horizon/api/nova.py')
-rw-r--r-- | horizon/api/nova.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/horizon/api/nova.py b/horizon/api/nova.py index c90d75ef..0ad08a2e 100644 --- a/horizon/api/nova.py +++ b/horizon/api/nova.py @@ -30,6 +30,7 @@ from novaclient.v1_1.servers import REBOOT_HARD from horizon.api.base import APIResourceWrapper, APIDictWrapper, url_for +from django.utils.translation import ugettext as _ LOG = logging.getLogger(__name__) @@ -166,13 +167,19 @@ class SecurityGroup(APIResourceWrapper): class SecurityGroupRule(APIResourceWrapper): """ Wrapper for individual rules in a SecurityGroup. """ - _attrs = ['id', 'ip_protocol', 'from_port', 'to_port', 'ip_range'] + _attrs = ['id', 'ip_protocol', 'from_port', 'to_port', 'ip_range', 'group'] def __unicode__(self): - vals = {'from': self.from_port, - 'to': self.to_port, - 'cidr': self.ip_range['cidr']} - return 'ALLOW %(from)s:%(to)s from %(cidr)s' % vals + if 'name' in self.group: + vals = {'from': self.from_port, + 'to': self.to_port, + 'group': self.group['name']} + return _('ALLOW %(from)s:%(to)s from %(group)s') % vals + else: + vals = {'from': self.from_port, + 'to': self.to_port, + 'cidr': self.ip_range['cidr']} + return _('ALLOW %(from)s:%(to)s from %(cidr)s') % vals def novaclient(request): |