diff options
author | Michael Wood <michael.g.wood@intel.com> | 2014-11-14 18:12:20 +0000 |
---|---|---|
committer | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-11-20 15:43:57 +0000 |
commit | af42ea5f006c5cf55a7c57a42904f412639d261f (patch) | |
tree | 6071729452724d1be7d75ff7f0c130900dca7aa2 | |
parent | cdf6178ae3675b40afca9f08d491ca1b7e45914e (diff) | |
download | bitbake-af42ea5f006c5cf55a7c57a42904f412639d261f.tar.gz |
toaster: libtoaster: Add getProjectInfo utility function
Add a utility function to return a specified project's info/config
This re-uses the existing server code path for the project edit
except that it allows any project id to be used as a parameter
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
-rw-r--r-- | lib/toaster/toastergui/static/js/libtoaster.js | 22 | ||||
-rw-r--r-- | lib/toaster/toastergui/urls.py | 1 | ||||
-rwxr-xr-x | lib/toaster/toastergui/views.py | 5 |
3 files changed, 27 insertions, 1 deletions
diff --git a/lib/toaster/toastergui/static/js/libtoaster.js b/lib/toaster/toastergui/static/js/libtoaster.js index b899b8de4..4983ef6f6 100644 --- a/lib/toaster/toastergui/static/js/libtoaster.js +++ b/lib/toaster/toastergui/static/js/libtoaster.js @@ -88,10 +88,32 @@ var libtoaster = (function (){ } }); }; + /* Get a project's configuration info */ + function _getProjectInfo(url, projectId, onsuccess, onfail){ + $.ajax({ + type: "POST", + url: url, + data: { project_id : projectId }, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (_data) { + if (_data.error != "ok") { + console.log(_data.error); + } else { + if (onsuccess != undefined) onsuccess(_data); + } + }, + error: function (_data) { + console.log(_data); + if (onfail) onfail(data); + } + }); + }; + return { reload_params : reload_params, startABuild : _startABuild, makeTypeahead : _makeTypeahead, + getProjectInfo: _getProjectInfo, } })(); diff --git a/lib/toaster/toastergui/urls.py b/lib/toaster/toastergui/urls.py index f43bb6465..bae710309 100644 --- a/lib/toaster/toastergui/urls.py +++ b/lib/toaster/toastergui/urls.py @@ -85,6 +85,7 @@ urlpatterns = patterns('toastergui.views', url(r'^project/(?P<pid>\d+)/builds$', 'projectbuilds', name='projectbuilds'), url(r'^xhr_projectbuild/(?P<pid>\d+)/$', 'xhr_projectbuild', name='xhr_projectbuild'), + url(r'^xhr_projectinfo/$', 'xhr_projectinfo', name='xhr_projectinfo'), url(r'^xhr_projectedit/(?P<pid>\d+)/$', 'xhr_projectedit', name='xhr_projectedit'), url(r'^xhr_datatypeahead/$', 'xhr_datatypeahead', name='xhr_datatypeahead'), diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py index 1b4bb9ff6..9f214bb67 100755 --- a/lib/toaster/toastergui/views.py +++ b/lib/toaster/toastergui/views.py @@ -2057,8 +2057,11 @@ if toastermain.settings.MANAGED: except Exception as e: return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") + def xhr_projectinfo(request): + if request.POST.has_key("project_id") == False: + raise BadParameterException("invalid project id") - + return xhr_projectedit(request, request.POST['project_id']) def xhr_projectedit(request, pid): try: |