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: [MIQ-2130] Fix big chart by adding LIMIT to control panel #265

Merged
merged 4 commits into from
Mar 9, 2020

Conversation

shmsr
Copy link

@shmsr shmsr commented Nov 4, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

Add LIMIT selector in the control panel for BigChart and BigChartTotal charts.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

> Previously limit 50000 was automatically added to the query
> Now the automatic addition of limit in the query is not allowed
Copy link

@arpit-agarwal arpit-agarwal left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@arpit-agarwal arpit-agarwal left a comment

Choose a reason for hiding this comment

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

Good thought but we would like it to be configurable

superset/viz.py Outdated
@@ -1097,6 +1097,7 @@ def query_obj(self):
raise Exception(_('Pick a metric!'))
d['metrics'] = [self.form_data.get('metric')]
self.form_data['metric'] = metric
d['row_limit'] = None

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the references, it helped a lot.

On selection of "-1", LIMIT is removed from the query. I dropped the idea of "None" as the options are getting validated if they are an integer or not; hence raises an error if "None" is there in options.

@shmsr shmsr changed the title Fix: [MIQ-2130] Fix big chart query Fix: [MIQ-2130] Fix big chart by adding LIMIT to control panel Nov 4, 2019
@@ -95,7 +95,7 @@ const D3_PERCENT_FORMAT_OPTIONS = [
['.3%', '.3% (12345.432 => 1234543.200%)'],
];

const ROW_LIMIT_OPTIONS = [10, 50, 100, 250, 500, 1000, 5000, 10000, 50000];
const ROW_LIMIT_OPTIONS = [-1, 10, 50, 100, 250, 500, 1000, 5000, 10000, 50000];

Choose a reason for hiding this comment

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

As we are not adding handling of -1 in all widgets. we should not modify this array. Instead override options in visTypes.jsx. the possible way to do is as follow around Line 1422

 controlOverrides: {
      y_axis_format: {
        label: t('Number format'),
      },
      row_limit: {
       default: -1,
       choices:  formatSelectOptions([-1, ...ROW_LIMIT_OPTIONS]
     }
    }

... is js syntax to expand array in-place

Copy link

@jitendra-kumawat jitendra-kumawat left a comment

Choose a reason for hiding this comment

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

LGTM

@jitendra-kumawat jitendra-kumawat merged commit 280977e into master Mar 9, 2020
@jitendra-kumawat jitendra-kumawat deleted the fix/MIQ-2130-fix-big-chart-query branch March 9, 2020 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants