Skip to content

Commit

Permalink
Adding dashboard add view (apache#4344)
Browse files Browse the repository at this point in the history
* Adding DashboardAddView and setting show_columns on SLiceAddView

* Adding tests for sliceaddview read api

* Dedupe show_columns
  • Loading branch information
michellethomas authored and Grace Guo committed Feb 6, 2018
1 parent 782488e commit b075ab3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions superset/views/core.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
7 changes: 7 additions & 0 deletions tests/core_tests.py
Expand Up @@ -249,6 +249,13 @@ def test_add_slice(self):
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
Expand Down

0 comments on commit b075ab3

Please sign in to comment.