summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-06-26 15:21:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-07-14 14:10:03 +0100
commitcff19351a8b9d6267177dc548d994e3f28590391 (patch)
treef8fba60b5b395035c534f2169b3f3ea1e08905f9 /bitbake/lib
parent6b62a0fd6eb9a609f71857f5793b0696f7a790b4 (diff)
downloadpoky-cff19351a8b9d6267177dc548d994e3f28590391.tar.gz
bitbake: toaster: add project pages
We add the new project and project page skeletons. In the process, we add an identifier in the settings.py to detect whenever Toaster is running in managed mode, and a context processor to make this value available to the template processor. (Bitbake rev: 927a27c68e24cfe13f62ca5f0e60878b04fa4e24) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/base.html13
-rw-r--r--bitbake/lib/toaster/toastergui/templates/newproject.html41
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html6
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py5
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py38
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py19
6 files changed, 118 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
index 9ca9c9ac3b..1407d641d5 100644
--- a/bitbake/lib/toaster/toastergui/templates/base.html
+++ b/bitbake/lib/toaster/toastergui/templates/base.html
@@ -58,6 +58,19 @@ function reload_params(params) {
58 <div class="navbar-inner"> 58 <div class="navbar-inner">
59 <a class="brand logo" href="#"><img src="{% static 'img/logo.png' %}" class="" alt="Yocto logo project"/></a> 59 <a class="brand logo" href="#"><img src="{% static 'img/logo.png' %}" class="" alt="Yocto logo project"/></a>
60 <a class="brand" href="/">Toaster</a> 60 <a class="brand" href="/">Toaster</a>
61 {%if MANAGED %}
62 <div class="btn-group pull-right">
63 <a class="btn" href="{% url 'newproject' %}">New project</a>
64 <button class="btn dropdown-toggle" data-toggle="dropdown">
65 <i class="icon-caret-down"></i>
66 </button>
67 <ul class="dropdown-menu">
68 <li><a href="#">Clone project</a></li>
69 <li><a href="#">Export project</a></li>
70 <li><a href="#">Import project</a></li>
71 </ul>
72 </div>
73 {%endif%}
61 <a class="pull-right manual" target="_blank" href="http://www.yoctoproject.org/documentation/toaster-manual"> 74 <a class="pull-right manual" target="_blank" href="http://www.yoctoproject.org/documentation/toaster-manual">
62 <i class="icon-book"></i> 75 <i class="icon-book"></i>
63 Toaster manual 76 Toaster manual
diff --git a/bitbake/lib/toaster/toastergui/templates/newproject.html b/bitbake/lib/toaster/toastergui/templates/newproject.html
new file mode 100644
index 0000000000..e5a6551967
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/newproject.html
@@ -0,0 +1,41 @@
1{% extends "base.html" %}
2{% load projecttags %}
3{% load humanize %}
4{% block pagecontent %}
5<div class="row-fluid">
6 <div class="span6">
7 <div class="page-header">
8 <h1>Create a new project</h1>
9 </div>
10 <form>
11 <fieldset>
12 <label>Project name <span class="muted">(required)</span></label>
13 <input type="text" class="input-xlarge" required name="projectname">
14 <label class="project-form">
15 Project owner
16 <i class="icon-question-sign get-help" title="The go-to person for this project"></i>
17 </label>
18 <form method="POST">
19 <input type="text">
20 <label class="project-form">Owner's email</label>
21 <input type="email" class="input-large" name="email">
22 <label class="project-form">
23 Yocto Project version
24 <i class="icon-question-sign get-help" title="This sets the branch for the Yocto Project core layers (meta, meta-yocto and meta-yocto-bsp), and for the layers you use from the OpenEmbedded Metadata Index"></i>
25 </label>
26 <select>
27 <option>Yocto Project 1.7 "D?"</option>
28 <option>Yocto Project 1.6 "Daisy"</option>
29 <option>Yocto Project 1.5 "Dora"</option>
30 </select>
31 </form>
32 </fieldset>
33
34 <div class="form-actions">
35 <a href="project-with-targets.html" class="btn btn-primary btn-large">Create project</a>
36 </div>
37 </form>
38 </div>
39 </div>
40 </div>
41{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
new file mode 100644
index 0000000000..71adb54431
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -0,0 +1,6 @@
1{% extends "base.html" %}
2{% load projecttags %}
3{% load humanize %}
4{% block pagecontent %}
5
6{% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index 9b583f217b..bba4fda074 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -65,6 +65,11 @@ urlpatterns = patterns('toastergui.views',
65 # urls not linked from the dashboard 65 # urls not linked from the dashboard
66 url(r'^layers/$', 'layer', name='all-layers'), 66 url(r'^layers/$', 'layer', name='all-layers'),
67 url(r'^layerversions/(?P<layerversion_id>\d+)/recipes/.*$', 'layer_versions_recipes', name='layer_versions_recipes'), 67 url(r'^layerversions/(?P<layerversion_id>\d+)/recipes/.*$', 'layer_versions_recipes', name='layer_versions_recipes'),
68
69 # project URLs
70 url(r'^newproject/$', 'newproject', name='newproject'),
71 url(r'^project/$', 'project', name='project'),
72
68 # default redirection 73 # default redirection
69 url(r'^$', RedirectView.as_view( url= 'builds/')), 74 url(r'^$', RedirectView.as_view( url= 'builds/')),
70) 75)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 1f3e11d57c..7dc0108393 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1758,3 +1758,41 @@ def image_information_dir(request, build_id, target_id, packagefile_id):
1758 # stubbed for now 1758 # stubbed for now
1759 return redirect(builds) 1759 return redirect(builds)
1760 1760
1761
1762import toastermain.settings
1763def managedcontextprocessor(request):
1764 return { "MANAGED" : toastermain.settings.MANAGED }
1765
1766
1767# we have a set of functions if we're in managed mode, or
1768# a default "page not available" simple functions for interactive mode
1769if toastermain.settings.MANAGED:
1770
1771 # new project
1772 def newproject(request):
1773 template = "newproject.html"
1774 context = {}
1775 if request.method == "GET":
1776 # render new project page
1777 return render(request, template, context)
1778 elif request.method == "POST":
1779 if request.method:
1780 return redirect(project)
1781 else:
1782 return render(request, template, context)
1783 raise Exception("Invalid HTTP method for this page")
1784
1785 # Shows the edit project page
1786 def project(request):
1787 template = "project.html"
1788 context = {}
1789 return render(request, template, context)
1790
1791
1792else:
1793 # these are pages that are NOT available in interactive mode
1794 def newproject(request):
1795 raise Exception("page not available in interactive mode")
1796
1797 def project(request):
1798 raise Exception("page not available in interactive mode")
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index 97f2ff7cab..09ec2bda98 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -75,6 +75,11 @@ if 'DATABASE_URL' in os.environ:
75 raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl) 75 raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl)
76 76
77 77
78if 'TOASTER_MANAGED' in os.environ and os.environ['TOASTER_MANAGED'] == "1":
79 MANAGED = True
80else:
81 MANAGED = False
82
78# Allows current database settings to be exported as a DATABASE_URL environment variable value 83# Allows current database settings to be exported as a DATABASE_URL environment variable value
79 84
80def getDATABASE_URL(): 85def getDATABASE_URL():
@@ -221,12 +226,11 @@ TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth',
221 'django.core.context_processors.static', 226 'django.core.context_processors.static',
222 'django.core.context_processors.tz', 227 'django.core.context_processors.tz',
223 'django.contrib.messages.context_processors.messages', 228 'django.contrib.messages.context_processors.messages',
224 "django.core.context_processors.request") 229 "django.core.context_processors.request",
230 'toastergui.views.managedcontextprocessor',
231 )
225 232
226INSTALLED_APPS = ( 233INSTALLED_APPS = (
227 #'django.contrib.auth',
228 #'django.contrib.contenttypes',
229 #'django.contrib.sessions',
230 #'django.contrib.sites', 234 #'django.contrib.sites',
231 #'django.contrib.messages', 235 #'django.contrib.messages',
232 'django.contrib.staticfiles', 236 'django.contrib.staticfiles',
@@ -243,6 +247,13 @@ INSTALLED_APPS = (
243 'bldcontrol', 247 'bldcontrol',
244) 248)
245 249
250# if we run in managed mode, we need user support
251if MANAGED:
252 INSTALLED_APPS = ('django.contrib.auth',
253 'django.contrib.contenttypes',
254 'django.contrib.sessions',) + INSTALLED_APPS
255
256
246# We automatically detect and install applications here if 257# We automatically detect and install applications here if
247# they have a 'models.py' or 'views.py' file 258# they have a 'models.py' or 'views.py' file
248import os 259import os