renamed ServicesPoolGroup to ServicePoolGroup

This commit is contained in:
Adolfo Gómez García 2019-08-14 09:52:10 +02:00
parent bec85b5463
commit 217a51728e
9 changed files with 35 additions and 18 deletions

View File

@ -33,7 +33,7 @@
import logging
from django.utils.translation import ugettext, ugettext_lazy as _
from uds.models import MetaPool, Image, ServicesPoolGroup
from uds.models import MetaPool, Image, ServicePoolGroup
from uds.core.ui.images import DEFAULT_THUMB_BASE64
from uds.core.util.State import State
from uds.core.util.model import processUuid
@ -138,7 +138,7 @@ class MetaPools(ModelHandler):
'tab': ugettext('Display'),
}, {
'name': 'servicesPoolGroup_id',
'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicesPoolGroup.objects.all()]),
'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicePoolGroup.objects.all()]),
'label': ugettext('Pool group'),
'tooltip': ugettext('Pool group for this pool (for pool classify on display)'),
'type': gui.InputField.IMAGECHOICE_TYPE,
@ -177,7 +177,7 @@ class MetaPools(ModelHandler):
logger.debug('servicesPoolGroup_id: %s', spgrpId)
try:
if spgrpId != '-1':
spgrp = ServicesPoolGroup.objects.get(uuid=processUuid(spgrpId))
spgrp = ServicePoolGroup.objects.get(uuid=processUuid(spgrpId))
fields['servicesPoolGroup_id'] = spgrp.id
except Exception:
logger.exception('At service pool group recovering')

View File

@ -33,7 +33,7 @@
import logging
from django.utils.translation import ugettext_lazy as _, ugettext
from uds.models import ServicesPoolGroup, Image
from uds.models import ServicePoolGroup, Image
from uds.core.util.model import processUuid
from uds.core.ui.UserInterface import gui
from uds.core.ui.images import DEFAULT_THUMB_BASE64
@ -52,7 +52,7 @@ class ServicesPoolGroups(ModelHandler):
# needs_admin = True
path = 'gallery'
model = ServicesPoolGroup
model = ServicePoolGroup
save_fields = ['name', 'comments', 'image_id', 'priority']
table_title = _('Services Pool Groups')

View File

@ -33,7 +33,7 @@
import logging
from django.utils.translation import ugettext, ugettext_lazy as _
from uds.models import DeployedService, OSManager, Service, Image, ServicesPoolGroup, Account
from uds.models import DeployedService, OSManager, Service, Image, ServicePoolGroup, Account
from uds.models.calendar_action import (
CALENDAR_ACTION_INITIAL,
CALENDAR_ACTION_MAX,
@ -255,7 +255,7 @@ class ServicesPools(ModelHandler):
'tab': ugettext('Display'),
}, {
'name': 'servicesPoolGroup_id',
'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicesPoolGroup.objects.all()]),
'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicePoolGroup.objects.all()]),
'label': ugettext('Pool group'),
'tooltip': ugettext('Pool group for this pool (for pool classify on display)'),
'type': gui.InputField.IMAGECHOICE_TYPE,
@ -397,7 +397,7 @@ class ServicesPools(ModelHandler):
logger.debug('servicesPoolGroup_id: %s', spgrpId)
try:
if spgrpId != '-1':
spgrp = ServicesPoolGroup.objects.get(uuid=processUuid(spgrpId))
spgrp = ServicePoolGroup.objects.get(uuid=processUuid(spgrpId))
fields['servicesPoolGroup_id'] = spgrp.id
except Exception:
logger.exception('At service pool group recovering')

View File

@ -0,0 +1,17 @@
# Generated by Django 2.2.4 on 2019-08-14 09:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uds', '0032_auto_20190814_0945'),
]
operations = [
migrations.RenameModel(
old_name='ServicesPoolGroup',
new_name='ServicePoolGroup',
),
]

View File

@ -61,7 +61,7 @@ from .group import Group
from .service_pool import DeployedService # Old name, will continue here for a while already
from .service_pool import ServicePool # New name
from .meta_pool import MetaPool
from .ServicesPoolGroup import ServicesPoolGroup
from .service_pool_group import ServicePoolGroup
from .ServicesPoolPublication import ServicePoolPublication
from .user_service import UserService
from .user_service_property import UserServiceProperty

View File

@ -45,7 +45,7 @@ from uds.models.util import getSqlDatetime
from uds.core.util.calendar import CalendarChecker
from uds.models.image import Image
from uds.models.ServicesPoolGroup import ServicesPoolGroup
from uds.models.service_pool_group import ServicePoolGroup
from uds.models.service_pool import ServicePool
from uds.models.group import Group
from uds.models.calendar import Calendar
@ -77,7 +77,7 @@ class MetaPool(UUIDModel, TaggingMixin): # type: ignore
comments = models.CharField(max_length=256, default='')
visible = models.BooleanField(default=True)
image = models.ForeignKey(Image, null=True, blank=True, related_name='metaPools', on_delete=models.SET_NULL)
servicesPoolGroup = models.ForeignKey(ServicesPoolGroup, null=True, blank=True, related_name='metaPools', on_delete=models.SET_NULL)
servicesPoolGroup = models.ForeignKey(ServicePoolGroup, null=True, blank=True, related_name='metaPools', on_delete=models.SET_NULL)
assignedGroups = models.ManyToManyField(Group, related_name='metaPools', db_table='uds__meta_grps')
accessCalendars = models.ManyToManyField(Calendar, related_name='accessMeta', through='CalendarAccessMeta')

View File

@ -50,7 +50,7 @@ from uds.models.service import Service
from uds.models.transport import Transport
from uds.models.group import Group
from uds.models.image import Image
from uds.models.ServicesPoolGroup import ServicesPoolGroup
from uds.models.service_pool_group import ServicePoolGroup
from uds.models.calendar import Calendar
from uds.models.account import Account
@ -91,7 +91,7 @@ class ServicePool(UUIDModel, TaggingMixin): # type: ignore
image = models.ForeignKey(Image, null=True, blank=True, related_name='deployedServices', on_delete=models.SET_NULL)
servicesPoolGroup = models.ForeignKey(ServicesPoolGroup, null=True, blank=True, related_name='servicesPools', on_delete=models.SET_NULL)
servicesPoolGroup = models.ForeignKey(ServicePoolGroup, null=True, blank=True, related_name='servicesPools', on_delete=models.SET_NULL)
accessCalendars = models.ManyToManyField(Calendar, related_name='accessSP', through='CalendarAccess')
# Default fallback action for access

View File

@ -43,7 +43,7 @@ from uds.core.ui.images import DEFAULT_THUMB_BASE64
logger = logging.getLogger(__name__)
class ServicesPoolGroup(UUIDModel):
class ServicePoolGroup(UUIDModel):
"""
A deployed service is the Service produced element that is assigned finally to an user (i.e. a Virtual Machine, etc..)
"""
@ -79,4 +79,4 @@ class ServicesPoolGroup(UUIDModel):
@staticmethod
def default():
return ServicesPoolGroup(name=_('General'), comments='', priority=-10000)
return ServicePoolGroup(name=_('General'), comments='', priority=-10000)

View File

@ -35,7 +35,7 @@ from django.utils.translation import ugettext
from django.utils import formats
from django.urls.base import reverse
from uds.models import ServicePool, Transport, Network, ServicesPoolGroup, MetaPool
from uds.models import ServicePool, Transport, Network, ServicePoolGroup, MetaPool
from uds.core.util.Config import GlobalConfig
from uds.core.util import html
@ -113,7 +113,7 @@ def getServicesData(request: 'HttpRequest') -> typing.Dict[str, typing.Any]: #
# If no usable pools, this is not visible
if hasUsablePools:
group = meta.servicesPoolGroup.as_dict if meta.servicesPoolGroup else ServicesPoolGroup.default().as_dict
group = meta.servicesPoolGroup.as_dict if meta.servicesPoolGroup else ServicePoolGroup.default().as_dict
services.append({
'id': 'M' + meta.uuid,
@ -179,7 +179,7 @@ def getServicesData(request: 'HttpRequest') -> typing.Dict[str, typing.Any]: #
else:
in_use = ads.in_use
group = svr.servicesPoolGroup.as_dict if svr.servicesPoolGroup else ServicesPoolGroup.default().as_dict
group = svr.servicesPoolGroup.as_dict if svr.servicesPoolGroup else ServicePoolGroup.default().as_dict
tbr = svr.toBeReplaced(request.user)
if tbr: