bito-code-review[bot] commented on code in PR #42792:
URL: https://github.com/apache/superset/pull/42792#discussion_r3803366149
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -363,6 +390,65 @@ export default function EchartsTimeseries({
[selectedValues, xAxis.label],
);
+ const getTimeAxisCrossFilterDataMask = useCallback(
+ (clickedTimestamp: number) => {
+ const filterColumn =
+ xAxis.label === DTTM_ALIAS ? formData.granularitySqla : xAxis.label;
+ const grain = resolvedTimeGrain as TimeGranularity | undefined;
+
+ if (!filterColumn || !grain) {
+ return {
+ dataMask: {
+ extraFormData: {
+ filters: [],
+ },
+ filterState: {
+ label: undefined,
+ value: null,
+ selectedValues: null,
+ },
+ },
+ isCurrentValueSelected: false,
+ };
+ }
+
+ const [start, inclusiveEnd] = createTimeRangeFromGranularity(
+ new Date(clickedTimestamp),
+ grain,
+ false,
+ );
+ const exclusiveEnd = new Date(inclusiveEnd.getTime() + 1);
+ const timeRange = `${formatDateTime(start)} :
${formatDateTime(exclusiveEnd)}`;
+ const selected: string[] = Object.values(selectedValues);
+ const isCurrentValueSelected = selected.includes(timeRange);
+ const values = isCurrentValueSelected ? [] : [timeRange];
+
+ return {
+ dataMask: {
+ extraFormData: {
+ filters:
+ values.length === 0
+ ? []
+ : [
+ {
+ col: filterColumn,
+ op: 'TEMPORAL_RANGE' as const,
+ val: timeRange,
+ },
+ ],
+ },
+ filterState: {
+ label: values.length ? values : undefined,
+ value: values.length ? values : null,
+ selectedValues: values.length ? values : null,
+ },
+ },
+ isCurrentValueSelected,
+ };
+ },
+ [formData.granularitySqla, resolvedTimeGrain, selectedValues, xAxis.label],
+ );
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing unit test coverage</b></div>
<div id="fix">
BITO.md [6262] requires tests to verify actual business logic, not just
component rendering. New cross-filtering logic has zero test coverage despite
containing critical behavior.
</div>
</div>
<small><i>Code Review Run #6c0bd2</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]