From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci site/luci/Extensions/StorageReport. ...
Date: 16 Oct 2006 15:30:03 -0000 [thread overview]
Message-ID: <20061016153003.22152.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-10-16 15:30:02
Modified files:
luci/site/luci/Extensions: StorageReport.py
luci/storage : form-macros
Log message:
luci storage:
- order properties
- other minor GUI nits
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-macros.diff?cvsroot=cluster&r1=1.15&r2=1.16
--- conga/luci/site/luci/Extensions/StorageReport.py 2006/10/16 07:39:27 1.18
+++ conga/luci/site/luci/Extensions/StorageReport.py 2006/10/16 15:30:01 1.19
@@ -256,9 +256,10 @@
session.set(SESSION_STORAGE_XML_REPORT, {})
# return cached report if existing
if session[SESSION_STORAGE_XML_REPORT].has_key(storagename):
- if session[SESSION_STORAGE_XML_REPORT][storagename] != None:
+ tmp_report = session[SESSION_STORAGE_XML_REPORT][storagename]
+ if tmp_report != None:
print 'using cached storage_xml_report'
- return StorageReport(session[SESSION_STORAGE_XML_REPORT][storagename])
+ return StorageReport(tmp_report)
# retrieve storage report using ricci
@@ -460,6 +461,7 @@
mapper_ret['mapper_id'] = mapper_id
mapper_ret['mapper_type'] = type
mapper_ret['props'] = props
+ mapper_ret['props_ordered'] = get_ordered_props(props)
mapper_ret['targets'] = targets
mapper_ret['new_targets'] = new_targets
mapper_ret['sources'] = sources
@@ -655,6 +657,7 @@
mapper_ret['mapper_id'] = mapper_id
mapper_ret['mapper_type'] = type
mapper_ret['props'] = props
+ mapper_ret['props_ordered'] = get_ordered_props(props)
#mapper_ret['removable'] = removable
mapper_ret['targets'] = targets
mapper_ret['new_targets'] = new_targets
@@ -1550,6 +1553,7 @@
data['pretty_name'] = pretty_name
data['description'] = description
data['props'] = props
+ data['props_ordered'] = get_ordered_props(props)
data['path'] = path
data['mapper_type'] = mapper_type
data['mapper_id'] = mapper_id
@@ -1641,7 +1645,7 @@
d_value = value
validation_data['min_length'] = var.getAttribute('min_length')
validation_data['max_length'] = var.getAttribute('max_length')
- validation_data['illegal_chars'] = var.getAttribute('illegal_chars')
+ validation_data['illegal_chars'] = var.getAttribute('illegal_chars').replace('\'', '\\\'').replace('<', '<').replace('>', '>').replace('"', '\\\"').replace('&', '&')
validation_data['reserved_words'] = var.getAttribute('reserved_words')
elif type == VARIABLE_TYPE_INT_SEL or type == VARIABLE_TYPE_STRING_SEL:
d_type = 'select'
@@ -1668,30 +1672,81 @@
d_value += node.getAttribute('value') + ', '
if d_value != '':
d_value = d_value[:len(d_value)-2]
+ elif type == 'hidden':
+ d_type = 'hidden'
+ d_value = str(value)
else:
d_type = 'label'
d_value = value
- if not mutable and d_type != 'label':
+ if not mutable and d_type != 'label' and d_type != 'hidden':
d_type = 'label'
d_value = str(value)
pass
+ hidden = False
+ if type == 'hidden' or name in ['partition_begin', 'snapshot']:
+ hidden = True
+
if name == 'removable':
removable = value == 'true'
elif name == 'path':
pass
else:
- data[name] = {'type' : d_type,
- 'value' : d_value,
+ data[name] = {'name' : name,
'pretty_name' : get_pretty_prop_name(name),
+ 'type' : d_type,
+ 'value' : d_value,
'units' : d_units,
- 'validation' : validation_data}
+ 'validation' : validation_data,
+ 'hidden' : hidden}
pass
return (removable, data)
+def get_ordered_props(props):
+ names = []
+ sizes = []
+ mounts = []
+ min_max = []
+ uuids = []
+ rest = []
+ for prop_name in props:
+ prop = props[prop_name]
+ # names
+ if 'name' in prop_name or 'label' in prop_name or 'vendor' == prop_name or 'model' == prop_name:
+ names.append(prop)
+ # sizes
+ elif 'size' in prop_name or 'extents' in prop_name or 'percent' in prop_name:
+ sizes.append(prop)
+ # mounts
+ elif 'mount' in prop_name or 'fstab' in prop_name:
+ mounts.append(prop)
+ # min_max
+ elif 'min' in prop_name or 'max' in prop_name:
+ min_max.append(prop)
+ elif 'uuid' in prop_name:
+ uuids.append(prop)
+ else:
+ rest.append(prop)
+
+ ordered = []
+ for prop in names:
+ ordered.append(prop)
+ for prop in sizes:
+ ordered.append(prop)
+ for prop in mounts:
+ ordered.append(prop)
+ for prop in min_max:
+ ordered.append(prop)
+ for prop in rest:
+ ordered.append(prop)
+ for prop in uuids:
+ ordered.append(prop)
+ return ordered
+
+
def mutable_props(props):
for name in props:
@@ -1747,8 +1802,11 @@
old_props = d['props']
new_props = {}
for name in old_props:
- new_props['content_variable_' + d['id'] + '_' + name] = old_props[name]
+ new_name = 'content_variable_' + d['id'] + '_' + name
+ new_props[new_name] = old_props[name]
+ new_props[new_name]['name'] = new_name
d['props'] = new_props
+ d['props_ordered'] = get_ordered_props(new_props)
d['is_source'] = False
# content's color and icon
--- conga/luci/storage/form-macros 2006/10/16 07:39:27 1.15
+++ conga/luci/storage/form-macros 2006/10/16 15:30:02 1.16
@@ -370,7 +370,10 @@
</style>
</div>
<div tal:omit-tag="" metal:define-macro="li-collapse-handler">
- <a onClick="this.parentNode.className = (this.parentNode.className == 'opened') ? 'closed' : 'opened';"><img src="tree_transparent.gif"/></a>
+ <a onClick="this.parentNode.className = (this.parentNode.className == 'opened') ? 'closed' : 'opened';">
+ <img src="tree_transparent.gif"
+ style="cursor: pointer;"/>
+ </a>
</div>
@@ -766,7 +769,7 @@
<tr class="props-form-body">
<td>
<table class="props-inner-table"
- tal:define="props mapper/props">
+ tal:define="props mapper/props_ordered">
<div metal:use-macro="here/form-macros/macros/display-props-tableless"/>
</table>
</td>
@@ -990,12 +993,13 @@
<span tal:omit-tag=""
tal:define="predefines_test python:'display-props: ' + str(props) + prefix + properties_span_id"/>
<span tal:omit-tag=""
- tal:repeat="p props">
- <tr tal:define="prop python:props[p];
- prop_pr_name prop/pretty_name">
+ tal:repeat="prop props">
+ <tr tal:define="p prop/name;
+ prop_pr_name prop/pretty_name"
+ tal:condition="not: prop/hidden">
<td tal:content="prop_pr_name"/>
- <td tal:define="prop_type prop/type;
- prop_units prop/units">
+ <td tal:define="prop_type prop/type;
+ prop_units prop/units">
<table>
<tr>
<td>
@@ -1122,7 +1126,7 @@
<span tal:omit-tag=""
tal:define="predefines_test python:'display-content: ' + str(cont) + properties_span_id"/>
<span tal:omit-tag=""
- tal:define="props cont/props">
+ tal:define="props cont/props_ordered">
<table class="props-inner-table">
<div metal:use-macro="here/form-macros/macros/display-props-tableless"/>
</table>
@@ -1659,7 +1663,7 @@
<tr class="props-form-body">
<td>
<span tal:omit-tag=""
- tal:define="props bd_data/props">
+ tal:define="props bd_data/props_ordered">
<table class="props-inner-table">
<div metal:use-macro="here/form-macros/macros/display-props-tableless"/>
</table>
@@ -1882,7 +1886,7 @@
<tr class="props-form-body">
<td>
<table class="props-inner-table"
- tal:define="props mapper/props">
+ tal:define="props mapper/props_ordered">
<div metal:use-macro="here/form-macros/macros/display-props-tableless"/>
</table>
</td>
next reply other threads:[~2006-10-16 15:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-16 15:30 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 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 19:11 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=20061016153003.22152.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.