From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/cluster resource-form-macros resour ...
Date: 22 Sep 2006 19:21:43 -0000 [thread overview]
Message-ID: <20060922192143.17289.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-22 19:21:42
Modified files:
luci/cluster : resource-form-macros resource_form_handlers.js
Log message:
fix for a javascript bug that shows up when inserting global resources into a service
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.9&r2=1.10
--- conga/luci/cluster/resource-form-macros 2006/09/22 18:21:59 1.13
+++ conga/luci/cluster/resource-form-macros 2006/09/22 19:21:41 1.14
@@ -153,11 +153,11 @@
<br/>
<form>
<input type="hidden" name="parent_uuid" value="" />
+ <input type="hidden" name="uuid" value="" />
<input type="hidden" name="tree_level" value="" />
- <select name="gres_chooser"
- onChange="swap_in_global_res('global_resources_block',
- this.options[this.selectedIndex].value,
- this.form.parentNode.parentNode, this.form);">
+ <select id="gres_chooser"
+ onChange="swap_in_global_res('global_resources_block', this,
+ this.form.parentNode, this.form);">
<option checked="checked">Select a resource name</option>
<tal:block
tal:repeat="gres global_resources">
--- conga/luci/cluster/resource_form_handlers.js 2006/09/22 18:21:59 1.9
+++ conga/luci/cluster/resource_form_handlers.js 2006/09/22 19:21:41 1.10
@@ -1,21 +1,18 @@
-function swap_in_global_res(container_id, res_id, replace, form) {
+function swap_in_global_res(container_id, sel, replace, form) {
+ sel.id = null;
var container = document.getElementById(container_id);
if (!container)
return (-1);
+ var res_id = sel.options[sel.selectedIndex].value;
var res = document.getElementById(res_id);
- if (!res)
+ if (!res || !replace)
return (-1);
- if (!replace)
- return (-1);
- var new_uuid = update_resource_form_uuid(res, form.parent_uuid.value, form.tree_level.value);
+ var new_uuid = update_resource_form_uuid(res, form.parent_uuid.value, form.tree_level.value, form.uuid.value);
res.id = new_uuid;
- if (form.gres_chooser && form.gres_chooser.options) {
- var o = form.gres_chooser.options;
- for (var i = 0 ; i < o.length ; i++) {
- if (o[i].value == res_id)
- o[i] = null;
- }
- }
+
+ var sopt = document.getElementById('gres_chooser');
+ if (sopt)
+ sopt.options[sel.selectedIndex].className = 'invisible';
return (replace.parentNode.replaceChild(res, replace));
}
@@ -211,14 +208,19 @@
}
}
-function update_resource_form_uuid(node, parent_uuid, indent_level) {
+function update_resource_form_uuid(node, parent_uuid, indent_level, uuid) {
var forms = node.getElementsByTagName('form');
for (var i = 0 ; i < forms.length ; i++)
forms.name = parent_uuid;
var ielem = node.getElementsByTagName('input');
if (!ielem)
return (null);
- var new_uuid = uuid_list.pop();
+
+ var new_uuid = null;
+ if (!uuid)
+ new_uuid = uuid_list.pop();
+ else
+ new_uuid = uuid;
var used_new_uuid = 0;
for (var i = 0 ; i < ielem.length ; i++) {
if (ielem[i].getAttribute('name') == 'tree_level')
@@ -235,7 +237,7 @@
}
}
- if (!used_new_uuid) {
+ if (!used_new_uuid && !uuid) {
uuid_list.push(new_uuid);
return (null);
}
@@ -276,7 +278,7 @@
node.id = null;
node.className = null;
- var new_uuid = update_resource_form_uuid(node, form.uuid.value, ilevel);
+ var new_uuid = update_resource_form_uuid(node, form.uuid.value, ilevel, null);
if (!new_uuid)
return (-1);
next reply other threads:[~2006-09-22 19:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-22 19:21 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-03-07 18:04 [Cluster-devel] conga/luci/cluster resource-form-macros resour rmccabe
2007-03-07 18:03 rmccabe
2007-03-07 18:02 rmccabe
2007-01-22 17:06 rmccabe
2007-01-17 20:50 rmccabe
2006-08-10 19:46 shuennek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060922192143.17289.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).