Add a 'Remember active group' option

This commit is contained in:
Bubka 2020-11-23 13:01:56 +01:00
parent c895e95b87
commit 0989e6e452
4 changed files with 20 additions and 8 deletions

View File

@ -40,6 +40,7 @@
'showAccountsIcons' => true, 'showAccountsIcons' => true,
'kickUserAfter' => '15', 'kickUserAfter' => '15',
'activeGroup' => 0, 'activeGroup' => 0,
'rememberActiveGroup' => true,
'defaultGroup' => 0, 'defaultGroup' => 0,
'useEncryption' => false, 'useEncryption' => false,
'defaultCaptureMode' => 'livescan', 'defaultCaptureMode' => 'livescan',

View File

@ -438,14 +438,16 @@
this.form.activeGroup = this.$root.appSettings.activeGroup = id this.form.activeGroup = this.$root.appSettings.activeGroup = id
this.form.post('/api/settings/options', {returnError: true}) if( this.$root.appSettings.rememberActiveGroup ) {
.then(response => { this.form.post('/api/settings/options', {returnError: true})
// everything's fine .then(response => {
}) // everything's fine
.catch(error => { })
.catch(error => {
this.$router.push({ name: 'genericError', params: { err: error.response } })
}); this.$router.push({ name: 'genericError', params: { err: error.response } })
});
}
this.closeGroupSwitch() this.closeGroupSwitch()
}, },

View File

@ -8,8 +8,12 @@
<form-toggle :choices="layouts" :form="form" fieldName="displayMode" :label="$t('settings.forms.display_mode.label')" :help="$t('settings.forms.display_mode.help')" /> <form-toggle :choices="layouts" :form="form" fieldName="displayMode" :label="$t('settings.forms.display_mode.label')" :help="$t('settings.forms.display_mode.help')" />
<!-- show icon --> <!-- show icon -->
<form-checkbox :form="form" fieldName="showAccountsIcons" :label="$t('settings.forms.show_accounts_icons.label')" :help="$t('settings.forms.show_accounts_icons.help')" /> <form-checkbox :form="form" fieldName="showAccountsIcons" :label="$t('settings.forms.show_accounts_icons.label')" :help="$t('settings.forms.show_accounts_icons.help')" />
<h4 class="title is-4 pt-4">{{ $t('groups.groups') }}</h4>
<!-- default group --> <!-- default group -->
<form-select :options="groups" :form="form" fieldName="defaultGroup" :label="$t('settings.forms.default_group.label')" :help="$t('settings.forms.default_group.help')" /> <form-select :options="groups" :form="form" fieldName="defaultGroup" :label="$t('settings.forms.default_group.label')" :help="$t('settings.forms.default_group.help')" />
<!-- retain active group -->
<form-checkbox :form="form" fieldName="rememberActiveGroup" :label="$t('settings.forms.remember_active_group.label')" :help="$t('settings.forms.remember_active_group.help')" />
<h4 class="title is-4 pt-4">{{ $t('settings.security') }}</h4> <h4 class="title is-4 pt-4">{{ $t('settings.security') }}</h4>
<!-- auto lock --> <!-- auto lock -->
@ -67,6 +71,7 @@
defaultGroup: '', defaultGroup: '',
useDirectCapture: null, useDirectCapture: null,
defaultCaptureMode: '', defaultCaptureMode: '',
rememberActiveGroup: true,
}), }),
langs: [ langs: [
{ text: this.$t('languages.en'), value: 'en' }, { text: this.$t('languages.en'), value: 'en' },

View File

@ -72,6 +72,10 @@
'label' => 'Default input mode', 'label' => 'Default input mode',
'help' => 'Default input mode used when the Direct input option is On', 'help' => 'Default input mode used when the Direct input option is On',
], ],
'remember_active_group' => [
'label' => 'Remember group filter',
'help' => 'Save the last group filter applied and restore it on your next visit',
],
'never' => 'Never', 'never' => 'Never',
'on_token_copy' => 'On security code copy', 'on_token_copy' => 'On security code copy',
'1_minutes' => 'After 1 minute', '1_minutes' => 'After 1 minute',