nanxiuzi opened a new pull request, #18447:
URL: https://github.com/apache/dolphinscheduler/pull/18447

   ## Summary
   
   Fixes #18446
   
   The SQL task node's "Resource File" mode (introduced in #18019) loses its 
`sqlSource` and `sqlResource` values after saving — the node reverts to 
"Script" mode and the selected SQL file path is empty on reopen. The two form 
fields are defined in `use-sql.ts` (lines ~65 and ~95) but are never written to 
`taskParams` by `formatParams()` in `format-data.ts`, so they are dropped on 
save.
   
   ## Changes
   
   - 
`dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts`: 
serialize `sqlSource` and `sqlResource` into `taskParams` in the SQL branch of 
`formatParams()`.
   - `dolphinscheduler-ui/src/views/projects/task/components/node/types.ts`: 
declare `sqlSource?: string` and `sqlResource?: string` on `ITaskParams`. 
Required because `strict: true` is set in `tsconfig.json` — otherwise `vue-tsc 
--noEmit` (part of `pnpm run build:prod`) fails the type check on 
`data.sqlSource` and `taskParams.sqlSource`.
   
   Backfill works automatically — `formatModel()` already does 
`...omit(data.taskParams, ['resourceList', 'mainJar', 'localParams'])`, so any 
field written into `taskParams` is transparently restored on edit. No 
backfill-side change needed.
   
   ## Verification
   
   - `pnpm run build:prod` passes (vue-tsc type check + Vite production build).
   - Manual test on a 3.4.2 deployment: SQL node configured with "Resource 
File" mode + a selected SQL file → save → reopen → both `sqlSource` and 
`sqlResource` preserved. DevTools Network confirms `"sqlSource":"FILE"` and 
`"sqlResource":"..."` in `taskDefinitionJson.taskParams`.
   
   ## Reproduce steps (for reviewers)
   
   1. Open a workflow definition for editing.
   2. Add a SQL task node.
   3. Set "SQL Source" to "File".
   4. Pick a `.sql` resource file from the resource tree.
   5. Save the node and the workflow definition.
   6. Reopen the SQL task node — without this PR, "SQL Source" has reverted to 
"Script" and the resource path is empty; with this PR, both are preserved.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to