diff --git a/server/src/uds/migrations/0020_auto_20160212_0925.py b/server/src/uds/migrations/0020_auto_20160216_0509.py similarity index 85% rename from server/src/uds/migrations/0020_auto_20160212_0925.py rename to server/src/uds/migrations/0020_auto_20160216_0509.py index aa007c95b..8536ae1fd 100644 --- a/server/src/uds/migrations/0020_auto_20160212_0925.py +++ b/server/src/uds/migrations/0020_auto_20160216_0509.py @@ -17,10 +17,10 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('uuid', models.CharField(default=None, max_length=50, unique=True, null=True)), - ('name', models.CharField(default='', max_length=128)), + ('name', models.CharField(default='', unique=True, max_length=128, db_index=True)), ('comments', models.CharField(default='', max_length=256)), ('priority', models.IntegerField(default=0, db_index=True)), - ('image', models.ForeignKey(related_name='servicesPoolsGrou', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='uds.Image', null=True)), + ('image', models.ForeignKey(related_name='servicesPoolsGroup', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='uds.Image', null=True)), ], options={ 'abstract': False, diff --git a/server/src/uds/models/ServicesPoolGroup.py b/server/src/uds/models/ServicesPoolGroup.py index 1810f776e..023553666 100644 --- a/server/src/uds/models/ServicesPoolGroup.py +++ b/server/src/uds/models/ServicesPoolGroup.py @@ -34,7 +34,8 @@ from __future__ import unicode_literals from django.db import models -from django.db.models import signals +from django.utils.translation import ugettext as _ + from django.utils.encoding import python_2_unicode_compatible from uds.models.UUIDModel import UUIDModel @@ -42,7 +43,7 @@ from uds.models.Image import Image import logging -__updated__ = '2016-02-15' +__updated__ = '2016-02-16' logger = logging.getLogger(__name__) @@ -54,7 +55,7 @@ class ServicesPoolGroup(UUIDModel): A deployed service is the Service produced element that is assigned finally to an user (i.e. a Virtual Machine, etc..) ''' # pylint: disable=model-missing-unicode - name = models.CharField(max_length=128, default='') + name = models.CharField(max_length=128, default='', db_index=True, unique=True) comments = models.CharField(max_length=256, default='') priority = models.IntegerField(default=0, db_index=True) image = models.ForeignKey(Image, null=True, blank=True, related_name='servicesPoolsGroup', on_delete=models.SET_NULL) @@ -69,3 +70,18 @@ class ServicesPoolGroup(UUIDModel): def __str__(self): return u"Service Pool group {0}({1})".format(self.name, self.comments) + + @property + def as_dict(self): + return { + 'name': self.name, + 'comments': self.comments, + 'priority': self.priority, + 'imageUuid': self.image.uuid if self.image is not None else 'x' + } + + @staticmethod + def default(): + return ServicesPoolGroup(name=_('General'), comments='Default group', priority=-10000) + + diff --git a/server/src/uds/static/js/uds-client.coffee b/server/src/uds/static/js/uds-client.coffee index 2bdc64914..6c0de7ede 100644 --- a/server/src/uds/static/js/uds-client.coffee +++ b/server/src/uds/static/js/uds-client.coffee @@ -241,7 +241,7 @@ uds.setReload = -> uds.reload = -> if uds.reloadCounter == 0 # window.location.reload() - window.location.href = window.location.href + window.location.href = window.location.href.split('?')[0].split('#')[0] + '?tab=' + $("ul#services-tabs li.active").attr('data-name') else uds.reloadCounter -= 1 uds.setReload() diff --git a/server/src/uds/templates/uds/html5/index.html b/server/src/uds/templates/uds/html5/index.html index c5bbcf9f6..8fdf8026a 100644 --- a/server/src/uds/templates/uds/html5/index.html +++ b/server/src/uds/templates/uds/html5/index.html @@ -3,9 +3,15 @@ {% block title %}{% trans 'Available services list' %}{% endblock %} {% block body %} -