-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclock.html
205 lines (177 loc) · 8.32 KB
/
clock.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<html>
<head>
<title>Clocks Dashboard</title>
<!--libraries-->
<script src='scripts/HTMLImports.min.js' type="text/javascript"></script>
<script src='scripts/mustache.js' type="text/javascript"></script>
<script src="scripts/jquery1-11-3.min.js" type="text/javascript"></script>
<script src="scripts/plotly-1.5.0.min.js"></script>
<!--helpers-->
<script src='scripts/helpers.js' type="text/javascript"></script>
<script src='scripts/dataStore.js' type="text/javascript"></script>
<script src='scripts/heartbeat.js' type="text/javascript"></script>
<script src='scripts/colorScales.js' type="text/javascript"></script>
<!--style-->
<link rel="stylesheet" href="css/global.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="scripts/bootstrap3-3-5.min.js" type="text/javascript"></script>
<!--html imports-->
<link id='brand-header' rel="import" href="templates/brand-header/brand-header.html">
<link id='brand-footer' rel="import" href="templates/brand-footer/brand-footer.html">
<link id='nav-bar' rel="import" href="templates/nav-bar/nav-bar.html">
<link id='run-status' rel="import" href="templates/run-status/run-status.html">
<link id='clock-control' rel="import" href="templates/clock-control/clock-control.html">
<link id='secondary-detail' rel="import" href="templates/clock-control/secondary-detail.html">
<link id='primary-detail' rel="import" href="templates/clock-control/primary-detail.html">
</head>
<body>
<div id='header'></div>
<div class='section-wrapper'>
<div id='nav' class='col-md-12'></div>
<div id='runStat' class='col-md-2'></div>
<div class='col-md-10 top-pan'>
<h2>Clock Control</h2>
<div id='clockTable1' class='col-md-4'></div>
<div id='clockTable2' class='col-md-4'></div>
<div id='clockTable3' class='col-md-4'></div>
</div>
</div>
<div id="footer"></div>
<script>
////////////////////////////////////////
//pre-load setup
////////////////////////////////////////
//pre-dom-ready setup
function setupClocks(){
// some dom-free config and parameters for the clocks
dataStore.clockParameters = {
summarySuffixes: [ //element id suffixes for entries in the summary table
'Config',
'syncSrc',
'clockSrc',
'refClock',
'lemoClock',
'lemoSync',
'esataClock',
'esataSync',
'lastEsata'
],
csacSuffixes: [ //element id suffixes for entries in the csac table
'CSACPower',
'CSACStatus',
'CSACMode',
'CSACAlarm',
'CSACUnitPower',
'CSACTuningVoltage',
'CSACLaserCurrent',
'CSACHeaterPower',
'CSACTemperature',
'CSACSerial',
'CSACFirmware'
],
hiChan: [11,15,19,23,27,39,31,35], // indices for cycles high for ESATA0-5, left lemo, right lemo (note weird order...)
loChan: [12,16,20,24,28,40,32,36],
channelSuffixes: ['ESATA0', 'ESATA1', 'ESATA2', 'ESATA3', 'ESATA4', 'LeftLEMO', 'RightLEMO', 'ESATA5'],
primaryFreq: 100, //primary steps down from 200MHz in the spec, but seems to be 100 in practice? TBD.
CSACunit: ['','','','','',' VDC',' mA',' mW',' C','','']
};
}
setupClocks();
function processDAQ(payload){
fetchDAQ(payload);
detectDetectors();
}
function processEquipment(payload){
var i, keys = Object.keys(payload);
dataStore.ODB.Equipment = payload;
//identify the clocks present
dataStore.clocks = []
for(i=0; i<keys.length; i++){
if(keys[i].slice(0,8) == 'GRIF-Clk'){
dataStore.clocks.push({
title: keys[i],
table: dataStore.ODB.Equipment[keys[i]]
});
}
}
//fill info into the dom
populateInfo();
}
window.addEventListener('HTMLImportsLoaded', function(e) {
var i, clocks = []
for(i=0; i<25; i++){
clocks.push('GRIF-Clk'+i);
}
validate_browser();
//////////////
// setup
//////////////
//get the ODB DAQ directory for the nav bar
promiseScript('http://' + dataStore.host + '/?cmd=jcopy&odb=/DAQ&encoding=json-p-nokeys&callback=processDAQ');
//get the ODB Equipment dir and set up clock host requests:
promiseScript('http://' + dataStore.host + '/?cmd=jcopy&odb=/Equipment&encoding=json-p-nokeys&callback=processEquipment');
///////////////////////////
//handle templates
///////////////////////////
templates = ['brand-header', 'brand-footer', 'nav-bar', 'run-status', 'clock-control', 'secondary-detail', 'primary-detail'];
dataStore.templates = prepareTemplates(templates);
//inject templates
//header
document.getElementById('header').innerHTML = Mustache.to_html(
dataStore.templates['brand-header'],
{
'title': dataStore.hostname.toUpperCase()+' Clocks',
}
);
//footer
document.getElementById('footer').innerHTML = Mustache.to_html(
dataStore.templates['brand-footer'],
{
}
);
setupFooter('footerImage', 2, '#999999');
//nav
document.getElementById('nav').innerHTML = Mustache.to_html(
dataStore.templates['nav-bar'],
{
}
);
//run control
document.getElementById('runStat').innerHTML = Mustache.to_html(
dataStore.templates['run-status'],
{
}
);
//clock control
document.getElementById('clockTable1').innerHTML = Mustache.to_html(
dataStore.templates['clock-control'],
{
'col': 0,
'clocks': clocks.slice(0,9)
}
);
document.getElementById('clockTable2').innerHTML = Mustache.to_html(
dataStore.templates['clock-control'],
{
'col': 1,
'clocks': clocks.slice(9,17)
}
);
document.getElementById('clockTable3').innerHTML = Mustache.to_html(
dataStore.templates['clock-control'],
{
'col': 2,
'clocks': clocks.slice(17)
}
);
if(dataStore.hostname=='tigress'){ document.getElementById('Logo').src = 'img/TIGRESS-logo.png';}
////////////////////////////
//set up heartbeat
////////////////////////////
dataStore.heartbeat.scriptQueries = [dataStore.runSummaryQuery];
dataStore.heartbeat.callback = updateRunStatus;
heartbeat();
});
</script>
</body>
</html>