Extract business logic from UI routes for dataset page#3763
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ui/app/routes/datasets/$dataset_name/datapoint/$id/datapointOperations.server.ts
Outdated
Show resolved
Hide resolved
ui/app/routes/datasets/$dataset_name/datapoint/$id/datapointOperations.server.ts
Show resolved
Hide resolved
1c8dcf9 to
f2ab723
Compare
8e915eb to
4a37229
Compare
f2ab723 to
b2a05c3
Compare
c8d4556 to
1945f42
Compare
|
Ok, now it should build. I think what's irking me is that there are too many things happening in these routes - some is UI, some is calling the Rust gateway, and some is handling HTTP actions. I would like to generally separate them more to make FE easier to understand (and generally remove all direct calls to ClickHouse), but will think about the right approach. |
|
Seems like some tests timed out in the docker build / compose step; we can rerun just these afterwards then merge. |
TensorZero CI Bot Automated CommentThanks for the refactor! CI is currently failing for two reasons:
Summary of what to do:
|
1945f42 to
23d7f1a
Compare

I would like to separate the UI components, routes and loaders, and business logic in the frontend. This takes one step forward (loaders and components are still together, but business logic is split out.
Not fully set on this approach, just want to send it out to get some feedback. If this looks good we can ask the models to do a refactor later.
Important
Extracted business logic from UI routes into
datapointOperations.tsfor better separation of concerns and maintainability.validateJsonOutput), transformation (transformOutputForTensorZero), and core operations (deleteDatapoint,saveDatapoint) todatapointOperations.ts.route.tsxto use extracted functions for handling datapoint actions.validateJsonOutputchecks JSON validity in outputs.hasDatapointChangedchecks for changes in input, output, and tags.deleteDatapointandsaveDatapointhandle datapoint deletion and saving, respectively.route.tsxnow imports and uses functions fromdatapointOperations.ts.parseDatapointFormDatato parse form data intoParsedDatasetRow.actionfunction to use new operations for save and delete actions.This description was created by