Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ooni run id filtering on measurements search page and mat #881

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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",
Expand Down
Loading