Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): proper error or success handling after copy view config

Ramesh Mane092dac76992d
diff --git a/packages/nc-gui/components/smartsheet/header/ColumnMenu.vue b/packages/nc-gui/components/smartsheet/header/ColumnMenu.vue
index fd06b4d7c1..28408dc7ab 100644
--- a/packages/nc-gui/components/smartsheet/header/ColumnMenu.vue
+++ b/packages/nc-gui/components/smartsheet/header/ColumnMenu.vue
@@ -444,7 +444,9 @@ const isGroupByLimitExceeded = computed(() => {
const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => {
if (column?.value) {
- eventBus.emit(event, column.value)
+ eventBus.emit(event, {
+ column: column.value,
+ })
}
isOpen.value = false
}
diff --git a/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
index 531b0dca4b..941ffd94c5 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/GroupByMenu.vue
@@ -154,7 +154,9 @@ watch(open, () => {
}
})
-eventBus.on(async (event, column) => {
+eventBus.on(async (event, payload = {}) => {
+ const column = payload.column
+
if (!column?.id) return
if (event === SmartsheetStoreEvents.GROUP_BY_ADD) {
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 977c0c9186..a30e253739 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -664,7 +664,9 @@
"selectConfigurationToCopy": "Select configuration(s) to copy",
"selectViewToCopyFrom": "Select view to copy from",
"copyConfigurationFromAnotherView": "Copy configuration from another view",
- "notSupportedByViewType": "Not supported by {view} view type"
+ "notSupportedByViewType": "Not supported by {view} view type",
+ "viewConfigurationCopied": "View configuration copied successfully",
+ "errorOccuredWhileCopyingViewConfiguration": "An error occurred while copying view configuration"
}
},
"datatype": {
diff --git a/packages/nc-gui/lib/ncMessage.ts b/packages/nc-gui/lib/ncMessage.ts
index f4aa7a07d6..da049d221b 100644
--- a/packages/nc-gui/lib/ncMessage.ts
+++ b/packages/nc-gui/lib/ncMessage.ts
@@ -45,7 +45,11 @@ export interface NcMessageObjectProps extends NcAlertMessageProps, Omit<MessageA
*/
export type NcMessageProps = NcMessageObjectProps | VueNode
-export interface NcMessageExtraProps extends Pick<NcMessageObjectProps, 'showDefaultMessage' | 'showCopyBtn'> {}
+/**
+ * Use `copyText` & `copyBtnTooltip` to set the copy text & tooltip for the copy button if params is primitive value
+ */
+export interface NcMessageExtraProps
+ extends Pick<NcMessageObjectProps, 'showDefaultMessage' | 'showCopyBtn' | 'copyText' | 'copyBtnTooltip'> {}
const defaultNcMessageExtraProps = {
showDefaultMessage: false,
@@ -132,7 +136,7 @@ const getMessageProps = (
...updatedParams,
title: ncMessageExtraProps.showDefaultMessage || !content ? getI18n().global.t(`objects.ncMessage.${type}`) : '',
content,
- copyText: ncMessageExtraProps.showCopyBtn ? content ?? '' : '',
+ copyText: ncMessageExtraProps.showCopyBtn ? ncMessageExtraProps.copyText ?? content ?? '' : '',
}
} else if (!isNcMessageObjectProps(params)) {
content = params
@@ -153,8 +157,8 @@ const getMessageProps = (
let copyText = ''
if (showCopyBtn) {
- if (params?.copyText) {
- copyText = params?.copyText
+ if (params?.copyText || ncMessageExtraProps.copyText) {
+ copyText = params?.copyText || ncMessageExtraProps.copyText
} else if (isPrimitiveValue(params.content)) {
copyText = params.content?.toString() ?? params.title ?? ''
}