Skip to content

Commit

Permalink
[bugfix] clarifying how to create a slice (#2565)
Browse files Browse the repository at this point in the history
* [bugfix] clarifying how to create a slice

First time users [rightfully] think that the proper way to create a
slice is to click the `+` button on the `Slices` CRUD page.

Changing / simplifying the redirect logic and message flashing that was
failing here somehow.

* Changing message from danger to info
  • Loading branch information
mistercrunch authored Apr 11, 2017
1 parent 75a358c commit a803705
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,11 @@ def pre_delete(self, obj):
@expose('/add', methods=['GET', 'POST'])
@has_access
def add(self):
widget = self._add()
if not widget:
return redirect(self.get_redirect())

sources = ConnectorRegistry.sources
for source in sources:
ds = db.session.query(ConnectorRegistry.sources[source]).first()
if ds is not None:
url = "/{}/list/".format(ds.baselink)
msg = _("Click on a {} link to create a Slice".format(source))
break

redirect_url = "/r/msg/?url={}&msg={}".format(url, msg)
return redirect(redirect_url)
flash(__(
"To create a new slice, you can open a data source "
"through the `Sources` menu, or alter an existing slice "
"from the `Slices` menu"), "info")
return redirect('/superset/welcome')

appbuilder.add_view(
SliceModelView,
Expand Down

0 comments on commit a803705

Please sign in to comment.