mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-03 01:17:56 +03:00
minor fixes for 2.2 version
This commit is contained in:
parent
2c10e9445b
commit
56553a70a1
@ -92,6 +92,10 @@ class ServicesPools(ModelHandler):
|
||||
|
||||
custom_methods = [('setFallbackAccess', True), ('actionsList', True)]
|
||||
|
||||
def getItems(self, *args, **kwargs):
|
||||
return super(ServicesPools, self).getItems(overview=kwargs.get('overview', True), prefetch=['service', 'service__provider', 'servicesPoolGroup', 'image', 'tags'])
|
||||
# return super(ServicesPools, self).getItems(overview)
|
||||
|
||||
def item_as_dict(self, item):
|
||||
summary = 'summarize' in self._params
|
||||
# if item does not have an associated service, hide it (the case, for example, for a removed service)
|
||||
|
@ -732,8 +732,28 @@ class ModelHandler(BaseModelHandler):
|
||||
|
||||
return method()
|
||||
|
||||
def getItems(self, overview=True, *args, **kwargs):
|
||||
for item in self.model.objects.filter(*args, **kwargs):
|
||||
def getItems(self, *args, **kwargs):
|
||||
if 'overview' in kwargs:
|
||||
overview = kwargs['overview']
|
||||
del kwargs['overview']
|
||||
else:
|
||||
overview = False
|
||||
|
||||
if 'prefetch' in kwargs:
|
||||
prefetch = kwargs['prefetch']
|
||||
logger.debug('Prefetching %s', prefetch)
|
||||
del kwargs['prefetch']
|
||||
else:
|
||||
prefetch = []
|
||||
|
||||
if 'query' in kwargs:
|
||||
query = kwargs['query']
|
||||
del kwargs['query']
|
||||
else:
|
||||
logger.debug('Args: %s, kwargs: %s', args, kwargs)
|
||||
query = self.model.objects.filter(*args, **kwargs).prefetch_related(*prefetch)
|
||||
|
||||
for item in query:
|
||||
try:
|
||||
if permissions.checkPermissions(self._user, item, permissions.PERMISSION_READ) is False:
|
||||
continue
|
||||
|
@ -115,7 +115,8 @@ class CalendarAction(UUIDModel):
|
||||
self.service_pool.save()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.next_execution = calendar.CalendarChecker(self.calendar).nextEvent(checkFrom=self.last_execution, startEvent=self.at_start, offset=self.offset)
|
||||
lastExecution = self.last_execution or getSqlDatetime()
|
||||
self.next_execution = calendar.CalendarChecker(self.calendar).nextEvent(checkFrom=lastExecution-self.offset, startEvent=self.at_start) + self.offset
|
||||
|
||||
return UUIDModel.save(self, *args, **kwargs)
|
||||
|
||||
|
@ -191,10 +191,17 @@ def index(request):
|
||||
else:
|
||||
tbrt = ''
|
||||
|
||||
left = ''
|
||||
# try:
|
||||
# if svr.max_srvs > 0:
|
||||
# left = ' (max {})'.format(svr.max_srvs - svr.assignedUserServices().filter(UserServiceManager.getStateFilter()).count())
|
||||
# except Exception:
|
||||
# logger.exception('Error')
|
||||
|
||||
services.append({
|
||||
'id': 'F' + svr.uuid,
|
||||
'name': svr.name,
|
||||
'visual_name': svr.visual_name,
|
||||
'name': svr.name + left,
|
||||
'visual_name': svr.visual_name + left,
|
||||
'description': svr.comments,
|
||||
'group': group,
|
||||
'transports': trans,
|
||||
|
Loading…
Reference in New Issue
Block a user