Started getting website working with new API data
This commit is contained in:
@@ -53,6 +53,8 @@ app.use bodyParser.urlencoded
|
||||
extended: true
|
||||
|
||||
app.use express.static path.join __dirname, 'public'
|
||||
app.use '/bower_components', express.static __dirname + '/bower_components'
|
||||
app.use '/node_modules', express.static __dirname + '/node_modules'
|
||||
|
||||
# /**
|
||||
# * Routes
|
||||
@@ -65,8 +67,9 @@ angular = (req, res) ->
|
||||
app.get '/json/all/:date', json.allCards
|
||||
app.get '/json/page/:date/:page/:numPerPage', json.filePage
|
||||
app.get '/json/count/:date', json.countDateFiles
|
||||
app.get '/json/latest/:num', json.cardLatestX
|
||||
app.get '/json/latestCard/:num', json.latestCardData
|
||||
app.get '/json/latestCard', json.latestCardData
|
||||
app.get '/json/latest/:num', json.cardLatestX
|
||||
app.get '/json/latest', json.cardLatestX
|
||||
app.get '/json/all', json.allDates
|
||||
app.get '/json/between/:start/:end', json.findBetweenDateTime
|
||||
|
||||
@@ -186,7 +186,7 @@ wellCtrls.factory('json',function($q, $http, $log){
|
||||
var deferred = $q.defer();
|
||||
$http.get('/json/totals').success(function(data) {
|
||||
var totalRet = {};
|
||||
var vals = data.totals.values;
|
||||
var vals = data.totals;
|
||||
i=0;
|
||||
while (i < vals.length){
|
||||
totalRet[vals[i].name] = vals[i].value;
|
||||
@@ -600,15 +600,15 @@ wellCtrls.controller('dashboardCtrl', function($scope, $route, $http, $routePara
|
||||
});
|
||||
$scope.dashboard = function() {
|
||||
$http.get('/json/latestCard').success(function(cData) {
|
||||
$scope.cardData = cData.card_data;
|
||||
$scope.cardData = cData.card_data[0];
|
||||
//$scope.cardData.dateTime = new Date($scope.cardData.localtime.replace(" ","T"));
|
||||
|
||||
$scope.surface = cData.card_data.Surface_Position.map(function(a, i){
|
||||
return {position:cData.card_data.Surface_Position[i], load:cData.card_data.Surface_Load[i]};
|
||||
$scope.surface = cData.card_data[0].Surface_Position.map(function(a, i){
|
||||
return {position:cData.card_data[0].Surface_Position[i], load:cData.card_data[0].Surface_Load[i]};
|
||||
});
|
||||
$scope.surface.push($scope.surface[0]);
|
||||
$scope.downhole = cData.card_data.Downhole_Position.map(function(a, i){
|
||||
return {position:cData.card_data.Downhole_Position[i], load:cData.card_data.Downhole_Load[i]};
|
||||
$scope.downhole = cData.card_data[0].Downhole_Position.map(function(a, i){
|
||||
return {position:cData.card_data[0].Downhole_Position[i], load:cData.card_data[0].Downhole_Load[i]};
|
||||
});
|
||||
$scope.downhole.push($scope.downhole[0]);
|
||||
var limits = {
|
||||
@@ -620,6 +620,10 @@ wellCtrls.controller('dashboardCtrl', function($scope, $route, $http, $routePara
|
||||
dMinLoad: $scope.downhole.map(function(x){return x.load;}).reduce(function(y,z){return Math.min(y,z);})- 2000,
|
||||
};
|
||||
$scope.limits = limits;
|
||||
$scope.card_graph_data = {
|
||||
surface: $scope.surface,
|
||||
downhole: $scope.downhole
|
||||
}
|
||||
|
||||
$scope.surfaceOptions = {
|
||||
axes: {
|
||||
@@ -642,12 +646,14 @@ wellCtrls.controller('dashboardCtrl', function($scope, $route, $http, $routePara
|
||||
},
|
||||
series: [
|
||||
{
|
||||
y: 'load',
|
||||
color: 'steelblue',
|
||||
thickness: '2px',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Surface Card'
|
||||
axis:"y",
|
||||
key: 'load',
|
||||
dataset: 'surface',
|
||||
color: 'steelblue',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Surface Card',
|
||||
id: "surfaceCard"
|
||||
}
|
||||
],
|
||||
lineMode: 'linear',
|
||||
@@ -683,12 +689,14 @@ wellCtrls.controller('dashboardCtrl', function($scope, $route, $http, $routePara
|
||||
},
|
||||
series: [
|
||||
{
|
||||
y: 'load',
|
||||
color: 'steelblue',
|
||||
thickness: '2px',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Downhole Card'
|
||||
axis:"y",
|
||||
key: 'load',
|
||||
dataset: 'downhole',
|
||||
color: 'steelblue',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Downhole Card',
|
||||
id: "downholeCard"
|
||||
}
|
||||
],
|
||||
lineMode: 'linear',
|
||||
@@ -703,8 +711,6 @@ wellCtrls.controller('dashboardCtrl', function($scope, $route, $http, $routePara
|
||||
drawDots: true,
|
||||
columnsHGap: 5
|
||||
};
|
||||
$scope.surfaceData = $scope.surface;
|
||||
$scope.downholeData = $scope.downhole;
|
||||
});
|
||||
|
||||
var statusMap = {
|
||||
@@ -719,10 +725,7 @@ wellCtrls.controller('dashboardCtrl', function($scope, $route, $http, $routePara
|
||||
};
|
||||
$http.get('/json/status/').success(function(data) {
|
||||
$scope.wellStatus = statusMap[parseInt(data.status)];
|
||||
var sDt = data.date.split('_');
|
||||
$scope.statusDate = dateConversion(sDt[[0]]);
|
||||
$scope.statusTime = sDt[1].slice(0, 2) + ':' + sDt[1].slice(2, 4) + ':' + sDt[1].slice(4, 6);
|
||||
$scope.statusISO = data.ISOdate;
|
||||
var sDt = new Date(data.date);
|
||||
});
|
||||
var getTotals = json.getTotals();
|
||||
getTotals.then(function(data){
|
||||
@@ -803,6 +806,10 @@ wellCtrls.controller('cardDataCtrl', function($scope, $http, $routeParams, json,
|
||||
dMinLoad: $scope.downhole.map(function(x){return x.load;}).reduce(function(y,z){return Math.min(y,z);})- 2000,
|
||||
};
|
||||
$scope.limits = limits;
|
||||
$scope.card_graph_data = {
|
||||
surface: $scope.surface,
|
||||
downhole: $scope.downhole
|
||||
}
|
||||
|
||||
$scope.surfaceOptions = {
|
||||
axes: {
|
||||
@@ -813,24 +820,24 @@ wellCtrls.controller('cardDataCtrl', function($scope, $http, $routeParams, json,
|
||||
},
|
||||
type: 'linear',
|
||||
min: limits.sMinPos,
|
||||
max: limits.sMaxPos,
|
||||
ticks: 7
|
||||
max: limits.sMaxPos
|
||||
},
|
||||
y: {
|
||||
type: 'linear',
|
||||
min: limits.sMinLoad,
|
||||
max: limits.sMaxLoad,
|
||||
ticks: 5
|
||||
max: limits.sMaxLoad
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
y: 'load',
|
||||
axis:"y",
|
||||
key: 'load',
|
||||
dataset: 'surface',
|
||||
color: 'steelblue',
|
||||
thickness: '2px',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Surface Card'
|
||||
label: 'Surface Card',
|
||||
id: "surfaceCard"
|
||||
}
|
||||
],
|
||||
lineMode: 'linear',
|
||||
@@ -840,10 +847,7 @@ wellCtrls.controller('cardDataCtrl', function($scope, $http, $routeParams, json,
|
||||
formatter: function(x, y, series) {
|
||||
return 'Position: ' + x + ' in., Load: ' + y + ' lb.';
|
||||
}
|
||||
},
|
||||
drawLegend: true,
|
||||
drawDots: true,
|
||||
columnsHGap: 5
|
||||
}
|
||||
};
|
||||
$scope.downholeOptions = {
|
||||
axes: {
|
||||
@@ -866,12 +870,14 @@ wellCtrls.controller('cardDataCtrl', function($scope, $http, $routeParams, json,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
y: 'load',
|
||||
color: 'steelblue',
|
||||
thickness: '2px',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Downhole Card'
|
||||
axis:"y",
|
||||
key: 'load',
|
||||
dataset: 'downhole',
|
||||
color: 'steelblue',
|
||||
type: 'area',
|
||||
striped: true,
|
||||
label: 'Downhole Card',
|
||||
id: "downholeCard"
|
||||
}
|
||||
],
|
||||
lineMode: 'linear',
|
||||
@@ -886,8 +892,6 @@ wellCtrls.controller('cardDataCtrl', function($scope, $http, $routeParams, json,
|
||||
drawDots: true,
|
||||
columnsHGap: 5
|
||||
};
|
||||
$scope.surfaceData = $scope.surface;
|
||||
$scope.downholeData = $scope.downhole;
|
||||
$scope.loading = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,12 +88,16 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h1>Surface Card</h1>
|
||||
<linechart data="surfaceData" options="surfaceOptions" mode="" width="" height="500"></linechart>
|
||||
<div class="surfaceCard" style="height:500px">
|
||||
<linechart data="card_graph_data" options="surfaceOptions"></linechart>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<h1>Downhole Card</h1>
|
||||
<linechart data="downholeData" options="downholeOptions" mode="" width="" height="500"></linechart>
|
||||
<div class="downholeCard" style="height:500px">
|
||||
<linechart data="card_graph_data" options="downholeOptions"></linechart>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -104,13 +104,18 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h1>Surface Card</h1>
|
||||
<linechart data="surfaceData" options="surfaceOptions" mode="" width="" height="500"></linechart>
|
||||
<h1>Surface Card</h1>
|
||||
<div class="surfaceCard" style="height:500px">
|
||||
<linechart data="card_graph_data" options="surfaceOptions"></linechart>
|
||||
</div>
|
||||
<pre>{{cardData}}</pre>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<h1>Downhole Card</h1>
|
||||
<linechart data="downholeData" options="downholeOptions" mode="" width="" height="500"></linechart>
|
||||
<h1>Downhole Card</h1>
|
||||
<div class="downholeCard" style="height:500px">
|
||||
<linechart data="card_graph_data" options="downholeOptions"></linechart>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,35 +7,45 @@ wellSite.config [
|
||||
($routeProvider) ->
|
||||
$routeProvider.when('/dashboard',
|
||||
templateUrl: '/partials/dashboard.html'
|
||||
controller: 'dashboardCtrl').when('/files/id/:date/:card_id',
|
||||
controller: 'dashboardCtrl')
|
||||
.when('/files/id/:date/:card_id',
|
||||
templateUrl: '/partials/cardOverview.html'
|
||||
controller: 'cardIDCtrl').when('/files/compare',
|
||||
controller: 'cardIDCtrl')
|
||||
.when('/files/compare',
|
||||
templateUrl: '/partials/cardCompare.html'
|
||||
controller: 'cardCompareCtrl').when('/files/:date/:file/overview',
|
||||
controller: 'cardCompareCtrl')
|
||||
.when('/files/:date/:file/overview',
|
||||
templateUrl: '/partials/cardOverview.html'
|
||||
controller: 'cardDataCtrl').when('/files/:date/:file/data',
|
||||
controller: 'cardDataCtrl')
|
||||
.when('/files/:date/:file/data',
|
||||
templateUrl: '/partials/cardData.html'
|
||||
controller: 'cardDataCtrl').when('/files/:date/:file/cards',
|
||||
controller: 'cardDataCtrl')
|
||||
.when('/files/:date/:file/cards',
|
||||
templateUrl: '/partials/cardCards.html'
|
||||
controller: 'cardDataCtrl').when('/files/:date/:file',
|
||||
controller: 'cardDataCtrl')
|
||||
.when('/files/:date/:file',
|
||||
templateUrl: '/partials/cardOverview.html'
|
||||
controller: 'cardDataCtrl').when('/files/:date',
|
||||
controller: 'cardDataCtrl')
|
||||
.when('/files/:date',
|
||||
templateUrl: '/partials/fileList.html'
|
||||
controller: 'fileListPreviousCtrl').when('/files',
|
||||
controller: 'fileListPreviousCtrl')
|
||||
.when('/files',
|
||||
templateUrl: '/partials/fileList.html'
|
||||
controller: 'fileListTodayCtrl').when('/gaugeOff',
|
||||
controller: 'fileListTodayCtrl')
|
||||
.when('/gaugeOff',
|
||||
templateUrl: '/partials/gaugeOff.html'
|
||||
controller: 'gaugeOffCtrl').when('/wellTest',
|
||||
controller: 'gaugeOffCtrl')
|
||||
.when('/wellTest',
|
||||
templateUrl: '/partials/wellTest.html'
|
||||
controller: 'wellTestCtrl').when('/events',
|
||||
controller: 'wellTestCtrl')
|
||||
.when('/events',
|
||||
templateUrl: '/partials/eventList.html'
|
||||
controller: 'eventsCtrl').when('/setup',
|
||||
controller: 'eventsCtrl')
|
||||
.when('/setup',
|
||||
templateUrl: '/partials/setup.html'
|
||||
controller: 'setupCtrl').when '/',
|
||||
controller: 'setupCtrl')
|
||||
.when '/',
|
||||
templateUrl: '/partials/dashboard.html'
|
||||
controller: 'dashboardCtrl'
|
||||
return
|
||||
]
|
||||
|
||||
# ---
|
||||
# generated by js2coffee 2.1.0
|
||||
|
||||
@@ -237,6 +237,7 @@ exports.latestCardData = (req, res) ->
|
||||
db.serialize () ->
|
||||
query = db.prepare "SELECT * FROM card_history WHERE id > ((SELECT MAX(id) FROM card_history) - ?)"
|
||||
query.all numCards, (err, rows) ->
|
||||
query.finalize()
|
||||
db.close()
|
||||
if err
|
||||
console.log err
|
||||
|
||||
@@ -4,24 +4,27 @@
|
||||
<title>POConsole: {{ Page.title() }}</title>
|
||||
<meta http-equiv="content-type" context="text/html"; charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel='stylesheet' href='/css/bootstrap.css'>
|
||||
<link rel='stylesheet' href='/css/animate.css'>
|
||||
<link rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.min.css'>
|
||||
<link rel='stylesheet' href='/bower_components/angular-animate-css/build/nga.min.css'>
|
||||
|
||||
<script src='/js/angular.min.js'></script>
|
||||
<script src='/js/angular-route.min.js'></script>
|
||||
<script src='/js/angular-animate.min.js'></script>
|
||||
<script src="/js/ui-bootstrap-0.12.0.min.js"></script>
|
||||
<script src="/js/ui-bootstrap-tpls-0.12.0.js"></script>
|
||||
<!-- <script src='/js/ng-socket-io.min.js'></script> -->
|
||||
<script src='/js/raphael-2.1.4.min.js'></script>
|
||||
<script src='/js/justgage-1.1.0.min.js'></script>
|
||||
<script src='/js/ng-justgage.js'></script>
|
||||
<script src="/js/d3.js"></script>
|
||||
<script src="/js/line-chart.min.js"></script>
|
||||
<!-- <script type='text/javascript' src='/socket.io/socket.io.js'></script> -->
|
||||
<script src='/bower_components/angular/angular.min.js'></script>
|
||||
<script src='/bower_components/angular-route/angular-route.min.js'></script>
|
||||
<script src='/bower_components/angular-animate/angular-animate.min.js'></script>
|
||||
<script src="/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
|
||||
<script src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
|
||||
<script src='/bower_components/raphael/raphael-min.js'></script>
|
||||
<script src='/bower_components/justgage-toorshia/justgage.js'></script>
|
||||
<script src='/bower_components/angular-justgage/ng-justgage.js'></script>
|
||||
<script src="/node_modules/n3-charts/node_modules/d3/d3.min.js"></script>
|
||||
<script src="/node_modules/n3-charts/build/LineChart.js"></script>
|
||||
|
||||
<script src='/js/jquery-1.11.1.min.js'></script>
|
||||
<script src='/js/bootstrap.js'></script>
|
||||
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
|
||||
<script src='/bower_components/bootstrap/dist/js/bootstrap.js'></script>
|
||||
|
||||
<link rel="stylesheet" href="/bower_components/font-awesome/css/font-awesome.min.css">
|
||||
<script src="/bower_components/ngQuickDate/dist/ng-quick-date.min.js"></script>
|
||||
<link rel="stylesheet" href="/bower_components/ngQuickDate/dist/ng-quick-date.css">
|
||||
<link rel="stylesheet" href="/bower_components/ngQuickDate/dist/ng-quick-date-default-theme.css">
|
||||
|
||||
<script src="/js/router.js"></script>
|
||||
<script src="/js/controllers.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user