diff --git a/server/src/uds/REST/methods/services.py b/server/src/uds/REST/methods/services.py index b24563082..ac86c5c84 100644 --- a/server/src/uds/REST/methods/services.py +++ b/server/src/uds/REST/methods/services.py @@ -45,6 +45,7 @@ from uds.core.Environment import Environment from uds.REST.model import DetailHandler from uds.REST import NotFound, ResponseError, RequestError from django.db import IntegrityError +from uds.core.ui.images import DEFAULT_THUMB_BASE64 import logging @@ -231,6 +232,7 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods self.invalidItemException() def servicesPools(self, parent, item): + self.ensureAccess(item, permissions.PERMISSION_READ) logger.debug('Got parameters for servicepools: {}, {}'.format(parent, item)) uuid = processUuid(item) service = parent.services.get(uuid=uuid) @@ -240,6 +242,8 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods 'id': i.uuid, 'name': i.name, 'thumb': i.image.thumb64 if i.image is not None else DEFAULT_THUMB_BASE64, + 'user_services_count': i.userServices.count(), + 'state': _('With errors') if i.isRestrained() else _('Ok'), }) return res diff --git a/server/src/uds/REST/methods/services_pool_calendars.py b/server/src/uds/REST/methods/services_pool_calendars.py index 890372101..e044137a3 100644 --- a/server/src/uds/REST/methods/services_pool_calendars.py +++ b/server/src/uds/REST/methods/services_pool_calendars.py @@ -192,6 +192,7 @@ class ActionsCalendars(DetailHandler): CalendarAction.objects.get(uuid=processUuid(self._args[0])).delete() def execute(self, parent, item): + self.ensureAccess(item, permissions.PERMISSION_MANAGEMENT) logger.debug('Launching action') uuid = processUuid(item) calAction = CalendarAction.objects.get(uuid=uuid) diff --git a/server/src/uds/REST/methods/services_pools.py b/server/src/uds/REST/methods/services_pools.py index fe12887f4..28d1c7bb8 100644 --- a/server/src/uds/REST/methods/services_pools.py +++ b/server/src/uds/REST/methods/services_pools.py @@ -282,6 +282,8 @@ class ServicesPools(ModelHandler): # Set fallback status def setFallbackAccess(self, item): + self.ensureAccess(item, permissions.PERMISSION_MANAGEMENT) + fallback = self._params.get('fallbackAccess') logger.debug('Setting fallback of {} to {}'.format(item.name, fallback)) item.fallbackAccess = fallback diff --git a/server/src/uds/locale/pt/LC_MESSAGES/djangojs.po b/server/src/uds/locale/pt/LC_MESSAGES/djangojs.po index 32dad8fef..6385ced7a 100644 --- a/server/src/uds/locale/pt/LC_MESSAGES/djangojs.po +++ b/server/src/uds/locale/pt/LC_MESSAGES/djangojs.po @@ -938,7 +938,7 @@ msgstr "Filtro" #: static/tmp_js/gui.js:36 #, javascript-format msgid "Selected %d rows" -msgstr "%D selecionado linhas" +msgstr "%d selecionado linhas" #: static/tmp_js/gui.js:37 msgid "Click on a row to select it" diff --git a/server/src/uds/static/adm/js/gui-d-services.coffee b/server/src/uds/static/adm/js/gui-d-services.coffee index 9eaa6e901..67a263f4d 100644 --- a/server/src/uds/static/adm/js/gui-d-services.coffee +++ b/server/src/uds/static/adm/js/gui-d-services.coffee @@ -119,7 +119,7 @@ gui.providers.link = (event) -> pools: pools ) modalId = gui.launchModal(gettext('Service information'), content, - actionButton: "" + actionButton: " " ) gui.methods.typedShow services, val, '#information-overview', gettext('Error accessing data') tmpLogTable = services.logTable(val.id, @@ -127,7 +127,30 @@ gui.providers.link = (event) -> onLoad: -> return ) - $('#information-pools-table').DataTable(); + $('#information-pools-table').DataTable( + colReorder: true + stateSave: true + paging: true + info: true + autoWidth: false + lengthChange: false + pageLength: 10 + + columnDefs: [ + { 'width': '50%', 'targets': 0 }, + { 'width': '120px', 'targets': 1 }, + { 'width': '40px', 'targets': 2 }, + { 'width': '160px', 'targets': 3 }, + ] + + ordering: true + order: [[ 1, 'asc' ]] + + dom: '<>fr<"uds-table"t>ip' + + language: gui.config.dataTablesLanguage + ) + return select: (vals, value, btn, tbl, refreshFnc) -> diff --git a/server/src/uds/templates/uds/admin/tmpl/service-info.html b/server/src/uds/templates/uds/admin/tmpl/service-info.html index d75a5bf07..7b94ba7cf 100644 --- a/server/src/uds/templates/uds/admin/tmpl/service-info.html +++ b/server/src/uds/templates/uds/admin/tmpl/service-info.html @@ -15,16 +15,23 @@
- +
- + + + {{#each pools }} - + + + + + + {{/each }}
{% endverbatim %}{% trans 'Image' %}{% verbatim %} {% endverbatim %}{% trans 'Pool' %}{% verbatim %}{% endverbatim %}{% trans 'State' %}{% verbatim %}{% endverbatim %}{% trans 'Image' %}{% verbatim %}{% endverbatim %}{% trans 'User Services' %}{% verbatim %}
{{ name }}
{{ name }}{{ state }}{{ user_services_count }}