From b61ee0865300f85563c0c708d9c56923e0429049 Mon Sep 17 00:00:00 2001 From: Gabriel Hurley Date: Wed, 14 Mar 2012 17:59:00 -0700 Subject: [PATCH] Corrects available actions for syspanel images table. * Fixes bug 955630 by removing the launch instance action. * Allows admins to delete any image. Change-Id: Ie9bd1c93349c19ac07b6d576115420da55148042 --- horizon/dashboards/syspanel/images/tables.py | 17 ++++++++++++++++- horizon/dashboards/syspanel/images/views.py | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/horizon/dashboards/syspanel/images/tables.py b/horizon/dashboards/syspanel/images/tables.py index 9520672ea..0e8d0a2b2 100644 --- a/horizon/dashboards/syspanel/images/tables.py +++ b/horizon/dashboards/syspanel/images/tables.py @@ -14,5 +14,20 @@ # License for the specific language governing permissions and limitations # under the License. +from django.utils.translation import ugettext as _ + from horizon.dashboards.nova.images_and_snapshots.images.tables import ( - ImagesTable, LaunchImage, EditImage, DeleteImage) + ImagesTable, EditImage, DeleteImage) + + +class AdminDeleteImage(DeleteImage): + def allowed(self, request, image=None): + return True + + +class AdminImagesTable(ImagesTable): + class Meta: + name = "images" + verbose_name = _("Images") + table_actions = (AdminDeleteImage,) + row_actions = (EditImage, AdminDeleteImage) diff --git a/horizon/dashboards/syspanel/images/views.py b/horizon/dashboards/syspanel/images/views.py index a6512647a..28ac07023 100644 --- a/horizon/dashboards/syspanel/images/views.py +++ b/horizon/dashboards/syspanel/images/views.py @@ -26,14 +26,14 @@ from horizon import api from horizon import exceptions from horizon import tables from horizon.dashboards.nova.images_and_snapshots.images import views -from .tables import ImagesTable +from .tables import AdminImagesTable LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = ImagesTable + table_class = AdminImagesTable template_name = 'syspanel/images/index.html' def get_data(self):