-
Notifications
You must be signed in to change notification settings - Fork 203
Filtered process list #411
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
Open
bokner
wants to merge
49
commits into
phoenixframework:main
Choose a base branch
from
bokner:filtered_process_list
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
ff627d2
Enable filtering of process PIDs
bokner 63bc1bf
Fix process count
bokner 3e92e97
Use the process naming if it's created by process filter
bokner 9f0c928
Customize process_info page
bokner a8fb339
Let the callback decide what to do with the filter name
bokner 6c97999
Behaviour for process filter
bokner e628820
Merge branch 'main' into filtered_process_list
bokner 94265e3
Fixes
bokner a13b1a9
Refactoring
bokner ed5d42f
process_filter -> page_filter
bokner d1e4834
Refactoring, fixes
bokner 9db7de8
The content returned by the info_content/2 can be either of Phoenix.L…
bokner 1be224a
Update lib/phoenix/live_dashboard/page_filter.ex
bokner fe0f424
Update lib/phoenix/live_dashboard/components/table_component.ex
bokner 2c3a7be
Update lib/phoenix/live_dashboard/pages/processes_page.ex
bokner 2b1f7c4
Update lib/phoenix/live_dashboard/components/table_component.ex
bokner 2f12ee8
Fix formatting and indentation
bokner 58dc67f
Add description for Phoenix.LiveDashboard.PageFilter
bokner 3ac44c1
Get rid of rendering the modal info page (might go to another PR)
bokner 547ca85
Retrieve filter list from the remote node
bokner 71798ec
Put it all together (wip, cleanup to follow)
bokner e4a5222
Various fixes
bokner 8e7c2cd
Update lib/phoenix/live_dashboard/components/table_component.ex
bokner df782d6
Various changes to address the review
bokner 7eec63d
Have row_fetcher return 5-tuple
bokner 7242996
Add documentation for the case row_fetcher returns page filter data
bokner bbdbb62
Unit tests for process filter
bokner 97b5838
Unit tests: add filter to process paths for compability with table co…
bokner 5f0c700
Formatting
bokner d146580
Fix process filter module in test helper
bokner 30d5ee6
Use :if for conditional filter form
bokner 6c9a3e1
Fix active_filter form
bokner a74954b
Rename process_filter to filter
bokner fe86d97
Fix misplaced @impl
bokner e6d9ec1
Have process filter tests for SystemInfo to run with async: false
bokner 235a6d5
Unit tests for the filter in the process page
bokner e056334
do not use active_filter; instead, update filter in fetch_rows
bokner 408a28b
Refactoring, fixes
bokner a3b5137
Simplify the base implementation of default_filter/0
bokner 2076105
More refactoring
bokner d6e566b
Merge branch 'filtered_process_list' of github.com:bokner/phoenix_liv…
bokner ce63526
Use default filter if the filter is not listed
bokner 93d1fb5
Minor
bokner e988f05
Do not use hardcoded filter values in test cases
bokner a0ce9f8
Update docs for row_fetcher
bokner f826536
Fix the invalid filter value handling
bokner fa3f109
Move filter param down the list of params
bokner 7fe72ca
Adjust filter_list to nil, if it's empty
bokner e5c4b6f
Merge branch 'phoenixframework:main' into filtered_process_list
bokner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| defmodule Phoenix.LiveDashboard.PageFilter do | ||
| @moduledoc """ | ||
| Page filter allows to customize the list of items for table components. | ||
| This could be useful for cases where there are too many items and/or | ||
| the customized list of items is desired. | ||
| For instance, you may have millions of processes per node. Then, using the standard Processes page | ||
| may present a performance problem. Besides, you may want to look at the application-specific groups of processes, | ||
| rather then going through the whole list. | ||
|
|
||
| Example of custom page filter implementation: | ||
|
|
||
| defmodule ProcessFilter.Demo do | ||
| @behaviour Phoenix.LiveDashboard.PageFilter | ||
|
|
||
| @impl true | ||
| def list() do | ||
| ["All", "Registered", "Phoenix"] | ||
| end | ||
|
|
||
| @impl true | ||
| def default_filter() do | ||
| "Phoenix" | ||
| end | ||
|
|
||
| @impl true | ||
| def filter("Registered") do | ||
| Process.registered() |> Enum.map(fn name -> Process.whereis(name) end) | ||
| end | ||
|
|
||
| def filter("All") do | ||
| Process.list() | ||
| end | ||
|
|
||
| def filter("Phoenix") do | ||
| Process.registered() |> Enum.flat_map(fn name -> String.contains?(to_string(name), "Phoenix") && | ||
| [Process.whereis(name)] || [] | ||
| end) | ||
| end | ||
| end | ||
|
|
||
|
|
||
| To enable the filter for Processes page, add this to your config.exs: | ||
|
|
||
| config :phoenix_live_dashboard, :process_filter, ProcessFilter.Demo | ||
|
|
||
| What will happen: | ||
|
|
||
| - The Processes page will have Filter dropdown defined in list() function; | ||
| - The groups of processes will be displayed according to selected filter | ||
|
|
||
| """ | ||
|
|
||
| @callback list() :: [String.t()] | ||
|
|
||
| @callback filter(filter_name :: String.t()) :: [any()] | ||
|
|
||
| @callback default_filter() :: String.t() | ||
|
|
||
| defmacro __using__(_) do | ||
| quote do | ||
| @behaviour Phoenix.LiveDashboard.PageFilter | ||
| def default_filter() do | ||
| List.first(list()) | ||
| end | ||
|
|
||
| defoverridable default_filter: 0 | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.