mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 17:34:51 +00:00
add action box
This commit is contained in:
parent
28945c560a
commit
90a3c08db8
9
src/types/trace.d.ts
vendored
9
src/types/trace.d.ts
vendored
@ -50,7 +50,7 @@ export interface Span {
|
|||||||
refs?: Ref[];
|
refs?: Ref[];
|
||||||
}
|
}
|
||||||
export type Ref = {
|
export type Ref = {
|
||||||
type: string;
|
type?: string;
|
||||||
parentSegmentId: string;
|
parentSegmentId: string;
|
||||||
parentSpanId: number;
|
parentSpanId: number;
|
||||||
traceId: string;
|
traceId: string;
|
||||||
@ -60,13 +60,6 @@ export interface log {
|
|||||||
data: Map<string, string>;
|
data: Map<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Ref {
|
|
||||||
traceId: string;
|
|
||||||
parentSegmentId: string;
|
|
||||||
parentSpanId: number;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StatisticsSpan {
|
export interface StatisticsSpan {
|
||||||
groupRef: StatisticsGroupRef;
|
groupRef: StatisticsGroupRef;
|
||||||
maxTime: number;
|
maxTime: number;
|
||||||
|
@ -15,6 +15,10 @@ limitations under the License. -->
|
|||||||
<Icon iconName="spinner" size="sm" />
|
<Icon iconName="spinner" size="sm" />
|
||||||
</div>
|
</div>
|
||||||
<div ref="traceGraph" class="d3-graph"></div>
|
<div ref="traceGraph" class="d3-graph"></div>
|
||||||
|
<div id="action-box">
|
||||||
|
<div @click="showDetail = true">Span Details</div>
|
||||||
|
<div v-for="span in parentSpans" :key="span.parentSegmentId">{{ `Parent Span: ${span.parentSegmentId}` }}</div>
|
||||||
|
</div>
|
||||||
<el-dialog v-model="showDetail" :destroy-on-close="true" @closed="showDetail = false" v-if="currentSpan?.segmentId">
|
<el-dialog v-model="showDetail" :destroy-on-close="true" @closed="showDetail = false" v-if="currentSpan?.segmentId">
|
||||||
<SpanDetail :currentSpan="currentSpan" />
|
<SpanDetail :currentSpan="currentSpan" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -46,6 +50,7 @@ limitations under the License. -->
|
|||||||
const refSpans = ref<Array<Ref>>([]);
|
const refSpans = ref<Array<Ref>>([]);
|
||||||
const tree = ref<Nullable<any>>(null);
|
const tree = ref<Nullable<any>>(null);
|
||||||
const traceGraph = ref<Nullable<HTMLDivElement>>(null);
|
const traceGraph = ref<Nullable<HTMLDivElement>>(null);
|
||||||
|
const parentSpans = ref<Array<Ref>>([]);
|
||||||
const debounceFunc = debounce(draw, 500);
|
const debounceFunc = debounce(draw, 500);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
@ -93,7 +98,15 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
function handleSelectSpan(i: Recordable) {
|
function handleSelectSpan(i: Recordable) {
|
||||||
currentSpan.value = i.data;
|
currentSpan.value = i.data;
|
||||||
showDetail.value = true;
|
parentSpans.value = currentSpan.value?.refs?.filter((d) => d) || [];
|
||||||
|
if (currentSpan.value?.parentSpanId !== -1) {
|
||||||
|
parentSpans.value.push({
|
||||||
|
parentSegmentId: currentSpan.value?.segmentId || "",
|
||||||
|
parentSpanId: currentSpan.value?.parentSpanId || NaN,
|
||||||
|
traceId: currentSpan.value?.traceId || "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// showDetail.value = true;
|
||||||
}
|
}
|
||||||
function traverseTree(node: Recordable, spanId: string, segmentId: string, data: Recordable) {
|
function traverseTree(node: Recordable, spanId: string, segmentId: string, data: Recordable) {
|
||||||
if (!node || node.isBroken) {
|
if (!node || node.isBroken) {
|
||||||
@ -396,4 +409,27 @@ limitations under the License. -->
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
fill: #409eff;
|
fill: #409eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#action-box {
|
||||||
|
position: absolute;
|
||||||
|
color: $font-color;
|
||||||
|
cursor: pointer;
|
||||||
|
border: var(--sw-topology-border);
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: $theme-background;
|
||||||
|
padding: 10px 0;
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
div {
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
text-align: left;
|
||||||
|
padding: 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div:hover {
|
||||||
|
color: $active-color;
|
||||||
|
background-color: $popper-hover-bg-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -117,6 +117,10 @@ export default class ListGraph {
|
|||||||
}
|
}
|
||||||
draw(callback: Function) {
|
draw(callback: Function) {
|
||||||
this.update(this.root, callback);
|
this.update(this.root, callback);
|
||||||
|
d3.select("body").on("click", function (event) {
|
||||||
|
if (event.target.closest("#action-box")) return;
|
||||||
|
d3.select("#action-box").style("display", "none");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
click(d: Recordable, scope: Recordable) {
|
click(d: Recordable, scope: Recordable) {
|
||||||
if (!d.data.type) return;
|
if (!d.data.type) return;
|
||||||
@ -155,9 +159,14 @@ export default class ListGraph {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (t.selectedNode) {
|
if (t.selectedNode) {
|
||||||
t.selectedNode.classed("highlighted", false);
|
t.selectedNode.classed("highlighted", false);
|
||||||
|
d3.select("#action-box").style("display", "none");
|
||||||
}
|
}
|
||||||
if (t.selectedNode?.datum().id !== d.id) {
|
if (t.selectedNode?.datum().id !== d.id) {
|
||||||
d3.select(this).classed("highlighted", true);
|
d3.select(this).classed("highlighted", true);
|
||||||
|
d3.select("#action-box")
|
||||||
|
.style("display", "block")
|
||||||
|
.style("left", `${event.pageX - 70}px`)
|
||||||
|
.style("top", `${event.pageY - 100}px`);
|
||||||
}
|
}
|
||||||
t.selectedNode = d3.select(this);
|
t.selectedNode = d3.select(this);
|
||||||
if (t.handleSelectSpan) {
|
if (t.handleSelectSpan) {
|
||||||
|
Loading…
Reference in New Issue
Block a user