Bug 814305

Summary: Dealing with singletons in inventory
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: Core UIAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: high    
Version: 4.4CC: ccrouch, hrupp, jkremser, jshaughn, loleary
Target Milestone: ---   
Target Release: RHQ 4.6   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: 4.5.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 826736 (view as bug list) Environment:
Last Closed: 2013-09-03 10:45:20 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 735475, 826736    
Description Flags
Screenshot none

Description Heiko W. Rupp 2012-04-19 10:43:38 EDT
When a resource type is marked as a singleton, the UI still allows to create multiple instances of it. The only difference to a non-singleton is that there is not folder in the tree where the target resources are put in.

- UI should grey out the "Create Child->type" item when there is already a resource of the same type as child of the base class.
 Perhaps with a hover of "a singleton resource with that type exists already".
Comment 1 Charles Crouch 2012-04-19 11:01:44 EDT
We should check out if this would be feasible to implement, since it prevents users from trying to creating a child which will subsequently fail.
Comment 2 Heiko W. Rupp 2012-04-19 11:06:32 EDT
Created attachment 578670 [details]

In the screenshot, both 'bla' and 'default' are resources of the singleton type "JVM Definition"
Comment 3 Charles Crouch 2012-05-21 16:15:42 EDT
It would be nice to see if we could fix this for 3.1.1
Comment 4 Jirka Kremser 2012-05-30 11:04:05 EDT

git log master:
time:    Wed May 30 17:00:05 2012 +0200
commit:  d645f4ec3d9b7c82bc61516cc8f89cc2b7ba4b26
author:  Jirka Kremser - jkremser@redhat.com
message: [BZ 814305] Before the context menu is shown the check for singleton resurces is performed (when creating child resources or importing the resources manually)
Comment 5 Ian Springer 2012-05-30 16:53:04 EDT
The SLSB layer now throws RuntimeExceptions if a create-child or manual-add is attempted for a singleton type that already exists in inventory. The SLSB layer now also verifies that the type of the Resource being manually added or created supports the required facets, and if not throws RuntimeExceptions:

Comment 6 Jay Shaughnessy 2012-06-12 12:27:29 EDT
I'm resetting this to ON_DEV as part of the work related to bug 831254, which is, I think a regression as part of the changes here.  I am actively working this...
Comment 7 Jay Shaughnessy 2012-06-13 21:54:57 EDT
master commit 1667f9730e4d547b399e1b30ad9965d8773d11a5

Fix the context menu issue in bug 831254 which was introduced with the
original fix for this singleton filtering support.  There were a few issues.
In the changes made to the context menu:
- fixed confusion around and lack of complete support for both create child and import
- consolidate duplicate server calls, narrow the results with more criteria,
  and avoid the call when not needed.

Additionally, the analogous change was not made to the Inventory->Child Resources
view which also offers Create Child and Import.  The change here ended up being
tricky because it involved Table's TableActions, and filtering the menu
button values in the footer.
Comment 8 Jirka Kremser 2012-08-29 08:18:50 EDT

time:    Wed Aug 29 14:15:26 2012 +0200
commit:  74704eda37bce26278fa089437d98bcd590b4317
author:  Jirka Kremser - jkremser@redhat.com
message: [BZ 814305 - Dealing with singletons in inventory] Refresh button now takes into consideration the already created singletons and they are not populated in the create/import child combobox
Comment 9 Jay Shaughnessy 2012-09-27 14:50:10 EDT
Commit 74704eda had an issue such that certain resources would no longer render any children in the Inventory->Child Resources subtab. Fixed with:

master commit 949ff96d973e2592762204713235cc359d2b63b6
Author: Jay Shaughnessy <jshaughn@jshaughn.csb>
Date:   Thu Sep 27 14:44:59 2012 -0400

 Fix an issue with the previous fix to handle the case where the parent
 did not actually have to worry about singleton children. Also, defer
 calling super's onInit until the subclass is done with it's work.
Comment 10 Heiko W. Rupp 2013-09-03 10:45:20 EDT
Bulk closing of issues in old RHQ releases that are in production for a while now.

Please open a new issue when running into an issue.