summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoderick142017-06-25 19:52:21 +0530
committercoderick142017-06-25 19:52:21 +0530
commit616886d5075802d043a8a0a6f141dd537d76c8b3 (patch)
tree1b04ef0de9e983769b663251b241460fed4dd2ac
parent7f86af60ad1ae0aa2d4e4f5b42d5a3c7a47bd170 (diff)
downloadSBHS-2018-Rpi-616886d5075802d043a8a0a6f141dd537d76c8b3.tar.gz
SBHS-2018-Rpi-616886d5075802d043a8a0a6f141dd537d76c8b3.tar.bz2
SBHS-2018-Rpi-616886d5075802d043a8a0a6f141dd537d76c8b3.zip
Change BASE_URL and fix logging format in admin panel
-rw-r--r--templates/admin/changeMID.html63
-rw-r--r--templates/admin/index.html2
-rw-r--r--templates/admin/testexp.html8
3 files changed, 38 insertions, 35 deletions
diff --git a/templates/admin/changeMID.html b/templates/admin/changeMID.html
index 721a6b8..a2ca257 100644
--- a/templates/admin/changeMID.html
+++ b/templates/admin/changeMID.html
@@ -17,8 +17,8 @@
<select id="mid">
{% for mid in mid_count %}
- <option id = "{{ mid.board_id }}">
- {{ mid.board__mid }}-{{mid.mcount}}
+ <option id = "{{ mid.2 }}">
+ {{ mid.0 }}-{{mid.1}}
</option>
{% endfor %}
</select>
@@ -30,43 +30,42 @@
<script type="text/javascript">
function updateMID() {
- $("#update-btn").prop('disabled',true);
- var BASE_URL = window.location.origin;
- var username = $("#username").val();
- var board_id = $("#mid").children(":selected").attr("id");
+ $("#update-btn").prop('disabled',true);
+ var BASE_URL = window.location.origin + "/sbhs";
+ var username = $("#username").val();
+ var board_id = $("#mid").children(":selected").attr("id");
+
+ if(username == "")
+ {
+ alert("Username field must not be empty");
+ return;
+ }
- if(username == "")
- {
- alert("Username field must not be empty");
- return;
+ var request = $.ajax({
+ url:BASE_URL + "/admin/updatemid",
+ method : "POST",
+ data : {
+ "username" : username,
+ "board_id" : board_id
}
+ });
- var request = $.ajax({
- url:BASE_URL + "/admin/updatemid",
- method : "POST",
- data : {
- "username" : username,
- "board_id" : board_id
- }
- });
-
- request.done(function(data){
- if(data.status_code == 200) {
- alert(data.message);
- location.reload();
- }
- else {
- alert(data.message);
- $("#update-btn").prop('disabled',false);
- }
- });
-
-
+ request.done(function(data){
+ if(data.status_code == 200) {
+ alert(data.message);
+ $("#update-btn").prop('disabled',false);
+ location.reload();
+ }
+ else {
+ alert(data.message);
+ $("#update-btn").prop('disabled',false);
+ }
+ });
}
// for live search of usernames
if (sessionStorage.getItem("fetchedUsers") == null) {
- var BASE_URL = window.location.origin;
+ var BASE_URL = window.location.origin + "/sbhs";
var request = $.ajax({
url: BASE_URL + '/admin/getusers',
method: 'POST'
diff --git a/templates/admin/index.html b/templates/admin/index.html
index e7ffe3b..dba8419 100644
--- a/templates/admin/index.html
+++ b/templates/admin/index.html
@@ -40,7 +40,7 @@
$(".label-warning").click(toggleState);
function toggleState() {
- var BASE_URL = window.location.origin;
+ var BASE_URL = window.location.origin + "/sbhs";
if (window.confirm("Are you sure you want to toggle the state?")) {
var element = $(this);
var board_class = element.attr("class");
diff --git a/templates/admin/testexp.html b/templates/admin/testexp.html
index d9cbce9..c47adaa 100644
--- a/templates/admin/testexp.html
+++ b/templates/admin/testexp.html
@@ -13,6 +13,10 @@
padding: 15px;
display: none;
}
+ #log-data > span {
+ word-spacing: 5em;
+ margin-left: 3em;
+ }
</style>
<div class="container">
<div class="row">
@@ -71,7 +75,7 @@
</div>
</div>
<script>
- var BASE_URL = window.location.origin;
+ var BASE_URL = window.location.origin + "/sbhs";
$("#tableId").on("click", "tr", function(e) {
$("#tableId").find("tr.highlight").removeClass("highlight");
$(this).addClass("highlight");
@@ -214,7 +218,7 @@
if (data.status_code == 200) {
console.log(data.message.logs.replace("/\n/g", "<br/>"));
document.getElementById("username").innerHTML = "User : " + data.message.user;
- document.getElementById("log-data").innerHTML = "<pre>Timestamp Heater Fan Temp</pre>" + data.message.logs.replace(new RegExp("\n","g"), "<br/>");
+ document.getElementById("log-data").innerHTML = "<pre>Iteration Heater Fan Temp</pre><span>" + data.message.logs.replace(new RegExp("\n","g"), "</span><br/><span>") + "</span>";
}
else {
alert(data.status_code);