Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
d34773b
ID: 108; DONE: 40; HOURS: 1; remove-force-refresh-flag
Sep 1, 2025
068d416
ID: ZEN-108; DONE: 40; HOURS: 1; dashboard-no-header
Sep 1, 2025
68ea619
Merge pull request #6 from gofynd/remove-force-refresh
pranav-mahadik Sep 1, 2025
e330b88
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number
Sep 1, 2025
1ec4971
Merge pull request #7 from gofynd/time-comparision
pranav-mahadik Sep 1, 2025
cd7da3c
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
fc493de
Merge pull request #8 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
3ddb153
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
e80372e
Merge pull request #9 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
08d8ced
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
62e14bd
Merge pull request #10 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
7257ae5
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
a498fd2
Merge pull request #11 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
13142a8
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
3b7915e
Merge pull request #12 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
bfab88e
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
b3d99dd
Merge pull request #13 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
b0ed50c
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
4fb96b6
Merge pull request #14 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
722d5e3
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
f734cae
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 2, 2025
d4f1a94
Merge pull request #15 from gofynd/time-comparision
pranav-mahadik Sep 2, 2025
a2979c0
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 3, 2025
4277f48
Merge pull request #16 from gofynd/time-comparision
MarkTFKOP Sep 3, 2025
a1fb727
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 3, 2025
fb5af14
Merge pull request #18 from gofynd/time-comparision
pranav-mahadik Sep 3, 2025
9c05e01
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 3, 2025
909aec9
Merge pull request #19 from gofynd/time-comparision
pranav-mahadik Sep 3, 2025
4d53858
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 3, 2025
d2b309c
Merge pull request #20 from gofynd/time-comparision
pranav-mahadik Sep 3, 2025
74b87bd
ID: ZEN-108; DONE: 40; HOURS: 1; time-comparision-big-number-debug
Sep 3, 2025
0a80d5a
Merge pull request #21 from gofynd/time-comparision
pranav-mahadik Sep 3, 2025
1799569
ID: ZEN-108; DONE: 40; HOURS: 1; color-range
Sep 3, 2025
50a3153
Merge pull request #22 from gofynd/color-range
pranav-mahadik Sep 3, 2025
e4e3635
ID: ZEN-108; DONE: 40; HOURS: 1; color-range
Sep 3, 2025
d32cb05
Merge pull request #23 from gofynd/color-range
pranav-mahadik Sep 3, 2025
2abd0d7
ID: ZEN-108; DONE: 40; HOURS: 1; color-range
Sep 4, 2025
e475d16
Merge pull request #24 from gofynd/time-comparision
MarkTFKOP Sep 4, 2025
ba1051e
ID: ZEN-108; DONE: 40; HOURS: 1; color-range
Sep 4, 2025
696cae8
Merge pull request #25 from gofynd/time-comparision
pranav-mahadik Sep 4, 2025
6142cba
Revert "ID: ZEN-108; DONE: 40; HOURS: 1; color-range"
MarkTFKOP Sep 4, 2025
bc7f696
Merge pull request #26 from gofynd/revert-23-color-range
pranav-mahadik Sep 4, 2025
c6d320b
Revert "ID: ZEN-108; DONE: 40; HOURS: 1; color-range"
MarkTFKOP Sep 4, 2025
e8891a5
Merge pull request #27 from gofynd/revert-22-color-range
pranav-mahadik Sep 4, 2025
3419ac7
ZEN-138: ADD CLASSNAMES to AISUMMARY
MarkTFKOP Sep 4, 2025
efaf0ae
ZEN-138: FULLSCREEN lofic
MarkTFKOP Sep 4, 2025
2402ffa
Merge pull request #28 from gofynd/ZEN-138-classname-ai-summary
pranav-mahadik Sep 4, 2025
414fc13
Merge pull request #29 from gofynd/ZEN-138-edit-css-fullscreen
pranav-mahadik Sep 4, 2025
4914107
ZEN-138: -
MarkTFKOP Sep 4, 2025
8dc39c2
Merge pull request #30 from gofynd/ZEN-138-edit-css-fullscreen
MarkTFKOP Sep 4, 2025
48b9404
ZEN-138: change the bg color of edit CSS dropdown
MarkTFKOP Sep 4, 2025
19cd0cc
Merge pull request #31 from gofynd/ZEN-138-edit-css-fullscreen
MarkTFKOP Sep 4, 2025
66c636b
ZEN-138: merge latest main branch
MarkTFKOP Sep 8, 2025
9d5fe8c
ZEN-138: chart shimmer width fix
MarkTFKOP Sep 8, 2025
86d8102
FIX: DROPDOWN
MarkTFKOP Sep 9, 2025
d0179e7
FIX: Dashboard listing UX
MarkTFKOP Sep 9, 2025
83c76bd
FIX: settings dropdown stylings
MarkTFKOP Sep 9, 2025
c99fef9
ZEN-138: settings dropdown and thumbnai radio button
MarkTFKOP Sep 10, 2025
bbb52f1
ZEN-138: fix settings dropdown styles
MarkTFKOP Sep 10, 2025
77d54f2
ZEN-138: FIX build dues to controlPanel.ts
MarkTFKOP Sep 10, 2025
af60f81
ZEN-138: update grid-template-columns of CardContainer
MarkTFKOP Sep 10, 2025
419beaf
ZEN-138: some new UI changes
MarkTFKOP Sep 10, 2025
9469939
ZEN-138: update the chart error message styles and the nav bar titles
MarkTFKOP Sep 10, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ describe('No Results', () => {

cy.visitChartByParams(formData);
cy.wait('@v1Data').its('response.statusCode').should('eq', 200);
cy.get('div.chart-container').contains(
'No data',
);
cy.get('div.chart-container').contains('No data');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum FeatureFlag {
EmbeddableCharts = 'EMBEDDABLE_CHARTS',
EmbeddedSuperset = 'EMBEDDED_SUPERSET',
EnableAdvancedDataTypes = 'ENABLE_ADVANCED_DATA_TYPES',
EnableChartForceRefresh = 'ENABLE_CHART_FORCE_REFRESH',
/** @deprecated */
EnableJavascriptControls = 'ENABLE_JAVASCRIPT_CONTROLS',
EnableTemplateProcessing = 'ENABLE_TEMPLATE_PROCESSING',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,183 @@
*/
import { buildQueryContext, QueryFormData } from '@superset-ui/core';

/**
* Detect time period from time range string
* Examples: "Last 7 days" -> "7 days ago", "Last 1 month" -> "1 month ago"
*/
function detectTimePeriod(timeRange: string): string | null {
const match = timeRange.match(/last\s+(\d+)\s+(day|week|month|year)s?/i);
if (match) {
const value = parseInt(match[1], 10);
const unit = match[2].toLowerCase();
// Handle singular vs plural
const singularUnit = value === 1 ? unit : `${unit}s`;
return `${value} ${singularUnit} ago`;
}

// Handle special cases
const lowerTimeRange = timeRange.toLowerCase();
if (lowerTimeRange.includes('this week')) return '1 week ago';
if (lowerTimeRange.includes('this month')) return '1 month ago';
if (lowerTimeRange.includes('this year')) return '1 year ago';

return null;
}

/**
* Calculate time period from since/until dates
* Example: since="2023-08-23", until="2023-08-26" -> "4 days ago"
*/
function calculatePeriodFromDates(since: string, until: string): string | null {
try {
const sinceDate = new Date(since);
const untilDate = new Date(until);
const diffTime = Math.abs(untilDate.getTime() - sinceDate.getTime());
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both dates

if (diffDays === 1) return '1 day ago';
if (diffDays < 7) return `${diffDays} days ago`;
if (diffDays < 30) {
const weeks = Math.floor(diffDays / 7);
return weeks === 1 ? '1 week ago' : `${weeks} weeks ago`;
}
if (diffDays < 365) {
const months = Math.floor(diffDays / 30);
return months === 1 ? '1 month ago' : `${months} months ago`;
}
const years = Math.floor(diffDays / 365);
return years === 1 ? '1 year ago' : `${years} years ago`;
} catch (error) {
console.warn('Error calculating period from dates:', error);
return null;
}
}

export default function buildQuery(formData: QueryFormData) {
return buildQueryContext(formData, baseQueryObject => [baseQueryObject]);
// Debug logging for buildQuery
console.group('🔧 BigNumberTotal buildQuery - COMPREHENSIVE DEBUG');
console.log('📥 Input formData analysis:', {
hasExtraFormData: !!formData.extra_form_data,
extraFormData: formData.extra_form_data,
customFormData: formData.extra_form_data?.custom_form_data,
timeCompare: formData.time_compare,
timeCompareType: typeof formData.time_compare,
timeCompareExtra: (formData.extra_form_data?.custom_form_data as any)
?.time_compare,
timeCompareDirect: (formData.extra_form_data as any)?.time_compare,
allFormDataKeys: Object.keys(formData),
metrics: formData.metrics,
datasource: formData.datasource,
timeRange: formData.time_range,
since: formData.since,
until: formData.until,
});
console.groupEnd();

const buildQuery = (baseQueryObject: any) => {
console.log(
'BigNumberTotal buildQuery - baseQueryObject:',
baseQueryObject,
);

// Use the proper Superset single-query approach for time comparison
// This ensures that formData.time_compare is preserved and passed to transformProps
const time_offsets = (() => {
const timeCompare =
formData.time_compare ||
(formData.extra_form_data as any)?.time_compare;

// Convert string time comparison to array format for transformProps
if (timeCompare && timeCompare !== 'NoComparison') {
if (timeCompare === 'inherit') {
// Enhanced inherit logic: detect actual time period and apply same offset
const timeRange = formData.time_range;
const { since } = formData;
const { until } = formData;

console.log('BigNumberTotal buildQuery - Inherit logic analysis:', {
timeRange,
since,
until,
hasTimeRange: !!timeRange,
hasSinceUntil: !!(since && until),
});

if (timeRange && typeof timeRange === 'string') {
// Parse time range string to detect period
const period = detectTimePeriod(timeRange);
if (period) {
console.log(
'BigNumberTotal buildQuery - Detected period from timeRange:',
period,
);
return [period];
}
}

if (since && until) {
// Calculate period from since/until dates
const period = calculatePeriodFromDates(since, until);
if (period) {
console.log(
'BigNumberTotal buildQuery - Calculated period from dates:',
period,
);
return [period];
}
}

// Fallback to default
console.log(
'BigNumberTotal buildQuery - Using fallback period: 1 day ago',
);
return ['1 day ago'];
}
if (timeCompare === 'custom') {
// For custom, use the time_compare_value
const customValue =
formData.time_compare_value ||
(formData.extra_form_data as any)?.time_compare_value;
return customValue ? [customValue] : [];
}
// For direct string values like "1 day ago", "1 week ago", etc.
return Array.isArray(timeCompare) ? timeCompare : [timeCompare];
}
return [];
})();

return [
{
...baseQueryObject,
...(time_offsets.length > 0 ? { time_offsets } : {}),
},
];
};

// Ensure time_compare is preserved on the root formData object
const timeCompare =
formData.time_compare || (formData.extra_form_data as any)?.time_compare;

if (timeCompare && !formData.time_compare) {
// eslint-disable-next-line no-param-reassign
formData.time_compare = timeCompare;
console.log(
'BigNumberTotal buildQuery - Setting time_compare on root formData:',
timeCompare,
);
}

const result = buildQueryContext(formData, buildQuery);
console.log(
'BigNumberTotal buildQuery - Final result from buildQueryContext:',
{
result,
hasQueries: !!result.queries,
queriesLength: result.queries?.length,
formData: result.form_data,
timeCompare: result.form_data?.time_compare,
},
);

return result;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import {
D3_TIME_FORMAT_OPTIONS,
Dataset,
getStandardizedControls,
sections,
} from '@superset-ui/chart-controls';

import { headerFontSize, subheaderFontSize } from '../sharedControls';

export default {
Expand Down Expand Up @@ -57,7 +59,9 @@ export default {
type: 'HiddenControl',
label: t('URL parameters'),
hidden: true,
description: t('Extra parameters for use in jinja templated queries'),
description: t(
'Extra parameters for use in jinja templated queries',
),
},
},
],
Expand All @@ -70,6 +74,7 @@ export default {
expanded: true,
controlSetRows: [['metric'], ['adhoc_filters']],
},
sections.timeComparisonControls({ multi: false }),
{
label: t('Display settings'),
expanded: true,
Expand Down
Loading
Loading