diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-02-11 05:48:20 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2013-02-11 05:48:20 +0000 |
commit | 4951c1b04bf66f81cf648b76af3795245d56381a (patch) | |
tree | 7e6182a46d4d246716438cdb9ecd4480ef3d4b65 /sca-cpp/trunk/hosting/server/apps.py | |
parent | 5c0eab60028407c84e2fee6a4fa1fbc03716d1d2 (diff) |
Improvements to the app management UI.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1444660 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/hosting/server/apps.py')
-rw-r--r-- | sca-cpp/trunk/hosting/server/apps.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sca-cpp/trunk/hosting/server/apps.py b/sca-cpp/trunk/hosting/server/apps.py index 20c38cb3c5..e61ee5eb9d 100644 --- a/sca-cpp/trunk/hosting/server/apps.py +++ b/sca-cpp/trunk/hosting/server/apps.py @@ -25,7 +25,7 @@ def appid(id): return ("apps", car(id), "app.info") # Put an app into the apps db -def put(id, app, user, cache, dashboard, store, composites, pages, icons): +def put(id, app, user, cache, db, dashboard, store, composites, pages, icons): debug('apps.py::put::id', id) debug('apps.py::put::app', app) @@ -68,7 +68,7 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): return False # Clone app - appentry = mkentry(title(app), car(id), user.get(()), now(), content(app)) + appentry = mkentry(title(capp), car(id), user.get(()), now(), content(capp)) debug('apps.py::put::appentry', appentry) cache.put(appid(id), appentry) composites.put(id, composites.get((eid,))) @@ -78,10 +78,19 @@ def put(id, app, user, cache, dashboard, store, composites, pages, icons): return True # Get an app from the apps db -def get(id, user, cache, dashboard, store, composites, pages, icons): +def get(id, user, cache, db, dashboard, store, composites, pages, icons): debug('apps.py::get::id', id) + + # Return the newest apps if isNull(id): - return (("'feed", ("'title", "Apps"), ("'id", "apps")),) + newentries = db.get((("'regex", '("apps" .* "app.info")'), ("'rank", "(regexp_matches(value, '(.*\(updated )([^\)]+)(\).*)'))[2]::timestamp"), ("'limit", 25))) + flatentries = tuple(map(lambda v: car(v), () if isNull(newentries) else newentries)) + def sortkey(e): + return updated((e,)) + sortedentries = tuple(sorted(flatentries, key = sortkey, reverse = True))[0:25] + newapps = ((("'feed", ("'title", "Apps"), ("'id", 'apps')) + sortedentries),) + debug('apps.py::get::newapps', newapps) + return newapps # Get the requested app app = cache.get(appid(id)) @@ -94,7 +103,7 @@ def get(id, user, cache, dashboard, store, composites, pages, icons): return app # Delete an app from the apps db -def delete(id, user, cache, dashboard, store, composites, pages, icons): +def delete(id, user, cache, db, dashboard, store, composites, pages, icons): debug('apps.py::delete::id', id) # Get the requested app |