Skip to content

Commit

Permalink
enh: improve props
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck committed Feb 13, 2024
1 parent 2ce0601 commit 2c60436
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/modules/modals/DeleteRows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ export default {
type: Array,
default: null,
},
elementId: {
type: Number,
default: null,
},
isView: {
type: Boolean,
default: true,
},
},
methods: {
deleteRows() {
let error = false
this.rowsToDelete.rows.forEach(rowId => {
this.rowsToDelete.forEach(rowId => {
const res = this.$store.dispatch('removeRow', {
rowId,
viewId: this.rowsToDelete.isView ? this.rowsToDelete.elementId : null,
viewId: this.isView ? this.elementId : null,
})
if (!res) {
error = true
Expand All @@ -42,7 +50,7 @@ export default {
if (error) {
showError(t('tables', 'Error occurred while deleting rows.'))
}
emit('tables:selected-rows:deselect', { elementId: this.rowsToDelete.elementId, isView: this.rowsToDelete.isView })
emit('tables:selected-rows:deselect', { elementId: this.elementId, isView: this.isView })
this.$emit('cancel')
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/modules/modals/Modals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:show-modal="editRow !== null"
:out-transition="true"
@close="editRow = null" />
<DeleteRows v-if="rowsToDelete" :rows-to-delete="rowsToDelete" @cancel="rowsToDelete = null" />
<DeleteRows v-if="rowsToDelete" :rows-to-delete="rowsToDelete?.rows" :is-view="rowsToDelete?.isView" :element-id="rowsToDelete?.elementId" @cancel="rowsToDelete = null" />

<ViewSettings
:show-modal="viewToEdit !== null"
Expand Down

0 comments on commit 2c60436

Please sign in to comment.