233 add reductselect to builder - #246
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The Select payload parsing/building currently permits invalid/unsupported format combinations and protobuf field ids, which can produce inconsistent UI states and invalid #ext.select output.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new “Process (Select)” transform step to the Conditional Query builder, enabling visual configuration of a ReductSelect #ext.select payload alongside the existing ROS transform.
Changes:
- Introduces Select transform state, mutators, payload build/parse logic, and test coverage in
transformStepBuilder. - Adds
SelectStepEditorUI (plus reusable row-list components) and wires it into the builder/block list with new tests. - Tweaks row layout constants and fixes a narrow-viewport overflow in the label filter editor.
File summaries
| File | Description |
|---|---|
| src/Helpers/transformStepBuilder.ts | Adds Select transform model/mutators plus build/parse handling for #ext.select. |
| src/Helpers/transformStepBuilder.test.ts | Expands unit tests to cover Select transform behavior and ROS/Select exclusivity. |
| src/Components/QueryConditionBuilder/TransformStepEditor.tsx | Extracts shared key/value row-list UI and improves export row wrapping. |
| src/Components/QueryConditionBuilder/stepRowLayout.ts | Adjusts shared widths and adds protobuf/export-specific width constants. |
| src/Components/QueryConditionBuilder/SelectStepEditor.tsx | New editor UI for Select transform configuration (SQL, format, protobuf, export, as_label). |
| src/Components/QueryConditionBuilder/SelectStepEditor.test.tsx | New component tests for SelectStepEditor interactions and menu behavior. |
| src/Components/QueryConditionBuilder/QueryConditionBuilder.tsx | Wires Select transform creation and mutation handlers into builder state updates. |
| src/Components/QueryConditionBuilder/QueryConditionBuilder.test.tsx | Adds integration tests for Process (Select) block behavior and #ext output. |
| src/Components/QueryConditionBuilder/QueryBlockList.tsx | Adds Process (Select) block rendering and add-step menu gating vs ROS. |
| src/Components/QueryConditionBuilder/QueryBlockList.test.tsx | Updates/adds tests for new Process (Select) menu and block behavior. |
| src/Components/QueryConditionBuilder/ProtobufFieldRowList.tsx | New UI for editing protobuf field mapping rows (column/id/type). |
| src/Components/QueryConditionBuilder/LabelConditionEditor.tsx | Fixes narrow-viewport overflow by allowing wrapping and simplifying sizing. |
| src/Components/QueryConditionBuilder/KeyValueRowList.tsx | New shared key/value row-list component reused by ROS + Select editors. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
AnthonyCvn
left a comment
There was a problem hiding this comment.
move steps to components folder
| interface Window { | ||
| __sqlCompletionProviderDisposable?: IDisposable; | ||
| } | ||
| } |
There was a problem hiding this comment.
Not related to vitest. It's there to handle Vite's hot reload in dev: without it, every time a file is saved, the module reloads and re-registers the autocomplete provider without removing the old one, so suggestions end up appearing duplicated. This bit of code just cleans up the old provider before registering a new one. In production this never happens, since the module only loads once.
There was a problem hiding this comment.
yeah but it's not best practice in React. Please check implementation of JsonQueryEditor. It is the same, also with auto-complete.
There was a problem hiding this comment.
Done, merged them into one QueryEditor component, used for both JSON and SQL now.
| <Button | ||
| aria-label={onlyRow ? sectionRemoveLabel : removeLabel} | ||
| type="text" | ||
| icon={<CloseOutlined style={{ transform: "scale(0.65)" }} />} |
There was a problem hiding this comment.
to check if we need a transform or fixed size here
There was a problem hiding this comment.
it was already there since #243 (issue #238), in TransformStepEditor.tsx's icons. Since we're already moving/touching these files here, I fixed it everywhere it showed up (9 spots across 6 files) instead of leaving it inconsistent, and centralized the value into a new ROW_ICON_FONT_SIZE constant in stepRowLayout.ts, matching how the other shared sizing constants (ROW_LABEL_WIDTH, ROW_INPUT_WIDTH, etc.) already work there.
AnthonyCvn
left a comment
There was a problem hiding this comment.
Combining ReductSelect with ReductROS should be possible from the builder:
{
"$each_t": "$__interval",
"#ext": {
"ros": {
"extract": {}
},
"select": {
"sql": "SELECT * FROM ENTRY()"
}
}
}
| "@dnd-kit/utilities": "^3.2.2", | ||
| "@monaco-editor/react": "^4.7.0", | ||
| "@reductstore/reduct-query-monaco": "^1.0.1", | ||
| "@reductstore/reduct-query-monaco": "github:reductstore/reduct-query-monaco#feat/sql-completion-provider", |
There was a problem hiding this comment.
You should test locally with npm link without touching package.json. We can update the version here once reduct-query-monaco is published.
There was a problem hiding this comment.
reverted the dependency
| SELECT * FROM ENTRY() | ||
| </div> | ||
| )} | ||
| <Editor |
There was a problem hiding this comment.
Would it make sense to reuse the JsonQueryEditor and make it universal as queryEditor so it can be used for JSON and SQL? it has more options to resize, format and so on which is missing here and would be great to have as an editor.
There was a problem hiding this comment.
Yes good idea, i'll implement it
…ons, type-to-autocomplete
| @@ -85,7 +118,7 @@ export default function QueryBlockList({ | |||
| blockOrder, | |||
There was a problem hiding this comment.
Too many pops, use composition instead.
There was a problem hiding this comment.
Added a new file (builderReducer.ts) centralizing all state updates through a single useReducer.
| onChangeSelectExport, | ||
| onAddAsLabelRow, | ||
| onChangeAsLabelRow, | ||
| onRemoveAsLabelRow, |
There was a problem hiding this comment.
Here you can use useReducer hook from react to dispatch your changes.
There was a problem hiding this comment.
Same as for QueryBlockList.tsx. Added a new file (builderReducer.ts) centralizing all state updates through a single useReducer.
| updateSelectExport, | ||
| updateSql, | ||
| updateTopic, | ||
| } from "../../Helpers/transformStepBuilder"; |
There was a problem hiding this comment.
You can also use the useReducer hook for the QueryConditionBuilder
There was a problem hiding this comment.
Same as for QueryBlockList.tsx. Added a new file (builderReducer.ts) centralizing all state updates through a single useReducer.
| ); | ||
| } | ||
|
|
||
| interface TransformStepEditorProps { |
There was a problem hiding this comment.
TransformStepEditor can also use composition + useReducer hook
There was a problem hiding this comment.
Done, TransformStepEditor now takes a single dispatch prop instead of the individual callbacks
…assed via actions)



Closes #233
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Feature.
What was changed?
Added a "Process (Select)" step to the Data Explorer's Conditional Query builder, letting users configure a ReductSelect transform (SQL expression, output format, and label mapping) visually instead of hand-writing the
#extJSON.SelectStepEditorcomponent with a unified "+ Add option" dropdown (Format / Protobuf / Export / As label), mirroring the existing ReductROS step's conventions: options stay visible but greyed out with a tooltip when unavailable instead of being hidden, and row-list options (Protobuf fields, As label) reuse the same button to add both the first row and subsequent ones.column/id/type) and Export (format/rows/duration) are separate, independently addable sections.TransformStepEntrytype into a discriminated union (ros|select) so the builder can host either transform kind, with all existing ReductROS behavior and tests unchanged.KeyValueRowList) out of the ReductROS editor so both transform kinds reuse it.Related issues
Closes #233.
Does this PR introduce a breaking change?
No. This only adds a new, optional step type to the builder; existing ReductROS steps and hand-written JSON queries are unaffected.
Other information:
None.