Commit 7caf0459 authored by Anton's avatar Anton

DataTable now checks 'feature' property on actions

parent 6f12e689
......@@ -32,6 +32,8 @@
<script>
import PromiseSpan from './PromiseSpan'
import { mapGetters } from 'vuex'
import { userHasFeature } from 'mbjs-quasar/src/lib'
// import { DateTime } from 'luxon'
export default {
props: ['config', 'path', 'query', 'title', 'basePath', 'hasShow', 'requestTransform'],
......@@ -66,7 +68,10 @@
const makeFormatter = function (field) {
if (field === 'actions') {
return () => {
return _this.config.actions
return _this.config.actions.filter(action => {
if (action.feature) return _this.user && userHasFeature(_this.user, action.feature)
return true
})
}
}
return undefined
......@@ -156,6 +161,9 @@
await this.request({ pagination: this.pagination, filter: this.filter })
},
computed: {
...mapGetters({
user: 'auth/getUserState'
}),
tableTitle () {
return this.$t(this.title)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment