2023-03-30 18:37:45 -04:00
|
|
|
<script setup>
|
2023-04-08 18:54:38 -07:00
|
|
|
import { shallowRef } from 'vue'
|
2023-05-09 19:48:47 -04:00
|
|
|
import GridDisplay from '@/components/GridDisplay.vue'
|
|
|
|
|
import { list } from '@/helpers/profile.js'
|
2023-04-26 23:19:37 -04:00
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
import { useBreadcrumbs } from '@/store/breadcrumbs'
|
2023-05-10 18:50:42 -04:00
|
|
|
import { loading_listener } from '@/helpers/events.js'
|
2023-04-26 23:19:37 -04:00
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const breadcrumbs = useBreadcrumbs()
|
2023-03-30 18:37:45 -04:00
|
|
|
|
2023-04-26 23:19:37 -04:00
|
|
|
breadcrumbs.setRootContext({ name: 'Library', link: route.path })
|
2023-05-09 19:48:47 -04:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
)
|
2023-05-10 18:50:42 -04:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-03-30 18:37:45 -04:00
|
|
|
</script>
|
2023-03-17 15:46:55 -04:00
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
2023-05-10 18:50:42 -04:00
|
|
|
<GridDisplay v-if="instances.length > 0" label="Instances" :instances="instances" />
|
|
|
|
|
<GridDisplay v-if="modpacks.length > 0" label="Modpacks" :instances="modpacks" />
|
2023-03-17 15:46:55 -04:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-05-09 19:48:47 -04:00
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|