restructure

This commit is contained in:
2022-05-28 12:10:33 +02:00
parent 33f2afdadb
commit 15fb6c7434
5 changed files with 10 additions and 10 deletions

View File

@ -1,53 +0,0 @@
import streamlit as st
import stand.hacks
from stand.widgets.aggrid import aggrid
from stand.widgets.download import download
from stand.restapi import restapi
from stand.utils.st_utils import get_session_id, hide_UI_elements
print(">>> start of streamlit run")
st.set_page_config(
page_title="stand",
page_icon="icon.png",
layout="wide"
)
hide_UI_elements()
restapi.sid = get_session_id() # rest api needs current session ID to trigger the next rerun
changed = restapi.changed
df = restapi.data
download(df)
# if df in restapi changed, we need to reload it into aggrid.
# if df in restapi did not change, we do not reload to ensure changes in the browser persist.
response = aggrid(
df,
reload_data=changed
)
# if we reloaded, aggrid returns the df from before (why?), thus we do not update the restapi.
# if we did not reload, aggrid may return an updated df from an edit in the browser,
# and thus we need to update the restapi.
new_df = response["data"]
if not new_df.equals(df) and not changed:
restapi.data = new_df
print(">>> end of streamlit run")