fix(ui): propery update the events, and add new filters
This commit is contained in:
parent
4d0730f394
commit
6689b89d0c
2 changed files with 6 additions and 5 deletions
|
|
@ -73,7 +73,7 @@ window.getJWT = () => {
|
|||
};
|
||||
|
||||
window.setJWT = (jwt) => {
|
||||
userStore.updateJwt(jwt);
|
||||
userStore.updateJwt({jwt});
|
||||
};
|
||||
|
||||
export class RootStore {
|
||||
|
|
@ -167,4 +167,4 @@ export const withStore = (Component: any) => (props: any) => {
|
|||
return <Component {...props} mstore={useStore()} />;
|
||||
};
|
||||
|
||||
export { userStore, sessionStore, searchStore, searchStoreLive, projectStore };
|
||||
export { userStore, sessionStore, searchStore, searchStoreLive, projectStore };
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class SearchStore {
|
|||
}
|
||||
|
||||
addFilter(filter: any) {
|
||||
const index = this.instance.filters.findIndex((i: FilterItem) => i.key === filter.key);
|
||||
const index = filter.isEvent ? -1 : this.instance.filters.findIndex((i: FilterItem) => i.key === filter.key);
|
||||
|
||||
filter.value = checkFilterValue(filter.value);
|
||||
filter.filters = filter.filters
|
||||
|
|
@ -202,12 +202,13 @@ class SearchStore {
|
|||
: null;
|
||||
|
||||
if (index > -1) {
|
||||
const oldFilter = this.instance.filters[index];
|
||||
const oldFilter = new FilterItem(this.instance.filters[index]);
|
||||
const updatedFilter = {
|
||||
...oldFilter,
|
||||
value: oldFilter.value.concat(filter.value)
|
||||
};
|
||||
oldFilter.merge(updatedFilter);
|
||||
this.updateFilter(index, updatedFilter);
|
||||
} else {
|
||||
this.instance.filters.push(filter);
|
||||
this.instance = new Search({
|
||||
|
|
@ -239,7 +240,7 @@ class SearchStore {
|
|||
// TODO
|
||||
}
|
||||
|
||||
updateFilter = (index: number, search: Partial<IFilter>) => {
|
||||
updateFilter = (index: number, search: Partial<FilterItem>) => {
|
||||
const newFilters = this.instance.filters.map((_filter: any, i: any) => {
|
||||
if (i === index) {
|
||||
return search;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue