Merge "Fixed Catch errors in horizon tables"
This commit is contained in:
commit
f816a08da1
@ -19,6 +19,7 @@ from horizon import tables
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
import disaster_recovery.api.api as freezer_api
|
import disaster_recovery.api.api as freezer_api
|
||||||
|
from disaster_recovery.utils import shield
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -51,6 +52,7 @@ class DeleteClient(tables.DeleteAction):
|
|||||||
count
|
count
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@shield("Unable to delete client", redirect="clients:index")
|
||||||
def delete(self, request, client_id):
|
def delete(self, request, client_id):
|
||||||
return freezer_api.Client(request).delete(client_id)
|
return freezer_api.Client(request).delete(client_id)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ from horizon import messages
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
import disaster_recovery.api.api as freezer_api
|
import disaster_recovery.api.api as freezer_api
|
||||||
|
from disaster_recovery.utils import shield
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -69,6 +70,7 @@ class DeleteJob(tables.DeleteAction):
|
|||||||
count
|
count
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@shield("Unable to delete job", redirect="jobs:index")
|
||||||
def delete(self, request, job_id):
|
def delete(self, request, job_id):
|
||||||
return freezer_api.Job(request).delete(job_id)
|
return freezer_api.Job(request).delete(job_id)
|
||||||
|
|
||||||
@ -82,6 +84,7 @@ class CloneJob(tables.Action):
|
|||||||
verbose_name = _("Clone Job")
|
verbose_name = _("Clone Job")
|
||||||
help_text = _("Clone and edit a job file")
|
help_text = _("Clone and edit a job file")
|
||||||
|
|
||||||
|
@shield("Unable to clone job", redirect="jobs:index")
|
||||||
def single(self, table, request, job_id):
|
def single(self, table, request, job_id):
|
||||||
freezer_api.Job(request).clone(job_id)
|
freezer_api.Job(request).clone(job_id)
|
||||||
return shortcuts.redirect('horizon:disaster_recovery:jobs:index')
|
return shortcuts.redirect('horizon:disaster_recovery:jobs:index')
|
||||||
@ -113,6 +116,7 @@ class StartJob(tables.Action):
|
|||||||
name = "start_job"
|
name = "start_job"
|
||||||
verbose_name = _("Start Job")
|
verbose_name = _("Start Job")
|
||||||
|
|
||||||
|
@shield("Unable to start job", redirect="jobs:index")
|
||||||
def single(self, table, request, job_id):
|
def single(self, table, request, job_id):
|
||||||
freezer_api.Job(request).start(job_id)
|
freezer_api.Job(request).start(job_id)
|
||||||
messages.success(request, _("Job has started"))
|
messages.success(request, _("Job has started"))
|
||||||
@ -126,6 +130,7 @@ class StopJob(tables.Action):
|
|||||||
name = "stop_job"
|
name = "stop_job"
|
||||||
verbose_name = _("Stop Job")
|
verbose_name = _("Stop Job")
|
||||||
|
|
||||||
|
@shield("Unable to stop job", redirect="jobs:index")
|
||||||
def single(self, table, request, job_id):
|
def single(self, table, request, job_id):
|
||||||
freezer_api.Job(request).stop(job_id)
|
freezer_api.Job(request).stop(job_id)
|
||||||
messages.success(request, _("Job has stopped"))
|
messages.success(request, _("Job has stopped"))
|
||||||
@ -211,6 +216,7 @@ class DeleteAction(tables.DeleteAction):
|
|||||||
count
|
count
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@shield("Unable to delete action", redirect="jobs:index")
|
||||||
def delete(self, request, obj_id):
|
def delete(self, request, obj_id):
|
||||||
freezer_api.Job(request).delete_action(obj_id)
|
freezer_api.Job(request).delete_action(obj_id)
|
||||||
return reverse("horizon:disaster_recovery:jobs:index")
|
return reverse("horizon:disaster_recovery:jobs:index")
|
||||||
|
@ -22,6 +22,7 @@ from horizon import tables
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
import disaster_recovery.api.api as freezer_api
|
import disaster_recovery.api.api as freezer_api
|
||||||
|
from disaster_recovery.utils import shield
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -67,6 +68,7 @@ class DeleteSession(tables.DeleteAction):
|
|||||||
count
|
count
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@shield("Unable to delete session", redirect="sessions:index")
|
||||||
def delete(self, request, session_id):
|
def delete(self, request, session_id):
|
||||||
return freezer_api.Session(request).delete(session_id)
|
return freezer_api.Session(request).delete(session_id)
|
||||||
|
|
||||||
@ -108,6 +110,7 @@ class DeleteJobFromSession(tables.DeleteAction):
|
|||||||
count
|
count
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@shield("Unable to delete session", redirect="sessions:index")
|
||||||
def delete(self, request, session):
|
def delete(self, request, session):
|
||||||
job_id, session_id = session.split('===')
|
job_id, session_id = session.split('===')
|
||||||
return freezer_api.Session(request).remove_job(session_id, job_id)
|
return freezer_api.Session(request).remove_job(session_id, job_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user