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   
Whiteboard:
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 14:45:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 735475, 826736    
Attachments:
Description Flags
Screenshot none

Description Heiko W. Rupp 2012-04-19 14:43:38 UTC
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 15:01:44 UTC
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 15:06:32 UTC
Created attachment 578670 [details]
Screenshot

In the screenshot, both 'bla' and 'default' are resources of the singleton type "JVM Definition"

Comment 3 Charles Crouch 2012-05-21 20:15:42 UTC
It would be nice to see if we could fix this for 3.1.1

Comment 4 Jirka Kremser 2012-05-30 15:04:05 UTC
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=d645f4e

git log master:
time:    Wed May 30 17:00:05 2012 +0200
commit:  d645f4ec3d9b7c82bc61516cc8f89cc2b7ba4b26
author:  Jirka Kremser - jkremser
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 20:53:04 UTC
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:

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=7de3b23

Comment 6 Jay Shaughnessy 2012-06-12 16:27:29 UTC
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-14 01:54:57 UTC
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 12:18:50 UTC
http://git.fedorahosted.org/cgit/rhq/rhq.git/diff/?id=74704ed

master
time:    Wed Aug 29 14:15:26 2012 +0200
commit:  74704eda37bce26278fa089437d98bcd590b4317
author:  Jirka Kremser - jkremser
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 18:50:10 UTC
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>
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 14:45:20 UTC
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.