From 4f9085f0a2df072b92c49b2cb7ba21071b5bc104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Tue, 16 Feb 2016 07:00:14 +0100 Subject: [PATCH] Almost finished grouping services --- ...212_0925.py => 0020_auto_20160216_0509.py} | 4 +- server/src/uds/models/ServicesPoolGroup.py | 22 +- server/src/uds/static/js/uds-client.coffee | 2 +- server/src/uds/templates/uds/html5/index.html | 57 +- server/src/uds/urls.py | 1 + server/src/uds/web/views/__init__.py | 5 +- server/src/uds/web/views/images.py | 54 ++ server/src/uds/web/views/index.py | 25 +- .../public/app/fonts/DroidSansMono.woff2 | Bin 0 -> 17992 bytes .../public/app/fonts/FontAwesome.otf | Bin 0 -> 85908 bytes .../public/app/fonts/fontawesome-webfont.eot | Bin 0 -> 56006 bytes .../public/app/fonts/fontawesome-webfont.svg | 520 +++++++++++++++ .../public/app/fonts/fontawesome-webfont.ttf | Bin 0 -> 112160 bytes .../public/app/fonts/fontawesome-webfont.woff | Bin 0 -> 65452 bytes .../app/fonts/fontawesome-webfont.woff2 | Bin 0 -> 64464 bytes .../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20127 bytes .../fonts/glyphicons-halflings-regular.svg | 288 ++++++++ .../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 45404 bytes .../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23424 bytes .../fonts/glyphicons-halflings-regular.woff2 | Bin 0 -> 18028 bytes .../17a45e71-30c9-5c22-8c16-916ce4a51c56.png | Bin 0 -> 21615 bytes server/templates/public/app/index2.html | 144 ++++ .../app/scripts/bootstrap-select.min.js | 8 + .../app/scripts/bootstrap-switch.min.js | 22 + .../public/app/scripts/jquery-ui.min.js | 6 + .../public/app/scripts/jquery.blockUI.js | 618 ++++++++++++++++++ .../public/app/scripts/jquery.cookie.js | 117 ++++ .../public/app/scripts/jquery.cookiebar.js | 183 ++++++ .../public/app/styles/font-awesome.min.css | 4 + 29 files changed, 2054 insertions(+), 26 deletions(-) rename server/src/uds/migrations/{0020_auto_20160212_0925.py => 0020_auto_20160216_0509.py} (85%) create mode 100644 server/src/uds/web/views/images.py create mode 100644 server/templates/public/app/fonts/DroidSansMono.woff2 create mode 100644 server/templates/public/app/fonts/FontAwesome.otf create mode 100644 server/templates/public/app/fonts/fontawesome-webfont.eot create mode 100644 server/templates/public/app/fonts/fontawesome-webfont.svg create mode 100644 server/templates/public/app/fonts/fontawesome-webfont.ttf create mode 100644 server/templates/public/app/fonts/fontawesome-webfont.woff create mode 100644 server/templates/public/app/fonts/fontawesome-webfont.woff2 create mode 100644 server/templates/public/app/fonts/glyphicons-halflings-regular.eot create mode 100644 server/templates/public/app/fonts/glyphicons-halflings-regular.svg create mode 100644 server/templates/public/app/fonts/glyphicons-halflings-regular.ttf create mode 100644 server/templates/public/app/fonts/glyphicons-halflings-regular.woff create mode 100644 server/templates/public/app/fonts/glyphicons-halflings-regular.woff2 create mode 100644 server/templates/public/app/img/test/17a45e71-30c9-5c22-8c16-916ce4a51c56.png create mode 100644 server/templates/public/app/index2.html create mode 100644 server/templates/public/app/scripts/bootstrap-select.min.js create mode 100644 server/templates/public/app/scripts/bootstrap-switch.min.js create mode 100644 server/templates/public/app/scripts/jquery-ui.min.js create mode 100644 server/templates/public/app/scripts/jquery.blockUI.js create mode 100644 server/templates/public/app/scripts/jquery.cookie.js create mode 100644 server/templates/public/app/scripts/jquery.cookiebar.js create mode 100644 server/templates/public/app/styles/font-awesome.min.css 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 %} -