Enable interconnections between WFJT Nodes

This commit is contained in:
Jeff Bradberry
2020-04-03 16:21:26 -04:00
parent 719f0b407c
commit 1b264011a2

View File

@@ -31,6 +31,7 @@ EXPORTABLE_RESOURCES = [
EXPORTABLE_RELATIONS = [ EXPORTABLE_RELATIONS = [
'Roles', 'Roles',
'NotificationTemplates', 'NotificationTemplates',
'WorkflowJobTemplateNodes',
'Credentials', 'Credentials',
] ]
@@ -38,8 +39,10 @@ EXPORTABLE_RELATIONS = [
EXPORTABLE_DEPENDENT_OBJECTS = [ EXPORTABLE_DEPENDENT_OBJECTS = [
'Labels', 'Labels',
'SurveySpec', 'SurveySpec',
'WorkflowJobTemplateNodes',
'Schedules', 'Schedules',
# WFJT Nodes are a special case, we want full data for the create
# view and natural keys for the attach views.
'WorkflowJobTemplateNodes',
] ]
@@ -124,19 +127,19 @@ class ApiV2(base.Base):
related = {} related = {}
for key, related_endpoint in asset.related.items(): for key, related_endpoint in asset.related.items():
if key in asset.json or not related_endpoint: if key in options or not related_endpoint:
continue continue
rel = related_endpoint._create() rel = related_endpoint._create()
if rel.__class__.__name__ in EXPORTABLE_RELATIONS: related_options = self._get_options(related_endpoint)
if related_options is None: # This is a read-only endpoint.
continue
is_attach = 'id' in related_options # This is not a create-only endpoint.
if rel.__class__.__name__ in EXPORTABLE_RELATIONS and is_attach:
by_natural_key = True by_natural_key = True
related_options = self._get_options(related_endpoint)
if related_options is None:
continue
if 'id' not in related_options:
continue # This is a read-only or create-only endpoint.
elif rel.__class__.__name__ in EXPORTABLE_DEPENDENT_OBJECTS: elif rel.__class__.__name__ in EXPORTABLE_DEPENDENT_OBJECTS:
by_natural_key, related_options = False, None by_natural_key = False
else: else:
continue continue