@ -85,9 +85,7 @@
contextMenu
contextMenu
} ,
} ,
computed : {
computed : {
... mapState ( 'dag' , [
... mapState ( 'dag' , [ 'tasks' ] )
'tasks'
] )
} ,
} ,
methods : {
methods : {
... mapActions ( 'dag' , [ 'genTaskCodeList' ] ) ,
... mapActions ( 'dag' , [ 'genTaskCodeList' ] ) ,
@ -237,7 +235,9 @@
this . graph . on ( 'cell:mouseenter' , ( data ) => {
this . graph . on ( 'cell:mouseenter' , ( data ) => {
const { cell , e } = data
const { cell , e } = data
const isStatusIcon = ( tagName ) =>
const isStatusIcon = ( tagName ) =>
tagName && ( tagName . toLocaleLowerCase ( ) === 'em' || tagName . toLocaleLowerCase ( ) === 'body' )
tagName &&
( tagName . toLocaleLowerCase ( ) === 'em' ||
tagName . toLocaleLowerCase ( ) === 'body' )
if ( ! isStatusIcon ( e . target . tagName ) ) {
if ( ! isStatusIcon ( e . target . tagName ) ) {
this . setHighlight ( cell )
this . setHighlight ( cell )
}
}
@ -381,42 +381,38 @@
* @ param { Edge } edge
* @ param { Edge } edge
* /
* /
setEdgeHighlight ( edge ) {
setEdgeHighlight ( edge ) {
edge . setAttrs ( EDGE _HIGHLIGHT _PROPS . attrs )
const labelName = this . getEdgeLabelName ( edge )
const labelName = this . getEdgeLabelName ( edge )
if ( labelName ) {
edge . setAttrs ( EDGE _HIGHLIGHT _PROPS . attrs )
edge . setLabels ( [
edge . setLabels ( [
_ . merge ( EDGE _HIGHLIGHT _PROPS . defaultLabel , {
_ . merge (
attrs : {
{
label : {
attrs : _ . cloneDeep ( EDGE _HIGHLIGHT _PROPS . defaultLabel . attrs )
text : labelName
} ,
}
{
attrs : { label : { text : labelName } }
}
}
} )
)
] )
] )
}
} ,
} ,
/ * *
/ * *
* Reset edge style
* Reset edge style
* @ param { Edge } edge
* @ param { Edge } edge
* /
* /
resetEdgeStyle ( edge ) {
resetEdgeStyle ( edge ) {
edge . setAttrs ( EDGE _PROPS . attrs )
const labelName = this . getEdgeLabelName ( edge )
const labelName = this . getEdgeLabelName ( edge )
if ( labelName ) {
edge . setAttrs ( EDGE _PROPS . attrs )
edge . setLabels ( [
edge . setLabels ( [
{
{
attrs : {
... _ . merge (
label : {
{
fill : EDGE _PROPS . defaultLabel . attrs . label . fill ,
attrs : _ . cloneDeep ( EDGE _PROPS . defaultLabel . attrs )
text : labelName
} ,
} ,
body : {
{
stroke : EDGE _PROPS . defaultLabel . attrs . body . stroke
attrs : { label : { text : labelName } }
}
}
}
)
}
}
] )
] )
}
} ,
} ,
/ * *
/ * *
* Set cell highlight
* Set cell highlight
@ -644,7 +640,7 @@
this . graph . removeCells ( cells )
this . graph . removeCells ( cells )
cells . forEach ( ( cell ) => {
cells . forEach ( ( cell ) => {
if ( cell . isNode ( ) ) {
if ( cell . isNode ( ) ) {
this . removeTask ( cell . id )
this . removeTask ( + cell . id )
}
}
} )
} )
} ,
} ,
@ -761,12 +757,12 @@
const nodes = this . getNodes ( )
const nodes = this . getNodes ( )
const edges = this . getEdges ( )
const edges = this . getEdges ( )
const nodesMap = { }
const nodesMap = { }
nodes . forEach ( node => {
nodes . forEach ( ( node ) => {
nodesMap [ node . id ] = node
nodesMap [ node . id ] = node
} )
} )
return edges
return edges
. filter ( edge => edge . targetId === code )
. filter ( ( edge ) => edge . targetId === code )
. map ( edge => nodesMap [ edge . sourceId ] )
. map ( ( edge ) => nodesMap [ edge . sourceId ] )
} ,
} ,
/ * *
/ * *
* set prev nodes
* set prev nodes
@ -786,7 +782,7 @@
}
}
}
}
} )
} )
preNodeCodes . forEach ( preCode => {
preNodeCodes . forEach ( ( preCode ) => {
if ( currPreCodes . includes ( preCode ) || preCode === code ) return
if ( currPreCodes . includes ( preCode ) || preCode === code ) return
const edge = this . genEdgeJSON ( preCode , code )
const edge = this . genEdgeJSON ( preCode , code )
this . graph . addEdge ( edge )
this . graph . addEdge ( edge )
@ -802,12 +798,12 @@
const nodes = this . getNodes ( )
const nodes = this . getNodes ( )
const edges = this . getEdges ( )
const edges = this . getEdges ( )
const nodesMap = { }
const nodesMap = { }
nodes . forEach ( node => {
nodes . forEach ( ( node ) => {
nodesMap [ node . id ] = node
nodesMap [ node . id ] = node
} )
} )
return edges
return edges
. filter ( edge => edge . sourceId === code )
. filter ( ( edge ) => edge . sourceId === code )
. map ( edge => nodesMap [ edge . targetId ] )
. map ( ( edge ) => nodesMap [ edge . targetId ] )
} ,
} ,
/ * *
/ * *
* set post nodes
* set post nodes
@ -827,7 +823,7 @@
}
}
}
}
} )
} )
postNodeCodes . forEach ( postCode => {
postNodeCodes . forEach ( ( postCode ) => {
if ( currPostCodes . includes ( postCode ) || postCode === code ) return
if ( currPostCodes . includes ( postCode ) || postCode === code ) return
const edge = this . genEdgeJSON ( code , postCode )
const edge = this . genEdgeJSON ( code , postCode )
this . graph . addEdge ( edge )
this . graph . addEdge ( edge )