Add category list pagination support

Pagination was added to the 'Manage->Categories' page.

For getting category list 'catalog/categories' is used
everywhere. Before there were places where 'catalog/packages/categories' used.
This call is deprecated.

Also added handle of BadRequest error to common exception handler,
so if invalid sort key is passed, dashboard will stay alive.

Change-Id: I80758dce32fc3930250f8924d3243a7a1cdbda80
Related-bug: #1474932
This commit is contained in:
Ekaterina Chernova
2015-07-31 11:45:55 +03:00
parent 5b730c50f5
commit 59d4027d13
2 changed files with 61 additions and 6 deletions

View File

@@ -19,12 +19,12 @@ from django.contrib.messages import api as msg_api
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
import muranoclient.client as client
from muranoclient.common import exceptions as exc
from openstack_dashboard.api import base
from oslo_log import log as logging
import muranoclient.client as client
from muranoclient.common import exceptions as exc
from muranodashboard.common import utils as muranodashboard_utils
LOG = logging.getLogger(__name__)
@@ -73,6 +73,14 @@ def handled_exceptions(request):
msg = _('Requested operation conflicts with an existing object.')
LOG.exception(msg)
_handle_message(request, msg)
except exc.BadRequest as e:
msg = _('The request data is not acceptable by the server')
LOG.exception(msg)
reason = muranodashboard_utils.parse_api_error(
getattr(e, 'details', ''))
if not reason:
reason = msg
_handle_message(request, reason)
def _get_endpoint(request):