mirror of
https://git.yoctoproject.org/poky
synced 2026-04-10 14:02:21 +02:00
bitbake: 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 (Bitbake rev: af42ea5f006c5cf55a7c57a42904f412639d261f) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
fa9206e427
commit
5b8a62dad7
@@ -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,
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user