1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

Added info to services

This commit is contained in:
Adolfo Gómez García 2016-04-19 11:17:34 +02:00
parent 425257a464
commit f7fa92e6c1
6 changed files with 43 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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"

View File

@ -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) ->

View File

@ -15,16 +15,23 @@
<div class="tab-pane fade" id="{{ id }}-pools_tab">
<div class="row">
<div class="col-xs-12">
<table id="{{ id }}-pools-table" style="width:100%;">
<table id="{{ id }}-pools-table" style="width:100%;" class="display">
<thead>
<tr>
<th>{% endverbatim %}{% trans 'Image' %}{% verbatim %}</th>
<th>{% endverbatim %}{% trans 'Pool' %}{% verbatim %}</th>
<th>{% endverbatim %}{% trans 'State' %}{% verbatim %}</th>
<th>{% endverbatim %}{% trans 'Image' %}{% verbatim %}</th>
<th>{% endverbatim %}{% trans 'User Services' %}{% verbatim %}</th>
</tr>
</thead>
<tbody>
{{#each pools }}
<tr><td><img src="data:image/png;base64,{{ thumb }}" style="width: 32px; height: auto;"/></td><td>{{ name }}</td></tr>
<tr>
<td>{{ name }}</td>
<td>{{ state }}</td>
<td><img src="data:image/png;base64,{{ thumb }}" style="width: 32px; height: auto;"/></td>
<td>{{ user_services_count }}</td>
</tr>
{{/each }}
</tbody>
</table>