Add Ctrl+Enter search on the subscriber query exp box

This commit is contained in:
Kailash Nadh 2020-07-09 12:49:42 +05:30
parent ab8dbd8314
commit eae88c1add
1 changed files with 9 additions and 2 deletions

View File

@ -35,6 +35,7 @@
<div v-if="isSearchAdvanced"> <div v-if="isSearchAdvanced">
<b-field> <b-field>
<b-input v-model="queryParams.queryExp" <b-input v-model="queryParams.queryExp"
@keydown.native.enter="onAdvancedQueryEnter"
type="textarea" ref="queryExp" type="textarea" ref="queryExp"
placeholder="subscribers.name LIKE '%user%' or subscribers.status='blacklisted'"> placeholder="subscribers.name LIKE '%user%' or subscribers.status='blacklisted'">
</b-input> </b-input>
@ -43,8 +44,7 @@
<span class="is-size-6 has-text-grey"> <span class="is-size-6 has-text-grey">
Partial SQL expression to query subscriber attributes.{{ ' ' }} Partial SQL expression to query subscriber attributes.{{ ' ' }}
<a href="https://listmonk.app/docs/querying-and-segmentation" <a href="https://listmonk.app/docs/querying-and-segmentation"
target="_blank" rel="noopener noreferrer"> target="_blank" rel="noopener noreferrer"> Learn more.
Learn more <b-icon icon="link" size="is-small" />.
</a> </a>
</span> </span>
</b-field> </b-field>
@ -287,6 +287,13 @@ export default Vue.extend({
this.queryParams.queryExp = `(name ~* '${q}' OR email ~* '${q}')`; this.queryParams.queryExp = `(name ~* '${q}' OR email ~* '${q}')`;
}, },
// Ctrl + Enter on the advanced query searches.
onAdvancedQueryEnter(e) {
if (e.ctrlKey) {
this.querySubscribers();
}
},
// Search / query subscribers. // Search / query subscribers.
querySubscribers() { querySubscribers() {
this.$api.getSubscribers({ this.$api.getSubscribers({