Bug 741743 - leaf nodes in Resource tree incorrectly show expand-node icon
leaf nodes in Resource tree incorrectly show expand-node icon
Status: NEW
Product: RHQ Project
Classification: Other
Component: Core UI (Show other bugs)
4.1
Unspecified Unspecified
medium Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: rhq41
  Show dependency treegraph
 
Reported: 2011-09-27 15:32 EDT by Ian Springer
Modified: 2015-02-01 18:29 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Ian Springer 2011-09-27 15:32:54 EDT
This is misleading, since it suggests that the Resource has children. Once an expand-node icon is clicked, it disappears, since at that point the tree impl tries to load the children and realizes there aren't any.

To fix this, we'll need to add a new 'hasChildResources' boolean field to ResourceLineageComposite, that the GUI can check to determine if the Resource has children and render the node correctly. This field could be initialized in ResourceManagerBean.getResourceLineageAndSiblings() by executing the following code for each of the "children":

        Query childCountQuery;
        if (authorizationManager.isInventoryManager(user)) {
            childCountQuery = PersistenceUtility.createCountQuery(entityManager,                     Resource.QUERY_FIND_CHILDREN_BY_CATEGORY_AND_INVENTORY_STATUS_ADMIN);
        } else {
            childCountQuery = PersistenceUtility.createCountQuery(entityManager,
                Resource.QUERY_FIND_CHILDREN_BY_CATEGORY_AND_INVENTORY_STATUS);
            childCountQuery.setParameter("subject", user);
        }

        childCountQuery.setParameter("parent", resource);
        childCountQuery.setParameter("category", null);
        childCountQuery.setParameter("status", InventoryStatus.COMMITTED);
        long childCount = (Long) childCountQuery.getSingleResult();

        composite.setHasChildResources(childCount > 0);

However, we'll need to check that this addition doesn't significantly increase the time it takes to load the tree.

Note You need to log in before you can comment on or make changes to this bug.