diff --git a/doc/source/topics/tables.rst b/doc/source/topics/tables.rst
index b200096568..2b8a188134 100644
--- a/doc/source/topics/tables.rst
+++ b/doc/source/topics/tables.rst
@@ -114,7 +114,10 @@ all of the boilerplate associated with writing these types of actions and
provides consistent error handling, logging, and user-facing interaction.
It is worth noting that ``BatchAction`` and ``DeleteAction`` are extensions
-of the standard ``Action`` class.
+of the standard ``Action`` class. Some ``BatchAction`` or ``DeleteAction``
+classes may cause some unrecoverable results, like deleted images or
+unrecoverable instances. It may be helpful to specify specific help_text to
+explain the concern to the user, such as "Deleted images are not recoverable".
Preemptive actions
------------------
diff --git a/horizon/static/horizon/js/horizon.tables.js b/horizon/static/horizon/js/horizon.tables.js
index 23732e4327..cd93f8282d 100644
--- a/horizon/static/horizon/js/horizon.tables.js
+++ b/horizon/static/horizon/js/horizon.tables.js
@@ -174,6 +174,7 @@ horizon.datatables.confirm = function (action) {
$modal_parent = $(action).closest('.modal'),
name_array = [],
closest_table_id, action_string, name_string,
+ help_text,
title, body, modal, form;
if($action.hasClass("disabled")) {
return;
@@ -198,8 +199,9 @@ horizon.datatables.confirm = function (action) {
}
name_string = interpolate(gettext("You have selected %s. "), [name_string]);
}
+ help_text = $(action).attr("help_text");
title = interpolate(gettext("Confirm %s"), [action_string]);
- body = name_string + gettext("Please confirm your selection. This action cannot be undone.");
+ body = name_string + gettext("Please confirm your selection. ") + help_text;
modal = horizon.modals.create(title, body, action_string);
modal.modal();
if($modal_parent.length) {
diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py
index d231d8136a..80a9b8301f 100644
--- a/horizon/tables/actions.py
+++ b/horizon/tables/actions.py
@@ -635,8 +635,15 @@ class BatchAction(Action):
Optional location to redirect after completion of the delete
action. Defaults to the current page.
+
+ .. attribute:: help_text
+
+ Optional message for providing an appropriate help text for
+ the horizon user.
"""
+ help_text = _("This action cannot be undone.")
+
def __init__(self, **kwargs):
super(BatchAction, self).__init__(**kwargs)
@@ -696,6 +703,8 @@ class BatchAction(Action):
# Keep record of successfully handled objects
self.success_ids = []
+ self.help_text = kwargs.get('help_text', self.help_text)
+
def _allowed(self, request, datum=None):
# Override the default internal action method to prevent batch
# actions from appearing on tables with no data.
diff --git a/horizon/templates/horizon/common/_data_table_row_action_dropdown.html b/horizon/templates/horizon/common/_data_table_row_action_dropdown.html
index d766fb3151..aee336f6b4 100644
--- a/horizon/templates/horizon/common/_data_table_row_action_dropdown.html
+++ b/horizon/templates/horizon/common/_data_table_row_action_dropdown.html
@@ -1,5 +1,5 @@
{% if action.method != "GET" %}
-
+
{% else %}
{{ action.verbose_name }}
{% endif %}
diff --git a/horizon/templates/horizon/common/_data_table_table_action.html b/horizon/templates/horizon/common/_data_table_table_action.html
index 9830cc60e0..b0e819e2ef 100644
--- a/horizon/templates/horizon/common/_data_table_table_action.html
+++ b/horizon/templates/horizon/common/_data_table_table_action.html
@@ -1,5 +1,5 @@
{% if action.method != "GET" %}
-