mirror of
https://gitea.psi.ch/APOG/acsmnode.git
synced 2025-06-26 11:34:20 +02:00
Adjust code due to changes in flag definition location.
This commit is contained in:
@ -1,6 +1,16 @@
|
|||||||
from dash import Dash, html, dcc, callback, Output, Input, State, dash_table
|
from dash import Dash, html, dcc, callback, Output, Input, State, dash_table
|
||||||
import dash_bootstrap_components as dbc
|
import dash_bootstrap_components as dbc
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
with open('app/flags/ebas_dict.yaml') as stream:
|
||||||
|
try:
|
||||||
|
flags_dict = yaml.safe_load(stream)["flags"]
|
||||||
|
except yaml.YAMLError as exc:
|
||||||
|
flags_dict = {}
|
||||||
|
print(exc)
|
||||||
|
|
||||||
import data_flagging_utils
|
import data_flagging_utils
|
||||||
|
|
||||||
flagging_dashboard = dbc.Row([
|
flagging_dashboard = dbc.Row([
|
||||||
@ -9,7 +19,7 @@ flagging_dashboard = dbc.Row([
|
|||||||
#dbc.Row([
|
#dbc.Row([
|
||||||
dcc.Dropdown(
|
dcc.Dropdown(
|
||||||
id='flag-options',
|
id='flag-options',
|
||||||
options= data_flagging_utils.filter_flags_by_label(data_flagging_utils.flags_dict,'I'), # displays only flags to invalidate
|
options= data_flagging_utils.filter_flags_by_label(flags_dict,'I'), # displays only flags to invalidate
|
||||||
),
|
),
|
||||||
#],
|
#],
|
||||||
#width=12
|
#width=12
|
||||||
|
@ -54,6 +54,14 @@ from components.instrument_dashboard import instrument_dashboard
|
|||||||
from components.flagging_dashboard import flagging_dashboard
|
from components.flagging_dashboard import flagging_dashboard
|
||||||
from components.upload_component import upload_component
|
from components.upload_component import upload_component
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
with open('app/flags/ebas_dict.yaml') as stream:
|
||||||
|
try:
|
||||||
|
flags_dict = yaml.safe_load(stream)["flags"]
|
||||||
|
except yaml.YAMLError as exc:
|
||||||
|
flags_dict = {}
|
||||||
|
print(exc)
|
||||||
|
|
||||||
EnableVisCheckbox = dbc.Col(dbc.Row([dbc.Col(dcc.Checklist(
|
EnableVisCheckbox = dbc.Col(dbc.Row([dbc.Col(dcc.Checklist(
|
||||||
id='enable-flag-checkbox',
|
id='enable-flag-checkbox',
|
||||||
options=[{'label': html.Span('Enable Flag Visualization', style={'font-size': 15, 'padding-left': 10}), 'value': True}],
|
options=[{'label': html.Span('Enable Flag Visualization', style={'font-size': 15, 'padding-left': 10}), 'value': True}],
|
||||||
@ -64,7 +72,7 @@ EnableVisCheckbox = dbc.Col(dbc.Row([dbc.Col(dcc.Checklist(
|
|||||||
width=12)
|
width=12)
|
||||||
|
|
||||||
FlagVisTable = html.Div(dash_table.DataTable(data=[],
|
FlagVisTable = html.Div(dash_table.DataTable(data=[],
|
||||||
columns=[{"name": i, "id": i} for i in ['id','startdate','enddate','flag_description','parent_ch_pos','parent_channel']],
|
columns=[{"name": i, "id": i} for i in ['id','startdate','enddate','description','parent_ch_pos','parent_channel']],
|
||||||
id='tbl',
|
id='tbl',
|
||||||
style_header={'textAlign': 'center'},
|
style_header={'textAlign': 'center'},
|
||||||
fixed_rows={'headers': True}, # Fixed table headers
|
fixed_rows={'headers': True}, # Fixed table headers
|
||||||
@ -603,7 +611,7 @@ def commit_flag(n_clicks,flag_value,selected_Data, data):
|
|||||||
for key, value in selected_Data['range'].items():
|
for key, value in selected_Data['range'].items():
|
||||||
if 'x' in key:
|
if 'x' in key:
|
||||||
new_row = {'id':flagid,'startdate':value[0],'enddate':value[1],'flag_code': flag_value}
|
new_row = {'id':flagid,'startdate':value[0],'enddate':value[1],'flag_code': flag_value}
|
||||||
new_row.update(data_flagging_utils.flags_dict.get(flag_value,{}))
|
new_row.update(flags_dict.get(flag_value,{}))
|
||||||
if channel_names:
|
if channel_names:
|
||||||
channel_pos = extract_number(key)
|
channel_pos = extract_number(key)
|
||||||
parent_channel, parent_dataset = tuple(channel_names[channel_pos].split(','))
|
parent_channel, parent_dataset = tuple(channel_names[channel_pos].split(','))
|
||||||
|
Reference in New Issue
Block a user