Browse Source

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

Nc fix/sentry errors 2
pull/7469/head
Raju Udava 8 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
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
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
// when a new option is added within kanban view
nextTick(() => {
if (shouldScrollToRight.value) {
if (shouldScrollToRight.value && kanbanContainerRef.value) {
kanbanContainerRef.value.scrollTo({
left: kanbanContainerRef.value.scrollWidth,
behavior: 'smooth',

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

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

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

@ -25,7 +25,11 @@ export const useColumnDrag = ({
const reorderColumn = async (colId: string, toColId: string) => {
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 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 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 () => {
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]
if (!value) return acc
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]
if (!value) return acc
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 }[] = []
Object.values(gridViewCols.value).forEach((col) => {
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) {
tempGroupBy.push({
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",
"hintEnd": "Formulas.",
"noSuggestedFormulaFound": "No suggested formula found",
"typeIsExpected": "{calleeName} requires a {type} at position {position}",
"numericTypeIsExpected": "Numeric type is expected",
"stringTypeIsExpected": "String type is expected",
"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(
FormulaErrorType.INVALID_ARG,
{
key: 'msg.formula.numericTypeIsExpected',
key: 'msg.formula.typeIsExpected',
type: 'Numeric',
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`
);
} else {
let key = '',
message = 'Invalid argument type';
let key = '';
const position = i + 1;
let type = '';
if (expectedArgType === FormulaDataTypes.NUMERIC) {
key = 'msg.formula.numericTypeIsExpected';
message = 'Numeric type is expected';
key = 'msg.formula.typeIsExpected';
type = 'numeric';
} else if (expectedArgType === FormulaDataTypes.BOOLEAN) {
key = 'msg.formula.booleanTypeIsExpected';
message = 'Boolean type is expected';
key = 'msg.formula.typeIsExpected';
type = 'boolean';
} else if (expectedArgType === FormulaDataTypes.DATE) {
key = 'msg.formula.dateTypeIsExpected';
message = 'Date type is expected';
key = 'msg.formula.typeIsExpected';
type = 'date';
}
throw new FormulaError(
FormulaErrorType.INVALID_ARG,
{
type,
key,
position,
calleeName,
},
message
`${calleeName?.toUpperCase()} requires a ${
type || expectedArgType
} at position ${position}`
);
}
}

Loading…
Cancel
Save