Vue Attract: Sort/filterable table based on Vue

Initial commit implementing sortable and filterable tables for attract
using Vue.
This commit is contained in:
2019-02-12 09:08:37 +01:00
parent 66212ec5fa
commit 5e73720d91
51 changed files with 1375 additions and 485 deletions

View File

@@ -0,0 +1,40 @@
let PillarTable = pillar.vuecomponents.table.PillarTable;
import {AssetColumnFactory} from './columns/AssetColumnFactory'
import {AssetRowsSource} from './rows/AssetRowsSource'
import {RowFilter} from '../attracttable/filter/RowFilter'
const TEMPLATE =`
<div class="pillar-table-actions">
<button class="action"
v-if="canAddAsset"
@click="createNewAsset"
>
<i class="pi-plus">New Asset</i>
</button>
</div>
`;
let TableActions = {
template: TEMPLATE,
computed: {
canAddAsset() {
let projectId = ProjectUtils.projectId();
return attract.auth.AttractAuth.canUserCreateAsset(projectId);
}
},
methods: {
createNewAsset() {
asset_create(ProjectUtils.projectUrl());
}
},
}
Vue.component('attract-assets-table', {
extends: PillarTable,
columnFactory: AssetColumnFactory,
rowsSource: AssetRowsSource,
components: {
'pillar-table-actions': TableActions,
'pillar-table-row-filter': RowFilter,
}
});