Permalink
Browse files

major commit of various pieces -- should be broken into separate pieces

  • Loading branch information...
1 parent 4ee90a9 commit fc7a40c7af6e056b1e4de0d21d7bb195b6ec336c @stevenjenkins committed Jun 12, 2012
View
@@ -0,0 +1,11 @@
+#
+# This is just a set of stubs for integraiton with EFS.
+package EFS;
+
+sub check_maintenance_mode {
+ my $root = q{/efs};
+ my $efs = q{prod}; # or 'dev', etc. the release/releaselink
+ return ( -e qq{$root/dist/$efs/config/incr/common/etc/maintenance} );
+}
+
+1;
View
@@ -3,14 +3,23 @@ use Dancer ':syntax';
use Dancer::Plugin::Ajax;
use Unix::Uptime; # for testing purposes
use JSON;
+use EFS;
our $VERSION = '0.1';
+our $API_KEY = 'AIzaSyDj5mre4qsuZLywHgae82Opqd08dyzf-W8';
-get '/' => sub {
- template 'index';
+get '/map' => sub { # a sample google map api to verify this works
+ template 'map';
+};
+get '/dashboard' => sub {
+ template 'dashboard';
+};
+
+get '/highcharts' => sub {
+ template 'highcharts';
};
-ajax '/getloadavg' => sub {
+any '/getloadavg' => sub {
{
timestamp => time,
loadavg => ( Unix::Uptime->load )[0]
@@ -33,11 +42,8 @@ get '/efsserver_status' => sub {
get '/maintenance_mode' => sub {
content_type 'application/json';
- if (-e '/tmp/foo'){
- return to_json {status => "Success", result => "true"};
- } else {
- return to_json {status => "Success", result => "false"};
- }
+ my $result = EFS::check_maintenance_mode() ? q{true} : q{false};
+ return to_json {status => "Success", result => $result};
};
get '/map' => sub {
View
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+<title>jQuery Google Chart</title>
+<style type="text/css">
+#basicGChart { width: 450px; height: 300px }
+</style>
+<script type="text/javascript" src="javascripts/jquery.min.js"></script>
+<script type="text/javascript" src="javascripts/jquery.gchart.js"></script>
+<script type="text/javascript">
+$(function () {
+ $('#basicGChart').gchart({type: 'line', maxValue: 40,
+ title: 'Weather for|Brisbane, Australia', titleColor: 'green',
+ backgroundColor: $.gchart.gradient('horizontal', 'ccffff', 'ccffff00'),
+ series: [$.gchart.series('Max', [29.1, 28.9, 28.1, 26.3,
+ 23.5, 21.2, 20.6, 21.7, 23.8, 25.6, 27.3, 28.6], 'red', 'ffcccc'),
+ $.gchart.series('Min', [20.9, 20.8, 19.5, 16.9,
+ 13.8, 10.9, 9.5, 10.0, 12.5, 15.6, 18.0, 19.8], 'green'),
+ $.gchart.series('Rainfall', [157.7, 174.6, 138.5, 90.4,
+ 98.8, 71.2, 62.6, 42.7, 34.9, 94.4, 96.5, 126.2], 'blue', 0, 200)],
+ axes: [$.gchart.axis('bottom', ['Jan', 'Feb', 'Mar', 'Apr',
+ 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 'black'),
+ $.gchart.axis('left', 0, 40, 'red', 'right'),
+ $.gchart.axis('left', ['C'], [50], 'red', 'right'),
+ $.gchart.axis('right', 0, 200, 50, 'blue', 'left'),
+ $.gchart.axis('right', ['mm'], [50], 'blue', 'left')],
+ legend: 'right'});
+});
+</script>
+</head>
+<body>
+<h1>jQuery Google Chart Basics</h1>
+<p>This page demonstrates the very basics of the
+ <a href="http://keith-wood.name/gChart.html">jQuery Google Chart plugin</a>.
+ It contains the minimum requirements for using the plugin and
+ can be used as the basis for your own experimentation.</p>
+<p>For more detail see the <a href="http://keith-wood.name/gChartRef.html">documentation reference</a> page.</p>
+<div id="basicGChart"></div>
+</body>
+</html>

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,93 @@
+<!--
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
+-->
+<!-- script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js"></script -->
+
+<script type="text/javascript" src="javascripts/jquery.min.js"></script>
+
+<!--
+<script type="text/javascript">
+jQuery.noConflict();
+</script>
+-->
+
+<!--
+<script type="text/javascript" src="https://www.google.com/jsapi">
+</script>
+-->
+
+<script type="text/javascript" src="javascripts/jquery.gchart.js">
+</script>
+
+<!--
+<script type="text/javascript"
+ src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDj5mre4qsuZLywHgae82Opqd08dyzf-W8&sensor=false">
+</script>
+-->
+
+<script type="text/javascript">
+ $(document).ready(function()
+ {
+ function initialize(){
+ initialize_maintenance_mode();
+ initialize_meta();
+ };
+ function initialize_map() {
+ var myOptions = {
+ center: new google.maps.LatLng(-34.397, 150.644),
+ zoom: 8,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+ var map = new google.maps.Map(document.getElementById("map"), myOptions);
+ };
+ function initialize_meta() {
+ $('#meta').gchart({
+ type: 'line',
+ maxValue: 40,
+ title: 'Metaprojects',
+ titleColor: 'green',
+ backgroundColor: $.gchart.gradient('horizontal', 'ccffff', 'ccffff00'),
+ series: [
+ $.gchart.series('Max', [29.1, 28.9, 28.1], 'red', 'ffcccc'),
+ $.gchart.series('Min', [20.9, 20.8, 19.5, 16.9], 'green'),
+ $.gchart.series('Rainfall', [157.7, 174.4, 138.5], 'blue', 0, 200)],
+ axes: [
+ $.gchart.axis('bottom', ['Jan', 'Feb', 'Mar', 'Apr'], 'black'),
+ $.gchart.axis('left', 0, 40, 'red', 'right'),
+ $.gchart.axis('left', ['C'], [50], 'red', 'right'),
+ $.gchart.axis('right', 0, 200, 50, 'blue', 'left'),
+ $.gchart.axis('right', ['mm'], [50], 'blue', 'left')],
+ legend: 'right'});
+
+ };
+ function initialize_maintenance_mode(){
+ if (true){
+ $('#maintenance').hide();
+ };
+ };
+
+ // now call initialize()
+ initialize();
+ });
+</script>
+
+<!-- <body onload="initialize_meta()"> -->
+
+<h1>Dancer Dashboard demo</h1>
+
+<div id="map" style="width:100%; height=100%"></div>
+<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
+
+<div id="maintenance">
+ <h1>EFS is in maintenance mode</h1>
+</div>
+
+<div id="basicGChart"></div>
+<div id="dists" class="google-bar-chart"></div>
+<div id="meta" ></div>
+<div id="projects" class="google-bar-chart"></div>
+<div id="releases" class="google-bar-chart"></div>
+
+Simple dashboard
+</p>
+
View
@@ -0,0 +1,91 @@
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
+
+<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js">
+</script>
+
+<script type="text/javascript">
+jQuery.noConflict();
+</script>
+
+<script type="text/javascript" src="/javascripts/highcharts.js">
+</script>
+
+<script type="text/javascript">
+
+Highcharts.setOptions({
+ global: {
+ useUTC: false
+ }
+});
+
+var chart;
+jQuery(document).ready(function() {
+ chart = new Highcharts.Chart({
+ chart: {
+ renderTo: 'container',
+ defaultSeriesType: 'spline',
+ marginRight: 10,
+ events: {
+ load: function() {
+
+ // set up the updating of the chart every two seconds
+
+ var out = this;
+ setInterval(function() {
+ var series = out.series[0];
+ var shiftalong = series.data.length > 20;
+ $.getJSON('/getloadavg', function(response) {
+ var point = [ response.timestamp * 1000,
+ response.loadavg - 0 ];
+ series.addPoint(point, true, shiftalong);
+ })
+ }, 2000);
+ }
+ }
+ },
+ title: {
+ text: 'Live load average'
+ },
+ xAxis: {
+ type: 'datetime',
+ tickPixelInterval: 150
+ },
+ yAxis: {
+ title: {
+ text: 'Load average'
+ }
+ },
+ tooltip: {
+ formatter: function() {
+ return '<b>'+ this.series.name +'</b><br/>'+
+ Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
+ Highcharts.numberFormat(this.y, 2);
+ }
+ },
+ legend: {
+ enabled: false
+ },
+ exporting: {
+ enabled: false
+ },
+ series: [{
+ name: 'Load average',
+ data: []
+ }]
+ });
+
+
+});
+</script>
+
+<h1>Dancer AJAX Charting demo</h1>
+
+<div id="container" class="highcharts-container"
+ style="height:410px; margin: 0 2em; clear:both; min-width: 600px">
+
+<p>
+The above is a simple graph fetching data asynchronously from our Dancer
+application via AJAX.
+</p>
+
+
View
@@ -1,3 +1,4 @@
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<!-- script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js"></script -->
@@ -6,9 +7,27 @@
jQuery.noConflict();
</script>
+<script type="text/javascript" src="/javascripts/highcharts/js/highcharts.js"></script>
+<script type="text/javascript" src="/javascripts/highcharts/modules/exporting.js"></script>
+
+
+<script type="text/javascript">
+var example = 'dynamic-update',
+ theme = 'default';
+</script>
+
<script type="text/javascript" src="/javascripts/highcharts/demo/scripts.js"></script>
<script type="text/javascript">
+ Highcharts.theme = { colors: ['#4572A7'] };// prevent errors in default theme
+ var highchartsOptions = Highcharts.getOptions();
+</script>
+
+<link rel="stylesheet" href="/javascripts/highchart/templates/yoo_symphony/css/template.css" type="text/css" />
+<link rel="stylesheet" href="/javascripts/highchart/templates/yoo_symphony/css/variations/brown.css" type="text/css" />
+<link href="/javascripts/highchart/demo/demo.css" rel="stylesheet" type="text/css" />
+
+<script type="text/javascript">
Highcharts.setOptions({
global: {
View
@@ -6,17 +6,11 @@
<title>myapp</title>
<link rel="stylesheet" href="<% request.uri_base %>/css/style.css" />
-<!-- Grab Google CDN's jQuery. fall back to local if necessary -->
-<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
-<script type="text/javascript">/* <![CDATA[ */
- !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>')
-/* ]]> */</script>
-
</head>
<body>
<% content %>
<div id="footer">
-Powered by <a href="http://perldancer.org/">Dancer</a> <% dancer_version %>
+Welcome to the <a href="http://www.openefs.org/">OpenEFS</a> <a href="http://github.com/stevenjenkins/openefs-dashboard">Dashboard</a>
</div>
</body>
</html>
View
No changes.

0 comments on commit fc7a40c

Please sign in to comment.