Skip to content

Commit

Permalink
fix: нормальная работа одиночных фильтров, очистка запроса по кнопке
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Dec 23, 2018
1 parent b02b38c commit 39f534f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion components/FilterPresetButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default {
let parts = this.$store.state.q ? this.$store.state.q.split("&") : [];
parts.push(q);
this.$store.dispatch("q", parts.join("&"));
const result = parts.join("&");
this.$store.dispatch("q", { q: result });
}
}
};
Expand Down
7 changes: 5 additions & 2 deletions components/QueryInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
valueKey="name"
:clearable="true"
@select="querySelect"
@clear="queryChangeAction"
@keyup.enter.native="queryChangeAction"
>
<template slot-scope="slotProps">
Expand Down Expand Up @@ -111,6 +112,7 @@ export default {
globalQ() {
// update local data when store value changes
this.q = this.globalQ;
this.$refs.input.focus();
}
},
Expand Down Expand Up @@ -176,8 +178,9 @@ export default {
// autocomplete of query
queryComplete(q, cb) {
if (!q || this.completionProcess) return cb([]);
const parts = q.split("&");
// в q старое значение, надо брать this.q
if (!this.q || this.completionProcess) return cb([]);
const parts = this.q.split("&");
const lastPart = parts[parts.length - 1];
this.completionProcess = true;
Expand Down
8 changes: 6 additions & 2 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,12 @@ export const actions = {
},

q({ commit, dispatch }, q) {
commit('q', q);
dispatch('filterSites');
if (typeof q == 'object') {
commit('q', q.q);
} else {
commit('q', q);
dispatch('filterSites');
}
},

// переключает поле в таблице, через нее проходят все изменения полей
Expand Down

0 comments on commit 39f534f

Please sign in to comment.