From 822e31f9174b23ccecaf543d99be0c2d51da1c39 Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Tue, 31 Dec 2024 15:39:49 +0100 Subject: [PATCH] further fixes --- src/annescribe/webapp/task_list.py | 30 ++++++++++++++++++++---------- src/annescribe/webapp_main.py | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/annescribe/webapp/task_list.py b/src/annescribe/webapp/task_list.py index 7305bfd..14bd8af 100644 --- a/src/annescribe/webapp/task_list.py +++ b/src/annescribe/webapp/task_list.py @@ -40,16 +40,15 @@ def results_button(job_data: dict, app_config: dict): :param app_config: app configuration :return: None """ - # is_toggled = st.session_state.get(f"shown_result") == job_data['name'] - # - # if is_toggled: - # return st.button("Hide Results", on_click=partial(hide_results, job_data), key=f"hide_{job_data['name']}") - # else: - # return st.button("Show Results", on_click=partial(show_results, job_data), key=f"show_{job_data['name']}") + + if not job_data["completed"]: + st.markdown("--") + return with st.popover("Show Results"): st.markdown("Results") st.write(job_data['output']) + return @st.dialog("Are you sure?") @@ -97,7 +96,6 @@ def render_status(job_data: dict, app_config: dict): start_time = processing_details["start_time"] time_remaining = processing_details["time_remaining"] - cols = st.columns(3) st.markdown(f"{details}") st.markdown(f"Started: {start_time if start_time is not None else 'N/A'}") st.markdown(f"Time remaining: {time_remaining if time_remaining is not None else 'N/A'}") @@ -105,6 +103,20 @@ def render_status(job_data: dict, app_config: dict): st.markdown("Error") +def get_delete_button(job_data: dict, app_config: dict): + """ + Get the delete button for a job + :param job_data: job data + :param app_config: app configuration + :return: None + """ + if job_data["processing"]: + st.markdown("--") + return + + st.button("Delete", on_click=partial(delete_task, job_data, app_config), key=f"delete_{job_data['name']}") + + def render_task_list(container, app_config: dict): """ Render the task list page @@ -119,7 +131,6 @@ def render_task_list(container, app_config: dict): st.subheader('Task List') st.write("Here you can see the status of your tasks, view the results, and delete tasks.") - column_config = [ { "name": "Name", @@ -139,8 +150,7 @@ def render_task_list(container, app_config: dict): }, { "name": "Actions", - "render_func": lambda x: st.button("Delete", on_click=partial(delete_task, x, app_config), - key=f"delete_{x['name']}") + "render_func": lambda x: get_delete_button(x, app_config) } ] list_container = st.container(border=True) diff --git a/src/annescribe/webapp_main.py b/src/annescribe/webapp_main.py index 0807ba7..c6f18f2 100644 --- a/src/annescribe/webapp_main.py +++ b/src/annescribe/webapp_main.py @@ -71,7 +71,7 @@ if authentication_status is True: render_home(content_wrapper, config, authenticator if authentication_enabled else None) else: # make sure to remove cookie - st.markdown("Please login. If no login form is shown, please refresh the page.") + st.markdown("Please login. If no login form is shown, please refresh the page and or press R.") render_login()