Browse Source

Merge pull request #7463 from nocodb/nc-fix/sentry-errors-2

Nc fix/sentry errors 2
pull/7469/head
Raju Udava 11 months ago committed by GitHub
parent
commit
7bbbca2256
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      packages/nc-gui/components/dashboard/TreeView/ViewsList.vue
  2. 2
      packages/nc-gui/components/smartsheet/Kanban.vue
  3. 2
      packages/nc-gui/components/smartsheet/column/SelectOptions.vue
  4. 3
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  5. 6
      packages/nc-gui/components/smartsheet/grid/useColumnDrag.ts
  6. 6
      packages/nc-gui/components/smartsheet/header/CellIcon.ts
  7. 2
      packages/nc-gui/components/virtual-cell/HasMany.vue
  8. 2
      packages/nc-gui/components/virtual-cell/ManyToMany.vue
  9. 2
      packages/nc-gui/composables/useViewGroupBy.ts
  10. 1
      packages/nc-gui/lang/en.json
  11. 30
      packages/nocodb-sdk/src/lib/formulaHelpers.ts

3
packages/nc-gui/components/dashboard/TreeView/ViewsList.vue

@ -158,7 +158,8 @@ async function onSortEnd(evt: SortableEvent, undo = false) {
if (!currentItem || !currentItem.id) return if (!currentItem || !currentItem.id) return
const previousItem = (previousEl ? views.value.find((v) => v.id === previousEl.id) : {}) as ViewType // set default order value as 0 if item not found
const previousItem = (previousEl ? views.value.find((v) => v.id === previousEl.id) ?? { order: 0 } : { order: 0 }) as ViewType
const nextItem = (nextEl ? views.value.find((v) => v.id === nextEl.id) : {}) as ViewType const nextItem = (nextEl ? views.value.find((v) => v.id === nextEl.id) : {}) as ViewType
let nextOrder: number let nextOrder: number

2
packages/nc-gui/components/smartsheet/Kanban.vue

@ -367,7 +367,7 @@ watch(
// horizontally scroll to the end of the kanban container // horizontally scroll to the end of the kanban container
// when a new option is added within kanban view // when a new option is added within kanban view
nextTick(() => { nextTick(() => {
if (shouldScrollToRight.value) { if (shouldScrollToRight.value && kanbanContainerRef.value) {
kanbanContainerRef.value.scrollTo({ kanbanContainerRef.value.scrollTo({
left: kanbanContainerRef.value.scrollWidth, left: kanbanContainerRef.value.scrollWidth,
behavior: 'smooth', behavior: 'smooth',

2
packages/nc-gui/components/smartsheet/column/SelectOptions.vue

@ -176,6 +176,8 @@ const addNewOption = () => {
// } // }
const syncOptions = () => { const syncOptions = () => {
// set initial colOptions if not set
vModel.value.colOptions = vModel.value.colOptions || {}
vModel.value.colOptions.options = options.value vModel.value.colOptions.options = options.value
.filter((op) => op.status !== 'remove') .filter((op) => op.status !== 'remove')
.sort((a, b) => { .sort((a, b) => {

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

@ -116,7 +116,8 @@ const fields = computedInject(FieldsInj, (_fields) => {
}) })
const hiddenFields = computed(() => { const hiddenFields = computed(() => {
return (meta.value.columns ?? []).filter((col) => !fields.value?.includes(col)).filter((col) => !isSystemColumn(col)) // todo: figure out when meta.value is undefined
return (meta.value?.columns ?? []).filter((col) => !fields.value?.includes(col)).filter((col) => !isSystemColumn(col))
}) })
const showHiddenFields = ref(false) const showHiddenFields = ref(false)

6
packages/nc-gui/components/smartsheet/grid/useColumnDrag.ts

@ -25,7 +25,11 @@ export const useColumnDrag = ({
const reorderColumn = async (colId: string, toColId: string) => { const reorderColumn = async (colId: string, toColId: string) => {
const toBeReorderedViewCol = gridViewCols.value[colId] const toBeReorderedViewCol = gridViewCols.value[colId]
const toViewCol = gridViewCols.value[toColId]! const toViewCol = gridViewCols.value[toColId]
// if toBeReorderedViewCol/toViewCol is null, return
if (!toBeReorderedViewCol || !toViewCol) return
const toColIndex = fields.value.findIndex((f) => f.id === toColId) const toColIndex = fields.value.findIndex((f) => f.id === toColId)
const nextToColField = toColIndex < fields.value.length - 1 ? fields.value[toColIndex + 1] : null const nextToColField = toColIndex < fields.value.length - 1 ? fields.value[toColIndex + 1] : null

6
packages/nc-gui/components/smartsheet/header/CellIcon.ts

@ -115,9 +115,11 @@ export default defineComponent({
const { sqlUis } = storeToRefs(useBase()) const { sqlUis } = storeToRefs(useBase())
const sqlUi = ref(column.value?.source_id ? sqlUis.value[column.value?.source_id] : Object.values(sqlUis.value)[0]) const sqlUi = computed(() =>
column.value?.source_id ? sqlUis.value[column.value?.source_id] : Object.values(sqlUis.value)[0],
)
const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value)) const abstractType = computed(() => column.value && sqlUi.value?.getAbstractType(column.value))
return () => { return () => {
if (!column.value && !columnMeta.value) return null if (!column.value && !columnMeta.value) return null

2
packages/nc-gui/components/virtual-cell/HasMany.vue

@ -65,8 +65,6 @@ const cells = computed(() =>
const value = curr[relatedTableDisplayValueProp.value] const value = curr[relatedTableDisplayValueProp.value]
if (!value) return acc
return [...acc, { value, item: curr }] return [...acc, { value, item: curr }]
}, []), }, []),
) )

2
packages/nc-gui/components/virtual-cell/ManyToMany.vue

@ -66,8 +66,6 @@ const cells = computed(() =>
const value = curr[relatedTableDisplayValueProp.value] const value = curr[relatedTableDisplayValueProp.value]
if (!value) return acc
return [...acc, { value, item: curr }] return [...acc, { value, item: curr }]
}, []), }, []),
) )

2
packages/nc-gui/composables/useViewGroupBy.ts

@ -20,7 +20,7 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = [] const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = []
Object.values(gridViewCols.value).forEach((col) => { Object.values(gridViewCols.value).forEach((col) => {
if (col.group_by) { if (col.group_by) {
const column = meta?.value.columns?.find((f) => f.id === col.fk_column_id) const column = meta?.value?.columns?.find((f) => f.id === col.fk_column_id)
if (column) { if (column) {
tempGroupBy.push({ tempGroupBy.push({
column, column,

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

@ -972,6 +972,7 @@
"hintStart": "Hint: Use {placeholder1} to reference fields, e.g: {placeholder2}. For more, please check out", "hintStart": "Hint: Use {placeholder1} to reference fields, e.g: {placeholder2}. For more, please check out",
"hintEnd": "Formulas.", "hintEnd": "Formulas.",
"noSuggestedFormulaFound": "No suggested formula found", "noSuggestedFormulaFound": "No suggested formula found",
"typeIsExpected": "{calleeName} requires a {type} at position {position}",
"numericTypeIsExpected": "Numeric type is expected", "numericTypeIsExpected": "Numeric type is expected",
"stringTypeIsExpected": "String type is expected", "stringTypeIsExpected": "String type is expected",
"operationNotAvailable": "{operation} operation not available", "operationNotAvailable": "{operation} operation not available",

30
packages/nocodb-sdk/src/lib/formulaHelpers.ts

@ -722,10 +722,12 @@ export const formulas: Record<string, FormulaMeta> = {
throw new FormulaError( throw new FormulaError(
FormulaErrorType.INVALID_ARG, FormulaErrorType.INVALID_ARG,
{ {
key: 'msg.formula.numericTypeIsExpected', key: 'msg.formula.typeIsExpected',
type: 'Numeric',
calleeName: parsedTree.callee?.name?.toUpperCase(), calleeName: parsedTree.callee?.name?.toUpperCase(),
position: 2,
}, },
'Numeric type is expected' 'The REPEAT function requires a numeric as the parameter at position 2'
); );
} }
}, },
@ -1771,26 +1773,32 @@ export async function validateFormulaAndExtractTreeWithType({
`Field ${name} with ${argPt.dataType} type is found but ${expectedArgType} type is expected` `Field ${name} with ${argPt.dataType} type is found but ${expectedArgType} type is expected`
); );
} else { } else {
let key = '', let key = '';
message = 'Invalid argument type'; const position = i + 1;
let type = '';
if (expectedArgType === FormulaDataTypes.NUMERIC) { if (expectedArgType === FormulaDataTypes.NUMERIC) {
key = 'msg.formula.numericTypeIsExpected'; key = 'msg.formula.typeIsExpected';
message = 'Numeric type is expected'; type = 'numeric';
} else if (expectedArgType === FormulaDataTypes.BOOLEAN) { } else if (expectedArgType === FormulaDataTypes.BOOLEAN) {
key = 'msg.formula.booleanTypeIsExpected'; key = 'msg.formula.typeIsExpected';
message = 'Boolean type is expected'; type = 'boolean';
} else if (expectedArgType === FormulaDataTypes.DATE) { } else if (expectedArgType === FormulaDataTypes.DATE) {
key = 'msg.formula.dateTypeIsExpected'; key = 'msg.formula.typeIsExpected';
message = 'Date type is expected'; type = 'date';
} }
throw new FormulaError( throw new FormulaError(
FormulaErrorType.INVALID_ARG, FormulaErrorType.INVALID_ARG,
{ {
type,
key, key,
position,
calleeName, calleeName,
}, },
message `${calleeName?.toUpperCase()} requires a ${
type || expectedArgType
} at position ${position}`
); );
} }
} }

Loading…
Cancel
Save