Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Guide?: Changing default graph scale

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
Status
Not open for further replies.

Simon Tiplady

Junior Member
Joined
Jun 19, 2015
Messages
20
My system is not likely to change much on a minute by minute scale, so having the Reporting graphs default to "hourly" is not useful for me. An overview of daily or maybe even weekly could be more useful.

I know this update won't persist past system upgrades, but it's only 2 lines of code to change...

The file you need to change is /usr/local/www/freenasUI/static/lib/js/freeadmin/RRDControl.js

I used vi to edit the file and changed the default unit from "hourly" to "daily" (options are "hourly", "daily", "weekly", "monthly", "yearly"), you can find this near the top of the file, in my file it was on line 21.

Code:
   var RRDControl = declare("freeadmin.RRDControl", [ _Widget, _Templated ], {
        templateString : template,
        name : "",
        value: "",
        href: "",
        step: 0,
        unit: "weekly", // <-- Change this value

(Ignore the line numbers in the code snippet above)

You also need to make the zoomIn button active, normally when the scale is set to hourly you can't zoom in any further, to fix this, go to line 44 and comment it out (add // to the start of the line), or remove it.

Code:
           zoomIn = new Button({
                id: "rrd_" + me.name + "_zoomIn",
                label: this.zoomInButton.innerHTML,
                onClick: function(e) {
                    var newunit = me.zoomInUnit(me.unit)
                    if(newunit == me.unit || newunit == 'hourly') {
                        zoomIn.set('disabled', true);
                    } else {
                        zoomOut.set('disabled', false);
                    }
                    me.unit = newunit;
                    me.query();
                },
                //disabled: true, // delete or comment out this line
            }, this.zoomInButton);


It might be nice to remember the last used value in a cookie and to use that value, maybe I'll do that another day...
 

adrianwi

Neophyte Sage
Joined
Oct 15, 2013
Messages
1,171
This is a really nice and simple tweak, although would be great if this could be configured in the WUI :D
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
9,039
There is a feature request in for this which I submitted quite a long time ago, although it keeps getting pushed off "to the next version", and currently I think it's FreNAS 10 M3 version, but I'm not holding my breath. If you want this feature you should add a comment that request in order to let the iX folks know it is desired by more people than me. Or if you can't locate it, just add another feature request.
 
Last edited:
Status
Not open for further replies.
Top