Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explore): hide advanced analytics for non temporal xaxis #28312

Conversation

justinpark
Copy link
Member

SUMMARY

The superset feature allows users to choose a non-temporal column for the x-axis.
However, when a non-temporal column is selected, advanced analytics and forecast options are not compatible.

In order to address this, UI should dynamically hide these features when a non-temporal column is selected.
This commit introduces the visibility option in the ControlPanelSectionConfig, enabling the hiding of specific groups of controlSets.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

before--hide-non-temporal.mov

After:

after--hide-non-temporal.mov

TESTING INSTRUCTIONS

Choose non-temporal column in x-axis option
Verify that "Advanced analytics" and "Predictive Analytics" sections are hidden

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@justinpark justinpark changed the title Fix explore hide advanced analytics for non temporal xaxis fix(explore): hide advanced analytics for non temporal xaxis May 2, 2024
Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @justinpark. I left some first-pass comments.

import { isAdhocColumn, isPhysicalColumn } from '@superset-ui/core';
import type { ColumnMeta, ControlPanelsContainerProps } from '../types';

export default function showIfTimeSeries({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to showTimeRelatedControls?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-s-molina to clarify and specify the functionality, i'm thinking of use displayWhenTimeRelatedControls.
What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

displayTimeRelatedControls (without when) works too.

},
};

describe('showIfTimeSeries', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you avoid describe?

controlPanelSections: [
{
label: t('Advanced analytics'),
description: t('Advanced analytical post processin'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: t('Advanced analytical post processin'),
description: t('Advanced analytics post processing'),

@@ -144,4 +144,41 @@ describe('ControlPanelsContainer', () => {
await screen.findAllByTestId('collapsible-control-panel-header'),
).toHaveLength(2);
});

test('hide ControlPanelSections when its visibility is false', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're also testing if the panel is displayed when the visibility is true.

Suggested change
test('hide ControlPanelSections when its visibility is false', async () => {
test('visibility of panels is correctly applied', async () => {

@justinpark justinpark force-pushed the fix--explore-hide-advanced-analytics-for-non-temporal-xaxis branch from d5e2c33 to 24da739 Compare May 2, 2024 17:16
@michael-s-molina
Copy link
Member

@justinpark Can you also make sure to ignore or remove the values from the form data in case a user starts with a temporal column, fills the advanced properties and later changes to a categorial x-axis?

@pull-request-size pull-request-size bot added size/XL and removed size/L labels May 7, 2024
@justinpark justinpark force-pushed the fix--explore-hide-advanced-analytics-for-non-temporal-xaxis branch from 800e989 to f1278a8 Compare May 7, 2024 23:23
@justinpark
Copy link
Member Author

@justinpark Can you also make sure to ignore or remove the values from the form data in case a user starts with a temporal column, fills the advanced properties and later changes to a categorial x-axis?

Done

@justinpark justinpark force-pushed the fix--explore-hide-advanced-analytics-for-non-temporal-xaxis branch from f1278a8 to c213433 Compare May 8, 2024 16:25
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 8, 2024
@michael-s-molina michael-s-molina merged commit 07cd1d8 into apache:master May 8, 2024
29 checks passed
@michael-s-molina michael-s-molina added the v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch label May 8, 2024
michael-s-molina pushed a commit that referenced this pull request May 8, 2024
imancrsrk pushed a commit to imancrsrk/superset that referenced this pull request May 10, 2024
jzhao62 pushed a commit to jzhao62/superset that referenced this pull request May 16, 2024
...form_data,
...restoredField,
},
hiddenFormData,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit too late, but I guess there should be omit(hiddenFormData, fieldNames), otherwise it seems to break any field that was hidden once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer packages size/XL v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants