Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ updates:

- package-ecosystem: "npm"
directory: "/superset-frontend/plugins/plugin-chart-pivot-table/"
ignore:
# TODO: remove below entries until React >= 19.0.0
- dependency-name: "react-icons"
schedule:
interval: "daily"
labels:
Expand Down Expand Up @@ -189,6 +192,9 @@ updates:

- package-ecosystem: "npm"
directory: "/superset-frontend/plugins/plugin-chart-table/"
ignore:
# TODO: remove below entries until React >= 19.0.0
- dependency-name: "react-icons"
schedule:
interval: "daily"
labels:
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"remark-import-partial": "^0.0.2",
"reselect": "^5.1.1",
"storybook": "^8.6.17",
"swagger-ui-react": "^5.31.1",
"swagger-ui-react": "^5.31.2",
"swc-loader": "^0.2.7",
"tinycolor2": "^1.4.2",
"unist-util-visit": "^5.1.0"
Expand Down
557 changes: 288 additions & 269 deletions docs/yarn.lock

Large diffs are not rendered by default.

279 changes: 110 additions & 169 deletions superset-frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"lightningcss": "^1.31.1",
"mini-css-extract-plugin": "^2.10.0",
"open-cli": "^8.0.0",
"oxlint": "^1.48.0",
"oxlint": "^1.49.0",
"po2json": "^0.4.5",
"prettier": "3.8.1",
"prettier-plugin-packagejson": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4144,15 +4144,6 @@
"node": ">= 8"
}
},
"node_modules/@react-icons/all-files": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@react-icons/all-files/-/all-files-4.1.0.tgz",
"integrity": "sha512-hxBI2UOuVaI3O/BhQfhtb4kcGn9ft12RWAFVMUeNjqqhLsHvFtzIkFaptBJpFDANTKoDfdVoHTKZDlwKCACbMQ==",
"peer": true,
"peerDependencies": {
"react": "*"
}
},
"node_modules/@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
Expand Down Expand Up @@ -4186,7 +4177,6 @@
"integrity": "sha512-zi2DJ2cTpgR1HugPX3yBHJAaBo7XYhodgZqj0BsKNMoexrLvHyPYsN+cw5xXFE1Q1ZyeKtQBB5m41+CKKfwQYw==",
"peer": true,
"dependencies": {
"@react-icons/all-files": "^4.1.0",
"@superset-ui/core": "0.18.25",
"lodash": "^4.17.15",
"prop-types": "^15.7.2"
Expand Down Expand Up @@ -21330,13 +21320,6 @@
"fastq": "^1.6.0"
}
},
"@react-icons/all-files": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@react-icons/all-files/-/all-files-4.1.0.tgz",
"integrity": "sha512-hxBI2UOuVaI3O/BhQfhtb4kcGn9ft12RWAFVMUeNjqqhLsHvFtzIkFaptBJpFDANTKoDfdVoHTKZDlwKCACbMQ==",
"peer": true,
"requires": {}
},
"@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
Expand Down Expand Up @@ -21367,7 +21350,6 @@
"integrity": "sha512-zi2DJ2cTpgR1HugPX3yBHJAaBo7XYhodgZqj0BsKNMoexrLvHyPYsN+cw5xXFE1Q1ZyeKtQBB5m41+CKKfwQYw==",
"peer": true,
"requires": {
"@react-icons/all-files": "^4.1.0",
"@superset-ui/core": "0.18.25",
"lodash": "^4.17.15",
"prop-types": "^15.7.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export function getFontSize(theme: SupersetTheme, size?: FontSizeKey): string {
return String(theme[key] || theme.fontSize);
}

/**
* Check if the current theme is dark mode based on background color
* @param theme - Theme tokens from useTheme()
* @returns true if theme is dark, false if light
*/
export function isThemeDark(theme: SupersetTheme): boolean {
return tinycolor(theme.colorBgContainer).isDark();
}

