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

[Table view] Handle empty arrays in fd.timeseries_limit_metric #5715

Merged
merged 5 commits into from
Aug 29, 2018

Conversation

betodealmeida
Copy link
Member

In some of our charts fd.timeseries_limit_metric is being initialized to an empty array instead of null. This results in sortBy being set to an empty array, and then the last metric column is hidden.

@codecov-io
Copy link

codecov-io commented Aug 24, 2018

Codecov Report

Merging #5715 into master will increase coverage by 0.35%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5715      +/-   ##
==========================================
+ Coverage   63.43%   63.78%   +0.35%     
==========================================
  Files         361      362       +1     
  Lines       22977    22983       +6     
  Branches     2558     2557       -1     
==========================================
+ Hits        14575    14660      +85     
+ Misses       8387     8308      -79     
  Partials       15       15
Impacted Files Coverage Δ
superset/assets/src/visualizations/table.js 82.75% <100%> (+82.75%) ⬆️
superset/db_engine_specs.py 52.14% <0%> (-2.01%) ⬇️
superset/connectors/sqla/models.py 77.86% <0%> (-0.77%) ⬇️
superset/models/core.py 84.6% <0%> (-0.5%) ⬇️
superset/views/core.py 73.64% <0%> (-0.3%) ⬇️
...rc/explore/components/controls/AnnotationLayer.jsx 22.92% <0%> (-0.12%) ⬇️
...uperset/assets/src/datasource/DatasourceEditor.jsx 72.92% <0%> (ø) ⬆️
superset/assets/src/explore/controls.jsx 46.26% <0%> (ø) ⬆️
superset/assets/src/visualizations/sunburst.js 0% <0%> (ø) ⬆️
superset/assets/src/visualizations/treemap.js 0% <0%> (ø) ⬆️
... and 8 more

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 5e6efae...cd2d224. Read the comment docs.

@@ -185,9 +185,12 @@ function tableVis(slice, payload) {
container.find('.dataTables_wrapper'), height);
// Sorting table by main column
let sortBy;
if (fd.timeseries_limit_metric) {
const limitMetric = Array.isArray(fd.timeseries_limit_metric)
Copy link
Member

Choose a reason for hiding this comment

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

No need to check on .length?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically no, if the array has no elements then limitMetric is undefined, which is false and does the expected in line 191.

// Sort by as specified
sortBy = fd.timeseries_limit_metric.label || fd.timeseries_limit_metric;
sortBy = limitMetric.label || limitMetric;
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR: It's driving me crazy the number of places in the code where we deal with the historical metrics! We'll need to clean that up some day. Maybe that can be an early place where we enforce a typescript schema, and do it way upstream.

@mistercrunch
Copy link
Member

LGTM

@betodealmeida betodealmeida merged commit 2da5db9 into apache:master Aug 29, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Oct 29, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging

(cherry picked from commit 2da5db9)
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
…e#5715)

* Handle empty arrays

* Remove test code

* Adding unit test

* Fix unit tests

* Remove logging
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 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.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants