Merge branch 'daniel' of https://gitlab.psi.ch/samenv/seweb into daniel

# Conflicts:
#	client/jsFiles/SEAWebClientMain.js
This commit is contained in:
Daniel
2025-04-30 17:04:49 +02:00
8 changed files with 25 additions and 15 deletions

View File

@ -48,7 +48,7 @@
} }
.row-waiting-for-answer { .row-waiting-for-answer {
background-color: orangered; background-color: LightGoldenrodYellow;
} }
/* ------------------------------ icon-modules ------------------------------ */ /* ------------------------------ icon-modules ------------------------------ */

View File

@ -72,12 +72,18 @@ function handleUpdateMessage(src, message) {
clientID = message.id; clientID = message.id;
if ("device" in message) { if ("device" in message) {
if (message.device == "_inst_select") { if (message.device == "_inst_select") {
clientTitle = "select instrument"; window.clientTitle = "select instrument";
console.log('IDselect') console.log('IDselect')
pushInitCommand("getblock?path=_inst_select&", "instrument selection"); pushInitCommand("getblock?path=_inst_select&", "instrument selection");
sizeChange(); sizeChange();
} else { } else {
clientTitle = message.instrument + " " + message.device; if (message.instrument) {
window.instrument = message.instrument;
}
if (message.device) {
window.device = message.device;
}
window.clientTitle = window.instrument + " " + window.device;
// console.log('loadBlocks', message); // console.log('loadBlocks', message);
loadFirstBlocks(); loadFirstBlocks();
} }

View File

@ -181,11 +181,15 @@ window.onload = function() {
icon_lock_container.onclick = function(){ icon_lock_container.onclick = function(){
let array_icon_edit = document.getElementsByClassName('icon-edit'); let array_icon_edit = document.getElementsByClassName('icon-edit');
let array_button = document.getElementsByClassName('input-element-button'); let array_button = document.getElementsByClassName('input-element-button');
if (writePermission == false) { if (writePermission == false) {
alertify.prompt( 'WRITE PERMISSION', "Please enter the name of the instrument you want to work on." // TODO: here instead of asking "Please confirm we are on <instrument>", do not show the instrument,
// ask the user "Please confrim the instrument:" and check it the entered instrument is correct
// (case insensitive)
alertify.prompt( "WRITE PERMISSION", "Current device: <b>"+ window.device + "</br></br>Please confirm the instrument:", ""
, function(evt, value) { , function(evt, value) {
// User decided to proceed // User decided to proceed
if (clientTitle.includes(value)) { if (window.instrument === value) {
writePermission = true; writePermission = true;
icon_lock_container.innerHTML = '<img class = "icon-main icon-lock" src="res/icon_lock_open.png">'; icon_lock_container.innerHTML = '<img class = "icon-main icon-lock" src="res/icon_lock_open.png">';
for(i = 0; i < array_icon_edit.length; i++) { for(i = 0; i < array_icon_edit.length; i++) {
@ -197,7 +201,6 @@ window.onload = function() {
} else { } else {
console.log(clientTitle); console.log(clientTitle);
} }
// prompt = false;
} }
, function() { , function() {
// User decided to cancel // User decided to cancel

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -25,7 +25,8 @@ hefill=-
ln2fill=- ln2fill=-
hepump=- hepump=-
hemot=- hemot=-
nv=- flow_sensor=-
nv.speed=unit:1
nv.flow=unit:ln/min nv.flow=unit:ln/min
nv.flowtarget=unit:ln/min nv.flowtarget=unit:ln/min
nv.flowp=unit:ln/min nv.flowp=unit:ln/min

View File

@ -274,7 +274,7 @@ class InfluxGraph(HandlerBase):
pass # skip not existing or already removed items pass # skip not existing or already removed items
# add remaining curves # add remaining curves
curves.extend(curve_dict.values()) curves.extend(curve_dict.values())
print(key, curves) # print(key, curves)
group['curves'] = curves group['curves'] = curves
result.append(group) result.append(group)
return result return result
@ -370,8 +370,8 @@ class InfluxGraph(HandlerBase):
if len(curve) > l: if len(curve) > l:
del curve[:l] del curve[:l]
else: else:
if fullminute: # if fullminute:
print('R', key) # print('R', key)
result.pop(key) result.pop(key)
# print('poll', sum(len(c) for c in result.values()), self.last_time) # print('poll', sum(len(c) for c in result.values()), self.last_time)
if len(result) > 0: if len(result) > 0:

View File

@ -73,7 +73,6 @@ class SecopInteractor(SecopClient):
component['info'] = info component['info'] = info
component['name'] = f'{name}:value' component['name'] = f'{name}:value'
component['title'] = name component['title'] = name
print(component)
components.append(component) components.append(component)
self.param_updates.add('value') self.param_updates.add('value')
self.param_updates.add('status') self.param_updates.add('status')
@ -153,7 +152,9 @@ class SecopInteractor(SecopClient):
logging.info('SENDCOMMAND %r', command) logging.info('SENDCOMMAND %r', command)
try: try:
if is_param: if is_param:
self.setParameterFromString(module, parameter, strvalue) entry = self.setParameterFromString(module, parameter, strvalue)
item = {'name': f'{module}:{parameter}', 'value': str(entry), 'formatted': entry.formatted()}
self.updates[module, parameter] = item
result = True result = True
else: else:
result = self.execCommandFromString(module, parameter, strvalue)[0] result = self.execCommandFromString(module, parameter, strvalue)[0]

View File

@ -147,7 +147,7 @@ def get_update(_=None):
logging.info('UPDATE %s %s', client.id, socket.getfqdn(flask.request.remote_addr.split(':')[-1])) logging.info('UPDATE %s %s', client.id, socket.getfqdn(flask.request.remote_addr.split(':')[-1]))
# msg = dict(type='id', id=client.id, title=instrument.title); # msg = dict(type='id', id=client.id, title=instrument.title);
# yield to_json_sse(msg) # yield to_json_sse(msg)
msg = dict(type='id', id=client.id, instrument=kwargs.get('instrument', '<unknown>'), msg = dict(type='id', id=client.id, instrument=kwargs.get('instrument') or 'n_a',
device=client.device_name) device=client.device_name)
yield to_json_sse(msg) yield to_json_sse(msg)
try: try:
@ -385,7 +385,6 @@ a {
title('older than 30 days') title('older than 30 days')
showtitle = 2 showtitle = 2
print('A', args)
out.append(f'<tr><th><a href="/?{"&".join(args)}">{key[1]} / {" ".join(devices)}</a></th>') out.append(f'<tr><th><a href="/?{"&".join(args)}">{key[1]} / {" ".join(devices)}</a></th>')
out.append(f'<td>{daterange}</td></tr>') out.append(f'<td>{daterange}</td></tr>')
if timerange: if timerange: