moksha/api moksha/lib
by John (J5) Palmieri
moksha/api/widgets/containers/templates/layout_applist.mak | 2 +-
moksha/lib/helpers.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
New commits:
commit c8c5b99c1f2413957ba2c58387b77713142d27c7
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Thu May 21 17:02:22 2009 -0400
process params as json also
diff --git a/moksha/api/widgets/containers/templates/layout_applist.mak b/moksha/api/widgets/containers/templates/layout_applist.mak
index 4a46027..4cbf571 100644
--- a/moksha/api/widgets/containers/templates/layout_applist.mak
+++ b/moksha/api/widgets/containers/templates/layout_applist.mak
@@ -24,7 +24,7 @@
$(document).ready(function () {
moksha.html_load(moksha.url("${app['url']}"),
- ${app['params']},
+ ${app['json_params']},
success,
$('#${app["id"]}_overlay')
)
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index f61be17..b13e7c3 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.py
@@ -325,6 +325,7 @@ class App(ConfigWrapper):
qs = self._create_query_string(p)
results.update({'label': self.label, 'url': self.url,
'params': p,
+ 'json_params': json.dumps(p),
'query_string': qs,
'content_id': self.content_id + '-' + results['id'],
'css_class': css_class})
15 years
2 commits - moksha/lib moksha/public
by John (J5) Palmieri
moksha/lib/helpers.py | 8 +++-----
moksha/public/javascript/ui/moksha.ui.grid.js | 9 ++++++++-
2 files changed, 11 insertions(+), 6 deletions(-)
New commits:
commit a1322da10ad8a4e806ecefedd24c461ca1eaa2ca
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Thu May 21 16:37:18 2009 -0400
add a first_visible_row and last_visible_row variables for display purposes
diff --git a/moksha/public/javascript/ui/moksha.ui.grid.js b/moksha/public/javascript/ui/moksha.ui.grid.js
index b27ac4a..fe5de28 100644
--- a/moksha/public/javascript/ui/moksha.ui.grid.js
+++ b/moksha/public/javascript/ui/moksha.ui.grid.js
@@ -61,6 +61,7 @@
$('.' + o.rowClass, self.element).replaceWith('');
o.visible_rows = 0;
+ o.last_visible_row = 0;
},
insert_row: function(i, row_data) {
@@ -85,6 +86,7 @@
$ph.parent().append($new_row);
$new_row.addClass(row_class).addClass(o.rowClass);
o.visible_rows++;
+ o.last_visible_row = o.start_row + o.visible_rows;
} else {
// insert before i element and update all row numbers
var row_class = o.rowClass + '_' + i.toString();
@@ -107,6 +109,8 @@
o.visible_rows = o.rows_per_page;
self.remove_row(o.rows_per_page);
}
+
+ o.last_visible_row = o.start_row + o.visible_rows;
}
$new_row.show();
@@ -350,6 +354,7 @@
// reset based on returned values
o.total_rows = json.total_rows;
o.start_row = json.start_row;
+ o.first_visible_row = o.start_row + 1; // user visible index always starts with 1 not 0
o.rows_per_pager = json.rows_per_page;
moksha.defer(self, function() {
@@ -536,6 +541,8 @@
rows_per_page: 10,
page_num: 1,
total_rows: 0,
+ first_visible_row: 1, // 1 based index
+ last_visible_row: 1, // 1 based index
visible_rows: 0,
filters: {},
unique_key: undefined,
@@ -895,7 +902,7 @@ $.extend( $.template.helpers , {
filter: function(v, filter_cb) {
return window[filter_cb](v);
- }
+ },
}
);
commit 29beff328e5d3897a33489268e69ee3350d812bc
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Thu May 21 16:36:47 2009 -0400
don't unicode decode too early
diff --git a/moksha/lib/helpers.py b/moksha/lib/helpers.py
index 70954a4..f61be17 100644
--- a/moksha/lib/helpers.py
+++ b/moksha/lib/helpers.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/>.
@@ -55,8 +55,6 @@ def _update_params(params, d):
# recursive dicts also get updated
# by the passed params
- if isinstance(value, unicode):
- value = value.encode('utf8', 'replace')
if isinstance(value, dict):
value = _update_params(value, d)
value = json.dumps(value)
15 years
moksha/public
by Máirín Duffy
moksha/public/javascript/ui/moksha.ui.grid.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 104537cd305a5dfe9047a6af83f9fd476246a64d
Author: Máirín Duffy <duffy(a)redhat.com>
Date: Thu May 21 16:20:00 2009 -0400
very minor fixes to adjust padding on unlinked buttons, adding the 'no-link' class in situations where next and prev buttons are unlinked because usually the padding is linked to the a element
diff --git a/moksha/public/javascript/ui/moksha.ui.grid.js b/moksha/public/javascript/ui/moksha.ui.grid.js
index 950053b..b27ac4a 100644
--- a/moksha/public/javascript/ui/moksha.ui.grid.js
+++ b/moksha/public/javascript/ui/moksha.ui.grid.js
@@ -781,8 +781,9 @@
show_prev += (show_next - num_next_left)
// previous link
- var page = $("<li>Prev</li>").addClass('page-button').addClass('prev-page');
+ var page = $("<li>Prev</li>").addClass('page-button').addClass('prev-page').addClass('no-link');
if (curr_page != 1) {
+ page.removeClass('no-link');
var page_link = $('<a href="javascript:void(0)"></a>').html('Prev');
page_link.data('page.moksha_grid', prev_page);
page_link.click(goto_page);
@@ -861,8 +862,9 @@
}
- var page = $("<li>Next</li>").addClass('page-button').addClass('next-page');
+ var page = $("<li>Next</li>").addClass('page-button').addClass('next-page').addClass('no-link');
if (curr_page < total_pages) {
+ page.removeClass('no-link');
var page_link = $('<a href="javascript:void(0)"></a>').html('Next');
page_link.data('page.moksha_grid', next_page);
page_link.click(goto_page);
15 years
moksha/public
by John (J5) Palmieri
moksha/public/javascript/ui/moksha.ui.popup.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
New commits:
commit af1729ad391d4b5891560eb5fcd55695abbd8436
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Wed May 20 13:54:20 2009 -0400
add a show and hide signal to the menu
diff --git a/moksha/public/javascript/ui/moksha.ui.popup.js b/moksha/public/javascript/ui/moksha.ui.popup.js
index a08b767..07b68b2 100644
--- a/moksha/public/javascript/ui/moksha.ui.popup.js
+++ b/moksha/public/javascript/ui/moksha.ui.popup.js
@@ -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/>.
@@ -56,6 +56,9 @@ $.widget("ui.moksha_popup", {
this.$panel.show();
}
+ // fire off a show event
+ $e.trigger('show');
+
},
hidePopup: function() {
@@ -67,6 +70,8 @@ $.widget("ui.moksha_popup", {
} else {
this.$panel.hide();
}
+
+ $e.trigger('hide');
},
_startHover: function() {
15 years
moksha/api
by John (J5) Palmieri
moksha/api/widgets/containers/templates/layout_applist.mak | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit a98c326ae56ea3904fb26b83ef2c833da94c36c5
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue May 19 23:12:41 2009 -0400
add an overlay class
diff --git a/moksha/api/widgets/containers/templates/layout_applist.mak b/moksha/api/widgets/containers/templates/layout_applist.mak
index 91339f3..4a46027 100644
--- a/moksha/api/widgets/containers/templates/layout_applist.mak
+++ b/moksha/api/widgets/containers/templates/layout_applist.mak
@@ -5,7 +5,7 @@
% if app['label']:
<h3>${app['label']}</h3>
% endif
- <div id="${app['id']}_overlay"><div class="message"></div></div>
+ <div id="${app['id']}_overlay" class="overlay"><div class="message"></div></div>
<div id="${app['id']}">
% if app.has_key('widget'):
${app['widget'](**app['params'])}
15 years
moksha/public
by John (J5) Palmieri
moksha/public/javascript/ui/moksha.ui.tabs.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 66b56cffbd822b3aafd6ed2b3a9a5fc7bcd47521
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue May 19 17:01:54 2009 -0400
fix first non-static link selection regression
diff --git a/moksha/public/javascript/ui/moksha.ui.tabs.js b/moksha/public/javascript/ui/moksha.ui.tabs.js
index 056c368..feec429 100644
--- a/moksha/public/javascript/ui/moksha.ui.tabs.js
+++ b/moksha/public/javascript/ui/moksha.ui.tabs.js
@@ -217,11 +217,11 @@ $.widget("ui.mokshatabs", {
}, 500);
}
scrollTo(0, 0);
- } else {
+ } else if (index == -1) {
// invalid path, redirect to /invalid_path
path = location.hash.substring(1);
location.href=moksha.url('/invalid_path', {invalid_path: path});
- }
+ } // else we goto the first non-static tab
}
else if (o.cookie) {
@@ -593,7 +593,7 @@ $.widget("ui.mokshatabs", {
var id_index = level + offset;
if (id_index >= hash.length)
- return 0;
+ return -2;
var id = "#" + hash[level + offset];
15 years
moksha/public
by John (J5) Palmieri
moksha/public/javascript/ui/moksha.ui.tabs.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 98e78190631843d3cc1ce7c14f7f674e352c6ee0
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue May 19 16:20:29 2009 -0400
fix some linking regressions from the last tab commit
diff --git a/moksha/public/javascript/ui/moksha.ui.tabs.js b/moksha/public/javascript/ui/moksha.ui.tabs.js
index bfe449d..056c368 100644
--- a/moksha/public/javascript/ui/moksha.ui.tabs.js
+++ b/moksha/public/javascript/ui/moksha.ui.tabs.js
@@ -69,7 +69,7 @@ $.widget("ui.mokshatabs", {
if (attach_query_string && location.search)
tab_link += location.search;
- return '/' + tab_link;
+ return tab_link;
},
setData: function(key, value) {
15 years
moksha/api moksha/connector moksha/public
by John (J5) Palmieri
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(a)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];
15 years
moksha/public
by John (J5) Palmieri
moksha/public/javascript/ui/moksha.ui.tabs.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 83ce3deb6bf25fb049603e7be37ddc3de080e693
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Tue May 19 11:37:15 2009 -0400
make all tab link paths toplevel
diff --git a/moksha/public/javascript/ui/moksha.ui.tabs.js b/moksha/public/javascript/ui/moksha.ui.tabs.js
index 7bbaa24..bfe449d 100644
--- a/moksha/public/javascript/ui/moksha.ui.tabs.js
+++ b/moksha/public/javascript/ui/moksha.ui.tabs.js
@@ -69,7 +69,7 @@ $.widget("ui.mokshatabs", {
if (attach_query_string && location.search)
tab_link += location.search;
- return tab_link;
+ return '/' + tab_link;
},
setData: function(key, value) {
@@ -394,7 +394,7 @@ $.widget("ui.mokshatabs", {
}
} else {
if (o.staticLoadOnClick) {
- moksha.goto(href.substr(1));
+ moksha.goto('/' + href.substr(1));
return false;
} else {
location.hash = href;
15 years
moksha/public
by John (J5) Palmieri
moksha/public/javascript/moksha.js | 31 ++++++++++++++++++++++++++
moksha/public/javascript/ui/moksha.ui.tabs.js | 10 ++++++++
2 files changed, 41 insertions(+)
New commits:
commit efaf162c605308d52a12abd34ed0902c6a19b268
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon May 18 18:26:37 2009 -0400
add the ability to set the title from the tabs
diff --git a/moksha/public/javascript/moksha.js b/moksha/public/javascript/moksha.js
index cc4fa96..ff2fda6 100644
--- a/moksha/public/javascript/moksha.js
+++ b/moksha/public/javascript/moksha.js
@@ -721,6 +721,37 @@ moksha = {
if (_moksha_deferred.length == 1)
setTimeout(timeout, defer_time);
+ },
+
+ /*************************************************************
+ * Updates a component of the title
+ *
+ * label - the text to add into the title
+ * level - which component to update (e.g. if you have a two
+ * component title "Moksha" and "Updates" it will be
+ * displayed as "Updates - Moksha" if you then call
+ * moksha.update_title("Builds", 1) it will be rendered
+ * as "Builds - Moksha". level is a 0 based index so
+ * level 0 == "Moksha"
+ **************************************************************/
+
+ title: [],
+ update_title: function(label, level) {
+ var title = moksha.title;
+ var i;
+
+ title.length = level + 1;
+ title[level] = label;
+
+ var title_str = '';
+ for(i=title.length - 1; i > 0; i--) {
+ title_str += title[i] + ' - ';
+ }
+
+ title_str += title[0];
+ document.title = title_str;
+
+ moksha.title = title;
}
}
diff --git a/moksha/public/javascript/ui/moksha.ui.tabs.js b/moksha/public/javascript/ui/moksha.ui.tabs.js
index 10ad65a..7bbaa24 100644
--- a/moksha/public/javascript/ui/moksha.ui.tabs.js
+++ b/moksha/public/javascript/ui/moksha.ui.tabs.js
@@ -250,7 +250,12 @@ $.widget("ui.mokshatabs", {
if (o.selected !== null) {
var l = this.$lis.eq(o.selected).addClass(o.selectedClass);
+
var a = $('a', l)[0];
+ var title = $(a).attr('title');
+ if (title)
+ moksha.update_title(title, 1);
+
var $show = $($(a).data('dynamic_href.tabs') + ':first', self.element)
$show.show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
@@ -312,6 +317,11 @@ $.widget("ui.mokshatabs", {
// Show a tab, animation prevents browser scrolling to fragment,
// $hide is optional.
function showTab(clicked, $show, $hide) {
+ // last tab gets to set the second title component
+ var title = $(clicked).attr('title');
+ if (title)
+ moksha.update_title(title, 1);
+
if (showFx === baseFx)
$show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
$show.animate(showFx, showFx.duration || baseDuration, function() {
15 years