This is an automated email from the ASF dual-hosted git repository.

arivero pushed a commit to branch table-time-comparison
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/table-time-comparison by this 
push:
     new 3b046b0636 Table with Time Comparison:
3b046b0636 is described below

commit 3b046b06364ef923ef885f9cb3c79443a27b3b9e
Author: Antonio Rivero <[email protected]>
AuthorDate: Wed Apr 17 01:15:01 2024 +0200

    Table with Time Comparison:
    
    - Handle initial loaded of the label when nothing is selected yet by using 
inherited (the default)
    - The time range is not clearable
---
 superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx   | 1 +
 .../src/explore/components/controls/ComparisonRangeLabel.tsx        | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx 
b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
index c36310d48a..802dddb1b4 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
@@ -334,6 +334,7 @@ const config: ControlPanelConfig = {
                 Boolean(controls?.enable_time_comparison?.value) &&
                 isFeatureEnabled(FeatureFlag.ChartPluginsExperimental) &&
                 isAggMode({ controls }),
+              clearable: false,
             },
           },
         ],
diff --git 
a/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx 
b/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx
index a3f9993826..ccb8dd4d0c 100644
--- a/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx
+++ b/superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx
@@ -75,7 +75,11 @@ export const ComparisonRangeLabel = () => {
   useEffect(() => {
     if (shift !== ComparisonTimeRangeType.Custom) {
       const promises = currentTimeRangeFilters.map(filter =>
-        fetchTimeRange(filter.comparator, filter.subject, shift),
+        fetchTimeRange(
+          filter.comparator,
+          filter.subject,
+          shift || ComparisonTimeRangeType.InheritedRange,
+        ),
       );
       Promise.all(promises).then(res => {
         setLabels(res.map(r => r.value ?? ''));

Reply via email to