Files
speckle-server/packages/frontend-2/components/settings/server/Projects.vue
T
andrewwallacespeckle 4c1ab5f5a0 refactor(fe2): Inputs and Settings Dialog Updates (#2941)
* WIP

* Up to General

* Projects Table

* Other menu items

* Tidy up other inputs

* Refactor Developer Settings to be more modular

* Move buttons to menus

* Minor changes

* Fix build

* Updates from testing

* Fixes from testing
2024-09-12 16:15:27 +01:00

61 lines
1.5 KiB
Vue

<template>
<section>
<div class="md:max-w-5xl md:mx-auto pb-6 md:pb-0">
<SettingsSectionHeader title="Projects" text="Manage projects on your server" />
<SettingsSharedProjects
v-model:search="search"
:projects="projects"
@close="$emit('close')"
/>
<InfiniteLoading
v-if="projects?.length"
:settings="{ identifier }"
class="py-4"
@infinite="onInfiniteLoad"
/>
</div>
</section>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { getProjectsQuery } from '~~/lib/server-management/graphql/queries'
import { usePaginatedQuery } from '~/lib/common/composables/graphql'
import { graphql } from '~/lib/common/generated/gql'
graphql(`
fragment SettingsServerProjects_ProjectCollection on ProjectCollection {
totalCount
items {
...SettingsSharedProjects_Project
}
}
`)
defineEmits<{
(e: 'close'): void
}>()
const search = ref('')
const {
identifier,
onInfiniteLoad,
query: { result }
} = usePaginatedQuery({
query: getProjectsQuery,
baseVariables: computed(() => ({
query: search.value?.length ? search.value : null,
limit: 50
})),
resolveKey: (vars) => [vars.query || ''],
resolveCurrentResult: (res) => res?.admin.projectList,
resolveNextPageVariables: (baseVars, cursor) => ({
...baseVars,
cursor
}),
resolveCursorFromVariables: (vars) => vars.cursor
})
const projects = computed(() => result.value?.admin.projectList.items || [])
</script>