Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ooni run id filtering for measurements and mat
Browse files Browse the repository at this point in the history
majakomel committed Oct 7, 2024
1 parent ff9b7ea commit d5fc8ae
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
@@ -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 }) => {
@@ -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
18 changes: 18 additions & 0 deletions components/search/FilterSidebar.js
Original file line number Diff line number Diff line change
@@ -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', ''],
@@ -91,6 +92,7 @@ const FilterSidebar = ({
countries,
domainFilter,
inputFilter,
ooniRunLinkId,
categoryFilter,
onlyFilter = 'all',
testNameFilter = 'XX',
@@ -105,6 +107,7 @@ const FilterSidebar = ({
const defaultValues = {
domainFilter,
inputFilter,
ooniRunLinkId,
categoryFilter,
onlyFilter,
testNameFilter,
@@ -371,6 +374,7 @@ const FilterSidebar = ({
id: 'Search.Sidebar.Input.Placeholder',
})}
type="text"
className="mb-4"
/>
)}
rules={{
@@ -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">
2 changes: 2 additions & 0 deletions pages/search.js
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ const queryToParams = ({ query }) => {
'since',
'until',
'failure',
'ooni_run_link_id',
]

if (query.show) {
@@ -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}
1 change: 1 addition & 0 deletions public/static/lang/en.json
Original file line number Diff line number Diff line change
@@ -451,6 +451,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",

0 comments on commit d5fc8ae

Please sign in to comment.