Make "seda.tree" component selectable for all items of the SEDA tree
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 29 Nov 2018 09:15:28 +0100
changeset 2977 820fbe858027
parent 2976 d55232504250
child 2978 c44cc9226387
Make "seda.tree" component selectable for all items of the SEDA tree This follows-up on changeset 0b663b4c509f which made ProfileTreeComponent class abstract and introduced a regression in that the component was then only selectable for SEDAArchiveTransfer entities, hence making the tree component disappear when navigating to leafs of the tree. A concrete class of this component must exist for all possible entity types under a SEDAArchiveTransfer entity. We thus extend the selector of TransferTreeComponent (renamed as ProfileTreeComponent) to list all entity types. Accordingly, we make it clearer that the base class is abstract by renameing it.
cubicweb_seda/views/sedatree.py
--- a/cubicweb_seda/views/sedatree.py	Mon Oct 29 15:13:48 2018 +0100
+++ b/cubicweb_seda/views/sedatree.py	Thu Nov 29 09:15:28 2018 +0100
@@ -24,7 +24,7 @@
 from . import jqtree
 
 
-class ProfileTreeComponent(component.EntityCtxComponent):
+class BaseTreeComponent(component.EntityCtxComponent):
     """Display the whole profile tree."""
     __regid__ = 'seda.tree'
     __select__ = (component.EntityCtxComponent.__select__
@@ -39,13 +39,21 @@
         self.entity.view('jqtree.treeview', w=w)
 
 
-class TransferTreeComponent(ProfileTreeComponent):
-    __select__ = ProfileTreeComponent.__select__ & is_instance('SEDAArchiveTransfer')
+class ProfileTreeComponent(BaseTreeComponent):
+    __select__ = (
+        BaseTreeComponent.__select__
+        & is_instance(
+            'SEDAArchiveTransfer',
+            'SEDAArchiveUnit',
+            'SEDABinaryDataObject',
+            'SEDAPhysicalDataObject',
+        )
+    )
     title = _('SEDA profile tree')
 
 
-class UnitTreeComponent(ProfileTreeComponent):
-    __select__ = ProfileTreeComponent.__select__ & component_unit()
+class UnitTreeComponent(BaseTreeComponent):
+    __select__ = BaseTreeComponent.__select__ & component_unit()
     title = _('Archive unit component tree')