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. 93
      packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

93
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,57 +397,40 @@ async function savePreFilledMode() {
> >
</a-switch> </a-switch>
</div> </div>
<div v-if="formPreFill.preFillEnabled">
<a-select <a-select
:value="formPreFill.preFilledMode" v-if="formPreFill.preFillEnabled"
:allow-clear="formPreFill.preFilledMode !== t('general.default')" :value="formPreFill.preFilledMode"
class="nc-pre-filled-mode !rounded-md w-full" :allow-clear="formPreFill.preFilledMode !== t('general.default')"
dropdown-class-name="nc-dropdown-pre-filled-mode border-1 !rounded-md border-gray-200" class="nc-pre-filled-mode !rounded-md w-full !mt-0"
data-testid="nc-modal-share-view__preFillMode" dropdown-class-name="nc-dropdown-pre-filled-mode border-1 !rounded-md border-gray-200"
@update:value=" data-testid="nc-modal-share-view__preFillMode"
(value) => { @update:value="
formPreFill = { (value) => {
...formPreFill, formPreFill = {
preFilledMode: value || '', ...formPreFill,
} preFilledMode: value || '',
} }
" }
> "
<template #suffixIcon> >
<GeneralIcon icon="arrowDown" class="text-gray-700" /> <template #suffixIcon>
</template> <GeneralIcon icon="arrowDown" class="text-gray-700" />
<template v-for="mode of Object.values(PreFilledMode)" :key="mode"> </template>
<a-select-option v-if="mode !== PreFilledMode.Default" :value="mode"> <template v-for="mode of Object.values(PreFilledMode)" :key="mode">
<div class="flex gap-2 items-center"> <a-select-option v-if="mode !== PreFilledMode.Default" :value="mode">
<div class="flex-1">{{ $t(`activity.preFilledFields.${mode}`) }}</div> <div class="flex gap-2 items-center">
<component <div class="flex-1">{{ $t(`activity.preFilledFields.${mode}`) }}</div>
:is="iconMap.check" <component
v-if="formPreFill.preFilledMode === mode" :is="iconMap.check"
id="nc-selected-item-icon" v-if="formPreFill.preFilledMode === mode"
class="text-primary w-4 h-4" id="nc-selected-item-icon"
/> class="text-primary w-4 h-4"
</div> />
</a-select-option> </div>
</template> </a-select-option>
</a-select> </template>
</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