Skip to content

Commit 5c01246

Browse files
hai-tianYangyang96
authored andcommitted
perf: pretty graph
1 parent f16f45f commit 5c01246

File tree

3 files changed

+120
-37
lines changed

3 files changed

+120
-37
lines changed

ui/src/components/topologyMap/index.tsx

+47-22
Original file line numberDiff line numberDiff line change
@@ -432,40 +432,65 @@ const TopologyMap = forwardRef((props: IProps, drawRef) => {
432432
})
433433
}
434434

435-
436-
437-
438-
const statusShape = group.addShape('circle', {
435+
const statusShape1 = group.addShape('circle', {
439436
attrs: {
440-
x: 190,
441-
y: 10,
437+
zIndex: -3,
438+
x: 185,
439+
y: 15,
442440
fill: statusColorMap?.[(cfg?.nodeData as any)?.status],
443441
r: 4,
444-
opacity: 0.8,
442+
opacity: 0.6,
445443
},
446-
name: 'status-circle',
444+
name: 'status-circle1',
447445
})
448-
449-
statusShape.animate({
450-
x: 190,
451-
y: 10,
452-
r: 5,
453-
opacity: 0.5,
446+
const statusShape2 = group.addShape('circle', {
447+
attrs: {
448+
zIndex: -2,
449+
x: 185,
450+
y: 15,
451+
fill: statusColorMap?.[(cfg?.nodeData as any)?.status],
452+
r: 4,
453+
opacity: 0.6,
454+
},
455+
name: 'status-circle2',
456+
})
457+
const statusShape3 = group.addShape('circle', {
458+
attrs: {
459+
zIndex: -1,
460+
x: 185,
461+
y: 15,
462+
fill: statusColorMap?.[(cfg?.nodeData as any)?.status],
463+
r: 4,
464+
opacity: 0.6,
465+
},
466+
name: 'status-circle3',
467+
})
468+
group.sort(); // Sort according to the zIndex
469+
statusShape1.animate({
470+
r: 10,
471+
opacity: 0.1,
454472
}, {
455-
duration: 1000,
473+
duration: 3000,
456474
easing: 'easeCubic',
457475
delay: 0,
458476
repeat: true,
459477
},)
460-
statusShape.animate({
461-
x: 190,
462-
y: 10,
463-
r: 4,
464-
opacity: 0.3,
478+
statusShape2.animate({
479+
r: 10,
480+
opacity: 0.1,
465481
}, {
466-
duration: 1000,
482+
duration: 3000,
467483
easing: 'easeCubic',
468-
delay: 0,
484+
delay: 1000,
485+
repeat: true,
486+
},)
487+
statusShape3.animate({
488+
r: 10,
489+
opacity: 0.1,
490+
}, {
491+
duration: 3000,
492+
easing: 'easeCubic',
493+
delay: 2000,
469494
repeat: true,
470495
},)
471496

ui/src/pages/projects/components/runs/previewDetail/index.tsx

+22-7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ const PreviewDetail = ({ open, currentRecord, handleClose }) => {
3131
}
3232
}, [ansi_up, currentRecord?.logs, logRef]);
3333

34+
const dotStyle = {
35+
background: changeSteps?.[selectedResource]?.action === 'Undefined' ? '#ff4d4f' : changeSteps?.[selectedResource]?.action === 'UnChanged' ? "rgba(0,0,0,0.25)" : '#faad14'
36+
}
37+
3438
return (
3539
<Drawer
3640
title={'Preview Detail'}
@@ -64,14 +68,25 @@ const PreviewDetail = ({ open, currentRecord, handleClose }) => {
6468
})
6569
}
6670
</Select>
67-
<div className={styles.status}>
68-
<div className={styles.pulse}>
69-
<Badge style={{ marginLeft: 10 }} status={
70-
changeSteps?.[selectedResource]?.action === 'Undefined' ? 'error' : changeSteps?.[selectedResource]?.action === 'UnChanged' ? "default" : 'warning'
71-
} />
71+
{
72+
selectedResource && <div className={styles.status}>
73+
<div className={styles.animate_wave}>
74+
<div
75+
style={dotStyle}
76+
className={`${styles.animate_circle} ${styles.animate_inner}`}>
77+
</div>
78+
<div
79+
style={dotStyle}
80+
className={`${styles.animate_circle} ${styles.animate_middle}`}>
81+
</div>
82+
<div
83+
style={dotStyle}
84+
className={`${styles.animate_circle} ${styles.animate_outer}`}>
85+
</div>
86+
</div>
87+
{changeSteps?.[selectedResource]?.action}
7288
</div>
73-
{changeSteps?.[selectedResource]?.action}
74-
</div>
89+
}
7590
</div>
7691
<CodeDiffView oldContent={changeSteps?.[selectedResource]?.from ? JSON.stringify(changeSteps?.[selectedResource]?.from, null, 2) : ''} newContent={changeSteps?.[selectedResource]?.to ? JSON.stringify(changeSteps?.[selectedResource]?.to, null, 2) : ''} />
7792
</>

ui/src/pages/projects/components/runs/previewDetail/styles.module.less

+51-8
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,68 @@
77
display: flex;
88
align-items: center;
99
margin-bottom: 10px;
10+
margin-left: 10px;
1011

11-
.pulse {
12-
margin-right: 7px;
13-
animation: fade-animation 1.5s infinite;
12+
.animate_wave {
13+
position: relative;
14+
display: flex;
15+
justify-content: center;
16+
align-items: center;
17+
margin-right: 10px;
18+
}
19+
20+
.animate_circle {
21+
position: absolute;
22+
border-radius: 50%;
23+
}
24+
25+
.animate_inner {
26+
width: 6px;
27+
height: 6px;
28+
z-index: 3;
29+
}
30+
31+
.animate_middle {
32+
width: 8px;
33+
height: 8px;
34+
opacity: 0.6;
35+
z-index: 2;
36+
animation: pulse 2s ease-in-out infinite;
37+
}
38+
39+
.animate_outer {
40+
width: 10px;
41+
height: 10px;
42+
opacity: 0.1;
43+
z-index: 1;
44+
animation: pulse 2s ease-in-out infinite;
1445
}
1546
}
1647
}
1748

18-
19-
@keyframes fade-animation {
49+
@keyframes pulse {
2050
0% {
21-
opacity: 0;
51+
transform: scale(1);
2252
}
2353

2454
50% {
25-
opacity: 1;
55+
transform: scale(1.8);
2656
}
2757

2858
100% {
29-
opacity: 0;
59+
transform: scale(1);
60+
}
61+
}
62+
63+
64+
@keyframes flash {
65+
0% {
66+
opacity: .6;
67+
transform: scale(.8)
68+
}
69+
70+
to {
71+
opacity: 0.1;
72+
transform: scale(2.4)
3073
}
3174
}

0 commit comments

Comments
 (0)