π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): keep button disabled and show invalid tooltip
Ramesh Mane8519c36a1d3a
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button/index.ts b/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button/index.tsindex 38de994a10..8ec2cddbbe 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button/index.ts+++ b/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button/index.ts@@ -248,7 +248,7 @@ export const ButtonCellRenderer: CellRenderer = {const colOptions = column.columnObj?.colOptions as ButtonType- if (!colOptions) return+ if (!colOptions || !colOptions.type) returnconst buttonMeta = {label: colOptions?.label || '',@@ -298,7 +298,10 @@ export const ButtonCellRenderer: CellRenderer = {if (e.key === 'Enter') {const isLoading = actionManager.isLoading(pk, column.id!)- if (column.readonly || column.columnObj?.readonly || isLoading) return false+ if (column.readonly || column.columnObj?.readonly || isLoading) {+ return false+ }+await actionManager.executeButtonAction([pk], column, { row: [row], path, allowLocalUrl })return true}diff --git a/packages/nc-gui/components/virtual-cell/Button.vue b/packages/nc-gui/components/virtual-cell/Button.vueindex 02a2287674..a795fba97f 100644--- a/packages/nc-gui/components/virtual-cell/Button.vue+++ b/packages/nc-gui/components/virtual-cell/Button.vue@@ -153,6 +153,15 @@ const componentProps = computed(() => {generatingColumnRows.value.includes(column.value.id)),}}++ // If button type is missing then keep it as disabled+ if (!column.value.colOptions.type) {+ return {+ disabled: true,+ }+ }++ return {}})const afterActionStatus = ref<{@@ -164,6 +173,8 @@ const triggerAction = async () => {const colOptions = column.value.colOptionsafterActionStatus.value = null+ if (!colOptions.type) return+if (colOptions.type === ButtonActionsType.Url) {confirmPageLeavingRedirect(componentProps.value?.href, componentProps.value?.target, appInfo.value?.allowLocalUrl)} else if (colOptions.type === ButtonActionsType.Webhook) {diff --git a/packages/nc-gui/utils/columnUtils.ts b/packages/nc-gui/utils/columnUtils.tsindex 5f1c44e894..67e58f57aa 100644--- a/packages/nc-gui/utils/columnUtils.ts+++ b/packages/nc-gui/utils/columnUtils.ts@@ -339,6 +339,9 @@ const isColumnInvalid = ({result.isInvalid = trueresult.tooltip = `Input prompt has deleted column(s): ${missingIds.map((id) => id.title).join(', ')}`}+ } else if (!colOptions.type) {+ result.isInvalid = true+ result.tooltip = 'msg.invalidColumnConfiguration'}break}