From 87679276467f376b183ae05fb6143691fa56584c Mon Sep 17 00:00:00 2001 From: CodexAdrian <83074853+CodexAdrian@users.noreply.github.com> Date: Tue, 2 May 2023 13:54:40 -0400 Subject: [PATCH] Implement loading --- theseus_gui/src/App.vue | 50 ++++-- theseus_gui/src/components/ui/Instance.vue | 23 ++- .../src/components/ui/RunningAppBar.vue | 149 +++++++++++++++++- theseus_gui/src/main.js | 4 +- theseus_gui/src/pages/Library.vue | 11 +- theseus_gui/src/pages/instance/Index.vue | 43 ++++- 6 files changed, 251 insertions(+), 29 deletions(-) diff --git a/theseus_gui/src/App.vue b/theseus_gui/src/App.vue index be4124329..fc22fa4a6 100644 --- a/theseus_gui/src/App.vue +++ b/theseus_gui/src/App.vue @@ -1,35 +1,29 @@ diff --git a/theseus_gui/src/components/ui/Instance.vue b/theseus_gui/src/components/ui/Instance.vue index ceb74e181..f94e623de 100644 --- a/theseus_gui/src/components/ui/Instance.vue +++ b/theseus_gui/src/components/ui/Instance.vue @@ -1,6 +1,6 @@ diff --git a/theseus_gui/src/main.js b/theseus_gui/src/main.js index e79e06b15..75c8357db 100644 --- a/theseus_gui/src/main.js +++ b/theseus_gui/src/main.js @@ -16,8 +16,10 @@ app.use(pinia) app.use(FloatingVue) app.mixin(loadCssMixin) +const mountedApp = app.mount('#app') + initialize_state() - .then(() => app.mount('#app')) + .then(() => mountedApp.initialize()) .catch((err) => { console.error(err) }) diff --git a/theseus_gui/src/pages/Library.vue b/theseus_gui/src/pages/Library.vue index bb9120c0f..2dfeaa5b5 100644 --- a/theseus_gui/src/pages/Library.vue +++ b/theseus_gui/src/pages/Library.vue @@ -4,14 +4,21 @@ import { shallowRef } from 'vue' import { list } from '@/helpers/profile.js' import { useRoute } from 'vue-router' import { useBreadcrumbs } from '@/store/breadcrumbs' +import { loading_listener } from '@/helpers/events.js' +import { progress_bars_list } from '@/helpers/state.js' const route = useRoute() const breadcrumbs = useBreadcrumbs() -const profiles = await list() -const instances = shallowRef(Object.values(profiles)) +const instances = shallowRef(Object.values(await list())) +const loadingInstances = shallowRef(Object.values(await progress_bars_list())) breadcrumbs.setRootContext({ name: 'Library', link: route.path }) +loading_listener(async (profile) => { + console.log(profile) + instances.value = Object.values(await list()) + loadingInstances.value = Object.values(await progress_bars_list()) +})