remove gauges

This commit is contained in:
Sam Rijs 2018-03-10 23:23:09 +11:00
parent 5885ec3f8c
commit d953bdb2fb

View file

@ -1,4 +1,3 @@
use std::env;
use std::time::Duration; use std::time::Duration;
use hyper::Response; use hyper::Response;
@ -11,12 +10,6 @@ pub mod status;
use super::super::SELF_BASE_URL; use super::super::SELF_BASE_URL;
lazy_static! {
static ref GAUGES_SITE_ID: Option<String> = {
env::var("GAUGES_SITE_ID").ok().map(|s| s.to_string())
};
}
fn render_html<B: Render>(title: &str, body: B) -> Response { fn render_html<B: Render>(title: &str, body: B) -> Response {
let rendered = html! { let rendered = html! {
html { html {
@ -30,25 +23,7 @@ fn render_html<B: Render>(title: &str, body: B) -> Response {
link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Source+Code+Pro"; link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Source+Code+Pro";
link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"; link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css";
} }
body { body (body)
(body)
@if let Some(site_id) = GAUGES_SITE_ID.as_ref() {
script type="text/javascript" {
(format!("var _gauges = _gauges || [];
(function() {{
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '{}');
t.setAttribute('data-track-path', 'https://track.gaug.es/track.gif');
t.src = 'https://d2fuc4clr7gvcn.cloudfront.net/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
}})();", site_id))
}
}
}
} }
}; };