Skip to content

Commit 1850ae6

Browse files
style: format code with Prettier and StandardJS
This commit fixes the style issues introduced in c8c8b96 according to the output from Prettier and StandardJS. Details: None
1 parent c8c8b96 commit 1850ae6

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/pages/topology/index.jsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const CytoscapeTopology = () => {
1919
{ id: 'server-7', label: '库存服务', color: '#8BC34A' },
2020
{ id: 'server-8', label: '消息队列', color: '#FFC107' },
2121
{ id: 'server-9', label: '日志中心', color: '#607D8B' },
22-
{ id: 'server-10', label: '监控中心', color: '#E91E63' },
22+
{ id: 'server-10', label: '监控中心', color: '#E91E63' }
2323
]
2424

2525
// 18个项目,分布在不同服务器
@@ -41,7 +41,7 @@ const CytoscapeTopology = () => {
4141
{ id: 'proj-15', label: '消息生产', parent: 'server-8' },
4242
{ id: 'proj-16', label: '消息消费', parent: 'server-8' },
4343
{ id: 'proj-17', label: '日志采集', parent: 'server-9' },
44-
{ id: 'proj-18', label: '监控采集', parent: 'server-10' },
44+
{ id: 'proj-18', label: '监控采集', parent: 'server-10' }
4545
]
4646

4747
// 服务器节点
@@ -59,7 +59,7 @@ const CytoscapeTopology = () => {
5959
{ data: { source: 'server-1', target: 'server-7', label: '库存' } },
6060
{ data: { source: 'server-1', target: 'server-8', label: '消息' } },
6161
{ data: { source: 'server-1', target: 'server-9', label: '日志' } },
62-
{ data: { source: 'server-1', target: 'server-10', label: '监控' } },
62+
{ data: { source: 'server-1', target: 'server-10', label: '监控' } }
6363
]
6464

6565
// 项目间依赖(部分示例,真实可扩展)
@@ -76,7 +76,7 @@ const CytoscapeTopology = () => {
7676
// 交叉依赖
7777
{ data: { source: 'proj-8', target: 'proj-12', label: '商品详情' } },
7878
{ data: { source: 'proj-6', target: 'proj-11', label: '商品推荐' } },
79-
{ data: { source: 'proj-4', target: 'proj-5', label: '用户授权' } },
79+
{ data: { source: 'proj-4', target: 'proj-5', label: '用户授权' } }
8080
]
8181

8282
const elements = [...serverNodes, ...projectNodes, ...serverEdges, ...projectEdges]
@@ -93,8 +93,8 @@ const CytoscapeTopology = () => {
9393
shape: 'roundrectangle',
9494
'font-size': 12,
9595
width: 60,
96-
height: 30,
97-
},
96+
height: 30
97+
}
9898
},
9999
// 服务器父节点分组色
100100
...serverList.map((s) => ({
@@ -106,17 +106,17 @@ const CytoscapeTopology = () => {
106106
'font-size': 16,
107107
padding: 24,
108108
'border-width': 2,
109-
'border-color': s.color,
110-
},
109+
'border-color': s.color
110+
}
111111
})),
112112
{
113113
selector: ':parent',
114114
style: {
115115
'text-valign': 'top',
116116
'text-halign': 'center',
117117
'font-size': 16,
118-
'font-weight': 'bold',
119-
},
118+
'font-weight': 'bold'
119+
}
120120
},
121121
{
122122
selector: 'edge',
@@ -133,8 +133,8 @@ const CytoscapeTopology = () => {
133133
'text-background-shape': 'roundrectangle',
134134
'text-border-color': '#888',
135135
'text-border-width': 1,
136-
'text-border-opacity': 0.5,
137-
},
136+
'text-border-opacity': 0.5
137+
}
138138
},
139139
// 服务器间主干线美化
140140
{
@@ -144,9 +144,9 @@ const CytoscapeTopology = () => {
144144
'target-arrow-color': '#1976D2',
145145
width: 5,
146146
'line-style': 'dashed',
147-
opacity: 0.7,
148-
},
149-
},
147+
opacity: 0.7
148+
}
149+
}
150150
]
151151

152152
const layout = { name: 'cose-bilkent', animate: true, idealEdgeLength: 100, nodeRepulsion: 4500 }
@@ -158,7 +158,7 @@ const CytoscapeTopology = () => {
158158
if (!cy) return
159159
let dashOffset = 0
160160
let running = true
161-
function animate() {
161+
function animate () {
162162
dashOffset = (dashOffset + 2) % 40
163163
// 主干(服务器间)
164164
cy.edges('edge[source^="server-"][target^="server-"]').forEach((edge) => {
@@ -190,7 +190,7 @@ const CytoscapeTopology = () => {
190190
}, [])
191191

192192
return (
193-
<FixTabPanel fill={true}>
193+
<FixTabPanel fill>
194194
<CytoscapeComponent
195195
elements={elements}
196196
style={{ width: '100%', height: '100%' }}

0 commit comments

Comments
 (0)