Skip to content

Commit f07331e

Browse files
committed
[Fix] Fix code smell
1 parent 05f9081 commit f07331e

2 files changed

Lines changed: 36 additions & 21 deletions

File tree

dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/toolbar.vue

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
:content="$t('Copy name')"
2424
placement="bottom"
2525
>
26-
<i class="el-icon-copy-document" @click="copyName"></i>
26+
<em class="el-icon-copy-document" @click="copyName"></em>
2727
</el-tooltip>
2828
<textarea ref="textarea" cols="30" rows="10" class="transparent"></textarea>
2929
<div class="toolbar-left">
@@ -38,22 +38,22 @@
3838
placement="bottom"
3939
class="toolbar-operation"
4040
>
41-
<i
41+
<em
4242
class="custom-ico view-variables"
4343
v-if="$route.name === 'projects-instance-details'"
4444
@click="toggleVariableView"
45-
></i>
45+
></em>
4646
</el-tooltip>
4747
<el-tooltip
4848
:content="$t('Startup parameter')"
4949
placement="bottom"
5050
class="toolbar-operation"
5151
>
52-
<i
52+
<em
5353
class="custom-ico startup-parameters"
5454
v-if="$route.name === 'projects-instance-details'"
5555
@click="toggleParamView"
56-
></i>
56+
></em>
5757
</el-tooltip>
5858
</div>
5959
<div class="toolbar-right">
@@ -63,10 +63,10 @@
6363
placement="bottom"
6464
v-if="!searchInputVisible"
6565
>
66-
<i
66+
<em
6767
class="el-icon-search"
6868
@click="showSearchInput"
69-
></i>
69+
></em>
7070
</el-tooltip>
7171
<div
7272
:class="{
@@ -91,43 +91,43 @@
9191
placement="bottom"
9292
v-if="!isDetails"
9393
>
94-
<i class="el-icon-delete" @click="removeCells"></i>
94+
<em class="el-icon-delete" @click="removeCells"></em>
9595
</el-tooltip>
9696
<el-tooltip
9797
class="toolbar-operation"
9898
:content="$t('Download')"
9999
placement="bottom"
100100
>
101-
<i class="el-icon-download" @click="downloadPNG"></i>
101+
<em class="el-icon-download" @click="downloadPNG"></em>
102102
</el-tooltip>
103103
<el-tooltip
104104
class="toolbar-operation"
105105
:content="$t('Refresh DAG status')"
106106
placement="bottom"
107107
v-if="dagChart.type === 'instance'"
108108
>
109-
<i class="el-icon-refresh" @click="refreshTaskStatus"></i>
109+
<em class="el-icon-refresh" @click="refreshTaskStatus"></em>
110110
</el-tooltip>
111111
<el-tooltip
112112
class="toolbar-operation"
113113
:content="$t('Format DAG')"
114114
placement="bottom"
115115
v-if="!isDetails"
116116
>
117-
<i class="custom-ico graph-format" @click="chartFormat"></i>
117+
<em class="custom-ico graph-format" @click="chartFormat"></em>
118118
</el-tooltip>
119119
<el-tooltip
120120
class="toolbar-operation last"
121121
:content="$t('Full Screen')"
122122
placement="bottom"
123123
>
124-
<i
124+
<em
125125
:class="[
126126
'custom-ico',
127127
dagChart.fullScreen ? 'full-screen-close' : 'full-screen-open',
128128
]"
129129
@click="toggleFullScreen"
130-
></i>
130+
></em>
131131
</el-tooltip>
132132
<el-button
133133
class="toolbar-el-btn"

dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/canvas/x6-style-mixin.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
import {
1819
NODE,
1920
EDGE,
@@ -41,8 +42,8 @@ export default {
4142
const { cell, e } = data
4243
const isStatusIcon = (tagName) =>
4344
tagName &&
44-
(tagName.toLocaleLowerCase() === 'em' ||
45-
tagName.toLocaleLowerCase() === 'body')
45+
(tagName.toLocaleLowerCase() === 'em' ||
46+
tagName.toLocaleLowerCase() === 'body')
4647
if (!isStatusIcon(e.target.tagName)) {
4748
this.hoverCell = cell
4849
this.updateCellStyle(cell, graph)
@@ -82,13 +83,22 @@ export default {
8283
const nodeSelected = _.merge(_.cloneDeep(NODE.attrs), NODE_SELECTED.attrs)
8384

8485
let img = null
85-
let nodeAttrs = isHover ? nodeHover : isSelected ? nodeSelected : NODE.attrs
86-
let portAttrs = isHover ? _.merge(portDefault, portHover) : isSelected ? _.merge(portDefault, portSelected) : portDefault
86+
let nodeAttrs = null
87+
let portAttrs = null
8788

8889
if (isHover || isSelected) {
8990
img = require(`../images/task-icos/${node.data.taskType.toLocaleLowerCase()}_hover.png`)
91+
if (isHover) {
92+
nodeAttrs = nodeHover
93+
portAttrs = _.merge(portDefault, portHover)
94+
} else {
95+
nodeAttrs = nodeSelected
96+
portAttrs = _.merge(portDefault, portSelected)
97+
}
9098
} else {
9199
img = require(`../images/task-icos/${node.data.taskType.toLocaleLowerCase()}.png`)
100+
nodeAttrs = NODE.attrs
101+
portAttrs = portDefault
92102
}
93103
node.setAttrByPath('image/xlink:href', img)
94104
node.setAttrs(nodeAttrs)
@@ -107,10 +117,15 @@ export default {
107117
const isHover = edge === this.hoverCell
108118
const isSelected = graph.isSelected(edge)
109119
const labelName = this.getEdgeLabelName ? this.getEdgeLabelName(edge) : ''
110-
const edgeHover = _.cloneDeep(EDGE_HOVER)
111-
const edgeDefault = _.cloneDeep(EDGE)
112-
const edgeSelected = _.cloneDeep(EDGE_SELECTED)
113-
const edgeProps = isHover ? _.merge(edgeDefault, edgeHover) : isSelected ? _.merge(edgeDefault, edgeSelected) : edgeDefault
120+
let edgeProps = null
121+
122+
if (isHover) {
123+
edgeProps = _.merge(_.cloneDeep(EDGE), EDGE_HOVER)
124+
} else if (isSelected) {
125+
edgeProps = _.merge(_.cloneDeep(EDGE), EDGE_SELECTED)
126+
} else {
127+
edgeProps = _.cloneDeep(EDGE)
128+
}
114129

115130
edge.setAttrs(edgeProps.attrs)
116131
edge.setLabels([

0 commit comments

Comments
 (0)