Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cgi-bin/get-event.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fi
if [[ -z $PGDATABASE ]]; then
export PGDATABASE=daq
fi
if [[ -z $PGHOST ]]; then
export PGHOST=127.0.0.1
fi

query() {
psql --csv -c "$@" 2>&1 |
Expand Down
4 changes: 2 additions & 2 deletions cgi-bin/logs2.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ do
echo "<a href=\"../logs/$file\"> $file </a>


<div id=$file align='left' style=\"#ccc;font:12px/13px Georgia, Garamond, Serif;overflow:scroll;border:2px solid;padding:1%;height:200px\">"
<div id='"$file"' align='left' style=\"#ccc; font:12px/13px Georgia, Garamond, Serif; overflow:scroll; border:2px solid; padding:1%; height:200px\">"

tail ../logs/$file > /tmp/$file -n 15

Expand All @@ -34,6 +34,6 @@ divid.scrollTop = divid.scrollHeight;"

done

echo"
echo "
<body/><html/>
"
3 changes: 3 additions & 0 deletions cgi-bin/pmt-locations.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fi
if [[ -z $PGDATABASE ]]; then
export PGDATABASE=daq
fi
if [[ -z $PGHOST ]]; then
export PGHOST=127.0.0.1
fi

psql --csv -c 'select id, x, y, z, location from pmt order by id' 2>&1 |
{
Expand Down
4 changes: 2 additions & 2 deletions html-Common/Logs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@

<!--#include virtual="/includes/footer.html" -->

<script src="./logtabs.js?v=1" async></script>
<script src="./log_DB.js?v=1" async></script>
<script type="module" src="./logtabs.js?v=1" async></script>
<script type="module" src="./log_DB.js?v=1" async></script>
42 changes: 8 additions & 34 deletions html-Common/Logs/log_DB.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
"use strict;"
import { GetPSQLTable } from "/includes/functions.js";

var log_output=document.getElementById("log_output");
var update = setInterval(GetLogSources, 5000); // Run the GetLogSources() function every minute
var updating = false;

//load logs on startup
GetLogSources();

//generic funcion for returning SQL table
function gettable(command){
return GetPSQLTable(command, 'root', 'daq', true);
}

function GetLogSources(){ //command to get log files, first cehckes which devices exist then gets the last 15 messages for each

if(updating) return;
Expand Down Expand Up @@ -64,38 +72,4 @@ function GetLogSources(){ //command to get log files, first cehckes which device
});

}


function gettable(command){ //generic command to get table from SQL

return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();

var url = "/cgi-bin/sqlquery.cgi";

var user ="root";
var db="daq";

// Set the request method to POST
xhr.open("POST", url);

// Set the request header to indicate that the request body contains form data
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");


var dataString = "user=" + user + "&db=" + db + "&command=" + command;


// Send the request
xhr.send(dataString);
xhr.onreadystatechange = function() {

if (this.readyState == 4 && this.status == 200) {
resolve(xhr.responseText);
}
// else reject(new Error('error loading'));
}
});

}

