1 {% extends
"base.html" %}
6 $(document).ready(function(){
7 // Pre-populated initial data at page load
8 var content_data = {{ content_data }};
10 var refresh = function() {
11 $.get(
"/rbd_mirroring_data", function(data) {
12 _.extend(content_data, data);
13 setTimeout(refresh,
30000);
17 console.log(content_data);
19 rivets.formatters.mirror_health_color = function(status_str) {
20 if (status_str ==
"warning") {
21 return
"label label-warning";
22 } else if (status_str ==
"error") {
23 return
"label label-danger";
24 } else if (status_str ==
"success") {
25 return
"label label-success";
27 return
"label label-info";
29 rivets.formatters.sync_progress_bar = function(progress){
30 var ratio = progress /
100.0;
31 return
"width: " + Math.round(ratio *
100).toString() +
"%";
34 rivets.bind($(
"div#content"), content_data);
35 setTimeout(refresh,
30000);
37 var table_ids = [
"daemons",
"pools"];
38 for (var i =
0; i < table_ids.length; ++i) {
39 $('#' + table_ids[i]).DataTable({
42 'lengthChange': false,
49 var table_ids = [
"image_errors",
"image_syncing",
"image_ready"];
50 for (var i =
0; i < table_ids.length; ++i) {
51 $('#' + table_ids[i]).DataTable({
54 'lengthChange': false,
64 <section class=
"content-header">
70 <section class=
"content">
72 <div class=
"col-sm-6">
74 <div class=
"box-header">
75 <h3 class=
"box-title">Daemons
</h3>
77 <div class=
"box-body">
78 <table id=
"daemons" class=
"table table-condensed">
89 <tr rv-each-daemon=
"daemons">
91 <td>{daemon.instance_id}
</td>
92 <td>{daemon.server_hostname}
</td>
93 <td>{daemon.version | short_version}
</td>
94 <td><span rv-class=
"daemon.health_color | mirror_health_color">{daemon.health}
</span></td>
102 <div class=
"col-sm-6">
104 <div class=
"box-header">
105 <h3 class=
"box-title">Pools
</h3>
107 <div class=
"box-body">
108 <table id=
"pools" class=
"table table-condensed">
120 <tr rv-each-pool=
"pools">
122 <td>{pool.mirror_mode}
</td>
123 <td>{pool.leader_id}
</td>
124 <td>{pool.image_local_count}
</td>
125 <td>{pool.image_remote_count}
</td>
126 <td><span rv-class=
"pool.health_color | mirror_health_color">{pool.health}
</span></td>
136 <div class=
"box-header">
137 <h3 class=
"box-title">Images
</h3>
139 <div class=
"box-body">
140 <div class=
"nav-tabs-custom">
141 <ul class=
"nav nav-tabs">
142 <li class=
"active"><a href=
"#tab_1" data-toggle=
"tab">Issues
</a></li>
143 <li><a href=
"#tab_2" data-toggle=
"tab">Syncing
</a></li>
144 <li><a href=
"#tab_3" data-toggle=
"tab">Ready
</a></li>
146 <div class=
"tab-content">
147 <div class=
"tab-pane active" id=
"tab_1">
148 <table id=
"image_errors" class=
"table table-condensed">
158 <tr rv-each-image=
"image_error">
159 <td>{image.pool_name}
</td>
160 <td>{image.name}
</td>
161 <td>{image.description}
</td>
162 <td><span rv-class=
"image.state_color | mirror_health_color">{image.state}
</span></td>
167 <div class=
"tab-pane" id=
"tab_2">
168 <table id=
"image_syncing" class=
"table table-condensed">
178 <tr rv-each-image=
"image_syncing">
179 <td>{image.pool_name}
</td>
180 <td>{image.name}
</td>
182 <div class=
"progress" style=
"width: 100px; height: 18px;">
183 <div class=
"progress-bar progress-bar-aqua" rv-style=
"image.progress | sync_progress_bar">
188 <td><span class=
"label label-info">Syncing
</span></td>
193 <div class=
"tab-pane" id=
"tab_3">
194 <table id=
"image_ready" class=
"table table-condensed">
204 <tr rv-each-image=
"image_ready">
205 <td>{image.pool_name}
</td>
206 <td>{image.name}
</td>
207 <td>{image.description}
</td>
208 <td><span rv-class=
"image.state_color | mirror_health_color">{image.state}
</span></td>