more df, ui works

This commit is contained in:
Tommy Parnell
2017-01-11 22:15:11 -05:00
parent 8d738fe39d
commit 9d981341c0
8 changed files with 54 additions and 15 deletions

View File

@@ -3,10 +3,10 @@ FROM microsoft/dotnet:1.1.0-sdk-projectjson
WORKDIR /dotnetapp
# copy project.json and restore as distinct layers
COPY project.json .
ADD project.json .
RUN dotnet restore
# copy and build everything else
COPY . .
ADD . .
RUN dotnet build -C Release
ENTRYPOINT ["dotnet", "run", "-C", "Release"]

9
store/Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM ruby:alpine
RUN apk add --update build-base
RUN gem install bundle
RUN gem install thin
ADD Gemfile .
RUN bundle
ADD . .
CMD ["bundle", "exec", "thin", "start"]
EXPOSE 80

View File

@@ -1,3 +1,3 @@
source "https://rubygems.org"
gem 'sinatra'
gem 'nokogiri'
gem 'nokogiri'

10
ui/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM node:boron-wheezy
RUN npm install -g bower
ADD package.json .
RUN npm install
ADD bower.json
RUN bower install
ADD . .
EXPOSE 3000
CMD ["npm", "run", "start"]

View File

@@ -8,6 +8,8 @@
],
"dependencies": {
"rickshaw": "^1.6.0",
"jquery": "^3.1.1"
"jquery": "^3.1.1",
"underscore": "^1.8.3",
"moment": "^2.17.1"
}
}

View File

@@ -11,12 +11,13 @@
"test:integration": "mocha --recursive test/integration"
},
"dependencies": {
"express": "^4.13.3",
"serve-favicon": "^2.3.0",
"morgan": "^1.6.1",
"cookie-parser": "^1.3.3",
"body-parser": "^1.13.3",
"ejs": "^2.3.1"
"cookie-parser": "^1.3.3",
"ejs": "^2.3.1",
"express": "^4.13.3",
"morgan": "^1.6.1",
"request": "^2.79.0",
"serve-favicon": "^2.3.0"
},
"devDependencies": {
"chai": "^3.5.0",

View File

@@ -1,5 +1,6 @@
var express = require('express');
var router = express.Router();
var request = require('request');
/* GET home page. */
@@ -7,4 +8,15 @@ router.get('/', function(req, res) {
res.render('index', { title: 'Express' });
});
router.get('/db', (req, res)=>{
// request('http://store/', function (error, response, body) {
// if (!error && response.statusCode == 200) {
// console.log(body) // Show the HTML for the Google homepage.
// }
// res.set('Content-Type', 'application/json');
// return res.send(200, body);
// })
res.json([ { date: '2017-01-01 10:01', value: 20 }, { date: '2017-01-01 11:00', value: 60 }]);
});
module.exports = router;

View File

@@ -8,7 +8,7 @@
<script src="/components/d3/d3.min.js"></script>
<script src="/components/rickshaw/rickshaw.min.js"></script>
<script src="/components/underscore/underscore-min.js"></script>
<script src="/components/jquery/jquery.min.js"></script>
<script src="/components/jquery/dist/jquery.min.js"></script>
<script>
var data = []
var graph = new Rickshaw.Graph({
@@ -16,7 +16,6 @@
renderer: 'line',
series: [{
data: data,
//data: [ { x: parseInt(moment.utc('2017-01-01 10:01').format('X')), y: 20 }, { x: parseInt(moment.utc('2017-01-01 11:00').format('X')), y: 60 }],
color: 'steelblue'
}]
});
@@ -25,10 +24,10 @@ var yAxis = new Rickshaw.Graph.Axis.Y({
tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
ticksTreatment: "glow"
});
var addData = function(){
var addData = function(apiData){
data.length = 0
calculatedData = _.chain(sampleData)
calculatedData = _.chain(apiData)
.map(function(data){
return {x: parseInt(moment.utc(data.date).format('x')), y: data.value}
})
@@ -36,12 +35,18 @@ var addData = function(){
_.each(calculatedData, function(item){data.push(item)});
graph.update();
}
};
var updateData = function(){
$.ajax('/db', {
dataType: 'json',
success: addData
});
};
new Rickshaw.Graph.Axis.Time({
graph: graph
});
graph.render();
setInterval(updateData, 1000);
</script>
<% include footer %>