-
Notifications
You must be signed in to change notification settings - Fork 303
/
Copy pathdevice_management.html
172 lines (159 loc) · 7.37 KB
/
device_management.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{% extends "control_panel/base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load my_filters %}
{% block title %}{% blocktrans with device_name=device.name %}{{ device_name }} Device Syncing History{% endblocktrans %}{{ block.super }}{% endblock title %}
{% block i18n_do_not_translate %}
{% block users_active %}active{% endblock users_active %}
{% block manage_active %}active{% endblock manage_active %}
{% block facility_active %}active{% endblock facility_active %}
{% endblock i18n_do_not_translate %}
{% block headcss %}{{ block.super }}
<style>
.toggle-sync-details {
cursor: pointer;
}
.sync-details {
font-size: 0.7em;
padding-left: 20px;
position: relative;
display: none;
}
.sync-stderr {
color: red;
}
</style>
{% endblock headcss %}
{% block headjs %}{{ block.super }}
<script>
$(function() {
$(".toggle-sync-details a").click(function() {
// Toggle text
var toggle_text = $(".sync-details").is(":visible") ? gettext('show details') : gettext('hide details');
$(".show-detail-text").text(toggle_text);
// Flip caret
$(".caret-indicator").toggleClass("caret-reversed");
// Show and hide details
$(".sync-details").slideToggle();
return false;
});
});
</script>
{% endblock headjs %}
{% block buttons %}{{ block.super }}
{% if is_own_device %}
<div class="server-online-only">
<a id="force-sync" class="registered-only btn btn-success">{% trans "Sync to central server!" %}</a>
<a class="not-registered-only btn btn-success" href="{% url 'register_public_key' %}">{% trans "Register" %}</a>
</div>
{% endif %}
{% endblock buttons %}
{% block subnavbar %}{{block.super}}{% endblock subnavbar %}
{% block control_panel_content %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<h3>
{% trans "Device Metadata" %}
</h3>
<dl class="dl-horizontal">
{% if software_version %}
<!---Current System status -->
<dt>{% trans "Device ID" %}:</dt>
<dd>{{ device.id }}</dd>
<dt>{% trans "Current Version" %}:</dt>
<dd>{{ software_version }}</dd>
<dt>{% trans "Database Size" %}:</dt>
<dd>{{ database_size|floatformat }} MB</dd>
<dt>{% trans "Database last update" %}:</dt>
<dd>{{ database_last_updated }}</dd>
<dt>{% trans "Install Directory" %}:</dt>
<dd>{{ install_dir }}</dd>
{% elif not shown_sessions %}
{% else %}
<!---Remote system status -->
<dt>{% trans "Version" %}:</dt>
<dd>{{ device_version }}</dd>
<dt>{% trans "Operating System" %}:</dt>
<dd>{{ device_os }}</dd>
{% endif %}
</dl>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<h3>
{% trans "Sync Sessions" %}
</h3>
{% if not session_pages %}
<p class="registered-only">
{% trans "This device has never synced with the central server." %}
</p>
<p class="not-registered-only">
{% trans "This device is not registered, and so cannot sync data with the central server." %}
</p>
{% else %}
{% if sync_job %}
{% if sync_job.is_running %}
<h3>
{% trans "A sync is currently in progress..." %} <a href=".">{% trans "(refresh)" %}</a>
</h3>
{% else %}
<h3>
{% if sync_job.last_run_successful %}
<span aria-hidden="true"><i class="glyphicon glyphicon-ok-circle text-success"></i></span>
{% trans "The last sync completed successfully" %}
{% else %}
<span aria-hidden="true"><i class="glyphicon glyphicon-remove-circle text-danger"></i></span>
{% trans "There was an error during the last sync" %}
{% endif %}
<small class="toggle-sync-details"><a><span class="show-detail-text">{% trans "show details" %}</span> <span class="caret-indicator caret"></span></a></small>
</h3>
<div class="sync-details">
<div class="sync-stdout">{{ sync_job.log_set.all.0.stdout|linebreaksbr }}</div>
<div class="sync-stderr">{{ sync_job.log_set.all.0.stderr|linebreaksbr }}</div>
</div>
{% endif %}
{% endif %}
<table class="table">
<thead>
<tr class="header-footer-bg">
<th width="250px">{% trans "Sync Date" %}</th>
<th width="200px">{% trans "# Models Uploaded" %}</th>
<th width="200px">{% trans "# Models Downloaded" %}</th>
<th width="200px">{% trans "# Errors" %}</th>
</tr>
</thead>
<tbody>
{% for sync_session in session_pages %}
<tr>
<td>{{ sync_session.timestamp }}</td>
<td>{{ sync_session.models_uploaded }}</td>
<td>{{ sync_session.models_downloaded }}</td>
<td>{{ sync_session.errors }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if session_pages.num_listed_pages > 1 %}
<div class="pagination">
<a title="{% trans 'Browse to the previous page of sync sessions.' %}" {% if session_pages.has_previous %}href="{{ page_urls.prev_page }}"{% endif %}><<</a>
{% for listed_page in session_pages.listed_pages %}
{% if listed_page == -1 %}
<span class="disabled">…</span>
{% elif listed_page == session_pages.number %}
<span class="current">
{{ session_pages.number }}
</span>
{% else %}
<a title="{% blocktrans %}Browse to page # {{ listed_page }} of sessions.{% endblocktrans %}" href="{{ page_urls|get_item:listed_page }}">{{ listed_page }}</a>
{% endif %}
{% endfor %}
<a title="{% trans 'Browse to the next page of sessions.' %}" {% if session_pages.has_next %}href="{{ page_urls.next_page }}"{% endif %}>>></a>
</div>
{% endif %}
{% endif%}
</div>
</div>
</div>
{% endblock control_panel_content %}