Browse Source

fix(nc-gui): use existing copy link component for prefill link

pull/7786/head
Ramesh Mane 9 months ago
parent
commit
c71bcab080
  1. 33
      packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

33
packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

@ -54,10 +54,6 @@ const url = computed(() => {
return sharedViewUrl() ?? '' return sharedViewUrl() ?? ''
}) })
const forPreFillUrl = computed(() => {
return sharedViewUrl(true) ?? ''
})
const passwordProtectedLocal = ref(false) const passwordProtectedLocal = ref(false)
const passwordProtected = computed(() => { const passwordProtected = computed(() => {
@ -179,7 +175,7 @@ const formPreFill = computed({
}, },
}) })
function sharedViewUrl(isPreFillUrl: boolean = false) { function sharedViewUrl() {
if (!activeView.value) return if (!activeView.value) return
let viewType let viewType
@ -213,9 +209,7 @@ function sharedViewUrl(isPreFillUrl: boolean = false) {
return encodeURI( return encodeURI(
`${dashboardUrl1}#/nc/${viewType}/${activeView.value.uuid}${surveyMode.value ? '/survey' : ''}${ `${dashboardUrl1}#/nc/${viewType}/${activeView.value.uuid}${surveyMode.value ? '/survey' : ''}${
isPreFillUrl && formPreFill.value.preFillEnabled && viewStore.preFillFormSearchParams formPreFill.value.preFillEnabled && viewStore.preFillFormSearchParams ? `?${viewStore.preFillFormSearchParams}` : ''
? `?${viewStore.preFillFormSearchParams}`
: ''
}`, }`,
) )
} }
@ -403,11 +397,12 @@ async function savePreFilledMode() {
> >
</a-switch> </a-switch>
</div> </div>
<div v-if="formPreFill.preFillEnabled">
<a-select <a-select
v-if="formPreFill.preFillEnabled"
:value="formPreFill.preFilledMode" :value="formPreFill.preFilledMode"
:allow-clear="formPreFill.preFilledMode !== t('general.default')" :allow-clear="formPreFill.preFilledMode !== t('general.default')"
class="nc-pre-filled-mode !rounded-md w-full" class="nc-pre-filled-mode !rounded-md w-full !mt-0"
dropdown-class-name="nc-dropdown-pre-filled-mode border-1 !rounded-md border-gray-200" dropdown-class-name="nc-dropdown-pre-filled-mode border-1 !rounded-md border-gray-200"
data-testid="nc-modal-share-view__preFillMode" data-testid="nc-modal-share-view__preFillMode"
@update:value=" @update:value="
@ -436,24 +431,6 @@ async function savePreFilledMode() {
</a-select-option> </a-select-option>
</template> </template>
</a-select> </a-select>
<NcTooltip
:disabled="!!viewStore.preFillFormSearchParams"
:class="{
'!cursor-not-allowed': !viewStore.preFillFormSearchParams,
}"
>
<template #title> {{ $t('tooltip.fillTheFormFieldFirst') }} </template>
<div
class="mt-0.5 border-t-1 border-gray-100 pt-3"
:class="{
'pointer-events-none': !viewStore.preFillFormSearchParams,
}"
>
<GeneralCopyUrl v-model:url="forPreFillUrl" />
</div>
</NcTooltip>
</div>
</div> </div>
</template> </template>
</div> </div>

Loading…
Cancel
Save