commit 54ceddfeb08e6246eac7b260cc5964685123c8a6
Author: Chris Feist <cfeist(a)redhat.com>
Date: Thu Sep 17 17:29:08 2009 -0500
- Added support for the "Create a New Cluster"
- Submit buttons now don't cause a Turbogears Error
- Dynamic forms now work when adding more than one hostname
luci/controllers/root.py | 12 ++++++++----
luci/templates/.cluster.html.swp | Bin 0 -> 12288 bytes
luci/templates/.homebase.html.swp | Bin 0 -> 12288 bytes
luci/templates/cluster.html | 12 ++++++++++--
luci/templates/homebase.html | 28 +++++++++++++++++++++++++++-
luci/templates/master.html | 3 +--
luci/widgets/add_existing_form.py | 1 -
luci/widgets/add_system_form.py | 9 +++++----
luci/widgets/create_cluster_form.py | 21 +++++++++++++++++++++
luci/widgets/manage_systems_form.py | 11 +++++------
10 files changed, 77 insertions(+), 20 deletions(-)
---
diff --git a/luci/controllers/root.py b/luci/controllers/root.py
index 74c1123..fd6ee74 100644
--- a/luci/controllers/root.py
+++ b/luci/controllers/root.py
@@ -27,6 +27,7 @@ from luci.widgets.add_system_form import create_add_system_form
from luci.widgets.add_existing_form import create_add_existing_form
from luci.widgets.add_user_form import create_add_user_form
from luci.widgets.manage_systems_form import create_manage_systems_form
+from luci.widgets.create_cluster_form import create_cluster_form
__all__ = ['RootController']
@@ -72,7 +73,7 @@ class RootController(BaseController):
return dict(page='about')
@expose('luci.templates.homebase')
- def homebase(self, homebasepage='homebasepage'):
+ def homebase(self, homebasepage='homebasepage', **args):
if homebasepage == 'addsystem':
tmpl_context.form = create_add_system_form
elif homebasepage == 'addexisting':
@@ -82,11 +83,14 @@ class RootController(BaseController):
elif homebasepage == 'managesystems':
tmpl_context.form = create_manage_systems_form
- return dict(page='homebase',homebasepage=homebasepage)
+ return dict(page='homebase',homebasepage=homebasepage,args=args)
@expose('luci.templates.cluster')
- def cluster(self,clusterpage='clusterlist'):
- return dict(page='cluster', clusterpage=clusterpage)
+ def cluster(self,clusterpage='clusterlist', **args):
+ if clusterpage == 'createcluster':
+ tmpl_context.form = create_cluster_form
+
+ return dict(page='cluster', clusterpage=clusterpage)
@expose('luci.templates.storage')
def storage(self,storagepage='systemlist'):
diff --git a/luci/templates/.cluster.html.swp b/luci/templates/.cluster.html.swp
new file mode 100644
index 0000000..7aa344c
Binary files /dev/null and b/luci/templates/.cluster.html.swp differ
diff --git a/luci/templates/.homebase.html.swp b/luci/templates/.homebase.html.swp
new file mode 100644
index 0000000..07639ee
Binary files /dev/null and b/luci/templates/.homebase.html.swp differ
diff --git a/luci/templates/cluster.html b/luci/templates/cluster.html
index f99825f..3236ac3 100644
--- a/luci/templates/cluster.html
+++ b/luci/templates/cluster.html
@@ -23,8 +23,16 @@
</td>
<td valign="top">
<div class="mainpage">
- <b>Cluster</b><br/>
- ${clusterpage}
+ <div py:if="clusterpage == 'clusterlist'">
+ <h3>Choose a cluster to administer</h3>
+ <hr/>
+ </div>
+ <div py:if="clusterpage == 'createcluster'">
+ <div py:replace="tmpl_context.form()">Input Form</div>
+ </div>
+ <div py:if="clusterpage == 'configure'">
+ <h3>Choose a cluster to administer</h3>
+ </div>
</div>
</td>
</tr>
diff --git a/luci/templates/homebase.html b/luci/templates/homebase.html
index c6e9391..4d599b1 100644
--- a/luci/templates/homebase.html
+++ b/luci/templates/homebase.html
@@ -24,7 +24,33 @@
</td>
<td valign="top">
<div class="mainpage">
- <div py:if="homebasepage != 'homebasepage'">
+ <div py:if="homebasepage == 'managesystems'">
+ <h3>Manage Systems and Clusters</h3>
+ <hr/>
+ <fieldset><legend>Reauthenticate</legend>
+ <h3>Reauthenticate to Storage or Cluster Systems</h3><br/>
+ <div py:replace="tmpl_context.form()">Input Form</div>
+ </fieldset>
+ <fieldset><legend>Remove clusters and systems</legend>
+ <h3>Check storage systems and clusters to remove from the Luci management
interface.</h3>
+ <h3>Clusters</h3>
+ <h3>Storage Systems</h3>
+ </fieldset>
+ </div>
+ <div py:if="homebasepage == 'addsystem'">
+ <h3>Add a System</h3>
+ <hr/>
+ <div py:replace="tmpl_context.form()">Input Form</div>
+ </div>
+ <div py:if="homebasepage == 'addexisting'">
+ <h3>Add an Existing Cluster</h3>
+ <hr/>
+ <p>Enter one node from the cluster you wish to add to the Luci management
interface.</p>
+ <div py:replace="tmpl_context.form()">Input Form</div>
+ </div>
+ <div py:if="homebasepage == 'adduser'">
+ <h3>Add a User</h3>
+ <hr/>
<div py:replace="tmpl_context.form()">Input Form</div>
</div>
<div py:if="homebasepage == 'homebasepage'">
diff --git a/luci/templates/master.html b/luci/templates/master.html
index 95520a5..aeba83d 100644
--- a/luci/templates/master.html
+++ b/luci/templates/master.html
@@ -34,8 +34,7 @@
<div id="content">
<py:if test="defined('page')">
<div class="currentpage">
- Now Viewing: <span py:replace="page"/>
- </div>
+ </div>
</py:if>
<py:with vars="flash=tg.flash_obj.render('flash',
use_js=False)">
<div py:if="flash" py:content="XML(flash)" />
diff --git a/luci/widgets/add_existing_form.py b/luci/widgets/add_existing_form.py
index a7f4974..1ade914 100644
--- a/luci/widgets/add_existing_form.py
+++ b/luci/widgets/add_existing_form.py
@@ -3,7 +3,6 @@ from tw.forms import TableForm, TextField, Label
class AddExistingForm(TableForm):
class fields(WidgetsList):
- mylabel = Label(text = 'Enter one node from the cluster you wish to add the Luci
management interface.')
system_hostname = TextField()
root_password = TextField()
diff --git a/luci/widgets/add_system_form.py b/luci/widgets/add_system_form.py
index f1dffdc..8a0454c 100644
--- a/luci/widgets/add_system_form.py
+++ b/luci/widgets/add_system_form.py
@@ -1,10 +1,11 @@
from tw.api import WidgetsList
-from tw.forms import TableForm, TextField
+from tw.forms import TableForm, TextField, PasswordField
+import tw.dynforms as twd
-class AddSystemForm(TableForm):
- class fields(WidgetsList):
+class AddSystemForm(twd.GrowingTableForm):
+ class children(WidgetsList):
system_hostname = TextField()
- root_password = TextField()
+ root_password = PasswordField()
create_add_system_form = AddSystemForm("create_add_system_form")
diff --git a/luci/widgets/create_cluster_form.py b/luci/widgets/create_cluster_form.py
new file mode 100644
index 0000000..d17cd27
--- /dev/null
+++ b/luci/widgets/create_cluster_form.py
@@ -0,0 +1,21 @@
+from tw.api import WidgetsList
+from tw.forms import TableForm, TextField, PasswordField, RadioButtonList, RadioButton,
CheckBox, CheckBoxTable
+import tw.dynforms as twd
+
+class HostList(twd.GrowingTableFieldSet):
+ class children(WidgetsList):
+ node_hostname = TextField()
+ root_password = PasswordField()
+
+class CreateClusterForm(TableForm):
+ class fields(WidgetsList):
+ cluster_name = TextField()
+ host_list = HostList(suppress_label = True)
+ download_packages = RadioButtonList(options=["Download Packages","Use
locally installed packages"], suppress_label = True, default = "Download
Packages");
+# use_locally_installed_packages = RadioButton();
+ cb = CheckBoxTable(options=["Enable Shared Storage Support", "Reboot
nodes before joining cluster", "Check if node passwords are identical"],
suppress_label = True, default = "Enable Shared Storage Support")
+# enable_shared_storage_support = CheckBox()
+# reboot_nodes_before_joining_cluster = CheckBox()
+# check_if_node_passwords_are_identical = CheckBox()
+create_cluster_form = CreateClusterForm("create_cluster_form")
+
diff --git a/luci/widgets/manage_systems_form.py b/luci/widgets/manage_systems_form.py
index b713d99..9c22b0b 100644
--- a/luci/widgets/manage_systems_form.py
+++ b/luci/widgets/manage_systems_form.py
@@ -1,12 +1,11 @@
from tw.api import WidgetsList
-from tw.forms import TableForm, TextField, Label
+from tw.forms import TableForm, TextField, Label, PasswordField
+import tw.dynforms as twd
-class ManageSystemsForm(TableForm):
- class fields(WidgetsList):
-
- mylabel = Label(text='Reauthenticate to Storage or Cluster Systems')
+class ManageSystemsForm(twd.GrowingTableForm):
+ class children(WidgetsList):
system_hostname = TextField()
- root_password = TextField()
+ root_password = PasswordField()
create_manage_systems_form = ManageSystemsForm("create_manage_systems_form")