All of lore.kernel.org
 help / color / mirror / Atom feed
From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci site/luci/Extensions/StorageReport. ...
Date: 9 Oct 2006 19:11:59 -0000	[thread overview]
Message-ID: <20061009191159.20970.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at sourceware.org	2006-10-09 19:11:59

Modified files:
	luci/site/luci/Extensions: StorageReport.py 
	luci/storage   : form-macros 

Log message:
	luci storage: hide submit/reset buttons if nothing to modify

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-macros.diff?cvsroot=cluster&r1=1.10&r2=1.11

--- conga/luci/site/luci/Extensions/StorageReport.py	2006/10/09 17:03:17	1.12
+++ conga/luci/site/luci/Extensions/StorageReport.py	2006/10/09 19:11:59	1.13
@@ -481,6 +481,8 @@
     if type == MAPPER_VG_TYPE:
         link_snapshots(mapper_ret)
     
+    mapper_ret['need_apply_button'] = mutable_props(mapper_ret['props'])
+    
     return mapper_ret
 
 
@@ -643,6 +645,8 @@
     
     mapper_ret['actions'] = []
     
+    mapper_ret['need_apply_button'] = True
+
     return mapper_ret
 
 
@@ -1523,6 +1527,16 @@
                     actions.append(action)
     data['actions'] = actions
     
+    need_apply_butt = mutable_props(data['props'])
+    if need_apply_butt == False:
+        if len(data['contents']) > 1:
+            need_apply_butt = True
+        elif len(data['contents']) == 1:
+            need_apply_butt = mutable_props(data['contents'][0]['props'])
+        else:
+            need_apply_butt = False
+    data['need_apply_button'] = need_apply_butt
+    
     return data
 
 
@@ -1621,6 +1635,14 @@
 
 
 
+def mutable_props(props):
+    for name in props:
+        type = props[name]['type']
+        if type == 'int' or type == 'text' or type == 'select':
+            return True
+    return False
+
+
 
 def get_content_data_internal(session, bd_xml):
     c_xml = None
--- conga/luci/storage/form-macros	2006/10/09 17:03:17	1.10
+++ conga/luci/storage/form-macros	2006/10/09 19:11:59	1.11
@@ -1580,27 +1580,34 @@
         </td>
         <td align="right"
             tal:define="validate_url  context/validate_html/absolute_url">
-         <input tal:attributes="type    string:button; 
-                                name    string:action_type; 
-                                value   string:Reset; 
-                                onclick python:'return reset_bd_form(this.form, \'' + select_content_id + '\', \'' + content_span_id + '\')'"
-                class="form_button"/>
-         <input tal:condition="bd_data/new" 
-                tal:define="prompt_msg  python:'Do you really want to create ' + bd_data['pretty_type'] + '?'" 
-                tal:attributes="id      apply_button_id;
-                                type    string:button; 
-                                name    string:action_type; 
-                                value   string:Create; 
-                                onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
-                class="form_button"/>
-         <input tal:condition="not: bd_data/new" 
-                tal:define="prompt_msg  python:'Do you really want to apply changes to ' + bd_data['pretty_type'] + ' \\\'' + bd_data['pretty_name'] + '\\\'?'" 
-                tal:attributes="id      apply_button_id; 
-                                type    string:button; 
-                                name    string:action_type; 
-                                value   string:Apply; 
-                                onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
-                class="form_button"/>
+         <span tal:omit-tag=""
+               tal:condition="not: bd_data/need_apply_button">
+          &nbsp;
+         </span>
+         <span tal:omit-tag="" 
+               tal:condition="bd_data/need_apply_button">
+          <input tal:attributes="type    string:button; 
+                                 name    string:action_type; 
+                                 value   string:Reset; 
+                                 onclick python:'return reset_bd_form(this.form, \'' + select_content_id + '\', \'' + content_span_id + '\')'"
+                 class="form_button"/>
+          <input tal:condition="bd_data/new" 
+                 tal:define="prompt_msg  python:'Do you really want to create ' + bd_data['pretty_type'] + '?'" 
+                 tal:attributes="id      apply_button_id;
+                                 type    string:button; 
+                                 name    string:action_type; 
+                                 value   string:Create; 
+                                 onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
+                 class="form_button"/>
+          <input tal:condition="not: bd_data/new" 
+                 tal:define="prompt_msg  python:'Do you really want to apply changes to ' + bd_data['pretty_type'] + ' \\\'' + bd_data['pretty_name'] + '\\\'?'" 
+                 tal:attributes="id      apply_button_id; 
+                                 type    string:button; 
+                                 name    string:action_type; 
+                                 value   string:Apply; 
+                                 onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + bd_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
+                 class="form_button"/>
+         </span>
         </td>
         </tr>
         </table>
@@ -1712,19 +1719,26 @@
           </span>
          </td>
          <td align="right">
-          <input type="button"
-                 name="action_type"
-                 value="Reset"
-                 onclick="return reset_form(this.form)"
-                 class="form_button"/>
-          <input tal:define="prompt_msg    python:'Do you really want to apply changes to ' + mapper['pretty_type'] + ' \\\'' + mapper['pretty_name'] + '\\\'?';
-                             validate_url  context/validate_html/absolute_url" 
-                 tal:attributes="id      apply_button_id; 
-                                 type    string:button; 
-                                 name    string:action_type; 
-                                 value   string:Apply; 
-                                 onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + mapper_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
-                 class="form_button"/>
+          <span tal:omit-tag=""
+                tal:condition="not: mapper/need_apply_button">
+           &nbsp;
+          </span>
+          <span tal:omit-tag=""
+                tal:condition="mapper/need_apply_button">
+           <input type="button"
+                  name="action_type"
+                  value="Reset"
+                  onclick="return reset_form(this.form)"
+                  class="form_button"/>
+           <input tal:define="prompt_msg    python:'Do you really want to apply changes to ' + mapper['pretty_type'] + ' \\\'' + mapper['pretty_name'] + '\\\'?';
+                              validate_url  context/validate_html/absolute_url" 
+                  tal:attributes="id      apply_button_id; 
+                                  type    string:button; 
+                                  name    string:action_type; 
+                                  value   string:Apply; 
+                                  onclick python:'return validate_and_submit_form(\'' + validate_url + '\', \'' + mapper_form_id + '\', \'' + apply_button_id + '\', \'' + prompt_msg + '\')'"
+                  class="form_button"/>
+          </span>
          </td>
         </tr>
        </table>



             reply	other threads:[~2006-10-09 19:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-09 19:11 kupcevic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-30 22:04 [Cluster-devel] conga/luci site/luci/Extensions/StorageReport. rmccabe
2006-10-16 15:30 kupcevic
2006-10-16  7:39 kupcevic
2006-10-15 22:34 kupcevic
2006-10-15  5:44 kupcevic
2006-10-15  5:09 kupcevic
2006-10-14 20:01 kupcevic
2006-10-09 17:03 kupcevic

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=20061009191159.20970.qmail@sourceware.org \
    --to=kupcevic@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.