Skip to content

Commit

Permalink
Fix bogonFilteringSpace that cannot save 'none' option
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowee committed Mar 13, 2021
1 parent cf7dfba commit 5e98274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class TracerouteMapPanel extends Component<Props, State> {
}

let bogonFilterer = (_: string) => false; // true for bogon
if (options.bogonFilteringSpace) {
if (options.bogonFilteringSpace !== 'none') {
bogonFilterer = (ip: string) => {
const address = parseIPAddress(ip);
return address ? isBogusIPAddress(address, options.bogonFilteringSpace === 'extendedBogon') : true;
Expand Down
5 changes: 3 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PanelOptionsEditorBuilder } from '@grafana/data';

import GeoIPProvidersEditor, { GeoIPProvidersOption } from './geoip/Editor';

// undefined will be treated as defaultValue, so it can only be used for the default option
export type LongitudeWrapping = undefined | 'primeMeridian' | 'antimeridian';
export type HopLabelType = 'label' | 'ip' | 'ipAndLabel';

Expand All @@ -17,7 +18,7 @@ export interface TracerouteMapOptions {
srcHostAsZerothHop: boolean;
hopLabelType: HopLabelType;
showSearchIconInHopLabel: boolean;
bogonFilteringSpace: undefined | 'bogon' | 'extendedBogon';
bogonFilteringSpace: 'none' | 'bogon' | 'extendedBogon';
pathSpline: undefined | 'spline1' | 'spline2';
pathLineStyle: 'solid' | 'dashed' | 'antPath';
pathAnimationSpeedFactor: number;
Expand Down Expand Up @@ -197,7 +198,7 @@ export const buildOptionsEditor = (builder: PanelOptionsEditorBuilder<Traceroute
defaultValue: 'bogon',
settings: {
options: [
{ label: 'None', value: undefined, description: 'Pass all IPs to GeoIP API without filtering' },
{ label: 'None', value: 'none', description: 'Pass all IPs to GeoIP API without filtering' },
{
label: 'Bogon (private + reserved)',
value: 'bogon',
Expand Down

0 comments on commit 5e98274

Please sign in to comment.