Browse Source

[Improvement-14835][UI] Support to immediately adjust the fill color of the task node after changing the run flag of the task. (#14837)

* worked out this issue
3.2.1-prepare
calvin 1 year ago committed by GitHub
parent
commit
168a3930fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-cell-update.ts
  2. 6
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-task-edit.ts

14
dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-cell-update.ts

@ -51,6 +51,19 @@ export function useCellUpdate(options: Options) {
} }
} }
/**
* Set the node's fill color by id
* @param {string} id
* @param {string} color
*/
function setNodeFillColor(id: string, color: string) {
const node = graph.value?.getCellById(id)
if (!node) {
return false
}
node.attr('rect/fill', color)
}
/** /**
* Add a node to the graph * Add a node to the graph
* @param {string} id * @param {string} id
@ -124,6 +137,7 @@ export function useCellUpdate(options: Options) {
return { return {
setNodeName, setNodeName,
setNodeFillColor,
setNodeEdge, setNodeEdge,
addNode, addNode,
removeNode, removeNode,

6
dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-task-edit.ts

@ -47,6 +47,7 @@ export function useTaskEdit(options: Options) {
getSources, getSources,
getTargets, getTargets,
setNodeName, setNodeName,
setNodeFillColor,
setNodeEdge setNodeEdge
} = useCellUpdate({ } = useCellUpdate({
graph graph
@ -167,6 +168,11 @@ export function useTaskEdit(options: Options) {
processDefinition.value.taskDefinitionList.map((task) => { processDefinition.value.taskDefinitionList.map((task) => {
if (task.code === currTask.value?.code) { if (task.code === currTask.value?.code) {
setNodeName(task.code + '', taskDef.name) setNodeName(task.code + '', taskDef.name)
let fillColor = '#f3f3f5'
if (task.flag === 'NO') {
fillColor = '#ffffff'
}
setNodeFillColor(task.code + '', fillColor)
setNodeEdge(String(task.code), data.preTasks) setNodeEdge(String(task.code), data.preTasks)
updatePreTasks(data.preTasks, task.code) updatePreTasks(data.preTasks, task.code)

Loading…
Cancel
Save