-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of proof of concept for admin page:
-added new html page + javascript -used jquery to fetch list of servos from bellhouse -modified gulpfile to support browserifying of multiple js files -updated package.json with required dependencies
- Loading branch information
Pablo Toledo
committed
Jun 1, 2017
1 parent
5455271
commit ea502b4
Showing
6 changed files
with
180 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
"description": "EUPORIAS - ceramic bell project - video stream sampler", | ||
"author": "tpowellmeto <[email protected]>", | ||
"main": "src/js/main.js", | ||
"setup": "src/js/setup.js", | ||
"engines": { | ||
"node": ">=7.9.0" | ||
}, | ||
|
@@ -17,12 +18,16 @@ | |
"browser-sync": "^2.14.0", | ||
"browserify": "^13.1.0", | ||
"del": "^2.2.1", | ||
"event-stream": "^3.3.4", | ||
"glob": "^7.1.2", | ||
"gulp": "^3.9.1", | ||
"gulp-htmlmin": "^2.0.0", | ||
"gulp-rename": "1.2.2", | ||
"gulp-sass": "^2.3.2", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-uglify": "^2.0.0", | ||
"gulp-util": "^3.0.7", | ||
"jquery": "^3.2.1", | ||
"minimatch": "^3.0.3", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>EUPORIAS :: Ceramic Bell Project :: Setup</title> | ||
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css"> | ||
<link type="text/css" rel="stylesheet" href="css/styles.css"/> | ||
<script src="https://use.fontawesome.com/3c353addfa.js"></script> | ||
</head> | ||
<body> | ||
<div id="header" class="pure-g"> | ||
<div class="pure-u-1-2"> | ||
<img src="./images/bellhouse.png" class="pure-img"/> | ||
</div> | ||
<div class="pure-u-1-2"> | ||
<div> | ||
<label>Setup Page</label> | ||
</div> | ||
</div> | ||
</div> | ||
<div id="controls" class="pure-g"> | ||
<form class="pure-form pure-u-1-1"> | ||
<label>Add Bells | ||
<input id="bell-count" type="number" step="any" value="1" min="0" max="32"/> | ||
</label> | ||
<button id="add-bells-button" type="button"><i class="fa fa-plus" aria-hidden="true"></i> Add </button> | ||
<button id="reset-bells-button" type="button"><i class="fa fa-remove" aria-hidden="true"></i> Reset </button> | ||
<button id="home-button" type="button"><i class="fa fa-check" aria-hidden="true"></i> Done </button> | ||
</form> | ||
</div> | ||
<div id="servos"> | ||
</div> | ||
|
||
<script src="js/setup.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
const CAMERA_FRAME_RATE = 1000 / 20; | ||
const BELL_SERVER = "http://192.168.1.83:5000"; | ||
|
||
var $ = require("jquery"); | ||
var request = require('request'); | ||
|
||
/*Setup event listeners for controls on setup page */ | ||
initSetupPage(); | ||
|
||
|
||
|
||
/*Setup event listeners for controls on bell setup page*/ | ||
function initSetupPage(){ | ||
var homeButton = document.getElementById('home-button'); | ||
|
||
homeButton.addEventListener('click', function(evt) { | ||
console.log('Clicked done'); | ||
window.location.href="index.html" | ||
}); | ||
|
||
getServos(); | ||
|
||
} | ||
|
||
function getServos() { | ||
var servos = document.getElementById('servos'); | ||
$.ajax({ | ||
url: 'http://bellhouse.eu.ngrok.io/servos', | ||
method: 'GET' | ||
}).then(function(response) { | ||
console.log("got a response"); | ||
$.each(response, function(i, resultset){ | ||
console.log(i + ": " + resultset); | ||
$.each(resultset, function(i, result){ | ||
console.log(i + ": " + result); | ||
var listItem = document.createElement("li"); | ||
var listItemText = document.createTextNode("id: " + result.id + ", rotate by degrees: " + result.rotate_to_deg); | ||
listItem.appendChild(listItemText); | ||
servos.appendChild(listItem); | ||
}); | ||
}); | ||
}); | ||
}; |