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

Limit number of objects on topology views #95

Merged
merged 1 commit into from
Jan 26, 2017

Conversation

zeari
Copy link

@zeari zeari commented Jan 8, 2017

Set object limit in settings:
screencapture-localhost-3000-configuration-index-1485269167360

Objects kinds are hidden by order of granularity. Since containers are the least major entity they will be hidden first, then pods, then similarly other types until we are below the set object limit.
Edit: you can bring back each hidden type separately (containers, pods, etc.) using the filter buttons on top
screencapture-localhost-3000-container_topology-show-1483886321675

@dclarizio @simon3z The code here is bad but in general, this is a possible approach towards scaling in topology. If this policy is good enough Ill go forward with it.

@zeari
Copy link
Author

zeari commented Jan 8, 2017

@miq-bot add_label providers/containers, topology

@miq-bot
Copy link
Member

miq-bot commented Jan 8, 2017

@zeari Cannot apply the following label because they are not recognized: topology

@zeari
Copy link
Author

zeari commented Jan 8, 2017

Setting the default number of items per page for topology to 20 would yield:
screencapture-localhost-3000-container_topology-show-1483886921445

@zeari zeari changed the title [WIP] Limit number of objects on topology screens [WIP] Limit number of objects on topology views Jan 8, 2017
@simon3z
Copy link
Contributor

simon3z commented Jan 9, 2017

Approach LGTM 👍.

