Skip to content

Commit

Permalink
prepare handlebar helper to display apm levels humanized rockstor#885
Browse files Browse the repository at this point in the history
To aid with upstream changes where refactoring has split
the helper we use currently into many smaller ones like this.
  • Loading branch information
phillxnet committed Apr 23, 2016
1 parent 9c1acaf commit 05bd886
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/rockstor/storageadmin/static/storageadmin/js/views/disks.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ DisksView = Backbone.View.extend({
html += '</td>';
// begin APM column
html += '<td>';
// pre-made handlebar helper for this section below
if (apmLevel == 0 || apmLevel == null) {
html += '???';
} else {
Expand Down Expand Up @@ -317,6 +318,23 @@ DisksView = Backbone.View.extend({
});
return new Handlebars.SafeString(html);
});
// Helper to display APM value after merger with upstream changes
// where the above helper is replaced by many smaller ones like this.
// N.B. untested. Presumably we do {{humanReadableAPM this.apm_level}}
// in upstream disks_table.jst
Handlebars.registerHelper('humanReadableAPM', function (apm) {
var apmhtml = '';
if (apm == 0 || apm == null) {
apmhtml = '???';
} else {
if (apm == 255) {
apmhtml = 'off';
} else {
apmhtml = apm;
}
}
return new Handlebars.SafeString(apmhtml);
});
},

smartToggle: function (event, state) {
Expand Down

0 comments on commit 05bd886

Please sign in to comment.