Bug 741743 - leaf nodes in Resource tree incorrectly show expand-node icon
Summary: leaf nodes in Resource tree incorrectly show expand-node icon
Keywords:
Status: NEW
Alias: None
Product: RHQ Project
Classification: Other
Component: Core UI
Version: 4.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: rhq41
TreeView+ depends on / blocked
 
Reported: 2011-09-27 19:32 UTC by Ian Springer
Modified: 2024-03-04 13:35 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Ian Springer 2011-09-27 19:32:54 UTC
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.