180 changes: 105 additions & 75 deletions html-Common/Monitoring/index.html
Original file line number Diff line number Diff line change
@@ -1,80 +1,110 @@
<head>
<title>ToolDAQ Webpage</title>
<style>
.loader {
border: 16px solid #f3f3f3; /* Light gray */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
display: none; /* Hidden by default */
margin: auto;
margin-top: 20px;
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>


<!--#include virtual="/includes/header.html" -->
<!--#include virtual="../subheader.html" -->

<div id="montabbar" class="mdl-layout__tab-bar mdl-js-ripple-effect is-casting-shadow mdl-js-ripple-effect--ignore-events" data-upgraded=",MaterialRipple"> <!--class="mdl-layout__tab-bar mdl-js-ripple-effect" >-->
</div>

<!--#include virtual="/includes/drawer.html" -->


<h1 align="center">Monitoring</h1>

<div id="page-content" align="center">
<div class="controls">
<div>
<label for="table select"> Select device data to plot </label><br>
<select id="tableselect"></select>
</div>
<div>
<label for="same"> Draw on same plot? </label><br>
<input type="checkbox" id="same" name="same" value="same">
</div>
</div>
<div class="chart">
<div align="center" id="output"></div>
<div id="loader" class="loader"></div>
<div id="graph"></div>
</div>
<br>

<!-- <div id="plots"></div> -->
<div id="plots_frame" align="center">
<label for="plots_dropdown">Select plot</label><br>
<select id="plots_dropdown">
<option>Update</option>
<option></option>
</select>
<div id="plots"></div>
</div>

<label for="rootplot_dropdown"> Select ROOT plot</label><br>
<div align="center"><select id="rootplot_dropdown"></select><br>
<div id="jsroot_div" style="height:500px;"></div>
<iframe width="700" height="400">
<!-- <div id="jsroot_div"></div> -->
</iframe>
</div>
</div>

<!--#include virtual="/includes/footer.html" -->
<html>
<head>
<title>ToolDAQ Webpage</title>

<style>
.loader {
border: 16px solid #f3f3f3; /* Light gray */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
display: none; /* Hidden by default */
margin: auto;
margin-top: 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>

</head>

<body>

<!--#include virtual="/includes/header.html" -->
<!--#include virtual="../subheader.html" -->

<div id="montabbar" class="mdl-layout__tab-bar mdl-js-ripple-effect is-casting-shadow mdl-js-ripple-effect--ignore-events" data-upgraded=",MaterialRipple"> <!--class="mdl-layout__tab-bar mdl-js-ripple-effect" >-->
</div>

<!--#include virtual="/includes/drawer.html" -->


<h1 align="center">Monitoring</h1>

<div id="page content" align="center">
<h3 align="center">Ad-hoc Plot from Monitoring Table</h3>

<div class="controls">
<label for="autoUpdate">AutoUpdate: </label>
<input id="autoUpdate" type="checkbox" checked>
<label for="refreshRate">Refresh Rate [s]: </label>
<input id="refreshRate" type="number" style="background-color: white" class="form-control" value='10' >
<br><br>

<label for="historyLength">History Length:</label>
<input id="historyLength" type="number" style="background-color: white" class="form-control" value='200' >
<br><br>

<label for="table select"> Select device data to plot </label><br>
<select id="tableselect"></select>
<input type="checkbox" id="same" name="same" value="same">
<label for="same"> Draw on same plot? </label><br>
<br>
</div>

<div id="loader" class="loader"></div>
<div align="center" class="chart" id="output"></div>
<div id="graph"></div>
<br>

</div>

<br>

<!-- old code, awaiting merge of updated version
<div id="plots_frame" align="center">
<h3 align="center">Retrieve Plot from Plots Table</h3>
<label for="plots_dropdown">Select plot</label><br>
<select id="plots_dropdown" onchange='plots_dropdown_update(this)'>
<option value="__update">Update</option>
<option value="__none" selected></option>
</select>
<div id="plots"></div>
</div>

<br>
-->

<div align="center">
<br><h3 align="center">Retrieve Plot from RootPlots Table</h3>
<label for="rootplot_dropdown"> Select ROOT plot</label><br>
<select id="rootplot_dropdown"></select><br><br>
<!-- NOTE: YOU MUST SPECIFY AT LEAST ONE DIMENSION TO YOUR PLOT DIV,
ELSE THE PLOT WILL BE 0 SIZE AND INVISIBLE -->
<div id="jsroot_div" style="height:500px;"></div>
<!-- see the following for an example of jsroot helper functions -->
<!--<script type="module" src="./demojsroot.js"></script> -->
</div>

</body>

<!--#include virtual="/includes/footer.html" -->

</html>

<!-- <script src="https://cdn.plot.ly/plotly-1.8.0.min.js" async></script> -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script type="module" src="/includes/functions.js"></script>

<script src="https://cdn.plot.ly/plotly-1.8.0.min.js" async></script>
<script src="./monitoring.js?v=7" async></script>
<script src="./monitoringtabs.js?v=1" async></script>
<script type="module" src="./monitoring.js?v=7" async></script>
<script type="module" src="./monitoringtabs.js?v=1" async></script>
<script type="module" src="./jsroot.js" async></script>
<!-- old code, awaiting merge of upstream updated version
<script type="module" src="./plots.js" async></script>
-->


Loading