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 filtering to the Network profiler #2340

Merged
merged 10 commits into from
Sep 21, 2020

Conversation

kenzieschmoll
Copy link
Member

@kenzieschmoll kenzieschmoll commented Sep 15, 2020

Screen Shot 2020-09-15 at 8 02 21 AM

Screen Shot 2020-09-15 at 12 01 57 PM

If a filter is applied, the filter button is toggled:
Screen Shot 2020-09-15 at 8 02 49 AM

At the bottom of the screen, the filter count "x of y" is shown:
Screen Shot 2020-09-15 at 8 49 06 AM

Fixes #2316

@jacob314
Copy link
Contributor

High level: it could make sense to support a query field where users can type a query like
uri:foo.com status:403 as well as or instead of providing a field for each possible way of filtering and searching. That could apply to all devtools pages doing search.

return textFieldSuffixButton(Icons.clear, onPressed);
}

Widget textFieldSuffixButton(IconData icon, VoidCallback onPressed) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this a "suffix" button?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for the suffix parameter of an InputDecoration. Maybe I should rename the method to inputDecorationSuffixButton

padding: const EdgeInsets.symmetric(horizontal: densePadding),
width: 24.0,
child: IconButton(
padding: const EdgeInsets.all(0.0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would placing the padding in the icon button look different than in the container?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the explicit 0 padding is to override the default padding of 4.0 in the IconButton, otherwise the size constraint of 24.0 is not respected.

this.showWebSocket = true,
});

static NetworkFilter from(NetworkFilter filter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: make a factory constructor even though that won't change anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

);
}

String method;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can these all be final?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no because they need to be modified when adjusting the filter in the dialog. We could make a copyWith method. Leaving as is for now since I'll likely tweak all this code in a follow up to use a query.

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jacob314
Copy link
Contributor

lgtm

@kenzieschmoll
Copy link
Member Author

Updated to use query-based filter as discussed. PTAL

@@ -351,11 +351,11 @@ class NetworkFilter {
if (querySeparatorIndex != -1) {
final value = part.substring(querySeparatorIndex + 1);
if (value != '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be nice to have an enum like
QueryFliter { final Iterable keys; }
class so that you can reuse this parsing logic for all pages rather than writing it again on each page.

Copy link
Contributor

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kenzieschmoll kenzieschmoll merged commit 404bd28 into flutter:master Sep 21, 2020
@kenzieschmoll kenzieschmoll deleted the filter branch September 21, 2020 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add search and filter to network page
2 participants