/**
* Get color variants for a given color type from theme tokens
* @param theme - Theme tokens from useTheme()
Expand Down Expand Up @@ -111,15 +120,6 @@ export function getColorVariants(
};
}

/**
* Check if the current theme is dark mode based on background color
* @param theme - Theme tokens from useTheme()
* @returns true if theme is dark, false if light
*/
export function isThemeDark(theme: SupersetTheme): boolean {
return tinycolor(theme.colorBgContainer).isDark();
}

/**
* Check if a theme configuration results in a dark theme
* @param config - The theme configuration to check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
],
"dependencies": {
"@apache-superset/core": "*",
"@react-icons/all-files": "^4.1.0",
"@types/react": "*",
"lodash": "^4.17.23"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,33 @@ export type DashboardComponentMetadata = {
dataMask: DataMaskStateWithId;
};

export interface LegacyChartCustomizationDataset {
value: number | string;
label: string;
table_name?: string;
}

export interface LegacyChartCustomizationConfig {
name: string;
dataset: string | number | LegacyChartCustomizationDataset | null;
column: string | string[] | null;
sortAscending?: boolean;
sortMetric?: string;
canSelectMultiple?: boolean;
defaultDataMask?: DataMask;
controlValues?: {
enableEmptyFilter?: boolean;
[key: string]: any;
};
description?: string;
}

export interface LegacyChartCustomizationItem {
id: string;
title?: string;
removed?: boolean;
chartId?: number;
customization: LegacyChartCustomizationConfig;
}

export default {};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
// @ts-nocheck
/* eslint no-use-before-define: ["error", { "functions": false }] */
/* oxlint-disable no-use-before-define: ["error", { "functions": false }] */
/* eslint-disable no-restricted-syntax */
/* eslint-disable react/sort-prop-types */
import d3 from 'd3';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"lib"
],
"dependencies": {
"@react-icons/all-files": "^4.1.0",
"@types/d3-array": "^3.2.2",
"@types/react-table": "^7.7.20",
"classnames": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ const CustomPopover: React.FC<Props> = ({
const triggerRef = useRef<HTMLDivElement>(null);
const popoverRef = useRef<HTMLDivElement>(null);

const handleClickOutside = (event: MouseEvent) => {
if (
popoverRef.current &&
!popoverRef.current.contains(event.target as Node) &&
!triggerRef.current?.contains(event.target as Node)
) {
onClose();
}
};

useEffect(() => {
const updatePosition = () => {
const rect = triggerRef.current?.getBoundingClientRect();
Expand Down Expand Up @@ -73,16 +83,6 @@ const CustomPopover: React.FC<Props> = ({
};
}, [isOpen]);

const handleClickOutside = (event: MouseEvent) => {
if (
popoverRef.current &&
!popoverRef.current.contains(event.target as Node) &&
!triggerRef.current?.contains(event.target as Node)
) {
onClose();
}
};

return (
<PopoverWrapper>
{cloneElement(children, { ref: triggerRef })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,47 @@ function formatValueForOperator(
return value;
}

/**
* Format a date string to ISO format expected by Superset, preserving local timezone
*/
export function formatDateForSuperset(dateStr: string): string {
// AG Grid typically provides dates in format: "YYYY-MM-DD HH:MM:SS"
// Superset expects: "YYYY-MM-DDTHH:MM:SS" in local timezone (not UTC)
const date = new Date(dateStr);
if (Number.isNaN(date.getTime())) {
return dateStr; // Return as-is if invalid
}

// Format date in local timezone, not UTC
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');

const formatted = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
return formatted;
}

/**
* Get the start of day (00:00:00) for a given date string
*/
export function getStartOfDay(dateStr: string): string {
const date = new Date(dateStr);
date.setHours(0, 0, 0, 0);
return formatDateForSuperset(date.toISOString());
}

/**
* Get the end of day (23:59:59) for a given date string
*/
export function getEndOfDay(dateStr: string): string {
const date = new Date(dateStr);
date.setHours(23, 59, 59, 999);
return formatDateForSuperset(date.toISOString());
}

/**
* Convert a date filter to a WHERE clause
* @param columnName - Column name
Expand Down Expand Up @@ -418,47 +459,6 @@ function compoundFilterToWhereClause(
return result;
}

/**
* Format a date string to ISO format expected by Superset, preserving local timezone
*/
export function formatDateForSuperset(dateStr: string): string {
// AG Grid typically provides dates in format: "YYYY-MM-DD HH:MM:SS"
// Superset expects: "YYYY-MM-DDTHH:MM:SS" in local timezone (not UTC)
const date = new Date(dateStr);
if (Number.isNaN(date.getTime())) {
return dateStr; // Return as-is if invalid
}

// Format date in local timezone, not UTC
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');

const formatted = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
return formatted;
}

/**
* Get the start of day (00:00:00) for a given date string
*/
export function getStartOfDay(dateStr: string): string {
const date = new Date(dateStr);
date.setHours(0, 0, 0, 0);
return formatDateForSuperset(date.toISOString());
}

/**
* Get the end of day (23:59:59) for a given date string
*/
export function getEndOfDay(dateStr: string): string {
const date = new Date(dateStr);
date.setHours(23, 59, 59, 999);
return formatDateForSuperset(date.toISOString());
}

// Converts date filters to TEMPORAL_RANGE format for Superset backend
function convertDateFilter(
columnName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ function getYAxisFormatter(
return yAxis.axisLabel!.formatter!;
}

const queriesData: ChartDataResponseResult[] = [
createTestQueryData(
createTestData(
[
{ 'San Francisco': 1, 'New York': 2 },
{ 'San Francisco': 3, 'New York': 4 },
],
{ intervalMs: 300000000 },
),
),
];

/**
* Creates a properly typed EchartsTimeseriesChartProps for testing.
* Uses shared createEchartsTimeseriesTestChartProps with Timeseries defaults.
Expand Down Expand Up @@ -128,17 +140,7 @@ const formData: SqlaFormData = {
groupby: ['foo', 'bar'],
viz_type: 'my_viz',
};
const queriesData: ChartDataResponseResult[] = [
createTestQueryData(
createTestData(
[
{ 'San Francisco': 1, 'New York': 2 },
{ 'San Francisco': 3, 'New York': 4 },
],
{ intervalMs: 300000000 },
),
),
];

describe('EchartsTimeseries transformProps', () => {
test('should transform chart props for viz', () => {
const chartProps = createTestChartProps({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"access": "public"
},
"peerDependencies": {
"@react-icons/all-files": "^4.1.0",
"react-icons": "5.4.0",
"@apache-superset/core": "*",
"@ant-design/icons": "^5.2.6",
"@superset-ui/chart-controls": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { Component, ReactNode, MouseEvent } from 'react';
import { safeHtmlSpan } from '@superset-ui/core';
import { t } from '@apache-superset/core/ui';
import PropTypes from 'prop-types';
import { FaSort } from '@react-icons/all-files/fa/FaSort';
import { FaSortDown as FaSortDesc } from '@react-icons/all-files/fa/FaSortDown';
import { FaSortUp as FaSortAsc } from '@react-icons/all-files/fa/FaSortUp';
import { FaSort } from 'react-icons/fa';
import { FaSortDown as FaSortDesc } from 'react-icons/fa';
import { FaSortUp as FaSortAsc } from 'react-icons/fa';
import { PivotData, flatKey } from './utilities';
import { Styles } from './Styles';

Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/plugins/plugin-chart-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"lib"
],
"dependencies": {
"@react-icons/all-files": "^4.1.0",
"react-icons": "5.4.0",
"@types/d3-array": "^3.2.2",
"@types/react-table": "^7.7.20",
"classnames": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import {
Row,
} from 'react-table';
import { extent as d3Extent, max as d3Max } from 'd3-array';
import { FaSort } from '@react-icons/all-files/fa/FaSort';
import { FaSortDown as FaSortDesc } from '@react-icons/all-files/fa/FaSortDown';
import { FaSortUp as FaSortAsc } from '@react-icons/all-files/fa/FaSortUp';
import { FaSort } from 'react-icons/fa';
import { FaSortDown as FaSortDesc } from 'react-icons/fa';
import { FaSortUp as FaSortAsc } from 'react-icons/fa';
import cx from 'classnames';
import {
DataRecord,
Expand Down
Loading
Loading