Skip to content

Commit

Permalink
Support search inside exp params (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
atuchin-m authored Jan 25, 2024
1 parent 2e938ec commit 315c2ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/study_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ export class StudyFilter {
if (regex !== undefined) {
let found = false;
found ||= regex.test(s.study.name);
for (const e of s.study.experiment ?? []) found ||= regex.test(e.name);
for (const e of s.study.experiment ?? []) {
found ||= regex.test(e.name);
for (const p of e.param ?? []) {
if (p.name != null) found ||= regex.test(p.name);
if (p.value != null) found ||= regex.test(p.value);
}
}
for (const feature of s.affectedFeatures) found ||= regex.test(feature);
if (!found) return false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/web/app/study_model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('models', () => {
enable_feature: ['EnabledFeature1', 'EnabledFeature2'],
disable_feature: ['DisabledFeature'],
},
param: [{ name: 'OsBlocklist', value: 'MacOs' }],
},
{
name: 'Empty',
Expand Down Expand Up @@ -130,6 +131,8 @@ describe('models', () => {
expect(useFilter(studyList, { search: 'DisabledFeature' }).length).toBe(1);
expect(useFilter(studyList, { search: 'EnabledFeature1' }).length).toBe(1);
expect(useFilter(studyList, { search: 'Default' }).length).toBe(1);
expect(useFilter(studyList, { search: 'OsBlock' }).length).toBe(1);
expect(useFilter(studyList, { search: 'Mac' }).length).toBe(1);
});

test('filter-outdated', () => {
Expand Down

0 comments on commit 315c2ad

Please sign in to comment.