Browse Source

fix(nc-gui): Improved copy record url button

pull/6600/head
Muhammed Mustafa 1 year ago
parent
commit
dd64847b83
  1. 17
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 1
      packages/nc-gui/lang/en.json

17
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -80,6 +80,8 @@ const isPublic = inject(IsPublicInj, ref(false))
// to check if a expanded form which is not yet saved exist or not // to check if a expanded form which is not yet saved exist or not
const isUnsavedFormExist = ref(false) const isUnsavedFormExist = ref(false)
const isRecordLinkCopied = ref(false)
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook()) const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook())
@ -216,15 +218,16 @@ const onNext = async () => {
emits('next') emits('next')
} }
const copyRecordUrl = () => { const copyRecordUrl = async () => {
copy( await copy(
encodeURI( encodeURI(
`${dashboardUrl?.value}#/${route.params.typeOrId}/${route.params.projectId}/${meta.value?.id}${ `${dashboardUrl?.value}#/${route.params.typeOrId}/${route.params.baseId}/${meta.value?.id}${
props.view ? `/${props.view.title}` : '' props.view ? `/${props.view.title}` : ''
}?rowId=${primaryKey.value}`, }?rowId=${primaryKey.value}`,
), ),
) )
message.success('Copied to clipboard')
isRecordLinkCopied.value = true
} }
const saveChanges = async () => { const saveChanges = async () => {
@ -265,6 +268,7 @@ provide(IsExpandedFormOpenInj, isExpanded)
const cellWrapperEl = ref() const cellWrapperEl = ref()
onMounted(async () => { onMounted(async () => {
isRecordLinkCopied.value = false
isLoading.value = true isLoading.value = true
if (props.loadRow) { if (props.loadRow) {
await _loadRow() await _loadRow()
@ -462,8 +466,9 @@ export default {
@click="!isNew ? copyRecordUrl() : () => {}" @click="!isNew ? copyRecordUrl() : () => {}"
> >
<div v-e="['c:row-expand:copy-url']" data-testid="nc-expanded-form-copy-url" class="flex gap-2 items-center"> <div v-e="['c:row-expand:copy-url']" data-testid="nc-expanded-form-copy-url" class="flex gap-2 items-center">
<component :is="iconMap.link" class="cursor-pointer nc-duplicate-row" /> <component :is="iconMap.check" v-if="isRecordLinkCopied" class="cursor-pointer nc-duplicate-row" />
{{ $t('labels.copyRecordURL') }} <component :is="iconMap.link" v-else class="cursor-pointer nc-duplicate-row" />
{{ isRecordLinkCopied ? $t('labels.copiedRecordURL') : $t('labels.copyRecordURL') }}
</div> </div>
</NcButton> </NcButton>
<NcDropdown v-if="!isNew"> <NcDropdown v-if="!isNew">

1
packages/nc-gui/lang/en.json

@ -397,6 +397,7 @@
"headerName": "Header Name", "headerName": "Header Name",
"icon": "Icon", "icon": "Icon",
"max": "Max", "max": "Max",
"copiedRecordURL": "Copied Record URL",
"copyRecordURL": "Copy Record URL", "copyRecordURL": "Copy Record URL",
"duplicateRecord": "Duplicate record", "duplicateRecord": "Duplicate record",
"binaryEncodingFormat": "Binary encoding format", "binaryEncodingFormat": "Binary encoding format",

Loading…
Cancel
Save