Browse Source

wip(gui-v2): dashboard url

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2860/head
Pranav C 2 years ago
parent
commit
5fdfa933c3
  1. 13
      packages/nc-gui-v2/components/smartsheet-toolbar/SharedViewList.vue

13
packages/nc-gui-v2/components/smartsheet-toolbar/SharedViewList.vue

@ -1,4 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useRoute } from '#app'
import { computed } from '@vue/reactivity'
import { useClipboard } from '@vueuse/core' import { useClipboard } from '@vueuse/core'
import { ViewTypes } from 'nocodb-sdk' import { ViewTypes } from 'nocodb-sdk'
import { useToast } from 'vue-toastification' import { useToast } from 'vue-toastification'
@ -22,13 +24,12 @@ interface SharedViewType {
const { view, $api, meta } = useSmartsheetStoreOrThrow() const { view, $api, meta } = useSmartsheetStoreOrThrow()
const { copy } = useClipboard() const { copy } = useClipboard()
const toast = useToast() const toast = useToast()
const route = useRoute()
let isLoading = $ref(false) let isLoading = $ref(false)
// let activeSharedView = $ref(null) // let activeSharedView = $ref(null)
const sharedViewList = ref<SharedViewType[]>() const sharedViewList = ref<SharedViewType[]>()
// todo: replace with inject/composable
const dashboardUrl = ''
const loadSharedViewsList = async () => { const loadSharedViewsList = async () => {
isLoading = true isLoading = true
@ -55,6 +56,11 @@ const loadSharedViewsList = async () => {
onMounted(loadSharedViewsList) onMounted(loadSharedViewsList)
// todo: get correct dashboard url
const dashboardUrl = computed(() =>{
return `${location.origin}`
})
const sharedViewUrl = (view: SharedViewType) => { const sharedViewUrl = (view: SharedViewType) => {
let viewType let viewType
switch (view.type) { switch (view.type) {
@ -80,7 +86,7 @@ const renderAllowCSVDownload = (view: SharedViewType) => {
} }
const copyLink = (view: SharedViewType) => { const copyLink = (view: SharedViewType) => {
copy(`${dashboardUrl}/${sharedViewUrl(view)}`) copy(`${dashboardUrl?.value as string}/${sharedViewUrl(view)}`)
toast.info('Copied to clipboard') toast.info('Copied to clipboard')
} }
@ -93,6 +99,7 @@ const deleteLink = async (id: string) => {
toast.error(await extractSdkResponseErrorMsg(e)) toast.error(await extractSdkResponseErrorMsg(e))
} }
} }
</script> </script>
<template> <template>

Loading…
Cancel
Save