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

[FilterBox] dashboard date range filtering #1165

Merged
merged 2 commits into from
Sep 22, 2016

Conversation

mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented Sep 21, 2016

Adding functionality to FilterBox that allows setting global, dynamic time filters on dashboards that apply to all widgets (except the ones set to be immune to filtering).

screen shot 2016-09-21 at 2 28 40 pm

fixes #894 #893 #665

@@ -58,7 +58,7 @@ const px = function () {
const containerId = data.token + '_con';
const selector = '#' + containerId;
const container = $(selector);
const sliceId = data.sliceId;
const sliceId = data.slice_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

/facepalm

Copy link
Member Author

Choose a reason for hiding this comment

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

that's the last one!

Copy link
Contributor

Choose a reason for hiding this comment

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

🎉


const propTypes = {
origSelectedValues: React.PropTypes.object,
filtersChoices: React.PropTypes.object,
Copy link
Contributor

@ascott ascott Sep 22, 2016

Choose a reason for hiding this comment

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

is this a required prop? if so we should mark it isRequired

Copy link
Member Author

Choose a reason for hiding this comment

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

it's not required, I added a default value for it

@@ -10,22 +10,80 @@ import '../stylesheets/react-select/select.less';

import './filter_box.css';

const TIME_CHOICES = [
Copy link
Contributor

Choose a reason for hiding this comment

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

could we put these in a constants.js file to be shared across the app?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm putting the constants.js in viz folder to try to keep that contained somewhat

onChange: () => {},
showDateFilter: false,
};

class FilterBox extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

i think this component should be in it's own file in the components directory, and imported for use in this visualization file.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to keep all of the visualization-specific as together as possible hoping that one day they can be standalone, or distributed outside of Caravel.

'1 year ago',
];

const propTypes = {
Copy link
Contributor

Choose a reason for hiding this comment

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

i like how you moved these to the top of the file. it's a pattern i use too & find super useful when reading a component file. 👌

changeFilter(filter, options) {
let vals = null;
if (options) {
if (Array.isArray(options)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why are options sometimes arrays and sometimes objects?

Copy link
Member Author

Choose a reason for hiding this comment

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

because we use a mix of Select multiple and Select one... The time ones are single choice

@@ -62,11 +62,11 @@
"moments": "0.0.2",
"mustache": "^2.2.1",
"nvd3": "1.8.4",
"react": "^15.2.1",
"react": "^15.3.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -205,36 +216,39 @@ def query_filters(self, is_having_filter=False):
if col and op and eq is not None:
filters.append((col, op, eq))

if is_having_filter:
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a python-ism? would has_filter be more clear?

Copy link
Member Author

Choose a reason for hiding this comment

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

it has to do with the SQL HAVING clause

@mistercrunch
Copy link
Member Author

Addressed/answered the comments, merging.

@mistercrunch mistercrunch merged commit 7115c54 into apache:master Sep 22, 2016
@dpgaspar dpgaspar mentioned this pull request Dec 9, 2019
12 tasks
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 17, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 24, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 25, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 26, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.11.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to- same time filter on dashboards
2 participants