Skip to content

Commit

Permalink
minor: unable to view all the workflow versions (#446)
Browse files Browse the repository at this point in the history
* fix: unable to view all the workflow versions

Signed-off-by: Carina Ursu <[email protected]>

* chore: cleanup

Signed-off-by: Carina Ursu <[email protected]>

Co-authored-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina and ursucarina authored May 4, 2022
1 parent 690e5cb commit f183757
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface BuildDataProps {
rootParentNode: dNode;
currentNestedView: string[];
}
export const buildReactFlowDataProps = (props: BuildDataProps) => {
const buildReactFlowDataProps = (props: BuildDataProps) => {
const {
node,
nodeExecutionsById,
Expand All @@ -61,13 +61,13 @@ export const buildReactFlowDataProps = (props: BuildDataProps) => {
currentNestedView,
} = props;

const taskType = node.value?.template ? node.value.template.type : null;
const displayName = node.name;
const { value: nodeValue, name: displayName, scopedId, type: nodeType } = node;
const taskType = nodeValue?.template?.type ?? null;

const mapNodeExecutionStatus = () => {
if (nodeExecutionsById) {
if (nodeExecutionsById[node.scopedId]) {
return nodeExecutionsById[node.scopedId].closure.phase as NodeExecutionPhase;
if (nodeExecutionsById[scopedId]) {
return nodeExecutionsById[scopedId].closure.phase as NodeExecutionPhase;
} else {
return NodeExecutionPhase.SKIPPED;
}
Expand All @@ -77,34 +77,35 @@ export const buildReactFlowDataProps = (props: BuildDataProps) => {
};
const nodeExecutionStatus = mapNodeExecutionStatus();

// nodeExecutionsById null check is required as on first render it can be undefined
const cacheStatus: CatalogCacheStatus =
nodeExecutionsById[node.scopedId]?.closure.taskNodeMetadata?.cacheStatus ??
nodeExecutionsById?.[scopedId]?.closure.taskNodeMetadata?.cacheStatus ??
CatalogCacheStatus.CACHE_DISABLED;

const dataProps = {
nodeExecutionStatus,
text: displayName,
handles: [],
nodeType: node.type,
scopedId: node.scopedId,
nodeType,
scopedId,
taskType,
cacheStatus,
onNodeSelectionChanged: () => {
if (onNodeSelectionChanged) {
onNodeSelectionChanged([node.scopedId]);
onNodeSelectionChanged([scopedId]);
}
},
onAddNestedView: () => {
onAddNestedView({
parent: rootParentNode.scopedId,
view: node.scopedId,
view: scopedId,
});
},
onRemoveNestedView,
};

for (const rootParentId in currentNestedView) {
if (node.scopedId === rootParentId) {
if (scopedId === rootParentId) {
dataProps['currentNestedView'] = currentNestedView[rootParentId];
}
}
Expand All @@ -119,7 +120,7 @@ interface BuildNodeProps {
parentNode?: dNode;
typeOverride?: dTypes;
}
export const buildReactFlowNode = ({
const buildReactFlowNode = ({
node,
dataProps,
rootParentNode,
Expand Down Expand Up @@ -214,7 +215,7 @@ export const buildGraphMapping = (props): ReactFlowGraphMapping => {
const parse = (props: ParseProps) => {
const { contextNode, contextParent, rootParentNode, nodeDataProps } = props;
let context: ReactFlowGraph | null = null;
contextNode.nodes.map((node: dNode) => {
contextNode.nodes.filter(n => !!n).map((node: dNode) => {
/* Case: node has children => recurse */
if (nodeHasChildren(node)) {
if (rootParentNode) {
Expand Down

0 comments on commit f183757

Please sign in to comment.