Files
speckle-server/packages/frontend-2/lib/common/composables/serverInfo.ts
T
andrewwallacespeckle 76cbcef4e6 Feature - FE2 - Developer Settings (#1822)
* WIP Developer Settings

* Access Tokens

* scopes load fix

* mapping to correct struct

* Updates to Application

* Update to apps.js to fix scopes error

* Application table done

* Token confirmation done.

* Application Success

* Fix ts

* Darkmode fixes

* Responsive fix

* Fixes for PR

* Pass size prop to Editable Avatar

* Updates from PR comments

* Section Header - TS Types

* Add Typeguard to Delete Dialog

* Add Description to scopes query

* minor type guard fix

* edit application cache update fix

* Fix Dialog Expansion

* Rename mutations to correct casing

* Remove unneeded import for defineProps

---------

Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
2023-10-26 12:51:05 +01:00

40 lines
1.1 KiB
TypeScript

import { useQuery } from '@vue/apollo-composable'
import { cloneDeep } from 'lodash-es'
import {
serverInfoAllScopesQuery,
serverInfoBlobSizeLimitQuery
} from '~~/lib/common/graphql/queries'
import { prettyFileSize } from '~~/lib/core/helpers/file'
import { AllScopes } from '@speckle/shared'
export function useServerFileUploadLimit() {
const { result } = useQuery(serverInfoBlobSizeLimitQuery)
const maxSizeInBytes = computed(
() => result.value?.serverInfo.blobSizeLimitBytes || 0
)
const maxSizeDisplayString = computed(() => prettyFileSize(maxSizeInBytes.value))
return {
maxSizeInBytes,
maxSizeDisplayString
}
}
export const useServerInfoScopes = () => {
const { result } = useQuery(serverInfoAllScopesQuery)
const scopes = computed(() => {
const base = result.value?.serverInfo.scopes || []
const cloned = cloneDeep(base) // cause it might get directly plopped back into the cache by a dev
return cloned.map((scope) => ({
...scope,
name: scope.name as unknown as (typeof AllScopes)[number]
}))
})
return {
scopes
}
}