Commit 385e5b9d authored by Duggan, John's avatar Duggan, John
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 106-dataselector---allow-the-developer-to-configure-the-dropdown-options
parents 4a889ccd 9ac2f901
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

* The existing DataSelector component has been renamed to NeutronDataSelector and moved to nova.trame.view.components.ornl.NeutronDataSelector (thanks to John Duggan).

### nova-trame, 0.22.1

* ThemedApp now has an Exit Button by default which closes the application and can stop any running jobs (thanks to Gregory Cage).

### nova-trame, 0.22.0

* DataSelector queries subdirectories on demand, which should improve performance for large directory trees (thanks to John Duggan).
+1 −1
Original line number Diff line number Diff line
@@ -9,6 +9,6 @@ You can install this package directly with
pip install nova-trame
```

A user guide, examples, and a full API for this package can be found at https://nova-application-development.readthedocs.io/en/stable/.
A user guide, examples, and a full API for this package can be found at [https://nova-application-development.readthedocs.io/en/stable/](https://nova-application-development.readthedocs.io/projects/nova-trame/en/stable/).

Developers: please read [this document](DEVELOPMENT.md)
+771 −715

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ trame-vega = "*"
trame-vuetify = "*"
nova-mvvm = "*"
pydantic = "*"
nova-common = ">=0.2.0"
nova-common = ">=0.2.2"
blinker = "^1.9.0"
natsort = "^8.4.0"

+73 −0
Original line number Diff line number Diff line
"""Components used to control the lifecycle of a Themed Application."""

import logging
from typing import Any

from trame.app import get_server
from trame.widgets import vuetify3 as vuetify

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


class ExitButton:
    """Exit button for Trame Applications."""

    def __init__(self, exit_callback: Any = None, job_status_callback: Any = None) -> None:
        self.server = get_server(None, client_type="vue3")
        self.server.state.nova_kill_jobs_on_exit = False
        self.server.state.nova_show_exit_dialog = False
        self.server.state.nova_show_stop_jobs_on_exit_checkbox = False
        self.server.state.nova_running_jobs = []
        self.server.state.nova_show_exit_progress = False
        self.exit_application_callback = exit_callback
        self.job_status_callback = job_status_callback
        self.create_ui()

    def create_ui(self) -> None:
        with vuetify.VBtn(
            "Exit",
            prepend_icon="mdi-close-box",
            classes="mr-4 bg-error",
            id="shutdown_app_theme_button",
            color="white",
            click=self.open_exit_dialog,
        ):
            with vuetify.VDialog(v_model="nova_show_exit_dialog", persistent="true"):
                with vuetify.VCard(classes="pa-4 ma-auto"):
                    vuetify.VCardTitle("Exit Application")
                    with vuetify.VCardText(
                        "Are you sure you want to exit this application?",
                        variant="outlined",
                    ):
                        vuetify.VCheckbox(
                            v_model="nova_kill_jobs_on_exit",
                            label="Stop All Jobs On Exit.",
                            v_if="nova_running_jobs.length > 0",
                        )
                        with vuetify.VList():
                            vuetify.VListSubheader("Running Jobs:", v_if="nova_running_jobs.length > 0")
                            vuetify.VListItem("{{ item }}", v_for="(item, index) in nova_running_jobs")
                    with vuetify.VCardActions(v_if="!nova_show_exit_progress"):
                        vuetify.VBtn(
                            "Exit App",
                            click=self.exit_application_callback,
                            color="error",
                        )
                        vuetify.VBtn(
                            "Stay In App",
                            click=self.close_exit_dialog,
                        )
                    with vuetify.VCardActions(v_else=True):
                        vuetify.VCardText(
                            "Exiting Application...",
                            variant="outlined",
                        )
                        vuetify.VProgressCircular(indeterminate=True)

    async def open_exit_dialog(self) -> None:
        self.server.state.nova_show_exit_dialog = True
        await self.job_status_callback()

    async def close_exit_dialog(self) -> None:
        self.server.state.nova_show_exit_dialog = False
Loading