From mboxrd@z Thu Jan 1 00:00:00 1970
From: rmccabe@sourceware.org
Date: 14 Sep 2006 21:24:25 -0000
Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
Message-ID: <20060914212425.1437.qmail@sourceware.org>
List-Id:
To: cluster-devel.redhat.com
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-14 21:24:25
Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
luci/homebase : homebase_common.js
luci/site/luci/Extensions: cluster_adapters.py
Log message:
the end of the service/resource frontend nastiness. i hope.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.64&r2=1.65
--- conga/luci/cluster/form-macros 2006/09/13 17:50:22 1.59
+++ conga/luci/cluster/form-macros 2006/09/14 21:24:24 1.60
@@ -1148,15 +1148,9 @@
-
-
- Hide Children
-
- Service Composition
+ Service Composition
@@ -1205,19 +1199,13 @@
-
-
- Hide Children
-
-
+
--- conga/luci/cluster/resource-form-macros 2006/09/13 17:50:22 1.10
+++ conga/luci/cluster/resource-form-macros 2006/09/14 21:24:24 1.11
@@ -4,6 +4,35 @@
+
Resources for
@@ -64,30 +93,27 @@
@@ -231,9 +256,12 @@
IP Address Resource Configuration
-
@@ -320,7 +336,11 @@
File System Resource Configuration
-
@@ -467,7 +476,11 @@
GFS Resource Configuration
-
@@ -584,7 +585,11 @@
NFS Mount Resource Configuration
-
@@ -710,7 +703,11 @@
NFS Client Resource Configuration
-
@@ -794,7 +779,11 @@
NFS Export Resource Configuration
-
@@ -863,7 +840,11 @@
Script Resource Configuration
-
@@ -944,7 +913,11 @@
Samba Server Configuration
-
--- conga/luci/cluster/resource_form_handlers.js 2006/09/13 17:50:22 1.7
+++ conga/luci/cluster/resource_form_handlers.js 2006/09/14 21:24:24 1.8
@@ -1,30 +1,64 @@
-function swap_div_elem(container, swap_out_cname, swap_in_cname, swap_in_name) {
- var divs = container.getElementsByTagName('div');
- if (!divs)
+function collapse_div(image) {
+ var span = null;
+ var pdiv = image.parentNode;
+ var spanc = pdiv.getElementsByTagName('span');
+ for (var i = 0 ; i < spanc.length ; i++) {
+ if (spanc[i].className.match(/expander/)) {
+ span = spanc[i];
+ break;
+ }
+ }
+ if (!span)
return (-1);
- var swap_out_cont = null;
- var swap_in_cont = null;
+ var div = pdiv.parentNode.parentNode;
+ while (div) {
+ if (div.tagName && div.tagName.match(/^DIV$/i) &&
+ div.className.match(/service_comp/))
+ {
+ break;
+ }
+ if (!div.nextSibling)
+ div = div.parentNode;
+ else
+ div = div.nextSibling;
+ }
+ if (!div)
+ return (-1);
+
+ var dclass = 'invisible expander service_comp';
+ if (div.className.match(/invisible/))
+ dclass = 'expander service_comp';
+ while (div) {
+ div.className = dclass;
+ div = div.nextSibling;
+ }
+
+ if (image.name == 'arrow_down') {
+ image.src = 'arrow_right.png';
+ image.name = 'arrow_right';
+ image.alt = '[-]';
+ span.innerHTML = 'Show Children';
+ } else {
+ image.src = 'arrow_down.png';
+ image.name = 'arrow_down';
+ image.alt = '[+]';
+ span.innerHTML = 'Hide Children';
+ }
+}
+
+function swap_div_elem(container, swap_in_name) {
var swap_in_elem = null;
- var i = 0;
- while ((!swap_out_cont || !swap_in_cont || !swap_in_elem) && i < divs.length)
- {
- if (!swap_in_cont && divs[i].getAttribute('name') == swap_in_cname)
- swap_in_cont = divs[i];
- else if (!swap_out_cont && divs[i].getAttribute('name') == swap_out_cname)
- swap_out_cont = divs[i];
- else if (!swap_in_elem && divs[i].getAttribute('name') == swap_in_name)
+ var divs = container.getElementsByTagName('div');
+
+ for (var i = 0 ; i < divs.length ; i++) {
+ if (!swap_in_elem && divs[i].getAttribute('name') == swap_in_name)
swap_in_elem = divs[i];
- i++;
}
-
- if (!swap_out_cont || !swap_in_cont || !swap_in_elem)
+ if (!swap_in_elem)
return (-1);
- if (swap_in_cont.id)
- swap_in_elem.id = swap_in_cont.id;
- var temp = swap_in_cont.parentNode.replaceChild(swap_in_elem, swap_in_cont);
- swap_out_cont.appendChild(temp);
+ container.parentNode.replaceChild(swap_in_elem, container);
}
function validate_ip(form) {
@@ -143,7 +177,16 @@
function delete_resource(form) {
if (!confirm('Are you sure you want to delete this resource?'))
return (-1);
- form.submit();
+ var div = document.getElementById(form.uuid.value);
+ if (!div)
+ return (-1);
+ var pdiv = document.getElementById(form.parent_uuid.value);
+ div.parentNode.removeChild(div);
+ var pelem = pdiv.getElementsByTagName('p');
+ for (var i = 0 ; i < pelem.length ; i++) {
+ if (pelem[i].className.match(/expander/))
+ pelem[i].className += ' invisible';
+ }
}
function add_child_resource(form) {
@@ -155,12 +198,12 @@
var ilevel = Number(form.tree_level.value) + 1;
var sdiv = document.getElementById('resskel');
- if (!sdiv)
+ if (!sdiv) {
return (-1);
+ }
var pdiv = document.getElementById(form.uuid.value);
if (!pdiv) {
- alert('failed to find ' + form.uuid.value);
return (-1);
}
@@ -179,8 +222,13 @@
node.id = null;
node.className = null;
ielem = node.getElementsByTagName('input');
- if (!ielem)
+ if (!ielem) {
return (-1);
+ }
+
+ forms = node.getElementsByTagName('form');
+ for (var i = 0 ; i < forms.length ; i++)
+ forms.name = form.uuid.value;
var new_uuid = uuid_list.pop();
for (var i = 0 ; i < ielem.length ; i++) {
@@ -198,7 +246,11 @@
}
if (!child_div) {
- /* enable parent collapse */
+ var pelem = pdiv.getElementsByTagName('p');
+ for (var i = 0 ; i < pelem.length ; i++) {
+ if (pelem[i].className.match(/expander/))
+ pelem[i].className = pelem[i].className.replace(/invisible/,'');
+ }
child_div = document.createElement('div');
} else {
wrap_div = document.createElement('div');
@@ -211,3 +263,29 @@
child_div.appendChild(node);
pdiv.appendChild(child_div);
}
+
+function forms_to_xml() {
+ var form = document.getElementsByTagName('form');
+ var master_form = null;
+ var form_xml = '';
+
+ for (var i = 0 ; i < form.length ; i++) {
+ if (form[i].name == 'master') {
+ master_form = form[i];
+ continue;
+ } else if (!form[i].uuid || !form[i].uuid.value)
+ continue;
+ var temp = form[i].innerHTML.match(/]+>/ig).toString().replace(/>(,|$)/g, '/>');
+ if (!temp)
+ continue;
+ form_xml += '';
+ }
+
+ if (!master_form || !form_xml)
+ return (-1);
+
+ /* sort this out in the backend */
+ master_form.form_xml.value = form_xml;
+ master_form.submit();
+}
--- conga/luci/homebase/homebase_common.js 2006/09/13 17:50:22 1.9
+++ conga/luci/homebase/homebase_common.js 2006/09/14 21:24:25 1.10
@@ -1,45 +1,3 @@
-function collapse_div(image) {
- if (!image)
- return (-1);
-
- var span = null;
- var pdiv = image.parentNode;
- var spanc = pdiv.getElementsByTagName('span');
- if (!spanc)
- return (-1);
- for (var i = 0 ; i < spanc.length ; i++) {
- if (spanc[i].className.match(/expander/)) {
- span = spanc[i];
- break;
- }
- }
- if (!span)
- return (-1);
-
- var div = image.parentNode.parentNode.nextSibling;
- while (div) {
- if (div.tagName && div.tagName.match(/^DIV$/i) && div.className.match(/expander/))
- break;
- div = div.nextSibling;
- }
- if (!div)
- return (-1);
-
- if (image.name == 'arrow_down') {
- image.src = 'arrow_right.png';
- image.name = 'arrow_right';
- image.alt = '[-]';
- span.innerHTML = 'Show Children';
- div.className = 'invisible expander service_comp';
- } else {
- image.src = 'arrow_down.png';
- image.name = 'arrow_down';
- image.alt = '[+]';
- span.innerHTML = 'Hide Children';
- div.className = 'expander service_comp';
- }
-}
-
function is_valid_int(str, min, max) {
if (str.match(/[^0-9 -]/))
return (0);
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/09/13 17:50:22 1.64
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/09/14 21:24:25 1.65
@@ -966,7 +966,7 @@
if svc != None:
indent_ctr = 0
children = svc.getChildren()
- root_uuid = make_uuid('resource')
+ root_uuid = 'toplevel';
for child in children:
recurse_resources(root_uuid, child, resource_list, indent_ctr)