Browse Source

fix: Added created record toastr in Links modal

pull/6938/head
Muhammed Mustafa 1 year ago
parent
commit
77b9038f3f
  1. 4
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 31
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  3. 1
      packages/nc-gui/lang/en.json

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

@ -47,7 +47,7 @@ interface Props {
const props = defineProps<Props>() const props = defineProps<Props>()
const emits = defineEmits(['update:modelValue', 'cancel', 'next', 'prev']) const emits = defineEmits(['update:modelValue', 'cancel', 'next', 'prev', 'createdRecord'])
const { activeView } = storeToRefs(useViewsStore()) const { activeView } = storeToRefs(useViewsStore())
@ -207,6 +207,8 @@ const save = async () => {
if (props.closeAfterSave) { if (props.closeAfterSave) {
isExpanded.value = false isExpanded.value = false
} }
emits('createdRecord', _row.value.row)
} }
const isPreventChangeModalOpen = ref(false) const isPreventChangeModalOpen = ref(false)

31
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -55,6 +55,8 @@ const isPublic = inject(IsPublicInj, ref(false))
const isExpandedFormCloseAfterSave = ref(false) const isExpandedFormCloseAfterSave = ref(false)
const createdRecord = ref()
isChildrenExcludedLoading.value = true isChildrenExcludedLoading.value = true
const isForm = inject(IsFormInj, ref(false)) const isForm = inject(IsFormInj, ref(false))
@ -165,6 +167,8 @@ watch(expandedFormDlg, () => {
loadChildrenList() loadChildrenList()
} }
loadChildrenExcludedList(rowState.value) loadChildrenExcludedList(rowState.value)
} else {
createdRecord.value = undefined
} }
}) })
@ -186,6 +190,14 @@ const addNewRecord = () => {
expandedFormDlg.value = true expandedFormDlg.value = true
isExpandedFormCloseAfterSave.value = true isExpandedFormCloseAfterSave.value = true
} }
const onCreatedRecord = (record: any) => {
createdRecord.value = record
setTimeout(() => {
createdRecord.value = undefined
}, 2000)
}
</script> </script>
<template> <template>
@ -206,7 +218,23 @@ const addNewRecord = () => {
:display-value="row.row[displayValueProp]" :display-value="row.row[displayValueProp]"
:header="$t('activity.addNewLink')" :header="$t('activity.addNewLink')"
/> />
<div class="!xs:hidden my-3 bg-gray-50 border-gray-50 border-b-2"></div> <div class="relative !xs:hidden my-3 bg-gray-50 border-gray-50 border-b-2">
<div v-if="createdRecord" class="absolute flex flex-row justify-center left-0 right-0 -top-3">
<div class="flex text-green-500 bg-green-100 pl-1.5 pr-0.75 py-0.5 rounded-md items-center">
<div>
{{
$t('activity.gotSavedLinkedSuccessfully', {
tableName: relatedTableMeta?.title,
recordTitle: createdRecord?.[relatedTableDisplayValueProp],
})
}}
</div>
<NcButton size="xxsmall" type="text" class="ml-1 !h-5.5 !w-4 !hover:(bg-green-200 text-gray-800)">
<GeneralIcon icon="close" class="text-gray-500 !text-xs !h-3.5 !w-3.5" @click="createdRecord = undefined" />
</NcButton>
</div>
</div>
</div>
<div class="flex mt-2 mb-2 items-center gap-2"> <div class="flex mt-2 mb-2 items-center gap-2">
<div <div
class="flex items-center border-1 p-1 rounded-md w-full border-gray-200" class="flex items-center border-1 p-1 rounded-md w-full border-gray-200"
@ -361,6 +389,7 @@ const addNewRecord = () => {
}) })
: undefined : undefined
" "
@created-record="onCreatedRecord"
/> />
</Suspense> </Suspense>
</NcModal> </NcModal>

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

@ -796,6 +796,7 @@
"addNewRecord": "Add new record", "addNewRecord": "Add new record",
"newRecord": "New record", "newRecord": "New record",
"tableNameCreateNewRecord": "{tableName}: Create new record", "tableNameCreateNewRecord": "{tableName}: Create new record",
"gotSavedLinkedSuccessfully": "{tableName} '{recordTitle}' got saved & linked successfully",
"useConnectionUrl": "Use Connection URL", "useConnectionUrl": "Use Connection URL",
"toggleCommentsDraw": "Toggle comments draw", "toggleCommentsDraw": "Toggle comments draw",
"expandRecord": "Expand Record", "expandRecord": "Expand Record",

Loading…
Cancel
Save