You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/21 16:04:46 UTC

[GitHub] [superset] sinhashubham95 opened a new pull request, #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

sinhashubham95 opened a new pull request, #21911:
URL: https://github.com/apache/superset/pull/21911

   ### SUMMARY
   This change fixes bulk delete of dashboards which have embedding enabled.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   NA
   
   ### TESTING INSTRUCTIONS
   
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287722848

   @villebro please check now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287180125

   # [Codecov](https://codecov.io/gh/apache/superset/pull/21911?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#21911](https://codecov.io/gh/apache/superset/pull/21911?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fe06c24) into [master](https://codecov.io/gh/apache/superset/commit/04b017e0060f7ac2da8fa33e60b12247795befd1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (04b017e) will **decrease** coverage by `11.36%`.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #21911       +/-   ##
   ===========================================
   - Coverage   66.91%   55.55%   -11.37%     
   ===========================================
     Files        1807     1807               
     Lines       69139    69140        +1     
     Branches     7392     7392               
   ===========================================
   - Hits        46266    38412     -7854     
   - Misses      20963    28818     +7855     
     Partials     1910     1910               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.92% <0.00%> (-0.01%)` | :arrow_down: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.82% <0.00%> (-0.01%)` | :arrow_down: |
   | python | `57.94% <0.00%> (-23.53%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `51.07% <0.00%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/21911?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/dashboards/dao.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9kYW8ucHk=) | `31.15% <0.00%> (-65.20%)` | :arrow_down: |
   | [superset/utils/dashboard\_import\_export.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvZGFzaGJvYXJkX2ltcG9ydF9leHBvcnQucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [superset/tags/core.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdGFncy9jb3JlLnB5) | `4.54% <0.00%> (-95.46%)` | :arrow_down: |
   | [superset/key\_value/commands/update.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `0.00% <0.00%> (-90.91%)` | :arrow_down: |
   | [superset/key\_value/commands/delete.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL2RlbGV0ZS5weQ==) | `0.00% <0.00%> (-87.88%)` | :arrow_down: |
   | [superset/key\_value/commands/delete\_expired.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQva2V5X3ZhbHVlL2NvbW1hbmRzL2RlbGV0ZV9leHBpcmVkLnB5) | `0.00% <0.00%> (-84.00%)` | :arrow_down: |
   | [superset/dashboards/commands/importers/v0.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9jb21tYW5kcy9pbXBvcnRlcnMvdjAucHk=) | `15.62% <0.00%> (-76.25%)` | :arrow_down: |
   | [superset/datasets/commands/create.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvY3JlYXRlLnB5) | `30.61% <0.00%> (-69.39%)` | :arrow_down: |
   | [superset/datasets/commands/update.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvdXBkYXRlLnB5) | `25.00% <0.00%> (-69.05%)` | :arrow_down: |
   | [superset/datasets/commands/importers/v0.py](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvaW1wb3J0ZXJzL3YwLnB5) | `24.03% <0.00%> (-69.00%)` | :arrow_down: |
   | ... and [284 more](https://codecov.io/gh/apache/superset/pull/21911/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287700414

   @villebro just to specify this part of the test case failing without this change, I removed the change keeping the test case. Check these job run failures - [MYSQL](https://github.com/apache/superset/actions/runs/3302822766/jobs/5450045592) and [Postgres](https://github.com/apache/superset/actions/runs/3302822766/jobs/5450045882).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287443605

   @lilykuang @michael-s-molina can you please check this? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
villebro commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287653743

   FYI @sinhashubham95 I restarted the cypress test on CI, will review now


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287653830

   Thanks @villebro 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on a diff in pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #21911:
URL: https://github.com/apache/superset/pull/21911#discussion_r1002383735


##########
tests/integration_tests/dashboards/api_tests.py:
##########
@@ -803,6 +803,47 @@ def test_delete_bulk_dashboards(self):
             model = db.session.query(Dashboard).get(dashboard_id)
             self.assertEqual(model, None)
 
+    def test_delete_bulk_embedded_dashboards(self):
+        """
+        Dashboard API: Test delete bulk embedded
+        """
+        admin_id = self.get_user("admin").id
+        dashboard_count = 4
+        dashboard_ids = list()
+        for dashboard_name_index in range(dashboard_count):
+            dashboard_ids.append(
+                self.insert_dashboard(
+                    f"title{dashboard_name_index}",
+                    f"slug{dashboard_name_index}",
+                    [admin_id],
+                ).id
+            )
+        self.login(username="admin")
+        for dashboard_name_index in range(dashboard_count):
+            # post succeeds and returns value
+            allowed_domains = ["test.example", "embedded.example"]
+            resp = self.post_assert_metric(
+                f"api/v1/dashboard/slug{dashboard_name_index}/embedded",
+                {"allowed_domains": allowed_domains},
+                "set_embedded",
+            )
+            self.assertEqual(resp.status_code, 200)
+            result = json.loads(resp.data.decode("utf-8"))["result"]
+            self.assertIsNotNone(result["uuid"])
+            self.assertNotEqual(result["uuid"], "")
+            self.assertEqual(result["allowed_domains"], allowed_domains)
+        self.login(username="admin")

Review Comment:
   nit: to make this slightly DRYer, let's just specify the "admin" username once. Also, there's a redundant second login that doesn't appear to be needed.
   ```suggestion
           user = self.get_user("admin")
           dashboard_count = 4
           dashboard_ids = []
           for dashboard_name_index in range(dashboard_count):
               dashboard_ids.append(
                   self.insert_dashboard(
                       f"title{dashboard_name_index}",
                       f"slug{dashboard_name_index}",
                       [user.id],
                   ).id
               )
           self.login(username=user.username)
           for dashboard_name_index in range(dashboard_count):
               # post succeeds and returns value
               allowed_domains = ["test.example", "embedded.example"]
               resp = self.post_assert_metric(
                   f"api/v1/dashboard/slug{dashboard_name_index}/embedded",
                   {"allowed_domains": allowed_domains},
                   "set_embedded",
               )
               self.assertEqual(resp.status_code, 200)
               result = json.loads(resp.data.decode("utf-8"))["result"]
               self.assertIsNotNone(result["uuid"])
               self.assertNotEqual(result["uuid"], "")
               self.assertEqual(result["allowed_domains"], allowed_domains)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
villebro commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287671601

   > @villebro I have refactored the test case as per your suggestion. Also, I verified the test case failing for me without the change when I was running from my local.
   
   @sinhashubham95 can you post the failing test output without the functional changes?  I'm still not able to reproduce the test failure without the functional change. What I did to run the tests locally:
   
   ```shell
   tox -e sqlite tests/integration_tests/dashboards/api_tests.py
   ```
   
   Btw, I'm getting an unrelated test failure when running the tests locally and I don't fully understand how that test (`test_gets_not_certified_dashboards_filter`) is passing on CI (the test seems wrong), but I can look into that, as it's unrelated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287652167

   @villebro @lilykuang @michael-s-molina can you please check this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro merged pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
villebro merged PR #21911:
URL: https://github.com/apache/superset/pull/21911


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287221998

   @villebro can you please check this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sinhashubham95 commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
sinhashubham95 commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287661469

   @villebro I have refactored the test case as per your suggestion. Also, I verified the test case failing for me without the change when I was running from my local.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on pull request #21911: fix(superset): Fixed API for bulk delete of embedded dashboards

Posted by GitBox <gi...@apache.org>.
villebro commented on PR #21911:
URL: https://github.com/apache/superset/pull/21911#issuecomment-1287765047

   > @villebro just to specify this part of the test case failing without this change, I removed the change keeping the test case. Check these job run failures - [MYSQL](https://github.com/apache/superset/actions/runs/3302822766/jobs/5450045592) and [Postgres](https://github.com/apache/superset/actions/runs/3302822766/jobs/5450045882).
   
   @sinhashubham95 oh, now I get it, the test didn't fail on sqlite because it doesn't enforce foreign keys 🤦 thanks for helping me get to the bottom of this!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org