@dclarizio can you review the approach/screenshots? (Code can be improved when we'll move this out of WIP).

@miq-bot assign dclarizio

@dclarizio
Copy link

@simon3z I'm not sure I'm fully on board with the approach. I mean, in theory I like it, but I have some issues:

  • you can't tell if there are more nodes you are not seeing, so it could be misleading, especially if you see only some of a certain node type
  • if I'm at my limit and I try to turn on another node type, nothing will happen, so we may need to show an error message

When I was thinking about this earlier, I had an idea that we could limit the maximum number of child nodes of any type (per parent), then show an extra "group" node, something like 28 more....

Another limit setting, at least for the initial display, could be Child Node Depth, which would turn off any nodes more than X levels below the root.

In both cases, perhaps we could let the user then drill into (or turn on) missing nodes on demand if they really need to see them.

Adding @serenamarie125 for more input.

@zeari
Copy link
Author

zeari commented Jan 9, 2017

you can't tell if there are more nodes you are not seeing, so it could be misleading, especially if you see only some of a certain node type
if I'm at my limit and I try to turn on another node type, nothing will happen, so we may need to show an error message

@dclarizio This is not the case. In this solution, all of a certain type are hidden (meaning all containers\ all pods\ all of type) by default and you can bring them all back using the filtering buttons on top. Those filter buttons are just on by default. Its indicated by the greyed out icons and the user can return to have all types shown.

Node depth from provider(root node) might not be a better filtering method since there are many types that are 'the same depth' but are less granular or interesting than their counterparts.

@dclarizio
Copy link

@zeari ahhh, I see . .. I misunderstood . . . so we eliminate (turn off) types, based on the furthest out nodes (i.e. granularity) until below the configured limit, but the user can turn them back on if they want, cool.

I still think a max number of child nodes would be a good idea, such that if I know more than 50 nodes is impossible for me to see clearly, it would just show the 50 and then a 83 more node that I could drill into if I wanted to. Just an idea. 😄

@zeari
Copy link
Author

zeari commented Jan 10, 2017

I still think a max number of child nodes would be a good idea, such that if I know more than 50 nodes is impossible for me to see clearly, it would just show the 50 and then a 83 more node that I could drill into if I wanted to. Just an idea.

That might be nice. Im not sure how we would decide which entity to hide (node?container?pod?) or how many of them to hide.
Anyway, if this approach is good enough for now I can go forward with it @dclarizio

@dclarizio
Copy link

@zeari this will help and can potentially be improved on later, I'm on board with moving forward . . . Thx, Dan

@serenamarie125
Copy link

@zeari Couple of questions ...

  1. If they limit the number of objects to see by default, is there to way to bring some back into view incrementally without leaving the page?

  2. Does it make sense to limit the number where you are ? It looks like it's the same place as setting number of items per page (as in paging)

@zeari
Copy link
Author

zeari commented Jan 15, 2017

If they limit the number of objects to see by default, is there to way to bring some back into view incrementally without leaving the page?

@serenamarie125 yes, you can bring back each hidden type separately (containers, pods, etc.) using the filter buttons on top

Does it make sense to limit the number where you are ? It looks like it's the same place as setting number of items per page (as in paging)

Maybe not. Where would you put it?

@zeari zeari force-pushed the set_topology_object_limit branch 2 times, most recently from e1a0f07 to c3aafb3 Compare January 17, 2017 11:18
@@ -37,6 +37,20 @@ function ContainerTopologyCtrl($scope, $http, $interval, $location, topologyServ

if (currentSelectedKinds && (Object.keys(currentSelectedKinds).length != Object.keys($scope.kinds).length)) {
$scope.kinds = currentSelectedKinds;
} else {
const remove_hierarchy = ['Container', 'ContainerGroup', 'ContainerReplicator', 'ContainerService',
Copy link
Contributor

Choose a reason for hiding this comment

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

can't use const yet, sorry :)

const remove_hierarchy = ['Container', 'ContainerGroup', 'ContainerReplicator', 'ContainerService',
'ContainerRoute', 'Host', 'Vm', 'ContainerNode', 'ContainerManager'];
// Cant use Object.values...
var tmp_list = Object.keys($scope.items).map(function(key) { return $scope.items[key] });
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be _.values ;)

var kind_index = 0;
while ((tmp_list.length > data.data.size_limit) && kind_index < remove_hierarchy.length) {
kind_to_hide = remove_hierarchy[kind_index];
tmp_list = tmp_list.filter(function(item) {
Copy link
Contributor

@himdel himdel Jan 19, 2017

Choose a reason for hiding this comment

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

Not a good idea to change tmp_list while iterating over it..

EDIT: ..unless you just care about the lenght :). We can keep this I think..

var tmp_list = Object.keys($scope.items).map(function(key) { return $scope.items[key] });
var kind_index = 0;
while ((tmp_list.length > data.data.size_limit) && kind_index < remove_hierarchy.length) {
kind_to_hide = remove_hierarchy[kind_index];
Copy link
Contributor

Choose a reason for hiding this comment

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

missing var

[_("Tile View"), "perpage_tile", :tile],
[_("List View"), "perpage_list", :list],
[_("Reports"), "perpage_reports", :reports],
[_("Topolgy View"), "perpage_topology", :topology]].each do |item_per_page|
Copy link
Contributor

Choose a reason for hiding this comment

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

Topolgy != Topology ;)

@zeari zeari force-pushed the set_topology_object_limit branch 2 times, most recently from 95c819d to 74cc5e0 Compare January 19, 2017 14:15
@zeari zeari changed the title [WIP] Limit number of objects on topology views Limit number of objects on topology views Jan 19, 2017
@zeari
Copy link
Author

zeari commented Jan 19, 2017

@miq-bot remove_label wip

@simon3z Aside from the comment by @serenamarie125 this should be ready.

@serenamarie125
Copy link

@zeari i would suggest something more like this, where it's in a box on it's own.
Here i have a switch which allows them to say if they want the auto filtering first ... is this something you could do as well ? If set to off, then the drop down would be disabled

screen shot 2017-01-19 at 10 57 12 am

@miq-bot miq-bot removed the wip label Jan 19, 2017
@@ -37,6 +37,20 @@ function ContainerTopologyCtrl($scope, $http, $interval, $location, topologyServ

if (currentSelectedKinds && (Object.keys(currentSelectedKinds).length != Object.keys($scope.kinds).length)) {
$scope.kinds = currentSelectedKinds;
} else {
remove_hierarchy = ['Container', 'ContainerGroup', 'ContainerReplicator', 'ContainerService',
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be

var remove_hierarchy = [
  'Container',
  'ContainerGroup',
  'ContainerManager',
  'ContainerNode',
  'ContainerReplicator',
  'ContainerRoute',
  'ContainerService',
  'Host',
  'Vm',
];

Copy link
Contributor

Choose a reason for hiding this comment

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

(because missing var, improbable formatting, and easier to see if its one entry per line, sorted alphabetically)

"OpenshiftEnterprise":{"type":"image","icon":"...openshift_enterprise..."}}}
"OpenshiftEnterprise":{"type":"image","icon":"...openshift_enterprise..."}
},
"size_limit": 100
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is no longer the right data, hence the spec failure ;)

@himdel
Copy link
Contributor

himdel commented Jan 25, 2017

Thanks @zeari that looks really nice, should make it much easier to add to another topologies :).

I'd merge, except for the spec failure :)

@simon3z
Copy link
Contributor

simon3z commented Jan 25, 2017

I'd merge, except for the spec failure :)

@himdel please note that above there's still a comment on the default value.

@himdel
Copy link
Contributor

himdel commented Jan 25, 2017

Ah, yeah, sorry about that, the default value is up to you guys, if that's something for a longer discussion, changing it would be trivial so .. I don't really consider it a blocker :) (But the current default would seem to be Unlimited.)

@himdel
Copy link
Contributor

himdel commented Jan 25, 2017

@zeari One more thing I notice .. if you enter the Settings screen with a clean (new) user, you'll get an exception...

undefined method '[]' for nil:NilClass [configuration/index]

Pretty sure it's that @edit[:new][:perpage][item_per_page[2]] in the ui_1 view.

(Note I also have to change entity.default_authentications.status.capitalize to ....try(:capitalize) (ContainerTopologyService#entity_status), but that's not a problem for this PR.)

@miq-bot
Copy link
Member

miq-bot commented Jan 25, 2017

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Jan 26, 2017

Checked commit zeari@b0862e5 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 1 offense detected

app/controllers/configuration_controller.rb

@zeari
Copy link
Author

zeari commented Jan 26, 2017

@zeari One more thing I notice .. if you enter the Settings screen with a clean (new) user, you'll get an exception...

undefined method '[]' for nil:NilClass [configuration/index]

Pretty sure it's that @edit[:new][:perpage][item_per_page[2]] in the ui_1 view.

@himdel I made a new user but im not getting this exception. ui_constants is reloaded when you reset the server so it might be that. topology setting was under perpage but isnt anymore so a restart might kick it off.

(Note I also have to change entity.default_authentications.status.capitalize to ....try(:capitalize) (ContainerTopologyService#entity_status), but that's not a problem for this PR.)

How did you add your containers provider? this shouldnt happen anymore since the ui doesnt let you add a containers provider that doesnt have a bearer auth.

@zeari
Copy link
Author

zeari commented Jan 26, 2017

@himdel please note that above there's still a comment on the default value.

@simon3z Changed default value to unlimited.

@himdel
Copy link
Contributor

himdel commented Jan 26, 2017

@himdel I made a new user but im not getting this exception. ui_constants is reloaded when you reset the server so it might be that. topology setting was under perpage but isnt anymore so a restart might kick it off.

You were right, sorry about that, it was indeed that restart thing :).

How did you add your containers provider? this shouldnt happen anymore since the ui doesnt let you add a containers provider that doesnt have a bearer auth.

Well, I'm not seeing any migrations that would fix providers that were added before it couldn't happen ;). But yeah, my db is not new.

@himdel
Copy link
Contributor

himdel commented Jan 26, 2017

Ok, this is working and looks good, merging.

@himdel himdel merged commit 41742ee into ManageIQ:master Jan 26, 2017
@himdel himdel added this to the Sprint 53 Ending Jan 30, 2017 milestone Jan 26, 2017
@abonas
Copy link
Member

abonas commented May 14, 2017

@miq-bot add_label topology

@miq-bot
Copy link
Member

miq-bot commented May 14, 2017

@zeari Cannot apply the following label because they are not recognized: providers/containers

@miq-bot miq-bot assigned dclarizio and unassigned himdel May 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants