mirror of
https://github.com/xodio/xod.git
synced 2026-02-20 02:01:20 +01:00
feat(xod-client): make a custom look and behavior for table-log node
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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 => ({
|
||||
|
||||
@@ -115,6 +115,7 @@ class Node extends React.Component {
|
||||
return R.cond([
|
||||
[XP.isTerminalPatchPath, () => <TerminalNodeBody {...this.props} />],
|
||||
[XP.isWatchPatchPath, () => <WatchNodeBody {...this.props} />],
|
||||
[XP.isTableLogPatchPath, () => <WatchNodeBody {...this.props} />],
|
||||
[XP.isConstantNodeType, () => <ConstantNodeBody {...this.props} />],
|
||||
[XP.isBindableCustomType, () => <ConstantNodeBody {...this.props} />],
|
||||
[XP.isTweakPath, () => <TweakNodeBody {...this.props} />],
|
||||
|
||||
Reference in New Issue
Block a user