Skip to content

Commit

Permalink
app: show highlight on loading intermediate file
Browse files Browse the repository at this point in the history
  • Loading branch information
abhidg committed Nov 26, 2024
1 parent 67097ef commit fde98b9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/arcmapper/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,29 @@ def handle_status(data, active_cell):

@callback(
Output("mapping", "data", allow_duplicate=True),
Output("mapping", "style_data_conditional", allow_duplicate=True),
Input("upload-intermediate-file", "contents"),
State("upload-intermediate-file", "filename"),
prevent_initial_call=True,
)
def upload_intermediate_file(contents, filename):
df = read_upload_data(contents, filename)
assert df is not None
return df.to_dict("records")
data = df.to_dict("records")
highlighted_rows = [i for i in range(len(data)) if data[i]["status"] == OK]
return (
data, # mapping data
[
{
"if": {
"filter_query": " || ".join(
f"{{id}} = {k}" for k in highlighted_rows
)
},
"backgroundColor": HIGHLIGHT_COLOR,
}
],
)


@callback(
Expand Down

0 comments on commit fde98b9

Please sign in to comment.