diff --git a/Website/Views/Home/Index.cshtml b/Website/Views/Home/Index.cshtml
index 975fe7d..89aef55 100644
--- a/Website/Views/Home/Index.cshtml
+++ b/Website/Views/Home/Index.cshtml
@@ -1,6 +1,6 @@
@{
- ViewData["Title"] = "Home Page";
+ ViewData["Title"] = "Home";
}
-
Hi, I'm Rob. I'm a software developer. I primarily work with C# in my professional life, but my home projects are often PHP and Python based.
+
+
+
+ The following errors were encountered:
+
+ Please rectify them and try again.
+
+
+
@RenderSection("ButtonsLeft", required: false)
+
@RenderSection("ButtonsRight", required: false)
+
+ Loading chart...
\ No newline at end of file
diff --git a/Website/wwwroot/js/javascript.js b/Website/wwwroot/js/javascript.js
new file mode 100644
index 0000000..2ce34f5
--- /dev/null
+++ b/Website/wwwroot/js/javascript.js
@@ -0,0 +1,145 @@
+function Navigate(url) {
+ window.location = url;
+}
+
+function CreateCookie(name, value, days) {
+ var expires;
+ if (days) {
+ var date = new Date();
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ expires = "; expires=" + date.toGMTString();
+ }
+ else {
+ expires = "";
+ }
+ document.cookie = name + "=" + value + expires + "; path=/";
+}
+
+function round(value, decimals) {
+ return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
+}
+
+function isNumber(value){
+ return isFinite(String(value));
+}
+
+String.prototype.upperCaseFirst = function() {
+ var lower = this.toLowerCase();
+ return lower.charAt(0).toUpperCase() + lower.slice(1);
+};
+
+function twoDigitZeroPad(input){
+ input=input.toString();
+ return [!input[1] && '0' || "", input].join('');
+}
+
+Date.prototype.oldToString = Date.prototype.toString;
+Date.prototype.toString = function(format) {
+ if (!format)
+ return this.oldToString();
+ var me=this;
+ return format.replace(/./g, function(match) {
+ switch(match){
+ case 'd': return twoDigitZeroPad(me.getDate());
+ case 'm': return twoDigitZeroPad(me.getMonth()+1);
+ case 'y': return me.getFullYear();
+ case "H": return twoDigitZeroPad(me.getHours());
+ case "i": return twoDigitZeroPad(me.getMinutes());
+ case "s": return twoDigitZeroPad(me.getSeconds());
+ default: return match;
+ }
+ });
+};
+
+Number.prototype.oldToString=Number.prototype.toString;
+Number.prototype.toString=function(input, shouldRound){
+ if (!shouldRound)
+ return this.oldToString(input);
+
+ return round(this, input);
+};
+
+$(function() {
+ var panels = $("nav > dl > .sub-pages");
+ var goIndicators = $("nav > dl > dt .go");
+ var expandIndicators = $("nav > dl > dt .expand");
+ panels.hide();
+ expandIndicators.show();
+
+ $("nav > dl > dt").click(function(e) {
+ var next = $(this).next();
+ if (!next.hasClass("sub-pages")) {
+ Navigate($(this).children("a").attr("href"));
+ return;
+ }
+ panels.slideUp();
+ goIndicators.hide();
+ expandIndicators.show();
+ if (next.is(":visible")) {
+ return;
+ }
+ next.slideDown();
+ $(this).children(".go").show();
+ $(this).children(".expand").hide();
+ });
+
+ $("nav dd").click(function(e) {
+ Navigate($(this).children("a").attr("href"));
+ });
+
+ $("nav a").click(function(e) {
+ $(this).parent().click();
+ return false;
+ });
+
+ $("#body").css("padding-bottom", window.innerHeight - $("#buttons-right").offset().top);
+
+ $("form[ajaxForm]").submit(function(e) {
+ e.preventDefault();
+ form = $(this);
+ $.ajax({
+ url: form.attr("action"),
+ method: form.attr("method"),
+ data: form.serialize(),
+ success: function(data) {
+ var successFunction = form.attr("onsuccess");
+ if (successFunction !== undefined && window[successFunction] !== undefined)
+ window[successFunction](data);
+ },
+ error: function() {
+ var errorFunction = form.attr("onerror");
+ if (errorFunction !== undefined && window[errorFunction] !== undefined)
+ window[errorFunction]();
+ },
+ });
+ var postFunction = form.attr("onpost");
+ if (postFunction !== undefined && window[postFunction] !== undefined)
+ window[postFunction]();
+ });
+
+ $("td").each(function() {
+ var elem = $(this);
+ if (/^[+-]?\d+(\.\d+)?$/.test(elem.text())) {
+ elem.addClass("number");
+ }
+ });
+});
+
+$(document).delegate('.allowTabInput', 'keydown', function(e) {
+ var keyCode = e.keyCode || e.which;
+ console.log(e);
+ if (keyCode == 9) {
+ e.preventDefault();
+ var start = $(this).get(0).selectionStart;
+ var end = $(this).get(0).selectionEnd;
+
+ // set textarea value to: text before caret + tab + text after caret
+ $(this).val($(this).val().substring(0, start)
+ + "\t"
+ + $(this).val().substring(end));
+
+ // put caret at right position again
+ $(this).get(0).selectionStart =
+ $(this).get(0).selectionEnd = start + 1;
+ }
+});
\ No newline at end of file
diff --git a/Website/wwwroot/js/services/statusService.js b/Website/wwwroot/js/services/statusService.js
new file mode 100644
index 0000000..d5bcc32
--- /dev/null
+++ b/Website/wwwroot/js/services/statusService.js
@@ -0,0 +1,60 @@
+angular.module("robware").service('statusService', ["$http", function($http) {
+ function parseProcessData(data) {
+ var headers = data.shift();
+ var cpuIndex = -1;
+ var ignoreColNames = ["user", "pid", "vsz", "rss", "tty", "stat"];
+ var ignoreCols = [];
+
+ var processHeaders = []
+ for (var col in headers) {
+ if (headers[col].toLowerCase() === "%cpu")
+ cpuIndex = col;
+
+ if (ignoreColNames.indexOf(headers[col].toLowerCase()) > -1)
+ ignoreCols.push(col);
+ else
+ processHeaders.push(headers[col]);
+ }
+
+ data.sort(function (a, b) {
+ cpuA = parseFloat(a[cpuIndex]);
+ cpuB = parseFloat(b[cpuIndex]);
+ if (cpuA > cpuB)
+ return -1;
+ if (cpuA < cpuB)
+ return 1
+ return 0;
+ });
+
+ var processData = [];
+ for (var row in data) {
+ var obj = {};
+ for (var col in data[row]) {
+ if (ignoreCols.indexOf(col) === -1)
+ obj[headers[col]] = data[row][col];
+ }
+ processData.push(obj);
+ }
+
+ return [processHeaders, processData];
+ }
+
+ this.getProcesses = function() {
+ return $http.get('/status/getprocesses').then(function(response) {
+ parsedData = parseProcessData(response.data);
+ return {headers: parsedData[0], data: parsedData[1]};
+ });
+ };
+
+ this.getSystemInfo=function(){
+ return $http.get('/status/getsysteminfo').then(function(response){
+ return response.data;
+ });
+ };
+
+ this.getUptime=function(){
+ return $http.get('/status/getuptime').then(function(response){
+ return response.data;
+ })
+ };
+}]);
\ No newline at end of file
diff --git a/Website/wwwroot/js/services/temperatureService.js b/Website/wwwroot/js/services/temperatureService.js
new file mode 100644
index 0000000..5f5d2a0
--- /dev/null
+++ b/Website/wwwroot/js/services/temperatureService.js
@@ -0,0 +1,13 @@
+angular.module("robware").service('temperatureService', ["$http", function($http) {
+ this.getReadings = function() {
+ return $http.get('/temperature/getreadings', {dontShowSpinner:true}).then(function(response) {
+ return response.data;
+ });
+ };
+
+ this.getCurrentTemperatureData = function() {
+ return $http.get("/temperature/GetTemperatureData", {dontShowSpinner:true}).then(function(response) {
+ return response.data;
+ });
+ }
+}]);
\ No newline at end of file
diff --git a/Website/wwwroot/js/services/weightService.js b/Website/wwwroot/js/services/weightService.js
new file mode 100644
index 0000000..27d810b
--- /dev/null
+++ b/Website/wwwroot/js/services/weightService.js
@@ -0,0 +1,31 @@
+angular.module("robware").service('weightService', ["$http", function($http) {
+ this.addWeight=function(weight, fat){
+ return $http({
+ method:'post',
+ url:'/weight/add',
+ data:{weight:weight, fat:fat},
+ showSpinner:true
+ }).then(function(response){
+ return response.data;
+ });
+ };
+ this.deleteWeight=function(id){
+ return $http({
+ method:'post',
+ url:'/weight/delete',
+ data:{id:id},
+ showSpinner:true
+ }).then(function(response){
+ return response.data;
+ });
+ };
+ this.getReadings=function(){
+ return $http({
+ method:'post',
+ url:'/weight/getreadings',
+ showSpinner:true
+ }).then(function(response){
+ return response.data;
+ });
+ };
+}]);
\ No newline at end of file
diff --git a/Website/wwwroot/js/site.js b/Website/wwwroot/js/site.js
deleted file mode 100644
index b2f58e1..0000000
--- a/Website/wwwroot/js/site.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
-// for details on configuring this project to bundle and minify static web assets.
-
-// Write your JavaScript code.