From 02f5c4b9768343cc387c2de285341eab4831fbba Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Tue, 26 Apr 2022 19:32:23 +0800 Subject: [PATCH] fix: optimize the trace widget (#73) --- src/assets/icons/arrow-down.svg | 16 +++++++++++++ src/views/dashboard/related/trace/Detail.vue | 23 ++++++++++++++----- .../related/trace/components/List.vue | 8 +++++-- .../related/trace/utils/d3-trace-list.ts | 8 +++---- 4 files changed, 43 insertions(+), 12 deletions(-) create mode 100755 src/assets/icons/arrow-down.svg diff --git a/src/assets/icons/arrow-down.svg b/src/assets/icons/arrow-down.svg new file mode 100755 index 00000000..f85e0b06 --- /dev/null +++ b/src/assets/icons/arrow-down.svg @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/src/views/dashboard/related/trace/Detail.vue b/src/views/dashboard/related/trace/Detail.vue index 3e2caa64..d44b01a5 100644 --- a/src/views/dashboard/related/trace/Detail.vue +++ b/src/views/dashboard/related/trace/Detail.vue @@ -24,7 +24,12 @@ limitations under the License. --> /> {{ traceStore.currentTrace.endpointNames[0] }}
- + {{ t("viewLogs") }}
@@ -88,7 +93,8 @@ limitations under the License. -->
@@ -96,7 +102,8 @@ limitations under the License. --> {{ t("list") }} @@ -104,7 +111,8 @@ limitations under the License. --> {{ t("tree") }} @@ -112,7 +120,8 @@ limitations under the License. --> {{ t("table") }} @@ -230,7 +239,9 @@ export default defineComponent({ } .trace-chart { - height: 100%; + height: calc(100% - 100px); + overflow: auto; + padding-bottom: 20px; } .trace-detail-wrapper { diff --git a/src/views/dashboard/related/trace/components/List.vue b/src/views/dashboard/related/trace/components/List.vue index e8d4cd07..907c2364 100644 --- a/src/views/dashboard/related/trace/components/List.vue +++ b/src/views/dashboard/related/trace/components/List.vue @@ -22,11 +22,11 @@ limitations under the License. --> {{ i }} - + {{ t("exportImage") }}
-
+
@@ -103,4 +103,8 @@ function downloadTrace() { .btn { float: right; } + +.list { + height: calc(100% - 150px); +} diff --git a/src/views/dashboard/related/trace/utils/d3-trace-list.ts b/src/views/dashboard/related/trace/utils/d3-trace-list.ts index dc2c16a7..8d90dc62 100644 --- a/src/views/dashboard/related/trace/utils/d3-trace-list.ts +++ b/src/views/dashboard/related/trace/utils/d3-trace-list.ts @@ -40,8 +40,8 @@ export default class ListGraph { constructor(el: HTMLDivElement, handleSelectSpan: (i: Trace) => void) { this.handleSelectSpan = handleSelectSpan; this.el = el; - this.width = el.clientWidth - 10; - this.height = el.clientHeight; + this.width = el.getBoundingClientRect().width - 10; + this.height = el.getBoundingClientRect().height - 10; this.svg = d3 .select(this.el) .append("svg") @@ -306,8 +306,8 @@ export default class ListGraph { if (!this.el) { return; } - this.width = this.el.clientWidth - 20; - this.height = this.el.clientHeight; + this.width = this.el.getBoundingClientRect().width - 20; + this.height = this.el.getBoundingClientRect().height - 10; this.svg.attr("width", this.width).attr("height", this.height); this.svg.select("g").attr("transform", () => `translate(160, 0)`); const transform = d3.zoomTransform(this.svg).translate(0, 0);