1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-04-26 07:48:43 +02:00

feat: option to set DATA tab page size

This commit is contained in:
Fabio Di Stasio 2021-05-29 11:04:02 +02:00
parent 79f033e524
commit e71c7568c0
4 changed files with 39 additions and 4 deletions

View File

@ -83,6 +83,27 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<div class="col-6 col-sm-12">
<label class="form-label">
{{ $t('message.dataTabPageSize') }}
</label>
</div>
<div class="col-6 col-sm-12">
<select
v-model="localPageSize"
class="form-select"
@change="changePageSize(+localPageSize)"
>
<option
v-for="size in pageSizes"
:key="size"
>
{{ size }}
</option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div class="col-6 col-sm-12"> <div class="col-6 col-sm-12">
<label class="form-label"> <label class="form-label">
@ -257,9 +278,11 @@ export default {
data () { data () {
return { return {
localLocale: null, localLocale: null,
localPageSize: null,
localTimeout: null, localTimeout: null,
localEditorTheme: null, localEditorTheme: null,
selectedTab: 'general', selectedTab: 'general',
pageSizes: [40, 100, 250, 500, 1000],
editorThemes: [ editorThemes: [
{ {
group: this.$t('word.light'), group: this.$t('word.light'),
@ -317,6 +340,7 @@ export default {
appVersion: 'application/appVersion', appVersion: 'application/appVersion',
selectedSettingTab: 'application/selectedSettingTab', selectedSettingTab: 'application/selectedSettingTab',
selectedLocale: 'settings/getLocale', selectedLocale: 'settings/getLocale',
pageSize: 'settings/getDataTabLimit',
selectedAutoComplete: 'settings/getAutoComplete', selectedAutoComplete: 'settings/getAutoComplete',
selectedLineWrap: 'settings/getLineWrap', selectedLineWrap: 'settings/getLineWrap',
notificationsTimeout: 'settings/getNotificationsTimeout', notificationsTimeout: 'settings/getNotificationsTimeout',
@ -359,6 +383,7 @@ ORDER BY
}, },
created () { created () {
this.localLocale = this.selectedLocale; this.localLocale = this.selectedLocale;
this.localPageSize = this.pageSize;
this.localTimeout = this.notificationsTimeout; this.localTimeout = this.notificationsTimeout;
this.localEditorTheme = this.editorTheme; this.localEditorTheme = this.editorTheme;
this.selectedTab = this.selectedSettingTab; this.selectedTab = this.selectedSettingTab;
@ -371,6 +396,7 @@ ORDER BY
...mapActions({ ...mapActions({
closeModal: 'application/hideSettingModal', closeModal: 'application/hideSettingModal',
changeLocale: 'settings/changeLocale', changeLocale: 'settings/changeLocale',
changePageSize: 'settings/changePageSize',
changeAutoComplete: 'settings/changeAutoComplete', changeAutoComplete: 'settings/changeAutoComplete',
changeLineWrap: 'settings/changeLineWrap', changeLineWrap: 'settings/changeLineWrap',
changeApplicationTheme: 'settings/changeApplicationTheme', changeApplicationTheme: 'settings/changeApplicationTheme',

View File

@ -139,7 +139,8 @@ export default {
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
getWorkspace: 'workspaces/getWorkspace' getWorkspace: 'workspaces/getWorkspace',
pageSize: 'settings/getDataTabLimit'
}), }),
workspaceSchema () { workspaceSchema () {
return this.getWorkspace(this.connUid).breadcrumbs.schema; return this.getWorkspace(this.connUid).breadcrumbs.schema;
@ -157,7 +158,7 @@ export default {
return this.fields.every(field => field.name); return this.fields.every(field => field.name);
}, },
isHardSort () { isHardSort () {
return this.mode === 'table' && this.localResults.length === 1000; return this.mode === 'table' && this.localResults.length === this.pageSize;
}, },
sortedResults () { sortedResults () {
if (this.currentSort && !this.isHardSort) { if (this.currentSort && !this.isHardSort) {

View File

@ -210,7 +210,8 @@ module.exports = {
editSchema: 'Edit schema', editSchema: 'Edit schema',
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'
}, },
faker: { faker: {
address: 'Address', address: 'Address',

View File

@ -19,10 +19,10 @@ export default {
}, },
getters: { getters: {
getLocale: state => state.locale, getLocale: state => state.locale,
getDataTabLimit: state => state.data_tab_limit,
getAllowPrerelease: state => state.allow_prerelease, getAllowPrerelease: state => state.allow_prerelease,
getExplorebarSize: state => state.explorebar_size, getExplorebarSize: state => state.explorebar_size,
getNotificationsTimeout: state => state.notifications_timeout, getNotificationsTimeout: state => state.notifications_timeout,
getDataTabLimit: state => state.data_tab_limit,
getAutoComplete: state => state.auto_complete, getAutoComplete: state => state.auto_complete,
getLineWrap: state => state.line_wrap, getLineWrap: state => state.line_wrap,
getApplicationTheme: state => state.application_theme, getApplicationTheme: state => state.application_theme,
@ -34,6 +34,10 @@ export default {
i18n.locale = locale; i18n.locale = locale;
persistentStore.set('locale', state.locale); persistentStore.set('locale', state.locale);
}, },
SET_DATA_TAB_LIMIT (state, limit) {
state.data_tab_limit = limit;
persistentStore.set('data_tab_limit', state.data_tab_limit);
},
SET_ALLOW_PRERELEASE (state, allow) { SET_ALLOW_PRERELEASE (state, allow) {
state.allow_prerelease = allow; state.allow_prerelease = allow;
persistentStore.set('allow_prerelease', state.allow_prerelease); persistentStore.set('allow_prerelease', state.allow_prerelease);
@ -67,6 +71,9 @@ export default {
changeLocale ({ commit }, locale) { changeLocale ({ commit }, locale) {
commit('SET_LOCALE', locale); commit('SET_LOCALE', locale);
}, },
changePageSize ({ commit }, limit) {
commit('SET_DATA_TAB_LIMIT', limit);
},
changeAllowPrerelease ({ commit }, allow) { changeAllowPrerelease ({ commit }, allow) {
commit('SET_ALLOW_PRERELEASE', allow); commit('SET_ALLOW_PRERELEASE', allow);
}, },