forked from shaba/openuds
Added {use} macro to Short name, so the % of pool use could be shown on pool name
This commit is contained in:
parent
a3c31bcfb7
commit
9a9afae79a
@ -148,7 +148,7 @@ class BaseModelHandler(Handler):
|
||||
'label': _('Short name'),
|
||||
'tooltip': _('Short name for user service visualization'),
|
||||
'required': False,
|
||||
'length': 16,
|
||||
'length': 18,
|
||||
'order': 0 - 95,
|
||||
})
|
||||
if 'comments' in flds:
|
||||
|
@ -451,6 +451,7 @@ class ServicePool(UUIDModel, TaggingMixin): # type: ignore
|
||||
visible=True
|
||||
)
|
||||
.annotate(pubs_active=models.Count('publications', filter=models.Q(publications__state=states.publication.USABLE)))
|
||||
.annotate(usage_count=models.Count('userServices', filter=models.Q(userServices__state__in=states.userService.VALID_STATES, userServices__cache_level=0)))
|
||||
.prefetch_related(
|
||||
'transports',
|
||||
'transports__networks',
|
||||
|
@ -92,6 +92,6 @@
|
||||
</svg>
|
||||
</div>
|
||||
</uds-root>
|
||||
<script src="/uds/res/admin/runtime.js?stamp=1596078766" defer></script><script src="/uds/res/admin/polyfills-es5.js?stamp=1596078766" nomodule defer></script><script src="/uds/res/admin/polyfills.js?stamp=1596078766" defer></script><script src="/uds/res/admin/main.js?stamp=1596078766" defer></script></body>
|
||||
<script src="/uds/res/admin/runtime.js?stamp=1596631243" defer></script><script src="/uds/res/admin/polyfills-es5.js?stamp=1596631243" nomodule defer></script><script src="/uds/res/admin/polyfills.js?stamp=1596631243" defer></script><script src="/uds/res/admin/main.js?stamp=1596631243" defer></script></body>
|
||||
|
||||
</html>
|
||||
|
@ -151,6 +151,8 @@ def getServicesData(request: 'HttpRequest') -> typing.Dict[str, typing.Any]: #
|
||||
if svr.is_meta:
|
||||
continue
|
||||
|
||||
use = str(svr.usage(svr.usage_count)) + '%'
|
||||
|
||||
trans = []
|
||||
for t in sorted(svr.transports.all(), key=lambda x: x.priority): # In memory sort, allows reuse prefetched and not too big array
|
||||
typeTrans = t.getType()
|
||||
@ -200,7 +202,7 @@ def getServicesData(request: 'HttpRequest') -> typing.Dict[str, typing.Any]: #
|
||||
services.append({
|
||||
'id': 'F' + svr.uuid,
|
||||
'name': svr.name,
|
||||
'visual_name': svr.visual_name,
|
||||
'visual_name': svr.visual_name.replace('{use}', use),
|
||||
'description': svr.comments,
|
||||
'group': group,
|
||||
'transports': trans,
|
||||
|
Loading…
Reference in New Issue
Block a user