moksha/api/widgets/containers/dashboardcontainer.py | 11 ++++++----- moksha/api/widgets/containers/templates/layout_applist.mak | 2 ++ moksha/connector/connector.py | 13 ++++++++++--- moksha/public/javascript/ui/moksha.ui.grid.js | 3 +++ 4 files changed, 21 insertions(+), 8 deletions(-)
New commits: commit fd822360d2b4b24771c7d19da8a97af84587fa31 Author: John (J5) Palmieri johnp@redhat.com Date: Tue May 19 16:16:32 2009 -0400
handle errors a bit better
* Still not finished in grid
diff --git a/moksha/api/widgets/containers/dashboardcontainer.py b/moksha/api/widgets/containers/dashboardcontainer.py index a78da65..90d6849 100644 --- a/moksha/api/widgets/containers/dashboardcontainer.py +++ b/moksha/api/widgets/containers/dashboardcontainer.py @@ -1,16 +1,16 @@ # This file is part of Moksha. # Copyright (C) 2008-2009 Red Hat, Inc. -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. -# +# # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
@@ -29,7 +29,7 @@ class AppListWidget(Widget): def update_params(self, d): super(AppListWidget, self).update_params(d)
- # we want to error out if there is no category + # ignore categories that don't exist c = d['category'] if isinstance(c, basestring): found = False @@ -39,8 +39,9 @@ class AppListWidget(Widget): found = True break
+ # ignore categories that don't exist if not found: - raise IndexError('Category "%s" not found in layout' % c) + d['category'] = None
applist_widget = AppListWidget('applist');
diff --git a/moksha/api/widgets/containers/templates/layout_applist.mak b/moksha/api/widgets/containers/templates/layout_applist.mak index 3a77fa8..91339f3 100644 --- a/moksha/api/widgets/containers/templates/layout_applist.mak +++ b/moksha/api/widgets/containers/templates/layout_applist.mak @@ -1,3 +1,4 @@ +% if category: <div id="${category['id']}" class="ui-sortable ${category['css_class']}"> % for app in category['apps']: <div class="app ${app['css_class']}"> @@ -34,3 +35,4 @@ </div> % endfor </div> +% endif \ No newline at end of file diff --git a/moksha/connector/connector.py b/moksha/connector/connector.py index 45efe00..164e80c 100644 --- a/moksha/connector/connector.py +++ b/moksha/connector/connector.py @@ -252,19 +252,26 @@ class IQuery(object): params = {}
query_func = self.query_model(resource_path).get_query() - (total_rows, rows) = query_func(self, + (total_rows, rows_or_error) = query_func(self, start_row = start_row, rows_per_page = rows_per_page, order = sort_order, sort_col = sort_col, filters = filters, **params) + + r['total_rows'] = total_rows r['rows_per_page'] = rows_per_page - r['visible_rows'] = len(rows) + if start_row: r['start_row'] = start_row - r['rows'] = rows + + if total_rows == -1: # there has been an error + r['error'] = rows_or_error + else: + r['visible_rows'] = len(rows_or_error) + r['rows'] = rows_or_error
results = r
diff --git a/moksha/public/javascript/ui/moksha.ui.grid.js b/moksha/public/javascript/ui/moksha.ui.grid.js index 5a1251b..950053b 100644 --- a/moksha/public/javascript/ui/moksha.ui.grid.js +++ b/moksha/public/javascript/ui/moksha.ui.grid.js @@ -338,6 +338,9 @@
var results = function(json) { self.clear(); + if (json.error) { + + }
for (var i in json.rows) { var row = json.rows[i];
moksha-commits@lists.fedorahosted.org