superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: Adding dashboard add view (#4344)
Date Tue, 06 Feb 2018 20:38:15 GMT
This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 19a0827  Adding dashboard add view (#4344)
19a0827 is described below

commit 19a0827d1f4868ebe2f68a51a5e568502444d338
Author: michellethomas <michelle.q.thomas@gmail.com>
AuthorDate: Tue Feb 6 12:38:07 2018 -0800

    Adding dashboard add view (#4344)
    
    * Adding DashboardAddView and setting show_columns on SLiceAddView
    
    * Adding tests for sliceaddview read api
    
    * Dedupe show_columns
---
 superset/views/core.py | 12 ++++++++++++
 tests/core_tests.py    |  7 +++++++
 2 files changed, 19 insertions(+)

diff --git a/superset/views/core.py b/superset/views/core.py
index 03636db..44b6b2a 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -493,6 +493,7 @@ class SliceAddView(SliceModelView):  # noqa
     list_columns = [
         'id', 'slice_name', 'slice_link', 'viz_type',
         'datasource_link', 'owners', 'modified', 'changed_on']
+    show_columns = list(set(SliceModelView.edit_columns + list_columns))
 
 
 appbuilder.add_view_no_menu(SliceAddView)
@@ -619,6 +620,17 @@ class DashboardModelViewAsync(DashboardModelView):  # noqa
 appbuilder.add_view_no_menu(DashboardModelViewAsync)
 
 
+class DashboardAddView(DashboardModelView):  # noqa
+    list_columns = [
+        'id', 'dashboard_link', 'creator', 'modified', 'dashboard_title',
+        'changed_on', 'url', 'changed_by_name',
+    ]
+    show_columns = list(set(DashboardModelView.edit_columns + list_columns))
+
+
+appbuilder.add_view_no_menu(DashboardAddView)
+
+
 class LogModelView(SupersetModelView):
     datamodel = SQLAInterface(models.Log)
     list_columns = ('user', 'action', 'dttm')
diff --git a/tests/core_tests.py b/tests/core_tests.py
index f6eb94d..8b4dd27 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -249,6 +249,13 @@ class CoreTests(SupersetTestCase):
         resp = self.client.get(url)
         self.assertEqual(resp.status_code, 200)
 
+    def test_get_user_slices(self):
+        self.login(username='admin')
+        userid = appbuilder.sm.find_user('admin').id
+        url = '/sliceaddview/api/read?_flt_0_created_by={}'.format(userid)
+        resp = self.client.get(url)
+        self.assertEqual(resp.status_code, 200)
+
     def test_slices_V2(self):
         # Add explore-v2-beta role to admin user
         # Test all slice urls as user with with explore-v2-beta role

-- 
To stop receiving notification emails like this one, please contact
graceguo@apache.org.

Mime
View raw message