From e59761a7094537bc2461e030b20dbc75f46687fe Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Wed, 4 Dec 2019 14:13:56 +0100 Subject: [PATCH] Code styles of databases view. --- musician/models.py | 13 +++++- musician/static/musician/css/default.css | 32 +++++++++++++- musician/templates/musician/databases.html | 50 +++++++++++----------- 3 files changed, 68 insertions(+), 27 deletions(-) diff --git a/musician/models.py b/musician/models.py index 5b61e16..268a3b1 100644 --- a/musician/models.py +++ b/musician/models.py @@ -90,12 +90,14 @@ class DatabaseUser(OrchestraModel): class DatabaseService(OrchestraModel): api_name = 'database' + verbose_name = _('Databases') fields = ('name', 'type', 'users') param_defaults = { "id": None, "name": None, "type": None, "users": None, + "usage": {}, } @classmethod @@ -103,7 +105,16 @@ class DatabaseService(OrchestraModel): users = None if 'users' in data: users = [DatabaseUser.new_from_json(user_data) for user_data in data['users']] - return super().new_from_json(data=data, users=users) + + # TODO(@slamora) retrieve database usage + usage = { + 'usage': 250, + 'total': 500, + 'unit': 'MB', + 'percent': 50, + } + + return super().new_from_json(data=data, users=users, usage=usage) class MailService(OrchestraModel): diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index b2effbc..3494b81 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -98,7 +98,8 @@ h1.service-name { table-layout: fixed; } /** TODO update theme instead of overriding **/ -.service-list thead.thead-dark th { +.service-list thead.thead-dark th, +.service-card .card-header { background: rgba(80, 70, 110, 0.25); color: #50466E; border-color: transparent; @@ -138,3 +139,32 @@ h1.service-name { .service-list tfoot tr td { padding-top: 3rem; } + +.service-card { + margin-bottom: 3rem; +} + +.service-card .card-body h4 { + color: #50466E; + font-weight: bold; +} + +.service-card .card-body { + color: #787878; + +} + +.service-card .card-body i.fas { + color:#9C9AA7; +} + +.service-manager-link { + position: absolute; + bottom: 0px; + right: 15px; +} + +.service-card .service-manager-link a, +.service-card .service-manager-link a i.fas { + color: white; +} diff --git a/musician/templates/musician/databases.html b/musician/templates/musician/databases.html index 448432c..33403bc 100644 --- a/musician/templates/musician/databases.html +++ b/musician/templates/musician/databases.html @@ -3,45 +3,45 @@ {% block content %} -

{{ service.verbose_name }}

-

{{ service.description }}

+

{{ service.verbose_name }}

+

{{ service.description }}

{% for database in object_list %} -
-
-
- {{ database.name }} -
-
- Type: {{ database.type }} -
-
- associated to: {{ database.domain|default:"-" }} -