Skip to content

Commit 056c011

Browse files
committed
removed NaN message in stats. improved styling
1 parent 96780a9 commit 056c011

4 files changed

Lines changed: 35 additions & 18 deletions

File tree

src/main/webapp/WEB-INF/Index.jsp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,23 @@
156156
</div>
157157
{{# } }}
158158

159-
{{# if( stats.averageArchiveCount != undefined ) { }}
159+
{{# if( stats.averageArchiveCount != undefined && !isNaN(stats.averageArchiveCount) ) { }}
160160
<div class="stats-line stat-averageArchiveCount">
161161
<div class="attribute-name">average archives per workspace:</div>
162162
<div class="attribute-detail">{{# print( Math.round(stats.averageArchiveCount*100)/100 ); }}</div>
163163
<div class="clearer"></div>
164164
</div>
165165
{{# } }}
166166

167-
{{# if( stats.averageArchiveCountQuota != undefined ) { }}
167+
{{# if( stats.averageArchiveCountQuota != undefined && !isNaN(stats.averageArchiveCountQuota) ) { }}
168168
<div class="stats-line stat-averageArchiveCountQuota">
169169
<div class="attribute-name">average usage of 'archives per workspace' quota:</div>
170170
<div class="attribute-detail">{{# print( Math.round(stats.averageArchiveCountQuota*10000)/100 ); }}%</div>
171171
<div class="clearer"></div>
172172
</div>
173173
{{# } }}
174174

175-
{{# if( stats.averageWorkspaceAge != undefined ) { }}
175+
{{# if( stats.averageWorkspaceAge != undefined && !isNaN(stats.averageWorkspaceAge) ) { }}
176176
{{# var avgAge = stats.averageWorkspaceAge/3600; }}
177177
<div class="stats-line stat-averageWorkspaceAge">
178178
<div class="attribute-name">average age of workspace:</div>
@@ -181,63 +181,63 @@
181181
</div>
182182
{{# } }}
183183

184-
{{# if( stats.averageWorkspaceSize != undefined ) { }}
184+
{{# if( stats.averageWorkspaceSize != undefined && !isNaN(stats.averageWorkspaceSize) ) { }}
185185
<div class="stats-line stat-averageWorkspaceSize">
186186
<div class="attribute-name">average size per workspace:</div>
187187
<div class="attribute-detail">{{# print( bytesToSize(Math.round(stats.averageWorkspaceSize*100)/100) ); }}</div>
188188
<div class="clearer"></div>
189189
</div>
190190
{{# } }}
191191

192-
{{# if( stats.averageWorkspaceSizeQuota != undefined ) { }}
192+
{{# if( stats.averageWorkspaceSizeQuota != undefined && !isNaN(stats.averageWorkspaceSizeQuota) ) { }}
193193
<div class="stats-line stat-averageWorkspaceSizeQuota">
194194
<div class="attribute-name">average usage of 'size per workspace' quota:</div>
195195
<div class="attribute-detail">{{# print( Math.round(stats.averageWorkspaceSizeQuota*10000)/100 ); }}%</div>
196196
<div class="clearer"></div>
197197
</div>
198198
{{# } }}
199199

200-
{{# if( stats.totalArchiveCount != undefined ) { }}
200+
{{# if( stats.totalArchiveCount != undefined && !isNaN(stats.totalArchiveCount) ) { }}
201201
<div class="stats-line stat-totalArchiveCount">
202202
<div class="attribute-name">total number of hosted archives:</div>
203203
<div class="attribute-detail">{{# print(stats.totalArchiveCount); }}</div>
204204
<div class="clearer"></div>
205205
</div>
206206
{{# } }}
207207

208-
{{# if( stats.totalSize != undefined ) { }}
208+
{{# if( stats.totalSize != undefined && !isNaN(stats.totalSize) ) { }}
209209
<div class="stats-line stat-totalSize">
210210
<div class="attribute-name">total size of all hosted archives:</div>
211211
<div class="attribute-detail">{{# print( bytesToSize(stats.totalSize) ); }}</div>
212212
<div class="clearer"></div>
213213
</div>
214214
{{# } }}
215215

216-
{{# if( stats.totalSizeQuota != undefined ) { }}
216+
{{# if( stats.totalSizeQuota != undefined && !isNaN(stats.totalSizeQuota) ) { }}
217217
<div class="stats-line stat-totalSizeQuota">
218218
<div class="attribute-name">usage of 'total size' quota:</div>
219219
<div class="attribute-detail">{{# print( Math.round(stats.totalSizeQuota*10000)/100 ); }}%</div>
220220
<div class="clearer"></div>
221221
</div>
222222
{{# } }}
223223

224-
{{# if( stats.totalWorkspaceCount != undefined ) { }}
224+
{{# if( stats.totalWorkspaceCount != undefined && !isNaN(stats.totalWorkspaceCount) ) { }}
225225
<div class="stats-line stat-totalWorkspaceCount">
226226
<div class="attribute-name">total number of hosted workspaces:</div>
227227
<div class="attribute-detail">{{# print(stats.totalWorkspaceCount); }}</div>
228228
<div class="clearer"></div>
229229
</div>
230230
{{# } }}
231231

232-
{{# if( stats.userArchiveCountQuota != undefined ) { }}
232+
{{# if( stats.userArchiveCountQuota != undefined && !isNaN(stats.userArchiveCountQuota) ) { }}
233233
<div class="stats-line stat-userArchiveCountQuota">
234234
<div class="attribute-name">usage of 'archives per workspace' quota:</div>
235235
<div class="attribute-detail">{{# print( Math.round(stats.userArchiveCountQuota*10000)/100 ); }}%</div>
236236
<div class="clearer"></div>
237237
</div>
238238
{{# } }}
239239

240-
{{# if( stats.userWorkspaceSizeQuota != undefined ) { }}
240+
{{# if( stats.userWorkspaceSizeQuota != undefined && !isNaN(stats.userWorkspaceSizeQuota) ) { }}
241241
<div class="stats-line stat-userWorkspaceSizeQuota">
242242
<div class="attribute-name">usage of 'workspace size' quota:</div>
243243
<div class="attribute-detail">{{# print( Math.round(stats.userWorkspaceSizeQuota*10000)/100 ); }}%</div>

src/main/webapp/res/css/css.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,20 @@ ul.start-history-list > li.current-workspace {
313313
}
314314

315315
/* -------- Stats View -------- */
316+
.stats-line {
317+
/* line-height: 1em; */
318+
padding: 0.3em 1em;
319+
}
320+
.stats-line:nth-of-type(2n) {
321+
background-color: #fafafa;
322+
}
316323
.stats-line .attribute-name {
317324
width: calc(65% - 5px);
325+
margin: 0;
318326
}
319327
.stats-line .attribute-detail {
320328
width: calc(35% - 5px);
329+
margin: 0;
321330
}
322331
.stats-par {
323332
margin-bottom: 1.1em;

src/main/webapp/res/js/js.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,22 @@ function bytesToSize(bytes) {
2323
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
2424
}
2525

26+
//Underscore template interpolate character to {{# ... }}
27+
_.templateSettings = {
28+
evaluate: /\{\{#(.+?)\}\}/g,
29+
interpolate: /\{\{([^#].*?)\}\}/g
30+
};
2631
var __escape = {
2732
lt: new RegExp("<", "g"),
2833
gt: new RegExp(">", "g"),
2934
br: new RegExp("\n", "g")
3035
};
36+
var __deescape = {
37+
amp: new RegExp("&amp;", "g"),
38+
lt: new RegExp("&lt;", "g"),
39+
gt: new RegExp("&gt;", "g")
40+
};
41+
3142
function escape(string, brline) {
3243
if( string == null || string == undefined )
3344
return string;
@@ -55,8 +66,11 @@ $(document).ready(function () {
5566
var id = $el.attr("id");
5667
var html = $el.html();
5768

58-
if( id != undefined && html != undefined && html.length > 1)
69+
if( id != undefined && html != undefined && html.length > 1) {
70+
console.log(html);
71+
html = html.replace(__deescape.amp, "&").replace(__deescape.lt, "<").replace(__deescape.gt, ">");
5972
templateCache[ id ] = _.template(html);
73+
}
6074
$el.remove();
6175
});
6276

src/main/webapp/res/js/models.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
// see http://backbonejs.org/
22

3-
//Underscore template interpolate character to {{# ... }}
4-
_.templateSettings = {
5-
evaluate: /\{\{#(.+?)\}\}/g,
6-
interpolate: /\{\{([^#].*?)\}\}/g
7-
};
8-
93
var ArchiveEntryModel = Backbone.Model.extend({
104
urlRoot: RestRoot + "archives/0/entries",
115
defaults: {

0 commit comments

Comments
 (0)