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

Adding dashboard add view #4344

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions superset/views/core.py
Expand Up @@ -507,6 +507,7 @@ class SliceAddView(SliceModelView): # noqa
list_columns = [
'id', 'slice_name', 'slice_link', 'viz_type',
'datasource_link', 'owners', 'modified', 'changed_on']
show_columns = SliceModelView.edit_columns + list_columns
Copy link
Member

Choose a reason for hiding this comment

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

This seems prone to have duplicated columns, is this not an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't cause an issue for me, but I agree it would be a good idea to dedupe. Fixed.



appbuilder.add_view_no_menu(SliceAddView)
Expand Down Expand Up @@ -633,6 +634,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 = 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 @@ -237,6 +237,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