Hide remove rule if no rule inserted in FW policy

Hide 'remove rule' row action in firewall policies, if no rule is inserted in it.

Change-Id: I7478f01c062ac20d23b4cfe6c8478d9881a6218c
Closes-Bug: #1452257
This commit is contained in:
Masco Kaliyamoorthy 2015-05-06 17:46:47 +05:30
parent adfec54572
commit 577fffa279

View File

@ -192,6 +192,11 @@ class RemoveRuleFromPolicyLink(policy.PolicyTargetMixin,
kwargs={'policy_id': policy.id}) kwargs={'policy_id': policy.id})
return base_url return base_url
def allowed(self, request, policy):
if len(policy.rules) > 0:
return True
return False
class AddRouterToFirewallLink(policy.PolicyTargetMixin, class AddRouterToFirewallLink(policy.PolicyTargetMixin,
tables.LinkAction): tables.LinkAction):