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