chore(deps-dev): bump oxlint from 1.48.0 to 1.49.0 in /superset-frontend (#38115)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
dependabot[bot]
2026-02-20 14:13:37 -08:00
committed by GitHub
parent 44d6b6a513
commit cff854b06e
14 changed files with 248 additions and 245 deletions

View File

@@ -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';

View File

@@ -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();
@@ -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 })}

View File

@@ -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
@@ -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,

View File

@@ -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.
@@ -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({});

View File

@@ -569,6 +569,29 @@ const transformProps = (
return { arrow, arrowColor, backgroundColor };
};
const nonCustomNorInheritShifts = ensureIsArray(formData.time_compare).filter(
(shift: string) => shift !== 'custom' && shift !== 'inherit',
);
const customOrInheritShifts = ensureIsArray(formData.time_compare).filter(
(shift: string) => shift === 'custom' || shift === 'inherit',
);
let timeOffsets: string[] = [];
if (isUsingTimeComparison && !isEmpty(nonCustomNorInheritShifts)) {
timeOffsets = nonCustomNorInheritShifts;
}
// Shifts for custom or inherit time comparison
if (isUsingTimeComparison && !isEmpty(customOrInheritShifts)) {
if (customOrInheritShifts.includes('custom')) {
timeOffsets = timeOffsets.concat([formData.start_date_offset]);
}
if (customOrInheritShifts.includes('inherit')) {
timeOffsets = timeOffsets.concat(['inherit']);
}
}
const getBasicColorFormatter = memoizeOne(function getBasicColorFormatter(
originalData: DataRecord[] | undefined,
originalColumns: DataColumnMeta[],
@@ -653,28 +676,6 @@ const transformProps = (
const timeGrain = extractTimegrain(formData);
const nonCustomNorInheritShifts = ensureIsArray(formData.time_compare).filter(
(shift: string) => shift !== 'custom' && shift !== 'inherit',
);
const customOrInheritShifts = ensureIsArray(formData.time_compare).filter(
(shift: string) => shift === 'custom' || shift === 'inherit',
);
let timeOffsets: string[] = [];
if (isUsingTimeComparison && !isEmpty(nonCustomNorInheritShifts)) {
timeOffsets = nonCustomNorInheritShifts;
}
// Shifts for custom or inherit time comparison
if (isUsingTimeComparison && !isEmpty(customOrInheritShifts)) {
if (customOrInheritShifts.includes('custom')) {
timeOffsets = timeOffsets.concat([formData.start_date_offset]);
}
if (customOrInheritShifts.includes('inherit')) {
timeOffsets = timeOffsets.concat(['inherit']);
}
}
const comparisonSuffix = isUsingTimeComparison
? ensureIsArray(timeOffsets)[0]
: '';