Files
baseui/src/views/lists/domainlist.vue
2017-10-23 14:05:53 +02:00

87 lines
2.4 KiB
Vue

<template>
<div class="Domainlist">
<h1>Domainlist</h1>
<scroll-table :actions="actions" :columns="columns" :new-rows="newRows" :has-more="hasMore" :loading="loading" :handler="more" orderBy="Name" :orderDesc="false" :limit="50"></scroll-table>
</div>
</template>
<script>
export default {
name: "Domainlist",
data() {
return {
actions: [{
title: 'Edit',
icon: 'icon-pencil',
action(row) {
console.log("yay edit", row);
}
}, {
title: 'Duplicate',
icon: 'icon-docs',
action(row) {
console.log("yay duplicate", row);
}
}, {
title: 'Hide',
icon: 'icon-eye-off',
action(row) {
console.log("yay hide", row);
}
}],
columns: [{
heading: 'ID',
prop: 'ID',
orderBy: 'id',
align: 'right',
colStyle: {
width: '70px'
},
cellStyle: {
color: '#999'
}
}, {
heading: 'TLD',
prop: 'TLD',
orderBy: 'tld',
align: 'left'
}, {
heading: 'Domain',
prop: 'Name',
orderBy: 'name'
}],
newRows: [ ],
hasMore: true,
loading: false
}
},
methods: {
more(offset, limit, orderBy, orderDesc, search) {
this.loading = true;
this.$store.dispatch('apiRequest', {
endpoint: 'domains',
params: {
start: offset,
length: limit,
orderBy,
orderDesc,
search
}
})
.then(response => {
this.hasMore = (response.data.length >= limit);
this.newRows = response.data;
this.loading = false;
})
.catch(error => {
this.loading = false;
this.hasMore = false;
console.log(error);
});
}
}
}
</script>