Skip to contentSkip to conversation

conga/luci site/luci/Extensions/StorageReport. ...

Cluster-devel [email protected] 1 participant 1 message Oct 9, 2006

lore
Share & tools
lore
#0 lore 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

luci/site/luci/Extensions/StorageReport.py +22 -0
@@ -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
luci/storage/form-macros +48 -34

94 lines not on this page · raw message