Skip to content

Commit

Permalink
enh: clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck authored and blizzz committed Feb 28, 2024
1 parent 4df2c23 commit 94ea89c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/modules/main/sections/MainWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ export default {
// Used to reload View from backend, in case there are Filter updates
const isLastElementSameAndView = this.element.id === this.lastActiveElement?.id && this.isView === this.lastActiveElement?.isView
if (!this.lastActiveElement || this.element.id !== this.lastActiveElement.id || isLastElementSameAndView || this.isView !== this.lastActiveElement.isView || force) {
this.localLoading = true
// Since we show one page at a time, no need keep other tables in the store
await this.$store.dispatch('clearState')
this.viewSetting = {}
await this.$store.dispatch('loadColumnsFromBE', {
Expand Down
16 changes: 8 additions & 8 deletions src/shared/components/ncTable/NcTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ deselect-all-rows -> unselect all rows, e.g. after deleting selected rows
<div class="options row" style="padding-right: calc(var(--default-grid-baseline) * 2);">
<Options :rows="rows" :columns="parsedColumns" :element-id="elementId" :is-view="isView"
:selected-rows="localSelectedRows" :show-options="parsedColumns.length !== 0"
:view-setting.sync="localViewSetting" :config="config" @create-row="$emit('create-row', elementId, isView)"
:view-setting.sync="localViewSetting" :config="config" @create-row="$emit('create-row')"
@download-csv="data => downloadCsv(data, parsedColumns, downloadTitle)"
@set-search-string="str => setSearchString(str)"
@delete-selected-rows="rowIds => $emit('delete-selected-rows', rowIds, elementId, isView)" />
@delete-selected-rows="rowIds => $emit('delete-selected-rows', rowIds)" />
</div>
<div class="custom-table row">
<CustomTable v-if="config.canReadRows || (config.canCreateRows && rows.length > 0)" :columns="parsedColumns"
:rows="rows" :is-view="isView" :element-id="elementId" :view-setting.sync="localViewSetting"
:config="config" @create-row="$emit('create-row', elementId, isView)"
@edit-row="rowId => $emit('edit-row', rowId, elementId, isView)"
@create-column="$emit('create-column', elementId, isView)"
@edit-column="col => $emit('edit-column', col, elementId, isView)"
@delete-column="col => $emit('delete-column', col, elementId, isView)"
:config="config" @create-row="$emit('create-row')"
@edit-row="rowId => $emit('edit-row', rowId)"
@create-column="$emit('create-column')"
@edit-column="col => $emit('edit-column', col)"
@delete-column="col => $emit('delete-column', col)"
@update-selected-rows="rowIds => localSelectedRows = rowIds"
@download-csv="data => downloadCsv(data, parsedColumns, table)">
<template #actions>
Expand All @@ -68,7 +68,7 @@ deselect-all-rows -> unselect all rows, e.g. after deleting selected rows
</template>
<template #action>
<NcButton :aria-label="t('tables', 'Create row')" type="primary"
@click="$emit('create-row', elementId, isView)">
@click="$emit('create-row')">
<template #icon>
<Plus :size="25" />
</template>
Expand Down
3 changes: 0 additions & 3 deletions src/shared/components/ncTable/sections/CustomTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import TableHeader from '../partials/TableHeader.vue'
import TableRow from '../partials/TableRow.vue'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { mapGetters } from 'vuex'
import { MagicFields } from '../mixins/magicFields.js'
export default {
Expand Down Expand Up @@ -85,8 +84,6 @@ export default {
},
computed: {
...mapGetters(['getColumnById']),
sorting() {
return this.viewSetting?.sorting
},
Expand Down
6 changes: 0 additions & 6 deletions src/store/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ export default {

},

getters: {
getColumnById: (state) => (id) => {
return state.columns.filter(column => column.id === id)[0]
},
},

actions: {
clearState({ commit }) {
commit('clearLoading')
Expand Down

0 comments on commit 94ea89c

Please sign in to comment.