Merge "Actions for a job no longer shows irrelevant actions for specific cases"
This commit is contained in:
commit
4c8cdb2d37
@ -87,6 +87,10 @@ def get_link(action):
|
||||
kwargs={'action_id': action.id})
|
||||
|
||||
|
||||
class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
|
||||
class ActionsTable(tables.DataTable):
|
||||
backup_name = tables.Column('backup_name',
|
||||
|
||||
@ -104,3 +108,4 @@ class ActionsTable(tables.DataTable):
|
||||
row_actions = (EditAction, DeleteAction,)
|
||||
table_actions = (Filter, CreateAction, DeleteMultipleActions)
|
||||
multi_select = True
|
||||
row_class = UpdateRow
|
||||
|
@ -118,6 +118,9 @@ class StartJob(tables.Action):
|
||||
messages.success(request, _("Job has started"))
|
||||
return shortcuts.redirect('horizon:disaster_recovery:jobs:index')
|
||||
|
||||
def allowed(self, request, job=None):
|
||||
return True
|
||||
|
||||
|
||||
class StopJob(tables.Action):
|
||||
name = "stop_job"
|
||||
@ -128,6 +131,11 @@ class StopJob(tables.Action):
|
||||
messages.success(request, _("Job has stopped"))
|
||||
return shortcuts.redirect('horizon:disaster_recovery:jobs:index')
|
||||
|
||||
def allowed(self, request, job=None):
|
||||
if job.event == 'stop':
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def get_link(row):
|
||||
return reverse('horizon:disaster_recovery:jobs:index',
|
||||
@ -142,6 +150,10 @@ class CreateJob(tables.LinkAction):
|
||||
icon = "plus"
|
||||
|
||||
|
||||
class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
|
||||
class JobsTable(tables.DataTable):
|
||||
job_name = tables.Column("description",
|
||||
link=get_link,
|
||||
@ -174,6 +186,7 @@ class JobsTable(tables.DataTable):
|
||||
DeleteJob)
|
||||
footer = False
|
||||
multi_select = True
|
||||
row_class = UpdateRow
|
||||
|
||||
|
||||
class DeleteAction(tables.DeleteAction):
|
||||
|
@ -137,6 +137,10 @@ class JobsTable(tables.DataTable):
|
||||
multi_select = True
|
||||
|
||||
|
||||
class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
|
||||
class SessionsTable(tables.DataTable):
|
||||
description = tables.Column('description',
|
||||
link=get_link,
|
||||
@ -155,3 +159,4 @@ class SessionsTable(tables.DataTable):
|
||||
DeleteSession,)
|
||||
footer = False
|
||||
multi_select = True
|
||||
row_class = UpdateRow
|
||||
|
Loading…
Reference in New Issue
Block a user