From 07ed8b9762cc9120413410f7ad0ed2e5dd7f1f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Fri, 12 Feb 2016 09:53:33 +0100 Subject: [PATCH] Fixed Images & pools groups (added priority and enhaced visual on admin --- server/src/uds/REST/methods/images.py | 2 +- .../src/uds/REST/methods/services_pool_groups.py | 12 +++++++++--- server/src/uds/REST/methods/transports.py | 2 +- ...0160212_0330.py => 0020_auto_20160212_0925.py} | 1 + server/src/uds/models/ServicesPoolGroup.py | 1 + .../src/uds/static/adm/img/icons/spool-group.png | Bin 0 -> 343 bytes .../static/adm/js/gui-d-servicespoolsgroup.coffee | 4 ++-- server/src/uds/static/adm/js/gui-element.coffee | 7 +++++-- 8 files changed, 20 insertions(+), 9 deletions(-) rename server/src/uds/migrations/{0020_auto_20160212_0330.py => 0020_auto_20160212_0925.py} (94%) create mode 100644 server/src/uds/static/adm/img/icons/spool-group.png diff --git a/server/src/uds/REST/methods/images.py b/server/src/uds/REST/methods/images.py index 6f8b33946..0a4c3079b 100644 --- a/server/src/uds/REST/methods/images.py +++ b/server/src/uds/REST/methods/images.py @@ -57,9 +57,9 @@ class Images(ModelHandler): table_title = _('Image Gallery') table_fields = [ + {'thumb': {'title': _('Image'), 'visible': True, 'type': 'image', 'width': '96px' }}, {'name': {'title': _('Name')}}, {'size': {'title': _('Size')}}, - {'thumb': {'title': _('Image'), 'visible': True, 'type': 'image'}}, ] def beforeSave(self, fields): diff --git a/server/src/uds/REST/methods/services_pool_groups.py b/server/src/uds/REST/methods/services_pool_groups.py index 5c270aece..8f037db12 100644 --- a/server/src/uds/REST/methods/services_pool_groups.py +++ b/server/src/uds/REST/methods/services_pool_groups.py @@ -55,12 +55,14 @@ class ServicesPoolGroups(ModelHandler): path = 'gallery' model = ServicesPoolGroup - save_fields = ['name', 'comments', 'image_id'] + save_fields = ['name', 'comments', 'image_id', 'priority'] table_title = _('Services Pool Groups') table_fields = [ + {'priority': {'title': _('Priority'), 'type': 'numeric', 'width': '6em'}}, + {'thumb': {'title': _('Image'), 'visible': True, 'type': 'image', 'width': '96px' }}, {'name': {'title': _('Name')}}, - {'thumb': {'title': _('Image'), 'visible': True, 'type': 'image'}}, + {'comments': {'title': _('Comments')}}, ] def beforeSave(self, fields): @@ -76,7 +78,7 @@ class ServicesPoolGroups(ModelHandler): # Gui related def getGui(self, type_): - g = self.addDefaultFields([], ['name', 'comments']) + g = self.addDefaultFields([], ['name', 'comments', 'priority']) for f in [{ 'name': 'image_id', @@ -93,13 +95,17 @@ class ServicesPoolGroups(ModelHandler): def item_as_dict(self, item): return { 'id': item.uuid, + 'priority': item.priority, 'name': item.name, + 'comments': item.comments, 'image_id': item.image.uuid, } def item_as_dict_overview(self, item): return { 'id': item.uuid, + 'priority': item.priority, 'name': item.name, + 'comments': item.comments, 'thumb': item.image.thumb64, } diff --git a/server/src/uds/REST/methods/transports.py b/server/src/uds/REST/methods/transports.py index c76759836..5c8f05715 100644 --- a/server/src/uds/REST/methods/transports.py +++ b/server/src/uds/REST/methods/transports.py @@ -48,7 +48,7 @@ logger = logging.getLogger(__name__) class Transports(ModelHandler): model = Transport - save_fields = ['name', 'comments', 'tags', ' priority', 'nets_positive'] + save_fields = ['name', 'comments', 'tags', 'priority', 'nets_positive'] table_title = _('Current Transports') table_fields = [ diff --git a/server/src/uds/migrations/0020_auto_20160212_0330.py b/server/src/uds/migrations/0020_auto_20160212_0925.py similarity index 94% rename from server/src/uds/migrations/0020_auto_20160212_0330.py rename to server/src/uds/migrations/0020_auto_20160212_0925.py index 3a5b64a77..aa007c95b 100644 --- a/server/src/uds/migrations/0020_auto_20160212_0330.py +++ b/server/src/uds/migrations/0020_auto_20160212_0925.py @@ -19,6 +19,7 @@ class Migration(migrations.Migration): ('uuid', models.CharField(default=None, max_length=50, unique=True, null=True)), ('name', models.CharField(default='', max_length=128)), ('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)), ], options={ diff --git a/server/src/uds/models/ServicesPoolGroup.py b/server/src/uds/models/ServicesPoolGroup.py index ed7f4fe5b..baeb8f591 100644 --- a/server/src/uds/models/ServicesPoolGroup.py +++ b/server/src/uds/models/ServicesPoolGroup.py @@ -56,6 +56,7 @@ class ServicesPoolGroup(UUIDModel): # pylint: disable=model-missing-unicode name = models.CharField(max_length=128, default='') 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='servicesPoolsGrou', on_delete=models.SET_NULL) class Meta(UUIDModel.Meta): diff --git a/server/src/uds/static/adm/img/icons/spool-group.png b/server/src/uds/static/adm/img/icons/spool-group.png new file mode 100644 index 0000000000000000000000000000000000000000..bb7c47e9df5693373039c7c2ff105fe52174ef38 GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_Gz7y~NYkmHj>|KZmmVs(y}hK%pm|E{-7;x8B~~$a}~^z~y3O_k$LV zCZ(JhX0?S31&JOk0s=c2xD-@dTI?pYdh{`ItZ{B&{jFa1<=p1&d^v`0m40f^8G+_7 zFdQgmi{%#y{rk>!;nWhN%)5Pgvx_g^*}Ip~*)w%Y*h4A3$uAcbL^Do4c5#z)obK~^ z=?(@r_2yqq)o;J>Rrf=qzaTdd!XN)hpbOiSOkhTHo^>p=fS?83{1OS-#Zt4I4 literal 0 HcmV?d00001 diff --git a/server/src/uds/static/adm/js/gui-d-servicespoolsgroup.coffee b/server/src/uds/static/adm/js/gui-d-servicespoolsgroup.coffee index e15f67826..d77abf79c 100644 --- a/server/src/uds/static/adm/js/gui-d-servicespoolsgroup.coffee +++ b/server/src/uds/static/adm/js/gui-d-servicespoolsgroup.coffee @@ -12,9 +12,9 @@ gui.sPoolGroups.link = -> sPoolGroups: "sPoolGroups-placeholder" ) gui.sPoolGroups.table - icon: 'sPoolGroups' + icon: 'spool-group' container: "sPoolGroups-placeholder" - rowSelect: "single" + rowSelect: "multi" buttons: [ "new" "edit" diff --git a/server/src/uds/static/adm/js/gui-element.coffee b/server/src/uds/static/adm/js/gui-element.coffee index efbf35c90..666c7d6e5 100644 --- a/server/src/uds/static/adm/js/gui-element.coffee +++ b/server/src/uds/static/adm/js/gui-element.coffee @@ -170,17 +170,18 @@ columns = [ { orderable: false, className: 'select-checkbox' - width: 32 + width: "32px" render: () -> return '' } ] $.each data.fields, (index, value) -> for v of value opts = value[v] + gui.doLog('***', opts, v, value) column = data: v column.title = opts.title column.render = renderEmptyCell - column.width = opts.width if opts.width + column.width = opts.width if opts.width? # column.width = "100px" column.visible = (if not opts.visible? then true else opts.visible) column.orderable = opts.sortable if opts.sortable? @@ -214,6 +215,8 @@ columns.push column return + gui.doLog('** Colums', columns) + # Responsive style for tables, using tables.css and this code generates the "titles" for vertical display on small sizes initTable = (data) ->