-
Notifications
You must be signed in to change notification settings - Fork 286
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
Filter Models [enhancement] #455
Comments
Can you say more about what you mean by empty models? Model types that don't have any records in the store? |
Exactly. Just a simple filter so that only models with records in the store are displayed. I started looking into it a little, I think I could get something to play with early next week. |
Can you describe how can I filter models which used at current route? I want to help, but I can't find idea how to implement that filter. Thx |
Can you clarify what you mean by "used at current route"? Has a record that is rendered in the template? Has a record set as |
It was a quote from start message " So the question is for @pete-the-pete I suppose |
I was suggesting the 'active' model classes, not necessarily the records themselves. I was thinking something similar to the View Tree filter options. So, yes to "Has a record set as currentModel in an active route? Has a record inside an object/array currentModel", but no to "Has a record that is rendered in the template?" |
seems like this would be a better explored via the route explorer then no? |
My request is coming from personal experience; when I wanted to explore the data/models, the Data explorer of ember inspector is pretty noisy (we have too many models in our project). I was thinking of how I could add some additional filtering within that tab to make exploring the models easier. Adding something to the Route explorer is an interesting idea, I like that it would tie everything together. , Maybe another column that lists all the models, or a link to the filtered list of models in the Data explorer. |
@pete-the-pete can you explain how can I filter models which are used by current scope of routes? |
@pete-the-pete would adding a model type search field help solve the problem of many models? |
@teddyzeenny it could. The more I think about it, the more I think I'd want the Data explorer to have relative parity with the View explorer, which would include search. The View and Route explorers have the topbar with subnav/filter controls that make sense for that type of module, I'd like to have the data explorer have something similar. @vvscode, I'm not sure yet, I'm starting to look into the code. Maybe I can use modelFor to find the route's current models, and then filter other models based on the relationships they have. |
I'm not convinced yet with the "used by current route" feature yet as it is not very clear which models it really filters.
I feel like adding search can help reduce noise without any of the complications. |
@teddyzeenny, I agree the 'used by current route' needs more clarity. How do you feel about the nonEmpty filter? I started looking into that as its own feature, and to get familiar with the code. If you're ok with that feature, maybe we could treat it as a first pass, and sort out what other enhancements to add as separate/follow up efforts; search, current route, showing the models in the Routes explorer as @stefanpenner mentioned. |
@pete-the-pete 'Hide empty models' already merged into ( see above ) |
@pete-the-pete @teddyzeenny What about adding search box to model-type topbar ( enter json and get filtered models with |
Ha, I should have been watching the PRs too...oh, well, I got some more exposure to the code. @vvscode search could be good. My project has way too many models, so search could help a developer get exposed to the many different types much easier than browsing. I also like that it makes the different explorers (Data, Routes, Views) consistent. @teddyzeenny what do you think? @vvscode let me know how I can help with the actual coding. |
the filter works great by the way, thanks for getting that in |
I've been thinking about how to define this better, and have come up with the following: ModelTypes for Current Route:Add an option to filter models used by the current route (similar to View Tree filter), similar to the new 'Hide Empty Models' filter. The 'non empty' filter should apply to the routes filtered for the current model. This is tricky
I think first pass could provide a solution for 1 and 2, while a more robust solution, and addressing 3 could come later. First Pass:Solving 1 is the base case, there are different ways a route can return from a model hook, but not infinitely many. I think it would be possible to pull out the models from currentModel. A default fallback could be used to avoid explicit errors (showing no models for ex):
Ideally the list of models by type would be maintained, so that switching between routes, or toggling the filter wouldn't be too costly. This gets into other issues/questions about how store and maintain this list in EmberInspector:
Later:Assuming a data structure was used to store the models by route, the relationships could be added to the filtered list programmatically, before the user drills down. Traversing the model relationships, starting from those found in currentModel, should give the relevant records. They wouldn't necessarily be the records used exclusively by the current route, but that's fine, and desirable. Models in routes explorer:
|
Since this was merged in a long time ago, closing this issue. |
i'd like to be able to filter models:
I'm assuming hiding empty is an easier task. I'm more than happy to do the work, but any tips on how to approach it are appreciated.
The text was updated successfully, but these errors were encountered: