Skip to content

[WIP][dashboard scoped filter] part 2: add algorithm to convert checked ids to scope object - #8521

Closed
graceguo-supercat wants to merge 78 commits into
scope-selector-modalfrom
convert-ids-to-tabs-v2
Closed

graceguo-supercat wants to merge 78 commits into
scope-selector-modalfrom
convert-ids-to-tabs-v2

Conversation

@graceguo-supercat

@graceguo-supercat graceguo-supercat commented Nov 6, 2019 •

Copy link
Copy Markdown

CATEGORY

Choose one

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

SUMMARY

After filter scope selector UI, we will get filters scope data like this format:

{
    filterKey: '108___time_range',
    checkedChartIds: [101, 102, 103, 104],
}

dashboard has layout data in tree structure, a simplified example could be like:

{
    'ROOT_ID': { children: ['tab-A', 'tab-B'] }
    'tab-A': { children: [101, 102, 103]},
    'tab-B': { children: [104, 105]},
}

this PR will create an algorithm that creates filter scope object for each filter field, and will be merged into dashboard redux state (as part of dashboardFilter state):

{
    18: {
        columns: {
            _time_range: ['last year'],
        },
        labels: {
            _time_range: "Time Range",
        },
        scopes: {
            _time_range: {
               scope: ['tab-A', 'tab-B'],
               immune: [105],
            },
        }
    }
}

Basic rules to decide scope:

  • A scope object has 2 fields:
    • The minimum component unit for scope is tab. A filter can apply to one or multiple tabs.
    • If a chart inside a tab but not applicable to a filter, it will be added to immune list.
{ 
    scope: [list of tab ids],
    immune: [list of chart ids],
}
  • If any chart is applicable to a filter field, the chart's container tab should be in the filter's scope. Other charts inside the tab that are not applicable to the filter, will be added to immune list.
  • If all sub tabs are applicable to a filter field, we mark the parent tab in the filter' scope. Any chart that under the parent tab and not applicable to the filter, will be added to immune list.

TEST PLAN

new unit test is added.

ADDITIONAL INFORMATION

REVIEWERS

@etr2460 @mistercrunch

dpgaspar and others added 30 commits October 17, 2019 14:54
* [docs] New, document need for PG to use autocommit for CTAS
* [ci] Deprecate flake8

* Addressing @villebro's comments
…ompatibility. (#8353)

* removing deprecated function for future Python release compatibility.

* also removed assertNotEquals per @dpgaspar
* Separate RC from VERSION

* Fix pypi_push.sh and refine instructions

* Add SUPERSET_ prefix to env variables

* Finalize release instructions

* Change one-off to First Time Only

* Add tagging of final version

* Convert some remaining env variables and add a check step to pypi deploy
* Split up db_engine_specs_test.py into a number of targeted files

* Remove db_engine_specs_test.py

* isort
* [setup] Fix, download_url
* Allow bypassing DISPLAY_MAX_ROW

* Add unit tests and docs

* Fix tests

* Fix mock

* Fix unit test

* Revert config change after test

* Change behavior

* Address comments
* [docs] Crafting a new release
…scenarios (#8448)

* Add encrypted_extra to dbs

* WIP - UI-based BigQuery connection configuration

* Fix 500 bubbling to the surface when adding a database connection

* Add check for valid json

* black formatting:

* isort

* Incorporate PR feedback. Thanks all!

* black

* Typo fix in CONTRIBUTING.md
* [db engine] Add support for Elasticsearch
* [fix] Making client time UTC

* Update UPDATING.md
* [sip-15] Adding initial framework

* [toast] Addressing etr2460's comments

* [fix] Addressing etr2460's comments
…ery (#8462)

* Provide documentation for using a Service Account to connect to BigQuery

* Alter line wrapping for shorter lines

* Whitespace commit to trigger another build (flake)

* Another meaningless whitespace change to trigger another build
dpgaspar and others added 2 commits November 10, 2019 16:29
* [cli] Fix, import datasources exported by UI
* Update CONTRIBUTING.md

* Update CONTRIBUTING.md
@graceguo-supercat
graceguo-supercat force-pushed the scope-selector-modal branch 2 times, most recently from d37a36a to 58f69a4 Compare November 11, 2019 08:43
@graceguo-supercat

graceguo-supercat commented Nov 11, 2019 •

Copy link
Copy Markdown
Author

I just realized I messed up this PR with some commits in another PR. so i rebased it again. This PR should only contain the function that converts checked chart ids to scope object (and its unit test).

For the comments about filter scope selector, I fixed them in #8404.

@codecov-io

codecov-io commented Nov 11, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #8521 into scope-selector-modal will increase coverage by 0.06%.
The diff coverage is 93.02%.

Impacted file tree graph

@@                   Coverage Diff                    @@
##           scope-selector-modal    #8521      +/-   ##
========================================================
+ Coverage                 66.76%   66.82%   +0.06%     
========================================================
  Files                       467      468       +1     
  Lines                     22850    22893      +43     
  Branches                   2466     2483      +17     
========================================================
+ Hits                      15255    15299      +44     
+ Misses                     7434     7433       -1     
  Partials                    161      161
Impacted Files Coverage Δ
.../src/dashboard/util/getFilterScopeFromNodesTree.js 93.02% <93.02%> (ø)
...assets/src/dashboard/util/getDashboardFilterKey.js 100% <0%> (+66.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58f69a4...03b722e. Read the comment docs.

nytai and others added 14 commits November 11, 2019 17:34
* Allow customization of documentation icon and text

* Set icon width to 100%

* Use double quotes for strings
* Add support for database engine SAP Hana

* Support hana services

Increase time, minute, and second

* Fix hana return string

* Fix formatting errors
* [docs] Update CHANGELOG with 0.35.0

* [docs] Fix, github md problem
* passing onClick prop to header with the existing onChange method.

* basic test checking that label click fires the onChange method.

* cleaning up stuff caught by linting.
* Encode feature flags to JSON pessimistically

* Add unit test

* Remove old imports
@graceguo-supercat

Copy link
Copy Markdown
Author

please comment on #8559.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.