Initial commit implementing sortable and filterable tables for attract using Vue.
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
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,
|
|
}
|
|
});
|