Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/src/plugins/bar.tsx → app/src/plugins/bar/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
import dynamic from "next/dynamic";
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { BarChartDataPoint, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToBarData, validateBarData } from "./transforms/bar";
import { useEChartsClick, type PluginProps } from "./utils";
import { barSettingsSchema } from "./settings/bar";
import { defineChartPlugin } from "../registry";
import { transformToBarData, validateBarData } from "./transform";
import { useEChartsClick, type PluginProps } from "../utils";
import { barSettingsSchema } from "./settings";

const BarChart = dynamic(
() => import("@neoboard/components").then((m) => ({ default: m.BarChart })),
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function BarPluginComponent({
data,
settings: raw,
onChartClick,
colorThresholds,
stylingRules,
paramValues,
}: PluginProps) {

Check warning on line 28 in app/src/plugins/bar/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowplT2g4iBOapmo8&open=AZ1vowplT2g4iBOapmo8&pullRequest=469
const onClick = useEChartsClick(onChartClick, data);
const settings = barSettingsSchema.parse(raw);

Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/bar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { barPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
resolveValueKeys,
normalizeValue,
type ColumnMapping,
} from "./shared";
} from "../transforms/shared-utils";

/**
* Transform to bar chart format: [{ label, series1, series2 }]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

import { getChartOptions } from "@neoboard/components";
import { FormWidgetRenderer } from "@/components/form-widget-renderer";
import { defineChartPlugin } from "./registry";
import { type PluginProps } from "./utils";
import { formSettingsSchema } from "./settings/form";
import { defineChartPlugin } from "../registry";
import { type PluginProps } from "../utils";
import { formSettingsSchema } from "./settings";

function FormPluginComponent({
settings: raw,
connectionId,
query,
}: PluginProps) {

Check warning on line 18 in app/src/plugins/form/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowq6T2g4iBOapmpN&open=AZ1vowq6T2g4iBOapmpN&pullRequest=469
const settings = formSettingsSchema.parse(raw);
return (
<FormWidgetRenderer
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/form/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { formPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
import dynamic from "next/dynamic";
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { GaugeDataPoint, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToGaugeData } from "./transforms/gauge";
import { useEChartsClick, type PluginProps } from "./utils";
import { gaugeSettingsSchema } from "./settings/gauge";
import { defineChartPlugin } from "../registry";
import { transformToGaugeData } from "./transform";
import { useEChartsClick, type PluginProps } from "../utils";
import { gaugeSettingsSchema } from "./settings";

const GaugeChart = dynamic(
() => import("@neoboard/components").then((m) => ({ default: m.GaugeChart })),
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function GaugePluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
onChartClick,
}: PluginProps) {

Check warning on line 27 in app/src/plugins/gauge/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowpfT2g4iBOapmo7&open=AZ1vowpfT2g4iBOapmo7&pullRequest=469
const onClick = useEChartsClick(onChartClick, data);
const settings = gaugeSettingsSchema.parse(raw);
return (
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/gauge/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { gaugePlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Gauge chart data transform.
*/

import { toRecords, normalizeValue } from "./shared";
import { toRecords, normalizeValue } from "../transforms/shared-utils";

/**
* Transform to gauge chart format: [{ value, name }]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { GraphNode, GraphEdge, StylingRule } from "@neoboard/components";
import { GraphExplorationWrapper } from "@/components/graph-exploration-wrapper";
import { defineChartPlugin } from "./registry";
import { transformToGraphData, validateGraphData } from "./transforms/graph";
import { type PluginProps } from "./utils";
import { graphSettingsSchema } from "./settings/graph";
import { defineChartPlugin } from "../registry";
import { transformToGraphData, validateGraphData } from "./transform";
import { type PluginProps } from "../utils";
import { graphSettingsSchema } from "./settings";

// NVL (WebGL) is heavy — lazy load so it's only bundled when a graph widget renders.
const GraphChart = dynamic(
Expand All @@ -22,17 +22,17 @@
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function GraphPluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
onChartClick,
connectionId,
widgetId,
resultId,
autoFit,
}: PluginProps) {

Check warning on line 35 in app/src/plugins/graph/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqdT2g4iBOapmpG&open=AZ1vowqdT2g4iBOapmpG&pullRequest=469
const settings = graphSettingsSchema.parse(raw);
const graphData = (data ?? { nodes: [], edges: [] }) as {
nodes: GraphNode[];
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/graph/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { graphPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Graph chart data transform and validator.
*/

import { toRecords, normalizeValue } from "./shared";
import { toRecords, normalizeValue } from "../transforms/shared-utils";

/**
* Normalize all properties in a record, converting non-primitives to display strings.
Expand Down Expand Up @@ -46,7 +46,7 @@
const edgesMap = new Map<string, Record<string, unknown>>();

function addNode(v: Record<string, unknown>) {
const id = String(v.elementId ?? v.identity ?? crypto.randomUUID());

Check warning on line 49 in app/src/plugins/graph/transform.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'v.elementId ?? v.identity ?? crypto.randomUUID()' will use Object's default stringification format ('[object Object]') when stringified.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqlT2g4iBOapmpH&open=AZ1vowqlT2g4iBOapmpH&pullRequest=469
if (!nodesMap.has(id)) {
const labels = (v.labels as string[]) ?? [];
const rawProps = (v.properties as Record<string, unknown>) ?? {};
Expand All @@ -63,9 +63,9 @@

function addEdge(v: Record<string, unknown>) {
const edgeId = String(
v.elementId ??
v.identity ??
`${v.startNodeElementId ?? v.start}-${v.type}-${v.endNodeElementId ?? v.end}`,

Check warning on line 68 in app/src/plugins/graph/transform.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'v.elementId ?? v.identity ?? `${v.startNodeElementId ?? v.start}-${v.type}-${v.endNodeElementId ?? v.end}`' will use Object's default stringification format ('[object Object]') when stringified.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqlT2g4iBOapmpI&open=AZ1vowqlT2g4iBOapmpI&pullRequest=469
);
if (!edgesMap.has(edgeId)) {
const rawProps = (v.properties ?? {}) as Record<string, unknown>;
Expand All @@ -79,7 +79,7 @@
}
}

function extractGraphValue(value: unknown) {

Check failure on line 82 in app/src/plugins/graph/transform.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqlT2g4iBOapmpJ&open=AZ1vowqlT2g4iBOapmpJ&pullRequest=469
if (!value || typeof value !== "object") return;
const v = value as Record<string, unknown>;

Expand Down Expand Up @@ -121,7 +121,7 @@
* Validates raw data shape for graph charts.
* Returns null if valid or empty, error string if rows exist but contain no graph structures.
*/
export function validateGraphData(data: unknown): string | null {

Check failure on line 124 in app/src/plugins/graph/transform.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 23 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqlT2g4iBOapmpK&open=AZ1vowqlT2g4iBOapmpK&pullRequest=469
const records = toRecords(data);
if (!records.length) return null;
for (const record of records) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/

import { IframeWidget, getChartOptions } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { type PluginProps } from "./utils";
import { iframeSettingsSchema } from "./settings/iframe";
import { defineChartPlugin } from "../registry";
import { type PluginProps } from "../utils";
import { iframeSettingsSchema } from "./settings";

function IframePluginComponent({ settings: raw }: PluginProps) {

Check warning on line 12 in app/src/plugins/iframe/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowrmT2g4iBOapmpU&open=AZ1vowrmT2g4iBOapmpU&pullRequest=469
const settings = iframeSettingsSchema.parse(raw);
return (
<IframeWidget
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/iframe/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { iframePlugin } from "./component";
File renamed without changes.
34 changes: 17 additions & 17 deletions app/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@

import { pluginRegistry } from "./registry";
import { CHART_TYPES } from "./chart-types";
import { markdownPlugin } from "./markdown";
import { barPlugin } from "./bar";
import { linePlugin } from "./line";
import { piePlugin } from "./pie";
import { singleValuePlugin } from "./single-value";
import { graphPlugin } from "./graph";
import { mapPlugin } from "./map";
import { tablePlugin } from "./table";
import { parameterSelectPlugin } from "./parameter-select";
import { jsonPlugin } from "./json";
import { formPlugin } from "./form";
import { iframePlugin } from "./iframe";
import { gaugePlugin } from "./gauge";
import { sankeyPlugin } from "./sankey";
import { sunburstPlugin } from "./sunburst";
import { radarPlugin } from "./radar";
import { treemapPlugin } from "./treemap";
import { markdownPlugin } from "./markdown/component";
import { barPlugin } from "./bar/component";
import { linePlugin } from "./line/component";
import { piePlugin } from "./pie/component";
import { singleValuePlugin } from "./single-value/component";
import { graphPlugin } from "./graph/component";
import { mapPlugin } from "./map/component";
import { tablePlugin } from "./table/component";
import { parameterSelectPlugin } from "./parameter-select/component";
import { jsonPlugin } from "./json/component";
import { formPlugin } from "./form/component";
import { iframePlugin } from "./iframe/component";
import { gaugePlugin } from "./gauge/component";
import { sankeyPlugin } from "./sankey/component";
import { sunburstPlugin } from "./sunburst/component";
import { radarPlugin } from "./radar/component";
import { treemapPlugin } from "./treemap/component";

const BUILT_IN_PLUGINS = [
markdownPlugin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import { JsonViewer, getChartOptions } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToJsonData } from "./transforms/json";
import { type PluginProps } from "./utils";
import { jsonSettingsSchema } from "./settings/json";
import { defineChartPlugin } from "../registry";
import { transformToJsonData } from "./transform";
import { type PluginProps } from "../utils";
import { jsonSettingsSchema } from "./settings";

function JsonPluginComponent({ data, settings: raw }: PluginProps) {

Check warning on line 14 in app/src/plugins/json/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowrYT2g4iBOapmpS&open=AZ1vowrYT2g4iBOapmpS&pullRequest=469
const settings = jsonSettingsSchema.parse(raw);
return (
<div className="h-full overflow-auto">
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/json/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { jsonPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* JSON viewer data transform.
*/

import { toRecords } from "./shared";
import { toRecords } from "../transforms/shared-utils";

/**
* Pass data through for JSON viewer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
import dynamic from "next/dynamic";
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { LineChartDataPoint, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToLineData, validateLineData } from "./transforms/line";
import { useEChartsClick, type PluginProps } from "./utils";
import { lineSettingsSchema } from "./settings/line";
import { defineChartPlugin } from "../registry";
import { transformToLineData, validateLineData } from "./transform";
import { useEChartsClick, type PluginProps } from "../utils";
import { lineSettingsSchema } from "./settings";

const LineChart = dynamic(
() => import("@neoboard/components").then((m) => ({ default: m.LineChart })),
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function LinePluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
onChartClick,
colorThresholds,
}: PluginProps) {

Check warning on line 28 in app/src/plugins/line/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqrT2g4iBOapmpL&open=AZ1vowqrT2g4iBOapmpL&pullRequest=469
const onClick = useEChartsClick(onChartClick, data);
const settings = lineSettingsSchema.parse(raw);
// Parse comma-separated rightAxisSeries string into string array
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/line/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { linePlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
resolveValueKeys,
normalizeValue,
type ColumnMapping,
} from "./shared";
} from "../transforms/shared-utils";

/**
* Transform to line chart format: [{ x, series1, series2 }]
Expand Down
8 changes: 4 additions & 4 deletions app/src/plugins/map.tsx → app/src/plugins/map/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import dynamic from "next/dynamic";
import { getChartOptions } from "@neoboard/components";
import type { MapMarker, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToMapData, validateMapData } from "./transforms/map";
import { type PluginProps } from "./utils";
import { mapSettingsSchema } from "./settings/map";
import { defineChartPlugin } from "../registry";
import { transformToMapData, validateMapData } from "./transform";
import { type PluginProps } from "../utils";
import { mapSettingsSchema } from "./settings";

// Leaflet relies on window/document — must be loaded client-side only.
const MapChart = dynamic(
Expand All @@ -26,13 +26,13 @@
},
);

function MapPluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
onChartClick,
}: PluginProps) {

Check warning on line 35 in app/src/plugins/map/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowr1T2g4iBOapmpV&open=AZ1vowr1T2g4iBOapmpV&pullRequest=469
const markers = (data ?? []) as MapMarker[];
const settings = mapSettingsSchema.parse(raw);
return (
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/map/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { mapPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Map chart data transform and validator.
*/

import { toRecords } from "./shared";
import { toRecords } from "../transforms/shared-utils";

/**
* Transform to map format: extract lat/lon/label from records.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
*/

import { MarkdownWidget, getChartOptions } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { type PluginProps } from "./utils";
import { markdownSettingsSchema } from "./settings/markdown";
import { defineChartPlugin } from "../registry";
import { type PluginProps } from "../utils";
import { markdownSettingsSchema } from "./settings";

/**
* Component adapter — extracts the `content` field from settings and
* renders the MarkdownWidget. The plugin contract passes the full
* settings object to the component as `settings` prop.
*/
function MarkdownPluginComponent({ settings: raw }: PluginProps) {

Check warning on line 19 in app/src/plugins/markdown/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqWT2g4iBOapmpF&open=AZ1vowqWT2g4iBOapmpF&pullRequest=469
const settings = markdownSettingsSchema.parse(raw);
return <MarkdownWidget content={settings.content} />;
}
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/markdown/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { markdownPlugin } from "./component";
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
import { EmptyState, getChartOptions } from "@neoboard/components";
import { ParameterWidgetRenderer } from "@/components/parameter-widget-renderer";
import type { ParameterType } from "@/stores/parameter-store";
import { defineChartPlugin } from "./registry";
import { transformToSelectData } from "./transforms/parameter-select";
import { type PluginProps } from "./utils";
import { parameterSelectSettingsSchema } from "./settings/parameter-select";
import { defineChartPlugin } from "../registry";
import { transformToSelectData } from "./transform";
import { type PluginProps } from "../utils";
import { parameterSelectSettingsSchema } from "./settings";

function ParameterSelectPluginComponent({
settings: raw,
connectionId,
widgetId,
}: PluginProps) {

Check warning on line 22 in app/src/plugins/parameter-select/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowpzT2g4iBOapmo9&open=AZ1vowpzT2g4iBOapmo9&pullRequest=469
const settings = parameterSelectSettingsSchema.parse(raw);
if (!settings.parameterName) {
return (
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/parameter-select/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { parameterSelectPlugin } from "./component";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Parameter-select widget data transform.
*/

import { toRecords } from "./shared";
import { toRecords } from "../transforms/shared-utils";

/**
* Transform to select data: extract first column values as options array.
Expand Down
8 changes: 4 additions & 4 deletions app/src/plugins/pie.tsx → app/src/plugins/pie/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
import dynamic from "next/dynamic";
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { PieChartDataPoint, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToPieData, validatePieData } from "./transforms/pie";
import { useEChartsClick, type PluginProps } from "./utils";
import { pieSettingsSchema } from "./settings/pie";
import { defineChartPlugin } from "../registry";
import { transformToPieData, validatePieData } from "./transform";
import { useEChartsClick, type PluginProps } from "../utils";
import { pieSettingsSchema } from "./settings";

const PieChart = dynamic(
() => import("@neoboard/components").then((m) => ({ default: m.PieChart })),
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function PiePluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
onChartClick,
colorThresholds,
}: PluginProps) {

Check warning on line 28 in app/src/plugins/pie/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowiRT2g4iBOapmo6&open=AZ1vowiRT2g4iBOapmo6&pullRequest=469
const onClick = useEChartsClick(onChartClick, data);
const settings = pieSettingsSchema.parse(raw);
return (
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/pie/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { piePlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
resolveLabelKey,
normalizeValue,
type ColumnMapping,
} from "./shared";
} from "../transforms/shared-utils";

/**
* Transform to pie chart format: [{ name, value }]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
import dynamic from "next/dynamic";
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { RadarChartData, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToRadarData } from "./transforms/radar";
import { type PluginProps } from "./utils";
import { radarSettingsSchema } from "./settings/radar";
import { defineChartPlugin } from "../registry";
import { transformToRadarData } from "./transform";
import { type PluginProps } from "../utils";
import { radarSettingsSchema } from "./settings";

const RadarChart = dynamic(
() => import("@neoboard/components").then((m) => ({ default: m.RadarChart })),
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function RadarPluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
}: PluginProps) {

Check warning on line 26 in app/src/plugins/radar/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowqBT2g4iBOapmo_&open=AZ1vowqBT2g4iBOapmo_&pullRequest=469
const radarData = (data as RadarChartData) ?? {
indicators: [],
series: [],
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/radar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { radarPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Radar chart data transform.
*/

import { toRecords, normalizeValue } from "./shared";
import { toRecords, normalizeValue } from "../transforms/shared-utils";

/**
* Transform to Radar chart format: { indicators: [{ name, max }], series: [{ name, values }] }
Expand All @@ -10,7 +10,7 @@
* 1. Records with indicator/value/max columns (optionally a series/group column).
* 2. Flat tabular records where column names become indicators.
*/
export function transformToRadarData(data: unknown): unknown {

Check failure on line 13 in app/src/plugins/radar/transform.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowp6T2g4iBOapmo-&open=AZ1vowp6T2g4iBOapmo-&pullRequest=469
const records = toRecords(data);
if (!records.length) return { indicators: [], series: [] };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import dynamic from "next/dynamic";
import { Skeleton, getChartOptions } from "@neoboard/components";
import type { SankeyChartData, StylingRule } from "@neoboard/components";
import { defineChartPlugin } from "./registry";
import { transformToSankeyData } from "./transforms/sankey";
import { useEChartsClick, type PluginProps } from "./utils";
import { sankeySettingsSchema } from "./settings/sankey";
import { defineChartPlugin } from "../registry";
import { transformToSankeyData } from "./transform";
import { useEChartsClick, type PluginProps } from "../utils";
import { sankeySettingsSchema } from "./settings";

const SankeyChart = dynamic(
() =>
Expand All @@ -19,13 +19,13 @@
{ ssr: false, loading: () => <Skeleton className="w-full h-full" /> },
);

function SankeyPluginComponent({
data,
settings: raw,
stylingRules,
paramValues,
onChartClick,
}: PluginProps) {

Check warning on line 28 in app/src/plugins/sankey/component.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=alfredo1996_neoboard&issues=AZ1vowrgT2g4iBOapmpT&open=AZ1vowrgT2g4iBOapmpT&pullRequest=469
const onClick = useEChartsClick(onChartClick, data);
const settings = sankeySettingsSchema.parse(raw);
const sankeyData = (data as SankeyChartData) ?? { nodes: [], links: [] };
Expand Down
1 change: 1 addition & 0 deletions app/src/plugins/sankey/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { sankeyPlugin } from "./component";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Sankey chart data transform.
*/

import { toRecords, normalizeValue } from "./shared";
import { toRecords, normalizeValue } from "../transforms/shared-utils";

/**
* Transform to Sankey chart format: { nodes: [{ name }], links: [{ source, target, value }] }
Expand Down
34 changes: 17 additions & 17 deletions app/src/plugins/settings/__tests__/settings-schemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@

import { describe, it, expect } from "vitest";
import { ZodError } from "zod";
import { barSettingsSchema } from "../bar";
import { lineSettingsSchema } from "../line";
import { pieSettingsSchema } from "../pie";
import { gaugeSettingsSchema } from "../gauge";
import { radarSettingsSchema } from "../radar";
import { sankeySettingsSchema } from "../sankey";
import { sunburstSettingsSchema } from "../sunburst";
import { treemapSettingsSchema } from "../treemap";
import { singleValueSettingsSchema } from "../single-value";
import { tableSettingsSchema } from "../table";
import { jsonSettingsSchema } from "../json";
import { graphSettingsSchema } from "../graph";
import { mapSettingsSchema } from "../map";
import { markdownSettingsSchema } from "../markdown";
import { iframeSettingsSchema } from "../iframe";
import { formSettingsSchema } from "../form";
import { parameterSelectSettingsSchema } from "../parameter-select";
import { barSettingsSchema } from "../../bar/settings";
import { lineSettingsSchema } from "../../line/settings";
import { pieSettingsSchema } from "../../pie/settings";
import { gaugeSettingsSchema } from "../../gauge/settings";
import { radarSettingsSchema } from "../../radar/settings";
import { sankeySettingsSchema } from "../../sankey/settings";
import { sunburstSettingsSchema } from "../../sunburst/settings";
import { treemapSettingsSchema } from "../../treemap/settings";
import { singleValueSettingsSchema } from "../../single-value/settings";
import { tableSettingsSchema } from "../../table/settings";
import { jsonSettingsSchema } from "../../json/settings";
import { graphSettingsSchema } from "../../graph/settings";
import { mapSettingsSchema } from "../../map/settings";
import { markdownSettingsSchema } from "../../markdown/settings";
import { iframeSettingsSchema } from "../../iframe/settings";
import { formSettingsSchema } from "../../form/settings";
import { parameterSelectSettingsSchema } from "../../parameter-select/settings";

// ---------------------------------------------------------------------------
// Helper: all schemas in one place for shared tests
Expand Down
Loading
Loading