Projet

Général

Profil

0001-log-panel-style.patch

Frédéric Péters, 29 mars 2017 20:48

Télécharger (4,42 ko)

Voir les différences:

Subject: [PATCH] log panel style

 passerelle/base/models.py                          |  5 ++++
 passerelle/static/css/style.css                    | 28 ++++++++++++++++++++++
 .../passerelle/includes/resource-logs-table.html   | 12 ++++------
 .../templates/passerelle/manage/service_view.html  | 10 ++++----
 4 files changed, 43 insertions(+), 12 deletions(-)
passerelle/base/models.py
8 8
from django.core.urlresolvers import reverse
9 9
from django.db import models, transaction
10 10
from django.db.models import Q
11
from django.utils.text import slugify
11 12
from django.utils.translation import ugettext_lazy as _
12 13
from django.core.files.base import ContentFile
13 14

  
......
322 323
            ('view_resourcelog', 'Can view resource logs'),
323 324
        )
324 325

  
326
    @property
327
    def level(self):
328
        return slugify(logging.getLevelName(self.levelno))
329

  
325 330
    def __unicode__(self):
326 331
        return '%s %s %s %s' % (self.timestamp, self.levelno, self.appname, self.slug)
327 332

  
passerelle/static/css/style.css
1 1
div#queries,
2 2
div#security,
3
div#logs,
3 4
div#endpoints {
4 5
	margin-bottom: 2em;
5 6
	border: 1px solid #bcbcbc;
......
7 8

  
8 9
div#queries h3,
9 10
div#security h3,
11
div#logs h3,
10 12
div#endpoints h3 {
11 13
	background: #FCFCFC;
12 14
	border-bottom: 1px solid #bcbcbc;
......
17 19

  
18 20
div#queries > div,
19 21
div#security > div,
22
div#logs > div,
20 23
div#endpoints > div {
21 24
	padding: 1rem;
22 25
}
23 26

  
24 27
div#queries ul,
25 28
div#security ul,
29
div#logs ul,
26 30
div#endpoints ul {
27 31
	padding-left: 2em;
28 32
	line-height: 140%;
......
37 41
	border-bottom: 1px solid #bcbcbc;
38 42
}
39 43

  
44
div#logs table th,
45
div#logs table td.timestamp {
46
	white-space: nowrap;
47
}
48

  
49
div#logs table td.message {
50
	text-align: left;
51
}
52

  
53
div#logs table tr.level-debug {
54
	color: #666;
55
}
56

  
57
div#logs table tr.level-warning,
58
div#logs table tr.level-error,
59
div#logs table tr.level-critical {
60
	color: #c33;
61
}
62

  
63
div#logs table tr.level-error,
64
div#logs table tr.level-critical {
65
	font-weight: bold;
66
}
67

  
40 68
select#id_msg_class { max-width: 30em; }
41 69

  
42 70
li.webservices a { background-image: url(icons/icon-webservices.png); }
passerelle/templates/passerelle/includes/resource-logs-table.html
5 5
{% if logrecords %}
6 6
<table class="main">
7 7
    <thead>
8
        <th>{% trans 'Id' %}</th>
9 8
        <th>{% trans 'Timestamp' %}</th>
10
        <th>{% trans 'Level' %}</th>
11 9
        <th>{% trans 'Ip Source' %}</th>
12 10
        <th>{% trans 'Message' %}</th>
13 11
    </thead>
14 12
    <tbody>
15 13
    {% for record in logrecords %}
16
    <tr>
17
        <td>{{ record.id }}</td>
18
        <td>{{ record.timestamp|localtime }}</td>
19
        <td>{{ record.levelno }}</td>
20
        <td>{{ record.ipsource }}</td>
21
        <td>{{ record.message}}</td>
14
    <tr class="level-{{record.level}}">
15
        <td class="timestamp">{{ record.timestamp|localtime }}</td>
16
        <td>{{ record.ipsource|default:"-" }}</td>
17
        <td class="message">{{ record.message}}</td>
22 18
    </tr>
23 19
    {% endfor %}
24 20
    </tbody>
passerelle/templates/passerelle/manage/service_view.html
50 50

  
51 51
{% if perms.base.view_resourcelog %}
52 52
<div id="logs">
53
    <h3>{% trans "Logs" %}</h3>
54
    {% block logs %}
55
        {% resource_logs_table resource=object %}
56
    {% endblock %}
53
  <h3>{% trans "Logs" %}</h3>
54
  <div>
55
  {% block logs %}
56
    {% resource_logs_table resource=object %}
57
  {% endblock %}
58
  </div>
57 59
</div>
58 60
{% endif %}
59 61

  
60
-