Skip to content

Commit

Permalink
Add support for ooni run id filtering for measurements and mat
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Sep 3, 2024
1 parent 7fd05e9 commit e7dcb04
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/aggregation/mat/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const defaultDefaultValues = {
axis_x: 'measurement_start_day',
axis_y: '',
time_grain: 'day',
ooni_run_link_id: '',
}

export const Form = ({ onSubmit, query }) => {
Expand Down Expand Up @@ -490,6 +491,20 @@ export const Form = ({ onSubmit, query }) => {
</div>
</>
)}
<div className="w-full sm:w-5/12 md:w-4/12 lg:w-2/12">
<Controller
name="ooni_run_link_id"
control={control}
render={({ field }) => (
<Input
label={intl.formatMessage({
id: 'Search.Sidebar.OoniRunLinkId',
})}
{...field}
/>
)}
/>
</div>
</div>
<div className="flex my-8">
<button
Expand Down
18 changes: 18 additions & 0 deletions components/search/FilterSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const inputRegEx =
export const queryToFilterMap = {
domain: ['domainFilter', ''],
input: ['inputFilter', ''],
ooni_run_link_id: ['ooniRunLinkId', ''],
category_code: ['categoryFilter', ''],
probe_cc: ['countryFilter', ''],
probe_asn: ['asnFilter', ''],
Expand All @@ -91,6 +92,7 @@ const FilterSidebar = ({
countries,
domainFilter,
inputFilter,
ooniRunLinkId,
categoryFilter,
onlyFilter = 'all',
testNameFilter = 'XX',
Expand All @@ -105,6 +107,7 @@ const FilterSidebar = ({
const defaultValues = {
domainFilter,
inputFilter,
ooniRunLinkId,
categoryFilter,
onlyFilter,
testNameFilter,
Expand Down Expand Up @@ -371,6 +374,7 @@ const FilterSidebar = ({
id: 'Search.Sidebar.Input.Placeholder',
})}
type="text"
className="mb-4"
/>
)}
rules={{
Expand All @@ -385,6 +389,20 @@ const FilterSidebar = ({
</>
)}

<Controller
control={control}
name="ooniRunLinkId"
render={({ field }) => (
<Input
{...field}
label={intl.formatMessage({
id: 'Search.Sidebar.OoniRunLinkId',
})}
type="text"
/>
)}
/>

{(showConfirmedFilter || showAnomalyFilter) && (
<>
<label className="mb-1 block text-base text-blue-500 pt-4">
Expand Down
2 changes: 2 additions & 0 deletions pages/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const queryToParams = ({ query }) => {
'since',
'until',
'failure',
'ooni_run_link_id',
]

if (query.show) {
Expand Down Expand Up @@ -290,6 +291,7 @@ const Search = ({ countries, query: queryProp }) => {
<FilterSidebar
domainFilter={query.domain}
inputFilter={query.input}
ooniRunLinkId={query.ooni_run_link_id}
categoryFilter={query.category_code}
testNameFilter={query.test_name}
countryFilter={query.probe_cc}
Expand Down
1 change: 1 addition & 0 deletions public/static/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@
"Search.Sidebar.From": "From",
"Search.Sidebar.Until": "Until",
"Search.Sidebar.HideFailed": "Hide failed measurements",
"Search.Sidebar.OoniRunLinkId": "OONI Run Link ID",
"Search.Sidebar.Button.FilterResults": "Filter Results",
"Search.FilterButton.AllResults": "All Results",
"Search.FilterButton.Confirmed": "Confirmed",
Expand Down

0 comments on commit e7dcb04

Please sign in to comment.