feat: add tips

This commit is contained in:
Fine 2023-03-29 19:20:00 +08:00
parent 1825dac561
commit 431f3ef22d
2 changed files with 38 additions and 16 deletions

View File

@ -72,8 +72,7 @@ export const profileStore = defineStore({
this.analyzeTrees = []; this.analyzeTrees = [];
}, },
setSegmentSpans(spans: Recordable<SegmentSpan>[]) { setSegmentSpans(spans: Recordable<SegmentSpan>[]) {
const index = spans.length - 1 || 0; this.currentSpan = spans[0] || {};
this.currentSpan = spans[index];
this.segmentSpans = spans; this.segmentSpans = spans;
}, },
setCurrentSpan(span: Recordable<SegmentSpan>) { setCurrentSpan(span: Recordable<SegmentSpan>) {
@ -84,8 +83,7 @@ export const profileStore = defineStore({
this.currentSegment = segment; this.currentSegment = segment;
this.segmentSpans = segment.spans || []; this.segmentSpans = segment.spans || [];
if (segment.spans) { if (segment.spans) {
const index = segment.spans.length - 1 || 0; this.currentSpan = segment.spans[0] || {};
this.currentSpan = segment.spans[index];
} else { } else {
this.currentSpan = {}; this.currentSpan = {};
} }
@ -167,8 +165,7 @@ export const profileStore = defineStore({
async getSegmentSpans() { async getSegmentSpans() {
this.analyzeTrees = []; this.analyzeTrees = [];
this.segmentSpans = this.currentSegment.spans; this.segmentSpans = this.currentSegment.spans;
const index = this.currentSegment.spans.length - 1 || 0; this.currentSpan = this.currentSegment.spans[0] || {};
this.currentSpan = this.currentSegment.spans[index];
}, },
async getProfileAnalyze(params: Array<{ segmentId: string; timeRange: { start: number; end: number } }>) { async getProfileAnalyze(params: Array<{ segmentId: string; timeRange: { start: number; end: number } }>) {
if (!params.length) { if (!params.length) {

View File

@ -56,6 +56,7 @@ limitations under the License. -->
{ 'trace-item-error': data.isError }, { 'trace-item-error': data.isError },
{ profiled: data.profiled === false }, { profiled: data.profiled === false },
]" ]"
:data-text="data.profiled === false ? 'No Thread Dump' : ''"
> >
<div <div
:class="['method', 'level' + (data.level - 1)]" :class="['method', 'level' + (data.level - 1)]"
@ -83,6 +84,7 @@ limitations under the License. -->
<span> <span>
{{ data.endpointName }} {{ data.endpointName }}
</span> </span>
<span v-if="data.profiled === false"></span>
</el-tooltip> </el-tooltip>
</div> </div>
<div class="start-time"> <div class="start-time">
@ -258,21 +260,44 @@ limitations under the License. -->
&:hover { &:hover {
background: rgba(0, 0, 0, 0.04); background: rgba(0, 0, 0, 0.04);
color: #448dfe;
}
&::before {
position: absolute;
content: "";
width: 5px;
height: 100%;
background: #448dfe;
left: 0;
} }
} }
.profiled { .profiled {
background-color: #eee; background-color: #eee;
position: relative;
}
.profiled:before {
content: attr(data-text);
position: absolute;
top: 80%;
left: 30%;
width: 100px;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
background-color: #333;
color: #fff;
text-align: center;
box-shadow: #eee 1px 2px 10px;
display: none;
}
.profiled:after {
content: "";
position: absolute;
left: 40%;
top: 50%;
border: 6px solid #333;
border-color: transparent transparent #333 transparent;
display: none;
}
.profiled:hover:before,
.profiled:hover:after {
display: block;
z-index: 999;
} }
.trace-item-error { .trace-item-error {