Files
AstralRinth/theseus_gui/src/pages/Library.vue
Adrian O.V 71cf2c53f5 Implement loading (#104)
* Implement loading

* LoadingBar

* Run linter

* Update App.vue

* Loading bar all the things

* Update SplashScreen.vue

* Update SplashScreen.vue

* Update App.vue

* initial revert

* Update Instance.vue

* revert css

* Fix instance

* More reverting

* Run lint

* Finalize changes

* Revert "Merge branch 'master' into loading"

This reverts commit 3014e765fb6fb343f3030fd8a822edd97fb2af41, reversing
changes made to b780e859d2b53a203eb3561ba3be88af083d9c15.

* Fix loading issues

* fix lint

* Revert "Revert "Merge branch 'master' into loading""

This reverts commit 971ef8466613579b7f523edbd25b692df62d0f86.

---------

Co-authored-by: Jai A <jaiagr+gpg@pm.me>
2023-05-10 15:50:42 -07:00

40 lines
1.2 KiB
Vue

<script setup>
import { shallowRef } from 'vue'
import GridDisplay from '@/components/GridDisplay.vue'
import { list } from '@/helpers/profile.js'
import { useRoute } from 'vue-router'
import { useBreadcrumbs } from '@/store/breadcrumbs'
import { loading_listener } from '@/helpers/events.js'
const route = useRoute()
const breadcrumbs = useBreadcrumbs()
breadcrumbs.setRootContext({ name: 'Library', link: route.path })
const profiles = await list()
const instances = shallowRef(
Object.values(profiles).filter((prof) => !prof.metadata.linked_project_id)
)
const modpacks = shallowRef(
Object.values(profiles).filter((prof) => prof.metadata.linked_project_id)
)
loading_listener(async (profile) => {
console.log(profile)
if (profile.event === 'loaded') {
const profiles = await list()
instances.value = Object.values(profiles).filter((prof) => !prof.metadata.linked_project_id)
modpacks.value = Object.values(profiles).filter((prof) => prof.metadata.linked_project_id)
}
})
</script>
<template>
<div>
<GridDisplay v-if="instances.length > 0" label="Instances" :instances="instances" />
<GridDisplay v-if="modpacks.length > 0" label="Modpacks" :instances="modpacks" />
</div>
</template>
<style lang="scss" scoped></style>