fix(ui): sessions listings settings filter

This commit is contained in:
Shekar Siri 2025-02-05 12:21:41 +01:00
parent 72e42dfd5f
commit 5a1bcf71f8
3 changed files with 20 additions and 4 deletions

View file

@ -58,7 +58,7 @@ function ListingVisibility() {
</div>
<div className="col-span-3">
<Select
defaultValue={periodOptions[1].value}
defaultValue={durationSettings.countType || periodOptions[0].value}
options={periodOptions}
onChange={({ value }) => {
changeSettings({ countType: value.value })

View file

@ -38,6 +38,7 @@ const projectStore = new ProjectsStore();
const sessionStore = new SessionStore();
const searchStore = new SearchStore();
const searchStoreLive = new SearchStoreLive();
const settingsStore = new SettingsStore();
function copyToClipboard(text: string) {
const textArea = document.createElement('textarea');
@ -114,7 +115,7 @@ export class RootStore {
this.dashboardStore = new DashboardStore();
this.metricStore = new MetricStore();
this.funnelStore = new FunnelStore();
this.settingsStore = new SettingsStore();
this.settingsStore = settingsStore;
this.userStore = userStore;
this.roleStore = new RoleStore();
this.auditStore = new AuditStore();
@ -168,4 +169,4 @@ export const withStore = (Component: any) => (props: any) => {
return <Component {...props} mstore={useStore()} />;
};
export { userStore, sessionStore, searchStore, searchStoreLive, projectStore, client };
export { userStore, sessionStore, searchStore, searchStoreLive, projectStore, client, settingsStore };

View file

@ -13,7 +13,7 @@ import { searchService } from 'App/services';
import Search from 'App/mstore/types/search';
import { checkFilterValue } from 'App/mstore/types/filter';
import FilterItem from 'App/mstore/types/filterItem';
import { sessionStore } from 'App/mstore';
import { sessionStore, settingsStore } from 'App/mstore';
import SavedSearch, { ISavedSearch } from 'App/mstore/types/savedSearch';
import { iTag } from '@/services/NotesService';
import { issues_types } from 'Types/session/issue';
@ -339,6 +339,21 @@ class SearchStore {
filter.filters = filter.filters.concat(tagFilter);
}
if (!filter.filters.some((f: any) => f.type === FilterKey.DURATION)) {
const { durationFilter } = settingsStore.sessionSettings;
if (durationFilter?.count > 0) {
const multiplier = durationFilter.countType === 'sec' ? 1000 : 60000;
const amount = durationFilter.count * multiplier;
const value = durationFilter.operator === '<' ? [amount, 0] : [0, amount];
filter.filters.push({
type: FilterKey.DURATION,
value,
operator: 'is',
});
}
}
this.latestRequestTime = Date.now();
this.latestList = List();