Skip to content

Commit 3406d00

Browse files
Instrumentation: Highlight selected commands on click (#3431)
This PR adds a border to clicked commands to highlight which command the details correspond to. <img width="200" alt="image" src="https://github.com/user-attachments/assets/2cb0e060-8e3f-4548-8412-0d10489f758b" />
1 parent 224f36e commit 3406d00

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

resources/js/vue/components/shared/CommandGanttChart.vue

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ export default {
8282
},
8383
deep: true,
8484
},
85+
selectedCommandId: {
86+
handler() {
87+
// We only need to update the series data to apply the selection highlight.
88+
// This avoids resetting the zoom level.
89+
this.chart.setOption({
90+
series: [{
91+
id: 'command-series',
92+
data: this.processedChartData.data,
93+
}],
94+
});
95+
},
96+
},
8597
},
8698
created() {
8799
this.chart = null;
@@ -253,6 +265,7 @@ export default {
253265
const height = this.commandBarHeight;
254266
const itemType = api.value(5);
255267
const isDisabled = api.value(6);
268+
const commandId = api.value(11);
256269
257270
const style = {
258271
fill: this.colors[itemType],
@@ -267,6 +280,14 @@ export default {
267280
opacity: 0.4,
268281
});
269282
}
283+
284+
if (commandId === this.selectedCommandId) {
285+
Object.assign(style, {
286+
stroke: '#000000',
287+
lineWidth: 2,
288+
});
289+
}
290+
270291
return {
271292
type: 'rect',
272293
shape: {
@@ -348,7 +369,13 @@ export default {
348369
return;
349370
}
350371
351-
this.selectedCommandId = parseInt(params.data.value[11]);
372+
const clickedCommandId = parseInt(params.data.value[11]);
373+
if (this.selectedCommandId === clickedCommandId) {
374+
this.selectedCommandId = null;
375+
}
376+
else {
377+
this.selectedCommandId = clickedCommandId;
378+
}
352379
},
353380
},
354381
};

0 commit comments

Comments
 (0)