jonnymccullagh / munstrap

Alternative Munin 2.x templates based on Twitter Bootstrap
GNU General Public License v2.0
112 stars 15 forks source link

Problem with whitespace in category name #16

Open kionez opened 9 years ago

kionez commented 9 years ago

There's a problem when the category has a namespace, such as "Power dns" [1], the generated tab has "power dns" as ID and you can't click and open it on corresponding label with href "#power dns". I don't know what templating engine is used, but maybe there is a "strip whitespace" option, I'll try to fix it :)

1: https://github.com/munin-monitoring/contrib/blob/master/plugins/network/dns/pdns_queries

jonnymccullagh commented 9 years ago

This issue has been raised a few times. Unfortuntely I can't solve it from the template end so I can only recommend changing the category names in the munin plugins with an underscore instead of a space e.g. power_dns rather than power dns

stromsoe commented 9 years ago

Instead of using the category, modify munin-nodeview.tmpl (not sure if anything else needs to be edited) use a placeholder and the counter variable to increment inside the href and the id. Something like:

``` ```
kionez commented 9 years ago

I've fixed it in javascript langage (because I know better than templating language used), adding a small js to footer.tmpl

$(document).ready(function() {
    $('ul#tabs').find('li').each(function(a,b){
        $(b).find('a').each(function(c,d) {
            var h = $(d).attr('href');
            $(d).attr('href',h.replace(/ /g, '_'));
        });
    });
    $('div.tab-pane').each(function(a,b){
        var i = $(b).attr('id');
        $(b).attr('id',i.replace(/ /g, '_'));
    });
})