Update table's actions
I updated audit template, action plan and audit tables by adding new possible actions. Checking of policies for audit templates has been fixed as well. Change-Id: Idacbfc7099633197089ebbf180d22d099df3d872 Closes-bug: #1623528
This commit is contained in:
parent
a386d66566
commit
9481f0551e
@ -49,10 +49,9 @@ class ActionPlansFilterAction(horizon.tables.FilterAction):
|
||||
policy_rules = (("infra-optim", "action_plan:detail"),)
|
||||
|
||||
|
||||
class ArchiveActionPlan(horizon.tables.BatchAction):
|
||||
name = "archive_action_plans"
|
||||
class ArchiveActionPlan(horizon.tables.DeleteAction):
|
||||
verbose_name = _("Archive Action Plans")
|
||||
policy_rules = (("infra-optim", "action_plan:delete"),)
|
||||
help_text = _("Archive an action plan.")
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
@ -170,6 +169,8 @@ class ActionPlansTable(horizon.tables.DataTable):
|
||||
table_actions = (
|
||||
# CancelActionPlan,
|
||||
ActionPlansFilterAction,
|
||||
StartActionPlan,
|
||||
ArchiveActionPlan,
|
||||
)
|
||||
row_actions = (
|
||||
StartActionPlan,
|
||||
|
@ -30,7 +30,7 @@ class CreateAuditTemplates(horizon.tables.LinkAction):
|
||||
verbose_name = _("Create Template")
|
||||
url = "horizon:admin:audit_templates:create"
|
||||
classes = ("ajax-modal", "btn-launch")
|
||||
policy_rules = (("infra-optim", "audit_templates:create"),)
|
||||
policy_rules = (("infra-optim", "audit_template:create"),)
|
||||
|
||||
|
||||
class AuditTemplatesFilterAction(horizon.tables.FilterAction):
|
||||
@ -39,7 +39,7 @@ class AuditTemplatesFilterAction(horizon.tables.FilterAction):
|
||||
('goal', _("Goal ="), True),
|
||||
('strategy', _("Strategy ="), True),
|
||||
)
|
||||
policy_rules = (("infra-optim", "audit_templates:detail"),)
|
||||
policy_rules = (("infra-optim", "audit_template:detail"),)
|
||||
|
||||
|
||||
class LaunchAudit(horizon.tables.BatchAction):
|
||||
@ -73,23 +73,23 @@ class LaunchAudit(horizon.tables.BatchAction):
|
||||
watcher.Audit.create(request, **params)
|
||||
|
||||
|
||||
class DeleteAuditTemplates(horizon.tables.DeleteAction):
|
||||
verbose_name = _("Delete Templates")
|
||||
class ArchiveAuditTemplates(horizon.tables.DeleteAction):
|
||||
verbose_name = _("Archive Templates")
|
||||
policy_rules = (("infra-optim", "audit_template:delete"),)
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
"Delete Template",
|
||||
"Delete Templates",
|
||||
"Archive Template",
|
||||
"Archive Templates",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
"Deleted Template",
|
||||
"Deleted Templates",
|
||||
"Archived Template",
|
||||
"Archived Templates",
|
||||
count
|
||||
)
|
||||
|
||||
@ -118,12 +118,14 @@ class AuditTemplatesTable(horizon.tables.DataTable):
|
||||
|
||||
class Meta(object):
|
||||
name = "audit_templates"
|
||||
verbose_name = _("Available")
|
||||
verbose_name = _("Audit Templates")
|
||||
table_actions = (
|
||||
CreateAuditTemplates,
|
||||
DeleteAuditTemplates,
|
||||
AuditTemplatesFilterAction,
|
||||
LaunchAudit,
|
||||
ArchiveAuditTemplates,
|
||||
)
|
||||
row_actions = (
|
||||
LaunchAudit,
|
||||
ArchiveAuditTemplates,
|
||||
)
|
||||
|
@ -52,8 +52,8 @@ class AuditsFilterAction(horizon.tables.FilterAction):
|
||||
|
||||
|
||||
class CreateAudit(horizon.tables.LinkAction):
|
||||
name = "launch_audit"
|
||||
verbose_name = _("Launch Audit")
|
||||
name = "create_audit"
|
||||
verbose_name = _("Create Audit")
|
||||
url = "horizon:admin:audits:create"
|
||||
classes = ("ajax-modal", "btn-launch")
|
||||
policy_rules = (("infra-optim", "audit:create"),)
|
||||
@ -84,22 +84,23 @@ class GoToActionPlan(horizon.tables.Action):
|
||||
args=[action_plans[0].uuid]))
|
||||
|
||||
|
||||
class DeleteAudits(horizon.tables.DeleteAction):
|
||||
verbose_name = _("Delete Audits")
|
||||
class ArchiveAudits(horizon.tables.DeleteAction):
|
||||
verbose_name = _("Archive Audits")
|
||||
policy_rules = (("infra-optim", "audit:delete"),)
|
||||
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
"Delete Audit",
|
||||
"Delete Audits",
|
||||
"Archive Audit",
|
||||
"Archive Audits",
|
||||
count
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
"Deleted Audit",
|
||||
"Deleted Audits",
|
||||
"Archived Audit",
|
||||
"Archived Audits",
|
||||
count
|
||||
)
|
||||
|
||||
@ -132,16 +133,12 @@ class AuditsTable(horizon.tables.DataTable):
|
||||
verbose_name = _("Audits")
|
||||
launch_actions = (CreateAudit,)
|
||||
table_actions = launch_actions + (
|
||||
# CancelAudit,
|
||||
AuditsFilterAction,
|
||||
# ArchiveAudits,
|
||||
ArchiveAudits,
|
||||
)
|
||||
row_actions = (
|
||||
GoToActionPlan,
|
||||
# CreateAudits,
|
||||
# ArchiveAudits,
|
||||
# CreateAudits,
|
||||
DeleteAudits,
|
||||
ArchiveAudits,
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user