Merge "Fix empty 'href' in link actions after AJAX actions_update"

This commit is contained in:
Jenkins 2016-03-18 06:36:07 +00:00 committed by Gerrit Code Review
commit 61768ae49d
4 changed files with 17 additions and 4 deletions

View File

@ -14,6 +14,7 @@
from collections import defaultdict
from collections import OrderedDict
import copy
import logging
import types
import warnings
@ -367,9 +368,11 @@ class LinkAction(BaseAction):
)
return "%s?%s" % (table_url, params)
def render(self):
def render(self, **kwargs):
action_dict = copy.copy(kwargs)
action_dict.update({"action": self, "is_single": True})
return render_to_string("horizon/common/_data_table_action.html",
{"action": self, "is_single": True})
action_dict)
def associate_with_table(self, table):
super(LinkAction, self).associate_with_table(table)

View File

@ -413,7 +413,7 @@ class LaunchLink(tables.LinkAction):
def single(self, table, request, object_id=None):
self.allowed(request, None)
return HttpResponse(self.render())
return HttpResponse(self.render(is_table_action=True))
class LaunchLinkNG(LaunchLink):

View File

@ -150,7 +150,7 @@ class CreateVolume(tables.LinkAction):
def single(self, table, request, object_id=None):
self.allowed(request, None)
return HttpResponse(self.render())
return HttpResponse(self.render(is_table_action=True))
class ExtendVolume(VolumePolicyTargetMixin, tables.LinkAction):

View File

@ -9,6 +9,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import time
from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages
@ -64,6 +65,15 @@ class TestVolumes(helpers.TestCase):
self.assertFalse(
volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))
# NOTE(tsufiev): A short regression test on bug 1553314: we try to
# re-open 'Create Volume' button after the volume was deleted. If the
# regression occurs, the form won't appear (because link is going to be
# invalid in this case). Give JavaScript callbacks an additional second
# to do all the job and possibly cause the regression.
if not isinstance(self, helpers.AdminTestCase):
time.sleep(1)
form = volumes_page.volumes_table.create_volume()
form.cancel()
def test_volumes_pagination(self):
"""This test checks volumes pagination