|
|
@ -28,6 +28,7 @@ interface TableExplorerColumn extends ColumnType { |
|
|
|
interface op { |
|
|
|
interface op { |
|
|
|
op: 'add' | 'update' | 'delete' |
|
|
|
op: 'add' | 'update' | 'delete' |
|
|
|
column: TableExplorerColumn |
|
|
|
column: TableExplorerColumn |
|
|
|
|
|
|
|
error?: string |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface fieldsVisibilityOps { |
|
|
|
interface fieldsVisibilityOps { |
|
|
@ -647,6 +648,23 @@ const fieldStatus = (field?: TableExplorerColumn) => { |
|
|
|
return id ? fieldStatuses.value[id] : '' |
|
|
|
return id ? fieldStatuses.value[id] : '' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fieldErrors = computed<Record<string, string>>(() => { |
|
|
|
|
|
|
|
const errors: Record<string, string> = {} |
|
|
|
|
|
|
|
for (const op of ops.value) { |
|
|
|
|
|
|
|
if (op?.error) { |
|
|
|
|
|
|
|
const id = op.column.id || op.column.temp_id |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (id) errors[id] = op.error |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return errors |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fieldError = (field?: TableExplorerColumn) => { |
|
|
|
|
|
|
|
const id = field?.id || field?.temp_id |
|
|
|
|
|
|
|
return id ? fieldErrors.value[id] : '' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const clearChanges = () => { |
|
|
|
const clearChanges = () => { |
|
|
|
ops.value = [] |
|
|
|
ops.value = [] |
|
|
|
moveOps.value = [] |
|
|
|
moveOps.value = [] |
|
|
@ -743,6 +761,10 @@ const saveChanges = async () => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ops.value = ops.value.map(({ error: _err, ...rest }) => { |
|
|
|
|
|
|
|
return rest |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const res = await $api.dbTableColumn.bulk(meta.value?.id, { |
|
|
|
const res = await $api.dbTableColumn.bulk(meta.value?.id, { |
|
|
|
hash: columnsHash.value, |
|
|
|
hash: columnsHash.value, |
|
|
|
ops: ops.value, |
|
|
|
ops: ops.value, |
|
|
@ -751,10 +773,7 @@ const saveChanges = async () => { |
|
|
|
await loadViewColumns() |
|
|
|
await loadViewColumns() |
|
|
|
|
|
|
|
|
|
|
|
if (res) { |
|
|
|
if (res) { |
|
|
|
ops.value = |
|
|
|
ops.value = res.failedOps && res.failedOps?.length ? res.failedOps : [] |
|
|
|
res.failedOps && res.failedOps?.length |
|
|
|
|
|
|
|
? (res.failedOps as (op & { error: unknown })[]).map(({ error: _, ...rest }) => rest) |
|
|
|
|
|
|
|
: [] |
|
|
|
|
|
|
|
newFields.value = newFields.value.filter((col) => { |
|
|
|
newFields.value = newFields.value.filter((col) => { |
|
|
|
if (res.failedOps) { |
|
|
|
if (res.failedOps) { |
|
|
|
const op = res.failedOps.find((fop) => { |
|
|
|
const op = res.failedOps.find((fop) => { |
|
|
@ -1161,6 +1180,20 @@ watch( |
|
|
|
> |
|
|
|
> |
|
|
|
{{ $t('labels.multiField.incompleteConfiguration') }} |
|
|
|
{{ $t('labels.multiField.incompleteConfiguration') }} |
|
|
|
</NcBadge> |
|
|
|
</NcBadge> |
|
|
|
|
|
|
|
<NcTooltip v-if="!!fieldError(field)" class="cursor-pointer"> |
|
|
|
|
|
|
|
<template #title> |
|
|
|
|
|
|
|
{{ fieldError(field) }} |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<NcBadge |
|
|
|
|
|
|
|
color="red" |
|
|
|
|
|
|
|
:border="false" |
|
|
|
|
|
|
|
class="ml-1 bg-red-50 text-red-700" |
|
|
|
|
|
|
|
data-testid="nc-field-status-error-configuration" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<GeneralIcon icon="info" class="!text-current" /> |
|
|
|
|
|
|
|
</NcBadge> |
|
|
|
|
|
|
|
</NcTooltip> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<NcButton |
|
|
|
<NcButton |
|
|
|
v-if="fieldStatus(field) === 'delete' || fieldStatus(field) === 'update'" |
|
|
|
v-if="fieldStatus(field) === 'delete' || fieldStatus(field) === 'update'" |
|
|
|