git://git.onelab.eu
/
unfold.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed naming for facility_name and testbed_name in QueryTable plugin
[unfold.git]
/
plugins
/
querytable
/
__init__.py
diff --git
a/plugins/querytable/__init__.py
b/plugins/querytable/__init__.py
index
2922906
..
995e935
100644
(file)
--- a/
plugins/querytable/__init__.py
+++ b/
plugins/querytable/__init__.py
@@
-33,6
+33,13
@@
Current implementation makes the following assumptions
as we use 'aoColumnDefs' instead.
"""
as we use 'aoColumnDefs' instead.
"""
+ MAP = {
+ 'facility_name' : 'Facility',
+ 'testbed_name' : 'Testbed',
+ 'hostname' : 'Resource name',
+ 'type' : 'Type',
+ }
+
def __init__ (self, query=None, query_all=None,
checkboxes=False, columns=None,
init_key=None,
def __init__ (self, query=None, query_all=None,
checkboxes=False, columns=None,
init_key=None,
@@
-43,20
+50,28
@@
Current implementation makes the following assumptions
self.query_all = query_all
self.query_all_uuid = query_all.query_uuid if query_all else None
self.checkboxes = checkboxes
self.query_all = query_all
self.query_all_uuid = query_all.query_uuid if query_all else None
self.checkboxes = checkboxes
+
# XXX We need to have some hidden columns until we properly handle dynamic queries
if columns is not None:
# XXX We need to have some hidden columns until we properly handle dynamic queries
if columns is not None:
-
self.columns=
columns
-
self.
hidden_columns = []
+
_columns =
columns
+
_
hidden_columns = []
elif self.query:
elif self.query:
- self.columns = self.query.fields
+ _columns = [field for field in self.query.fields if not field == 'urn']
if query_all:
# We need a list because sets are not JSON-serializable
if query_all:
# We need a list because sets are not JSON-serializable
- self.hidden_columns = list(self.query_all.fields - self.query.fields)
+ _hidden_columns = list(self.query_all.fields - self.query.fields)
+ _hidden_columns.append('urn')
else:
else:
-
self.
hidden_columns = []
+
_
hidden_columns = []
else:
else:
- self.columns = []
- self.hidden_columns = []
+ _columns = []
+ _hidden_columns = []
+
+ print "_columns=", _columns
+ self.columns = { self.MAP.get(c, c) : c for c in _columns }
+ self.hidden_columns = { self.MAP.get(c, c) : c for c in _hidden_columns }
+ print "self.columns", self.columns
+
self.init_key=init_key
self.datatables_options=datatables_options
# if checkboxes were required, we tell datatables about this column's type
self.init_key=init_key
self.datatables_options=datatables_options
# if checkboxes were required, we tell datatables about this column's type