{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2342","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2342/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2342/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2342/events","html_url":"https://github.com/ManageIQ/manageiq/pull/2342","id":64117980,"number":2342,"title":"UI should be able to only display state machine classes","user":{"login":"mkanoor","id":6452699,"avatar_url":"https://avatars.githubusercontent.com/u/6452699?v=3","gravatar_id":"","url":"https://api.github.com/users/mkanoor","html_url":"https://github.com/mkanoor","followers_url":"https://api.github.com/users/mkanoor/followers","following_url":"https://api.github.com/users/mkanoor/following{/other_user}","gists_url":"https://api.github.com/users/mkanoor/gists{/gist_id}","starred_url":"https://api.github.com/users/mkanoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkanoor/subscriptions","organizations_url":"https://api.github.com/users/mkanoor/orgs","repos_url":"https://api.github.com/users/mkanoor/repos","events_url":"https://api.github.com/users/mkanoor/events{/privacy}","received_events_url":"https://api.github.com/users/mkanoor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/automate","name":"automate","color":"5319e7"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/ui","name":"ui","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-24T22:43:48Z","updated_at":"2015-03-26T17:46:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/2342","html_url":"https://github.com/ManageIQ/manageiq/pull/2342","diff_url":"https://github.com/ManageIQ/manageiq/pull/2342.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/2342.patch"},"body":"https://bugzilla.redhat.com/show_bug.cgi?id=1205453\r\n\r\nThe UI displays a tree control allowing the user to select retirement entry points for provisioning, reconfiguring and retirement. The current display shows all classes state machine and non state machine classes. This PR allows the UI to only display only those classes which are state machine classes.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/86641929","html_url":"https://github.com/ManageIQ/manageiq/pull/2342#issuecomment-86641929","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/2342","id":86641929,"user":{"login":"mkanoor","id":6452699,"avatar_url":"https://avatars.githubusercontent.com/u/6452699?v=3","gravatar_id":"","url":"https://api.github.com/users/mkanoor","html_url":"https://github.com/mkanoor","followers_url":"https://api.github.com/users/mkanoor/followers","following_url":"https://api.github.com/users/mkanoor/following{/other_user}","gists_url":"https://api.github.com/users/mkanoor/gists{/gist_id}","starred_url":"https://api.github.com/users/mkanoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkanoor/subscriptions","organizations_url":"https://api.github.com/users/mkanoor/orgs","repos_url":"https://api.github.com/users/mkanoor/repos","events_url":"https://api.github.com/users/mkanoor/events{/privacy}","received_events_url":"https://api.github.com/users/mkanoor/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T17:46:28Z","updated_at":"2015-03-26T17:46:28Z","body":"@martinpovolny \r\n\r\nIn the Automate model there are certain classes which are marked as state machine classes. These classes could be located anywhere in the multiple namespaces, sub namespaces.\r\n\r\nToday during ServiceTemplate editing the UI allows the user to pick any class, even if it is not a state machine by walking down the tree and subtrees. This PR basically allows the user to walk down the paths(namespaces) that only have state machine classes all other namespaces will be filtered out. \r\n\r\nSo we have couple of choices here\r\n\r\n(1) As the user opens each namespace if check if it has any state machine classes and display those classes.\r\n(2) First we get a list of all classes in the automate model, and the parent namespaces and as we are allowing the user to pick the state machine, we can filter out the ones that don't have the state machine classes.\r\n\r\nThe key difference between (1) and (2) is in (1) you will get empty namespaces, that the user would have traveled to not finding any state machine classes. With (2) you will only allow the user to walk down the path that contains the state machine classes.\r\n\r\n \r\nIn this PR I have implemented the (2) choice. Which requires caching of the way point ids of all the namespaces, classes that lead to state machines. This needs to be done once when the user selects \"Edit Service Template\". Since users can add new automate classes or change existing ones, the list of state machine classes will change, hence the comment it cannot be cached in the MiqAeClass. If you open the \"Service Template Edit\" screen at different times in the same UI worker, the list of classes could change. So the best place to get this information once is when the user selects \"Edit Service Template\".\r\n\r\nOnce we have the list of ids we can filter them out. We would like to keep the data in the session block till the time the user is in the \"Edit Service Template\" and destroy it after that. This could span multiple HTTP requests.\r\n\r\n"}}