diff --git a/packages/xod-client/src/debugger/selectors.js b/packages/xod-client/src/debugger/selectors.js index e7a74fa3..a0c408ed 100644 --- a/packages/xod-client/src/debugger/selectors.js +++ b/packages/xod-client/src/debugger/selectors.js @@ -102,6 +102,11 @@ export const getWatchNodeValues = R.compose( getDebuggerState ); +export const geTableLogValues = R.compose( + R.prop('tableLogValues'), + getDebuggerState +); + export const getUploadProgress = R.compose( Maybe, R.prop('uploadProgress'), @@ -128,14 +133,38 @@ export const getCurrentChunksPath = createSelector( }, maybeTabId) ); -export const getWatchNodeValuesForCurrentPatch = createSelector( +// :: Number -> NodeId -> Map NodeId Any -> Map NodeId Any +const filterOutValuesForCurrentPatch = R.curry( + (activeIndex, nodeIdPath, nodeIdValuesMap) => + R.compose( + R.fromPairs, + R.when( + () => activeIndex !== 0, + R.map(R.over(R.lensIndex(0), R.replace(nodeIdPath, ''))) + ), + R.filter( + R.compose( + R.ifElse( + () => activeIndex === 0, + R.complement(R.contains('~')), + R.startsWith(nodeIdPath) + ), + R.nth(0) + ) + ), + R.toPairs + )(nodeIdValuesMap) +); + +export const getInteractiveNodeValuesForCurrentPatch = createSelector( [ getCurrentTabId, getWatchNodeValues, + geTableLogValues, getBreadcrumbChunks, getBreadcrumbActiveIndex, ], - (maybeTabId, nodeMap, chunks, activeIndex) => + (maybeTabId, nodeMap, tableLogs, chunks, activeIndex) => foldMaybe( {}, tabId => { @@ -143,24 +172,23 @@ export const getWatchNodeValuesForCurrentPatch = createSelector( const nodeIdPath = getChunksPath(activeIndex, chunks); - return R.compose( - R.fromPairs, - R.when( - () => activeIndex !== 0, - R.map(R.over(R.lensIndex(0), R.replace(nodeIdPath, ''))) - ), - R.filter( - R.compose( - R.ifElse( - () => activeIndex === 0, - R.complement(R.contains('~')), - R.startsWith(nodeIdPath) - ), - R.nth(0) - ) - ), - R.toPairs - )(nodeMap); + const watchNodeValues = filterOutValuesForCurrentPatch( + activeIndex, + nodeIdPath, + nodeMap + ); + + const tableLogValues = R.compose( + R.map(sheets => { + const lastSheetIndex = sheets.length > 0 ? sheets.length - 1 : 0; + return `Sheet #${sheets.length}, Row #${ + sheets[lastSheetIndex].length + }`; + }), + filterOutValuesForCurrentPatch(activeIndex, nodeIdPath) + )(tableLogs); + + return R.merge(watchNodeValues, tableLogValues); }, maybeTabId ) diff --git a/packages/xod-client/src/editor/containers/Patch/index.jsx b/packages/xod-client/src/editor/containers/Patch/index.jsx index c784a853..802aca5e 100644 --- a/packages/xod-client/src/editor/containers/Patch/index.jsx +++ b/packages/xod-client/src/editor/containers/Patch/index.jsx @@ -345,7 +345,7 @@ const mapStateToProps = R.applySpec({ focusedArea: EditorSelectors.getFocusedArea, draggedPreviewSize: EditorSelectors.getDraggedPreviewSize, isDebugSession: DebugSelectors.isDebugSession, - nodeValues: DebugSelectors.getWatchNodeValuesForCurrentPatch, + nodeValues: DebugSelectors.getInteractiveNodeValuesForCurrentPatch, }); const mapDispatchToProps = dispatch => ({ diff --git a/packages/xod-client/src/project/components/Node.jsx b/packages/xod-client/src/project/components/Node.jsx index c727bf12..4b82dd71 100644 --- a/packages/xod-client/src/project/components/Node.jsx +++ b/packages/xod-client/src/project/components/Node.jsx @@ -115,6 +115,7 @@ class Node extends React.Component { return R.cond([ [XP.isTerminalPatchPath, () => ], [XP.isWatchPatchPath, () => ], + [XP.isTableLogPatchPath, () => ], [XP.isConstantNodeType, () => ], [XP.isBindableCustomType, () => ], [XP.isTweakPath, () => ],