|
|
@ -16,6 +16,8 @@ const workspaceStore = useWorkspace() |
|
|
|
|
|
|
|
|
|
|
|
const isLocked = inject(IsLockedInj, ref(false)) |
|
|
|
const isLocked = inject(IsLockedInj, ref(false)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { copy } = useCopy() |
|
|
|
|
|
|
|
|
|
|
|
const isUpdating = ref({ |
|
|
|
const isUpdating = ref({ |
|
|
|
public: false, |
|
|
|
public: false, |
|
|
|
password: false, |
|
|
|
password: false, |
|
|
@ -104,16 +106,37 @@ const togglePasswordProtected = async () => { |
|
|
|
const isOpenCustomUrlLocal = ref(false) |
|
|
|
const isOpenCustomUrlLocal = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const isOpenCustomUrl = computed(() => { |
|
|
|
const isOpenCustomUrl = computed(() => { |
|
|
|
return !!activeView.value?.password || isOpenCustomUrlLocal.value |
|
|
|
return !!activeView.value?.custom_url_path || isOpenCustomUrlLocal.value |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const customUrl = computed({ |
|
|
|
const customUrl = ref() |
|
|
|
get: () => (isOpenCustomUrl.value ? activeView.value?.custom_url_path ?? '' : ''), |
|
|
|
|
|
|
|
set: async (value) => { |
|
|
|
|
|
|
|
if (!activeView.value) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
activeView.value = { ...(activeView.value as any), custom_url_path: isOpenCustomUrl.value ? value : null } |
|
|
|
// const customUrl = computed({ |
|
|
|
}, |
|
|
|
// get: () => (isOpenCustomUrl.value ? activeView.value?.custom_url_path ?? '' : ''), |
|
|
|
|
|
|
|
// set: async (value) => { |
|
|
|
|
|
|
|
// if (!activeView.value) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// activeView.value = { ...(activeView.value as any), custom_url_path: isOpenCustomUrl.value ? value : null } |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dashboardUrl1 = computed(() => { |
|
|
|
|
|
|
|
// get base url for workspace |
|
|
|
|
|
|
|
const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (baseUrl) { |
|
|
|
|
|
|
|
return `${baseUrl}${appInfo.value?.dashboardPath}` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dashboardUrl.value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const copyCustomUrl = () => { |
|
|
|
|
|
|
|
copy(`${dashboardUrl1.value}}#/shared/${customUrl.value}`) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
|
|
customUrl.value = activeView.value?.custom_url_path |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const toggleCustomUrl = async () => { |
|
|
|
const toggleCustomUrl = async () => { |
|
|
@ -121,17 +144,17 @@ const toggleCustomUrl = async () => { |
|
|
|
if (!activeView.value) return |
|
|
|
if (!activeView.value) return |
|
|
|
if (isUpdating.value.customUrl) return |
|
|
|
if (isUpdating.value.customUrl) return |
|
|
|
|
|
|
|
|
|
|
|
isUpdating.value.password = true |
|
|
|
isUpdating.value.customUrl = true |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (passwordProtected.value) { |
|
|
|
if (isOpenCustomUrl.value) { |
|
|
|
activeView.value = { ...(activeView.value as any), custom_url_path: null } |
|
|
|
customUrl.value = null |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
activeView.value = { ...(activeView.value as any), custom_url_path: '' } |
|
|
|
customUrl.value = null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await updateSharedView() |
|
|
|
await updateSharedView() |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
isUpdating.value.password = false |
|
|
|
isUpdating.value.customUrl = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -251,17 +274,6 @@ function sharedViewUrl() { |
|
|
|
}` |
|
|
|
}` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const dashboardUrl1 = computed(() => { |
|
|
|
|
|
|
|
// get base url for workspace |
|
|
|
|
|
|
|
const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (baseUrl) { |
|
|
|
|
|
|
|
return `${baseUrl}${appInfo.value?.dashboardPath}` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dashboardUrl.value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const toggleViewShare = async () => { |
|
|
|
const toggleViewShare = async () => { |
|
|
|
if (!activeView.value?.id) return |
|
|
|
if (!activeView.value?.id) return |
|
|
|
|
|
|
|
|
|
|
@ -328,8 +340,9 @@ async function updateSharedView() { |
|
|
|
await $api.dbViewShare.update(activeView.value.id!, { |
|
|
|
await $api.dbViewShare.update(activeView.value.id!, { |
|
|
|
meta, |
|
|
|
meta, |
|
|
|
password: activeView.value.password, |
|
|
|
password: activeView.value.password, |
|
|
|
custom_url_path: activeView.value?.custom_url_path ?? null, |
|
|
|
custom_url_path: customUrl.value ?? null, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
activeView.value.custom_url_path = customUrl.value ?? null |
|
|
|
} catch (e: any) { |
|
|
|
} catch (e: any) { |
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
message.error(await extractSdkResponseErrorMsg(e)) |
|
|
|
} |
|
|
|
} |
|
|
@ -396,10 +409,20 @@ async function savePreFilledMode() { |
|
|
|
size="small" |
|
|
|
size="small" |
|
|
|
:bordered="false" |
|
|
|
:bordered="false" |
|
|
|
autocomplete="off" |
|
|
|
autocomplete="off" |
|
|
|
@update:value="updateSharedViewWithDebounce" |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<NcButton size="xs" @click.stop="updateSharedView"> |
|
|
|
<NcButton |
|
|
|
|
|
|
|
v-if="customUrl && customUrl === activeView?.custom_url_path" |
|
|
|
|
|
|
|
size="xs" |
|
|
|
|
|
|
|
type="secondary" |
|
|
|
|
|
|
|
@click="copyCustomUrl" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<template #icon> |
|
|
|
|
|
|
|
<MdiContentCopy class="h-3.5" /> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
{{ $t('general.copy') }} |
|
|
|
|
|
|
|
</NcButton> |
|
|
|
|
|
|
|
<NcButton v-else size="xs" :disabled="!customUrl" @click.stop="updateSharedView"> |
|
|
|
{{ $t('general.save') }} |
|
|
|
{{ $t('general.save') }} |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|