From b34cb6f1e4b52df5a33b567c24dd71a9c7ea31ad Mon Sep 17 00:00:00 2001 From: "Katrina H. Turner" <46706381+KatrinaTurner@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:33:46 -1000 Subject: [PATCH 1/3] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef813d3..25b334a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netsage-sankey-panel", - "version": "1.1.1", + "version": "1.1.2", "description": "Sankey Panel Plugin for Grafana", "license": "Apache-2.0", "repository": "https://github.com/netsage-project/netsage-sankey-panel", From 99c5d9e83696f806b97f7fb860b732ecdfe3bcf0 Mon Sep 17 00:00:00 2001 From: "Katrina H. Turner" <46706381+KatrinaTurner@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:46:36 -1000 Subject: [PATCH 2/3] put tooltip back in front & adjust styling --- src/components/Tooltip.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Tooltip.tsx b/src/components/Tooltip.tsx index ba7180b..e5b3a17 100644 --- a/src/components/Tooltip.tsx +++ b/src/components/Tooltip.tsx @@ -42,13 +42,14 @@ export const Tooltip: React.FC = ({ rowNames, field, panelId }) => return text; }) .style('padding', '10px 15px') - .style('background', 'black') + .style('background', '#19191A') .style('color', 'white') - .style('border', '#A8A8A8 solid 5px') + .style('border', '#A8A8A8 solid 2px') .style('border-radius', '5px') .style('left', mousePosition.mouseX + 'px') .style('top', mousePosition.mouseY + 'px') .style('opacity', 0) + .style('z-index','1') .style('position', 'absolute'); div.transition().duration(200).style('opacity', 0.8); }) @@ -91,13 +92,14 @@ export const Tooltip: React.FC = ({ rowNames, field, panelId }) => return text; }) .style('padding', '10px 15px') - .style('background', 'black') + .style('background', '#19191A') .style('color', 'white') - .style('border', '#A8A8A8 solid 5px') + .style('border', '#A8A8A8 solid 2px') .style('border-radius', '5px') .style('left', mousePosition.mouseX + 'px') .style('top', mousePosition.mouseY + 'px') .style('opacity', 0) + .style('z-index', '1') .style('position', 'absolute'); div.transition().duration(200).style('opacity', 0.8); }) From fc27e48105a773b7e2b87010cd52ad93a396bb98 Mon Sep 17 00:00:00 2001 From: "Katrina H. Turner" <46706381+KatrinaTurner@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:47:00 -1000 Subject: [PATCH 3/3] fix for erroring out when invalid value field is selected --- src/dataParser.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/dataParser.ts b/src/dataParser.ts index 087c554..1f08a3d 100644 --- a/src/dataParser.ts +++ b/src/dataParser.ts @@ -13,7 +13,7 @@ import { DataFrameView, Field, getFieldDisplayName, Vector } from '@grafana/data * @return {valueField[0]} */ export function parseData(data: { series: any[] }, options: { valueField: any }, monochrome: boolean, color: any) { - const valueFieldName = options.valueField; + /** * Colors @@ -126,13 +126,25 @@ export function parseData(data: { series: any[] }, options: { valueField: any }, }); // Find selected value field or default to the first number field and use for values. - const valueField = valueFieldName - ? data.series.map((series: { fields: any[] }) => - series.fields.find((field: { name: any }) => field.name === valueFieldName) - ) - : data.series.map((series: { fields: any[] }) => + // const valueFieldName = options.valueField; + // const valueField = options.valueField + // ? data.series.map((series: { fields: any[] }) => + // series.fields.find((field: { name: any }) => field.name === options.valueField) + // ) + // : data.series.map((series: { fields: any[] }) => + // series.fields.find((field: { type: string }) => field.type === 'number') + // ); + // Fix to avoid erroring out when value field is hidden by transform + let valueField = data.series.map((series: { fields: any[] }) => + series.fields.find((field: { name: any }) => field.name === options.valueField) + ) + if(!valueField[0]) { + valueField = data.series.map((series: { fields: any[] }) => series.fields.find((field: { type: string }) => field.type === 'number') ); + } + + let values = []; valueField[0].values.map((value: any) => {