mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 03:55:57 +00:00
fix(nc-gui): update delete all records modal text
This commit is contained in:
@@ -4,6 +4,7 @@ import { onKeyDown } from '@vueuse/core'
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
rows: number
|
||||
isSelectedAll?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['cancel', 'update:modelValue', 'deleteAll'])
|
||||
@@ -31,14 +32,14 @@ const close = () => {
|
||||
@keydown.esc="dialogShow = false"
|
||||
>
|
||||
<div class="flex justify-between w-full text-base font-semibold mb-2 text-nc-content-gray-emphasis items-center">
|
||||
{{ 'Delete all records' }}
|
||||
{{ isSelectedAll ? $t('activity.deleteAllRecords') : $t('activity.deleteAllSelectedRecords') }}
|
||||
</div>
|
||||
<div data-testid="nc-expand-table-modal" class="flex flex-col">
|
||||
<div class="mb-2 nc-content-gray">Are you sure you want to delete all {{ rows }} records present in this view?</div>
|
||||
<div class="mb-2 nc-content-gray">{{ $t('objects.deleteAllRecordDlg.subtitle', { rowCount: rows }) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-nc-bg-gray-light py-2 px-4 flex items-center gap-4 w-full rounded-lg">
|
||||
<div class="leading-5 text-nc-content-gray">This action cannot be undone.</div>
|
||||
<div class="leading-5 text-nc-content-gray">{{ $t('objects.deleteAllRecordDlg.warning') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row mt-5 justify-end gap-x-2">
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { CellRange } from '../../../../../composables/useMultiSelect/cellRa
|
||||
import type { ActionManager } from '../loaders/ActionManager'
|
||||
const props = defineProps<{
|
||||
selectedAllRecords: boolean
|
||||
selectedAllRecordsSkipPks: Record<string, string>
|
||||
contextMenuTarget: { row: number; col: number; path: Array<number> | null } | null
|
||||
selection: CellRange
|
||||
columns: CanvasGridColumn[]
|
||||
@@ -53,7 +54,7 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
// Emits
|
||||
const emits = defineEmits(['bulkUpdateDlg', 'update:selectedAllRecords'])
|
||||
const emits = defineEmits(['bulkUpdateDlg', 'update:selectedAllRecords', 'update:selectedAllRecordsSkipPks'])
|
||||
|
||||
const {
|
||||
bulkDeleteAll,
|
||||
@@ -69,7 +70,7 @@ const {
|
||||
|
||||
const contextMenuTarget = useVModel(props, 'contextMenuTarget', emits)
|
||||
const vSelectedAllRecords = useVModel(props, 'selectedAllRecords', emits)
|
||||
|
||||
const vSelectedAllRecordsSkipPks = useVModel(props, 'selectedAllRecordsSkipPks', emits)
|
||||
// To Refs
|
||||
const isGroupBy = toRef(props, 'isGroupBy')
|
||||
const selection = toRef(props, 'selection')
|
||||
@@ -138,13 +139,17 @@ async function deleteAllRecords() {
|
||||
|
||||
const { totalRows } = getDataCache([])
|
||||
|
||||
const allSelectedRecordCount = totalRows.value - Object.keys(vSelectedAllRecordsSkipPks.value).length
|
||||
|
||||
const { close } = useDialog(resolveComponent('DlgRecordDeleteAll'), {
|
||||
'modelValue': isDeleteAllRecordsModalOpen,
|
||||
'rows': totalRows.value,
|
||||
'rows': allSelectedRecordCount,
|
||||
'isSelectedAll': totalRows.value === allSelectedRecordCount,
|
||||
'onUpdate:modelValue': closeDlg,
|
||||
'onDeleteAll': async () => {
|
||||
await bulkDeleteAll?.([])
|
||||
closeDlg()
|
||||
vSelectedAllRecordsSkipPks.value = {}
|
||||
vSelectedAllRecords.value = false
|
||||
},
|
||||
})
|
||||
@@ -294,7 +299,11 @@ const execBulkAction = async (path: Array<number>) => {
|
||||
>
|
||||
<div v-e="['a:row:delete-all']" class="flex gap-2 items-center">
|
||||
<GeneralIcon icon="delete" />
|
||||
{{ $t('activity.deleteAllRecords') }}
|
||||
{{
|
||||
ncIsEmptyObject(vSelectedAllRecordsSkipPks)
|
||||
? $t('activity.deleteAllRecords')
|
||||
: $t('activity.deleteAllSelectedRecords')
|
||||
}}
|
||||
</div>
|
||||
</NcMenuItem>
|
||||
</template>
|
||||
|
||||
@@ -2838,6 +2838,7 @@ watch(
|
||||
"
|
||||
v-model:context-menu-target="contextMenuTarget"
|
||||
v-model:selected-all-records="vSelectedAllRecords"
|
||||
v-model:selected-all-records-skip-pks="vSelectedAllRecordsSkipPks"
|
||||
:selection="selection"
|
||||
:columns="columns"
|
||||
:active-cell="activeCell"
|
||||
|
||||
@@ -644,6 +644,10 @@
|
||||
"resetFieldPermissionsDescription": "Edit access will be set to Editors & up.",
|
||||
"confirmRevertPermissionsToDefault": "Confirm reset permissions for table - \"{tableName}\"",
|
||||
"formViewFieldEditPermissionRestrictionTooltip": "This field is hidden in the form because no one has permission to edit it."
|
||||
},
|
||||
"deleteAllRecordDlg": {
|
||||
"subtitle": "Are you sure you want to delete all selected {rowCount} records present in this view?",
|
||||
"warning": "This action cannot be undone."
|
||||
}
|
||||
},
|
||||
"datatype": {
|
||||
@@ -1508,6 +1512,7 @@
|
||||
"runActions": "Run Actions",
|
||||
"createScript": "Create Script",
|
||||
"deleteAllRecords": "Delete all records",
|
||||
"deleteAllSelectedRecords": "Delete all selected records",
|
||||
"assignView": "Assign view",
|
||||
"webhookDetails": "Webhook Details",
|
||||
"webhookLogs": "Webhook: Logs",
|
||||
|
||||
Reference in New Issue
Block a user