select_experiment: use links to instruments
This commit is contained in:
22
webserver.py
22
webserver.py
@ -14,7 +14,9 @@ import flask
|
||||
import circularlog
|
||||
|
||||
|
||||
instlist = ['AMOR', 'BOA', 'CAMEA', 'DMC', 'EIGER', 'FOCUS', 'HRPT', 'SANS', 'TASP', 'ZEBRA']
|
||||
instruments = {ins: 8642 for ins in
|
||||
['amor', 'boa', 'camea', 'dmc', 'eiger', 'focus', 'hrpt', 'sans', 'tasp', 'zebra']
|
||||
}
|
||||
|
||||
|
||||
def guess_mimetype(filename):
|
||||
@ -376,7 +378,15 @@ a {
|
||||
chunk_list.sort(reverse=True)
|
||||
for end, beg, key, devices in chunk_list:
|
||||
today, begdate, enddate = (time.strftime("%Y-%m-%d", time.localtime(t)) for t in (now, beg, end))
|
||||
args = ['='.join(key)]
|
||||
port = None
|
||||
if key[0] == 'instrument':
|
||||
ins = key[1]
|
||||
port = instruments.get(ins)
|
||||
if port is None:
|
||||
args = ['='.join(key)]
|
||||
else:
|
||||
host = f'http://{ins}.psi.ch:{port}'
|
||||
args = []
|
||||
if end > now:
|
||||
if begdate == today:
|
||||
daterange = f'since {time.strftime("%H:%M", time.localtime(beg))}'
|
||||
@ -392,13 +402,15 @@ a {
|
||||
title('older than 30 days')
|
||||
showtitle = 2
|
||||
|
||||
out.append(f'<tr><th><a href="/?{"&".join(args)}">{key[1]} / {" ".join(devices)}</a></th>')
|
||||
out.append(f'<tr><th><a href="{host}/?{"&".join(args)}">{key[1]} / {" ".join(devices)}</a></th>')
|
||||
out.append(f'<td>{daterange}</td></tr>')
|
||||
if timerange:
|
||||
out.append(f'<h3><a href="/select_experiment?time=all">earlier dates</a></h3><br>')
|
||||
out.append('</table>')
|
||||
out.append('<h3>servers on the instruments:</h3>')
|
||||
out.extend([f"<a href='http://{i.lower()}.psi.ch:8642/'>{i}</a> \n" for i in instlist])
|
||||
out.append('<h3><a href="http://linse-c.psi.ch:8888/">central server</a></h3>')
|
||||
out.append('<h3>direct link to instruments:</h3>')
|
||||
out.extend([f'<a href="http://{ins}.psi.ch:{port}/">{ins}</a> \n'
|
||||
for ins, port in instruments.items()])
|
||||
out.extend(['</body></html>', ''])
|
||||
except Exception as e:
|
||||
logging.error('%s', traceback.format_exc())
|
||||
|
Reference in New Issue
Block a user