Skip to content

Commit

Permalink
add option to choose endpoint identifier to match to nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrinaTurner committed Sep 14, 2021
1 parent b921526 commit ce033ec
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/MapPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const MapPanel: React.FC<Props> = ({ options, data, width, height, id })
srcField: graphOptions.srcField,
dstField: graphOptions.dstField,
valField: graphOptions.valField,
endpointId: graphOptions.endpointId,
};
var parsedData = {};
var mapData;
Expand Down
5 changes: 3 additions & 2 deletions src/dataParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ export function parseData(data: { series: any[] }, mapData, colors, fields) {
});

const mapJson = JSON.parse(mapData);
const endpointId = fields.endpointId;

mapJson.edges.forEach((edge) => {
// Find A and Z node
let nodeA = edge.meta.endpoint_identifiers.router[0];
let nodeZ = edge.meta.endpoint_identifiers.router[1];
let nodeA = edge.meta.endpoint_identifiers[endpointId][0];
let nodeZ = edge.meta.endpoint_identifiers[endpointId][1];
// create za name
edge.AZname = `${nodeA}---${nodeZ}`;
edge.ZAname = `${nodeZ}---${nodeA}`;
Expand Down
6 changes: 6 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ plugin.setPanelOptions((builder) => {
description: 'JSON with edges and nodes of network map',
defaultValue: '',
});
builder.addTextInput({
path: 'endpointId',
name: 'Endpoint Identifier',
description: 'The endpoint identifier in the meta data to match to the query',
defaultValue: 'router',
});
builder.addColorPicker({
path: 'nodeHighlight',
name: 'Node highlight color',
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface MapOptions {
srcField: string;
dstField: string;
valField: string;
endpointId: string;
startLat: number;
startLng: number;
startZoom: number;
Expand Down

0 comments on commit ce033ec

Please sign in to comment.