From 96ccb4a878007af5dfa30f9a10019445c1eb3960 Mon Sep 17 00:00:00 2001 From: Simon Cardenas Date: Thu, 17 Mar 2016 20:27:43 +0000 Subject: [PATCH] doc --- README.md | 11 +++ web/routes/newdashboard.js | 97 ------------------------- web/routes/routeTemplate.js | 17 ++--- web/views/layout.jade | 6 +- web/views/newdashboard.jade | 138 ------------------------------------ web/views/viewTemplate.js | 61 ---------------- 6 files changed, 19 insertions(+), 311 deletions(-) delete mode 100755 web/routes/newdashboard.js delete mode 100755 web/views/newdashboard.jade delete mode 100755 web/views/viewTemplate.js diff --git a/README.md b/README.md index cfc4c92..4abe00a 100755 --- a/README.md +++ b/README.md @@ -64,6 +64,17 @@ a(href='newdashboard') 5) Go to APO/web and hit
`npm start` +If you find this error: +``` +events.js:72 + throw er; // Unhandled 'error' event + ^ +Error: listen EADDRINUSE + +``` +it means that the server is already running elsewhere, and you should stop it first. + + 6) Now you can go to your favorite browser and enter http://10.200.114.135:3000 and you should be able to see this: Image I diff --git a/web/routes/newdashboard.js b/web/routes/newdashboard.js deleted file mode 100755 index 70e2dd7..0000000 --- a/web/routes/newdashboard.js +++ /dev/null @@ -1,97 +0,0 @@ -var express = require('express'); -var mongodb = require('mongodb'); -var async = require('async'); -var router = express.Router(); - -router.get('/', function(req, res) { - - async.parallel([ - function(callback){ - var db = req.db; - var collection = db.collection('testing'); - collection.find().toArray(function(err,result){ - if (err){ - console.log(err); - callback(err); - } - else if (result.length){console.log("We've got results!");} - callback(null,result); - }); - }, - function(callback){ - var db = req.db; - var collection = db.collection('tablespacessco'); - collection.find().sort({timestamp:-1}).limit(1).toArray(function(err,result){ - - if (err){ - console.log(err); - callback(err); - } - else if (result.length){console.log("We've got a table!");} - else {console.log("no se encontro nada");} - callback(null,result); - }); - }, - - - function(callback){ - var db = req.db; - var collection = db.collection('datasize'); - collection.find().sort({date:-1}).limit(30).toArray(function(err,result){ - - if (err){ - console.log(err); - callback(err); - } - else if (result.length){console.log("We've got data ingested!");} - else {console.log("No results");} - callback(null,result); - }); - } - - - - ], - - - function(err,results){ - if (err){ - console.log(err); - return res.send(400); - } - data1 = results[0][0] - scotable = results[1][0]["data"] - dataingested = results[2] - - var chart1 = [] - - console.log(dataingested) - //handling the data comming from mongo - for (var i = dataingested.length-1;i>=0;i--) - { - var formatedResult = dataingested[i]; - var date = formatedResult["date"]; - var tar= formatedResult["tar"]; - var science = formatedResult["science"] - chart1.push({x:date, ytar:tar,yscience:science}); - - } - - - console.log(data1) - console.log(scotable) - console.log(chart1) - res.render('newdashboard', - { - data1:data1, - data2:scotable, - data3:chart1 - } - ) - //end function results - } - //end async - ); -}); -module.exports = router; - diff --git a/web/routes/routeTemplate.js b/web/routes/routeTemplate.js index e9c05ce..d8f9378 100755 --- a/web/routes/routeTemplate.js +++ b/web/routes/routeTemplate.js @@ -1,18 +1,11 @@ var express = require('express'); -var router = express.Router(); -var async = require('async'); var mongodb = require('mongodb'); -var http = require('http'); - - -/* GET home page. */ -router.get('/', function(req, res) -{ +var async = require('async'); +var router = express.Router(); - res.render('newdashboard'); +router.get('/', function(req, res) { + res.render('newdashboard'); }); - - - module.exports = router; + diff --git a/web/views/layout.jade b/web/views/layout.jade index 9785eb2..9f8d0d7 100755 --- a/web/views/layout.jade +++ b/web/views/layout.jade @@ -80,9 +80,9 @@ html a(href='map') i.fa.fa-map | Network Status - //a(href='newdashboard') - // i.fa.fa-pie-chart - // | New Dashboard + a(href='newdashboard') + i.fa.fa-pie-chart + | New Dashboard // /.sidebar // Right side column. Contains the navbar and content of the page diff --git a/web/views/newdashboard.jade b/web/views/newdashboard.jade deleted file mode 100755 index 54b6f02..0000000 --- a/web/views/newdashboard.jade +++ /dev/null @@ -1,138 +0,0 @@ -extends layout -block content - // Content Header (Page header) - section.content-header - h1 - | ALMA Monitoring - small General - ol.breadcrumb - li - a(href='#') - i.fa.fa-dashboard - | Template Dashboard - li.active Dashboard - // Main content - section.content - .row - .col-md-6 - .box.box-success - .box-header - i.fa.fa-exclamation - h3.box-title Success! - - .box-body - .alert.alert-success - i.fa.fa-check-circle - b New dashboard created! - | You are doing great - .row - .col-lg-4 - .box.box-solid.box-info - .box-header - h3.box-title My first widget - .box-body - .small-box.bg-green - .inner - - var myname = data1.servicename - - var mydata = data1.data - h3 - | #{myname} - h2 - | #{mydata} - - .icon - i.fa.fa-file-o - .col-lg-8 - .box.box-solid.box-info - .box-header - .pull-right.box-tools - button.btn.btn-info.btn-sm(data-widget='collapse',data-toggle='tooltip',title='Collapse') - i.fa.fa-minus - h3.box-title Data ingested last 30 days - .box-body.chart-responsive - #bar-chart1.chart(style='height: 140px;') - - - .row - .col-lg-12 - .box.box-solid.box-info - .box-header - h3.box-title My first Table - .box-body - table.table.table-bordered.table-hover - thead - tr - th Name - th MB Total - th Status - tbody - each key in data2 - td #{key.name} - td #{key.mbtotal} - td - - var status = key.status - if status == "ONLINE" - span.label.label-success Online - else - span.label.label-danger Danger - tr - - - - - -block javascript - // add new calendar event modal - // jQuery 2.0.2 - script(src='/js/libs/jquery.min.js') - // jQuery UI 1.10.3 - script(src='/js/jquery-ui-1.10.3.min.js', type='text/javascript') - // Bootstrap - script(src='/js/bootstrap.min.js', type='text/javascript') - // Morris.js charts - script(src='/js/libs/raphael-min.js') - script(src='/js/plugins/morris/morris.min.js', type='text/javascript') - // Sparkline - script(src='/js/plugins/sparkline/jquery.sparkline.min.js', type='text/javascript') - // jvectormap - script(src='/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js', type='text/javascript') - script(src='/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js', type='text/javascript') - // fullCalendar - script(src='/js/plugins/fullcalendar/fullcalendar.min.js', type='text/javascript') - // jQuery Knob Chart - script(src='/js/plugins/jqueryKnob/jquery.knob.js', type='text/javascript') - // fusionmaps - script(src='/js/plugins/fusioncharts/fusioncharts.js',type='text/javascript') - script(src='/js/plugins/fusioncharts/fusioncharts.maps.js',type='text/javascript') - script(src='/js/plugins/fusioncharts/themes/fusioncharts.theme.fint.js',type='text/javascript') - - - - - // Bootstrap WYSIHTML5 - script(src='/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js', type='text/javascript') - // iCheck - script(src='/js/plugins/iCheck/icheck.min.js', type='text/javascript') - // AdminLTE App - script(src='/js/AdminLTE/app.js', type='text/javascript') - // AdminLTE dashboard demo (This is only for demo purposes) - script(src='/js/AdminLTE/dashboard.js', type='text/javascript') - // AdminLTE for demo purposes - script(src='/js/AdminLTE/demo.js', type='text/javascript') - - script. - - console.log("This is a APOTEST - Template") - - - Morris.Bar({ - element: 'bar-chart1', - data: !{JSON.stringify(data3)}, - xkey: 'x', - ykeys: ['ytar','yscience'], - labels: ['TAR','Science'], - stacked: 'true', - hideHover: 'auto', - barColors: ["#0098ef", "#00a65a"] - }); - diff --git a/web/views/viewTemplate.js b/web/views/viewTemplate.js deleted file mode 100755 index b26707b..0000000 --- a/web/views/viewTemplate.js +++ /dev/null @@ -1,61 +0,0 @@ -extends layout -block content - // Content Header (Page header) - section.content-header - h1 - | ALMA Monitoring - small General - ol.breadcrumb - li - a(href='#') - i.fa.fa-dashboard - | Template Dashboard - li.active Dashboard - // Main content - section.content - .row - h1 New dashboard created! - - -block javascript - // add new calendar event modal - // jQuery 2.0.2 - script(src='/js/libs/jquery.min.js') - // jQuery UI 1.10.3 - script(src='/js/jquery-ui-1.10.3.min.js', type='text/javascript') - // Bootstrap - script(src='/js/bootstrap.min.js', type='text/javascript') - // Morris.js charts - script(src='/js/libs/raphael-min.js') - script(src='/js/plugins/morris/morris.min.js', type='text/javascript') - // Sparkline - script(src='/js/plugins/sparkline/jquery.sparkline.min.js', type='text/javascript') - // jvectormap - script(src='/js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js', type='text/javascript') - script(src='/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js', type='text/javascript') - // fullCalendar - script(src='/js/plugins/fullcalendar/fullcalendar.min.js', type='text/javascript') - // jQuery Knob Chart - script(src='/js/plugins/jqueryKnob/jquery.knob.js', type='text/javascript') - // fusionmaps - script(src='/js/plugins/fusioncharts/fusioncharts.js',type='text/javascript') - script(src='/js/plugins/fusioncharts/fusioncharts.maps.js',type='text/javascript') - script(src='/js/plugins/fusioncharts/themes/fusioncharts.theme.fint.js',type='text/javascript') - - - - - // Bootstrap WYSIHTML5 - script(src='/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js', type='text/javascript') - // iCheck - script(src='/js/plugins/iCheck/icheck.min.js', type='text/javascript') - // AdminLTE App - script(src='/js/AdminLTE/app.js', type='text/javascript') - // AdminLTE dashboard demo (This is only for demo purposes) - script(src='/js/AdminLTE/dashboard.js', type='text/javascript') - // AdminLTE for demo purposes - script(src='/js/AdminLTE/demo.js', type='text/javascript') - - script. - - console.log("This is a APOTEST - Template")