Skip to content

Commit b88356b

Browse files
authored
fix: polish the network profiling widget, bugfix (#151)
1 parent d8889f1 commit b88356b

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

src/views/dashboard/related/network-profiling/Content.vue

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ limitations under the License. -->
1515
<template>
1616
<div class="flex-h content">
1717
<Tasks />
18-
<div
19-
class="vis-graph ml-5"
20-
v-if="networkProfilingStore.nodes.length"
21-
v-loading="networkProfilingStore.loadNodes"
22-
>
23-
<process-topology :config="config" />
24-
</div>
25-
<div class="text" v-else v-loading="networkProfilingStore.loadNodes">
26-
{{ t("noData") }}
18+
<div class="vis-graph ml-5" v-loading="networkProfilingStore.loadNodes">
19+
<process-topology
20+
v-if="networkProfilingStore.nodes.length"
21+
:config="config"
22+
/>
23+
<div class="text" v-else>
24+
{{ t("noData") }}
25+
</div>
2726
</div>
2827
</div>
2928
</template>
@@ -60,7 +59,7 @@ const { t } = useI18n();
6059
}
6160
6261
.text {
63-
width: calc(100% - 330px);
62+
width: 100%;
6463
text-align: center;
6564
margin-top: 30px;
6665
}

src/views/dashboard/related/network-profiling/components/Graph/linkProcess.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export const linkElement = (graph: any) => {
3030
0.5
3131
);
3232
if (d.lowerArc) {
33-
controlPos[1] = -controlPos[1] - 10;
33+
controlPos[1] =
34+
Math.abs(controlPos[1]) < 50
35+
? -controlPos[1] + 90
36+
: -controlPos[1] - 10;
3437
}
3538
return (
3639
"M" +
@@ -141,7 +144,8 @@ function getMidpoint(d: Call) {
141144
0.5
142145
);
143146
if (d.lowerArc) {
144-
controlPos[1] = -controlPos[1];
147+
controlPos[1] =
148+
Math.abs(controlPos[1]) < 50 ? -controlPos[1] + 100 : -controlPos[1] - 10;
145149
}
146150
const p = quadraticBezier(
147151
0.5,

src/views/dashboard/related/network-profiling/components/ProcessTopology.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
1414
limitations under the License. -->
1515
<template>
1616
<div ref="chart" class="process-topo"></div>
17-
<el-popover placement="bottom" :width="295" trigger="click">
17+
<el-popover
18+
placement="bottom"
19+
:width="295"
20+
trigger="click"
21+
v-if="dashboardStore.editMode"
22+
>
1823
<template #reference>
19-
<div
20-
class="switch-icon-edit ml-5"
21-
title="Settings"
22-
@click="setConfig"
23-
v-if="dashboardStore.editMode"
24-
>
24+
<div class="switch-icon-edit ml-5" title="Settings" @click="setConfig">
2525
<Icon size="middle" iconName="setting_empty" />
2626
</div>
2727
</template>
@@ -76,7 +76,7 @@ const link = ref<any>(null);
7676
const anchor = ref<any>(null);
7777
const arrow = ref<any>(null);
7878
const oldVal = ref<{ width: number; height: number }>({ width: 0, height: 0 });
79-
const config = ref<any>({});
79+
const config = ref<any>(props.config || {});
8080
const diff = ref<number[]>([220, 200]);
8181
const radius = 210;
8282
const dates = ref<Nullable<{ start: number; end: number }>>(null);

src/views/dashboard/related/network-profiling/components/Settings.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ function getDashboards() {
6262
}
6363
6464
function changeLinkDashboard(opt: { value: string }[]) {
65+
const linkDashboard = opt.length ? opt[0].value : "";
6566
const p = {
6667
...dashboardStore.selectedGrid,
67-
linkDashboard: opt[0].value,
68+
linkDashboard,
6869
};
6970
dashboardStore.selectWidget(p);
7071
dashboardStore.setConfigs(p);

0 commit comments

Comments
 (0)