mirror of https://github.com/Fabio286/antares.git
feat(UI): ability to manually insert page number in DATA tabs, closes #65
This commit is contained in:
parent
e579f37438
commit
e2ebb04a90
|
@ -41,9 +41,24 @@
|
||||||
>
|
>
|
||||||
<i class="mdi mdi-24px mdi-skip-previous" />
|
<i class="mdi mdi-24px mdi-skip-previous" />
|
||||||
</button>
|
</button>
|
||||||
<div class="btn btn-dark btn-sm mr-0 text-bold c-auto px-2">
|
<div class="dropdown" :class="{'active': isPageMenu}">
|
||||||
|
<div class="btn-group" @click="openPageMenu">
|
||||||
|
<div class="btn btn-dark btn-sm mr-0 dropdown-toggle text-bold px-3">
|
||||||
{{ page }}
|
{{ page }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="menu px-3">
|
||||||
|
<span>{{ $t('message.pageNumber') }}</span>
|
||||||
|
<input
|
||||||
|
ref="pageSelect"
|
||||||
|
v-model="pageProxy"
|
||||||
|
type="number"
|
||||||
|
min="1"
|
||||||
|
class="form-input"
|
||||||
|
@blur="setPageNumber"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
class="btn btn-dark btn-sm mr-0"
|
class="btn btn-dark btn-sm mr-0"
|
||||||
:disabled="isQuering || (results.length && results[0].rows.length < limit)"
|
:disabled="isQuering || (results.length && results[0].rows.length < limit)"
|
||||||
|
@ -172,6 +187,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
tabUid: 'data',
|
tabUid: 'data',
|
||||||
isQuering: false,
|
isQuering: false,
|
||||||
|
isPageMenu: false,
|
||||||
results: [],
|
results: [],
|
||||||
lastTable: null,
|
lastTable: null,
|
||||||
isAddModal: false,
|
isAddModal: false,
|
||||||
|
@ -179,7 +195,8 @@ export default {
|
||||||
autorefreshTimer: 0,
|
autorefreshTimer: 0,
|
||||||
refreshInterval: null,
|
refreshInterval: null,
|
||||||
sortParams: {},
|
sortParams: {},
|
||||||
page: 1
|
page: 1,
|
||||||
|
pageProxy: 1
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -229,8 +246,11 @@ export default {
|
||||||
this.$refs.queryTable.resetSort();
|
this.$refs.queryTable.resetSort();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
page () {
|
page (val, oldVal) {
|
||||||
|
if (val && val > 0 && val !== oldVal) {
|
||||||
|
this.pageProxy = this.page;
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isSelected (val) {
|
isSelected (val) {
|
||||||
if (val && this.lastTable !== this.table) {
|
if (val && this.lastTable !== this.table) {
|
||||||
|
@ -292,11 +312,30 @@ export default {
|
||||||
this.sortParams = sortParams;
|
this.sortParams = sortParams;
|
||||||
this.getTableData(sortParams);
|
this.getTableData(sortParams);
|
||||||
},
|
},
|
||||||
|
openPageMenu () {
|
||||||
|
if (this.isQuering) return;
|
||||||
|
|
||||||
|
this.isPageMenu = true;
|
||||||
|
if (this.isPageMenu)
|
||||||
|
setTimeout(() => this.$refs.pageSelect.focus(), 20);
|
||||||
|
},
|
||||||
|
setPageNumber () {
|
||||||
|
this.isPageMenu = false;
|
||||||
|
|
||||||
|
if (this.pageProxy > 0)
|
||||||
|
this.page = this.pageProxy;
|
||||||
|
else
|
||||||
|
this.pageProxy = this.page;
|
||||||
|
},
|
||||||
pageChange (direction) {
|
pageChange (direction) {
|
||||||
if (this.isQuering) return;
|
if (this.isQuering) return;
|
||||||
|
|
||||||
if (direction === 'next' && (this.results.length && this.results[0].rows.length === this.limit))
|
if (direction === 'next' && (this.results.length && this.results[0].rows.length === this.limit)) {
|
||||||
|
if (!this.page)
|
||||||
|
this.page = 2;
|
||||||
|
else
|
||||||
this.page++;
|
this.page++;
|
||||||
|
}
|
||||||
else if (direction === 'prev' && this.page > 1)
|
else if (direction === 'prev' && this.page > 1)
|
||||||
this.page--;
|
this.page--;
|
||||||
},
|
},
|
||||||
|
|
|
@ -215,7 +215,8 @@ module.exports = {
|
||||||
deleteSchema: 'Delete schema',
|
deleteSchema: 'Delete schema',
|
||||||
markdownSupported: 'Markdown supported',
|
markdownSupported: 'Markdown supported',
|
||||||
plantATree: 'Plant a Tree',
|
plantATree: 'Plant a Tree',
|
||||||
dataTabPageSize: 'DATA tab page size'
|
dataTabPageSize: 'DATA tab page size',
|
||||||
|
pageNumber: 'Page number'
|
||||||
},
|
},
|
||||||
faker: {
|
faker: {
|
||||||
address: 'Address',
|
address: 'Address',
|
||||||
|
|
Loading…
Reference in New Issue