Fix Terminate Instance on network topology page

It failed because not all the info expected by the
`project.instances.IndexView` was provided by network topology view
while rendering part of Instances table in an iframe.

Change-Id: If36f877517d454430320b90362fd0d5207dbf9df
Closes-Bug: #1398468
(cherry picked from commit a1416b6d1d)
This commit is contained in:
Timur Sufiev 2014-12-02 21:09:32 +03:00 committed by Doug Fish
parent 947bc63977
commit 8b80fe7766
2 changed files with 12 additions and 7 deletions

View File

@ -7,7 +7,11 @@
</table>
" data-original-title="{% trans "Flavor Details" %}: {{ name }}">{{ name }}</a>
<script type="text/javascript" charset="utf-8">
$(function ()
{ $("#flavor_details_{{ id }}").popover({html:true});
$(function () {
var $flavor = $("#flavor_details_{{ id }}");
// NOTE(tsufiev): check this in case this template is used in network topology -> terminate instance
if ( $flavor.popover ) {
$flavor.popover({html:true});
}
});
</script>

View File

@ -121,12 +121,13 @@ class IndexView(tables.DataTableView):
return instances
def get_filters(self, filters):
filter_field = self.table.get_filter_field()
filter_action = self.table._meta._filter_action
if filter_action.is_api_filter(filter_field):
filter_string = self.table.get_filter_string()
if filter_field and filter_string:
filters[filter_field] = filter_string
if filter_action:
filter_field = self.table.get_filter_field()
if filter_action.is_api_filter(filter_field):
filter_string = self.table.get_filter_string()
if filter_field and filter_string:
filters[filter_field] = filter_string
return filters