Skip to content

Commit 8d12b15

Browse files
committed
ThreadMap: Added advanced Filter
1 parent e6a20f5 commit 8d12b15

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

Live-Tracing/grafana-plugins/ThreadMap-panel/src/ThreadMap.tsx

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export const ThreadMap: React.FC<ThreadMapPanelProps> = ({ options, data, width,
5757
}
5858
let minValLength = (minVal.toString().length) * 11
5959

60+
//Call Filter
61+
if(options.UseFileSystemFinder) {
62+
FileSystemFinder();
63+
}
64+
6065
drawThreadMap()
6166

6267
//functions
@@ -86,7 +91,7 @@ export const ThreadMap: React.FC<ThreadMapPanelProps> = ({ options, data, width,
8691
}
8792
return(Colour)
8893
}
89-
94+
9095
function ColourAssignment(Colour: any, lDatalength: any) {
9196
let ctrTpP = 0
9297
var ThreadHeatValue: any[] = []
@@ -247,12 +252,22 @@ export const ThreadMap: React.FC<ThreadMapPanelProps> = ({ options, data, width,
247252
cy: 140,
248253
r: 6,
249254
colour: Colour,
250-
class: "Thread"
255+
class: "Thread",
256+
stroke: ''
251257
}
252258
)
253259
}
254260

255-
function drawThreadMap() {
261+
function FileSystemFinder() {
262+
for (let i = 0; i < MapData.length; i++) {
263+
if (MapData[i].affiliated.includes(options.FileSystemFinder)) {
264+
MapData[i].stroke = 'pink';
265+
}
266+
}
267+
console.log(MapData)
268+
}
269+
270+
function drawThreadMap() {
256271
const svgTM = d3.select('#ThreadMapMain');
257272
const backgroundTooltip = d3
258273
.select('#ThreadMapMain')
@@ -315,6 +330,11 @@ function drawThreadMap() {
315330
.style('fill', function (d: any) {
316331
return d.colour;
317332
})
333+
.attr('stroke', function (d: any) {
334+
return d.stroke;
335+
})
336+
.attr('stroke-width', 2)
337+
318338
.on('mouseover', function (d) {
319339
d3.select(this).transition().duration(50).attr('opacity', '.85');
320340
backgroundTooltip.transition().duration(50).style('opacity', 1);
@@ -414,11 +434,24 @@ function drawThreadMap() {
414434
ProcessIDForceGraph
415435
.attr('ProcessID', d.name)
416436
//Remove old highlight
417-
d3.selectAll('circle').attr('stroke', null);
437+
d3.selectAll('circle')
438+
.filter(function() {return d3.select(this).attr('r') === '8';})
439+
.attr('stroke', null);
418440
//Add Highliting
419441
d3.select(this).attr('stroke', 'blue').attr('stroke-width', 2);
420442
}
421443
});
444+
//Highlight Threads with filtered Filenames
445+
//Remove old highlight
446+
d3.selectAll('circle')
447+
.filter(function() {return d3.select(this).attr('r') === '6';})
448+
.attr('stroke', null);
449+
d3.selectAll('circle')
450+
.filter(function() {return d3.select(this).attr('r') === '6';})
451+
.attr('stroke', function (d: any) {
452+
return d.stroke;
453+
})
454+
.attr('stroke-width', 2)
422455
//Style MinMax Display
423456
//remove old min max
424457
d3.select('#minValueText').remove();

Live-Tracing/grafana-plugins/ThreadMap-panel/src/module.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,18 @@ export const plugin = new PanelPlugin<PanelOptions>(ThreadMap).setPanelOptions(b
4444
category,
4545
showIf: (config) => config.UseMinMaxBoolean
4646
})
47+
.addBooleanSwitch({
48+
path: 'UseFileSystemFinder',
49+
name: 'Activate FileSystemFinder',
50+
defaultValue: defaultPanelOptions.UseFileSystemFinder,
51+
category,
52+
})
53+
.addTextInput({
54+
path: 'FileSystemFinder',
55+
name: 'FileSystemFinder:',
56+
description: '',
57+
defaultValue: defaultPanelOptions.FileSystemFinder,
58+
category,
59+
})
4760

4861
})

Live-Tracing/grafana-plugins/ThreadMap-panel/src/options.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
//Options to Panel
44
export interface PanelOptions {
55
UseMinMaxBoolean: any;
6-
ThreadMapColor: { min: any; max: any; }
7-
SortThreadMapBy: [string, string, string]
6+
ThreadMapColor: { min: any; max: any; };
7+
SortThreadMapBy: [string, string, string];
8+
UseFileSystemFinder: any;
9+
FileSystemFinder: string;
810
}
911

1012
export const defaultPanelOptions: PanelOptions = {
@@ -17,5 +19,7 @@ export const defaultPanelOptions: PanelOptions = {
1719
'default',
1820
'MaxBytes',
1921
'Filesystem'
20-
]
22+
],
23+
UseFileSystemFinder: false,
24+
FileSystemFinder: 'pfs',
2125
};

0 commit comments

Comments
 (0)