diff --git a/server/src/uds/REST/methods/services.py b/server/src/uds/REST/methods/services.py
index 8f69d078..bed631ef 100644
--- a/server/src/uds/REST/methods/services.py
+++ b/server/src/uds/REST/methods/services.py
@@ -61,7 +61,7 @@ class Services(DetailHandler):
} for k in parent.services.all() ]
else:
k = parent.services.get(pk=item)
- return {
+ val = {
'id':k.id,
'name': k.name,
'comments': k.comments,
@@ -69,7 +69,9 @@ class Services(DetailHandler):
'typeName' : _(k.getType().name()),
'deployed_services_count' : k.deployedServices.count(),
}
+ return self.fillIntanceFields(k, val)
except:
+ logger.exception('getItems')
return { 'error': 'not found' }
def saveItem(self, parent, item):
diff --git a/server/src/uds/REST/model.py b/server/src/uds/REST/model.py
index bc9b71ce..7d5ec428 100644
--- a/server/src/uds/REST/model.py
+++ b/server/src/uds/REST/model.py
@@ -121,6 +121,15 @@ class BaseModelHandler(Handler):
raise RequestError('needed parameter not found in data {0}'.format(unicode(e)))
return args
+
+ def fillIntanceFields(self, item, res):
+ if hasattr(item, 'getInstance'):
+ for key, value in item.getInstance().valuesDict().iteritems():
+ if type(value) in (unicode, str):
+ value = {"true":True, "false":False}.get(value, value) # Translate "true" & "false" to True & False (booleans)
+ logger.debug('{0} = {1}'.format(key, value))
+ res[key] = value
+ return res
# Exceptions
def invalidRequestException(self):
@@ -164,20 +173,22 @@ class DetailHandler(BaseModelHandler):
if nArgs == 1:
if self._args[0] == OVERVIEW:
return self.getItems(parent, None)
- elif self._args[0] == 'gui':
- return self.getGui(parent, None)
- elif self._args[0] == 'types':
+ elif self._args[0] == GUI:
+ gui = self.getGui(parent, None)
+ return sorted(gui, key=lambda f: f['gui']['order'])
+ elif self._args[0] == TYPES:
return self.getTypes(parent, None)
- elif self._args[0] == 'tableinfo':
+ elif self._args[0] == TABLEINFO:
return self.processTableFields(self.getTitle(parent), self.getFields(parent))
# try to get id
return self.getItems(parent, self._args[0])
if nArgs == 2:
- if self._args[0] == 'gui':
- return self.getGui(parent, self._args[1])
- elif self._args[0] == 'types':
+ if self._args[0] == GUI:
+ gui = self.getGui(parent, self._args[1])
+ return sorted(gui, key=lambda f: f['gui']['order'])
+ elif self._args[0] == TYPES:
return self.getTypes(parent, self._args[1])
return self.fallbackGet()
@@ -330,13 +341,6 @@ class ModelHandler(BaseModelHandler):
except:
logger.exception('Exception getting item from {0}'.format(self.model))
- def fillIntanceFields(self, item, res):
- if hasattr(item, 'getInstance'):
- for key, value in item.getInstance().valuesDict().iteritems():
- value = {"true":True, "false":False}.get(value, value)
- logger.debug('{0} = {1}'.format(key, value))
- res[key] = value
-
def get(self):
logger.debug('method GET for {0}, {1}'.format(self.__class__.__name__, self._args))
nArgs = len(self._args)
diff --git a/server/src/uds/static/adm/css/uds-admin.css b/server/src/uds/static/adm/css/uds-admin.css
index c3518459..7b912329 100644
--- a/server/src/uds/static/adm/css/uds-admin.css
+++ b/server/src/uds/static/adm/css/uds-admin.css
@@ -54,6 +54,10 @@ table.dataTable tr.even td.sorting_3 { background-color: blue; }*/
cursor: pointer;
}
+.cursor-pointer {
+ cursor: pointer !important;
+}
+
#minimized {
margin-top: 0.6em;
margin-bottom: 0.3em;
diff --git a/server/src/uds/static/adm/js/api-templates.js b/server/src/uds/static/adm/js/api-templates.js
index 742b9dbd..1e89378e 100644
--- a/server/src/uds/static/adm/js/api-templates.js
+++ b/server/src/uds/static/adm/js/api-templates.js
@@ -35,6 +35,22 @@
options.data['_counter_'+id] += 1;
});
+ // For inserting "inline" javascript scripts, due to the fact that we cannot
+ // Insert "" inside inline elements (they are already scripts)
+ Handlebars.registerHelper('javascript', function(options) {
+ return new Handlebars.SafeString('');
+ });
+
+ // Truncate chars, like django "truncatechars" filter
+ Handlebars.registerHelper('truncatechars', function(len, value) {
+ var val = value.toString(); // For Array objects, the toString method joins the array and returns one string containing each array element separated by commas
+ if(val.length > len) {
+ return val.substring(0, len-3) + "...";
+ } else {
+ return val;
+ }
+ });
+
api.templates = {};
// Now initialize templates api
api.templates.cache = new api.cache('tmpls'); // Will cache templates locally. If name contains
diff --git a/server/src/uds/templates/uds/admin/tmpl/fld/editlist.html b/server/src/uds/templates/uds/admin/tmpl/fld/editlist.html
index 302d4b3b..13c39c72 100644
--- a/server/src/uds/templates/uds/admin/tmpl/fld/editlist.html
+++ b/server/src/uds/templates/uds/admin/tmpl/fld/editlist.html
@@ -1,5 +1,29 @@
{% extends "uds/admin/tmpl/fld/form-group.html" %}
{% load i18n %}
-
+{% block field %}
+ {% verbatim %}{% endverbatim %}
{% verbatim %}
-{% endverbatim %}
\ No newline at end of file
+
+{% endverbatim %}{% comment %}{% endcomment %}
+
+{% endblock %}