mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
[bugfix] clarifying how to create a slice (#2565)
* [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
This commit is contained in:
parent
75a358c616
commit
a803705ddc
@ -363,20 +363,11 @@ class SliceModelView(SupersetModelView, DeleteMixin): # noqa
|
|||||||
@expose('/add', methods=['GET', 'POST'])
|
@expose('/add', methods=['GET', 'POST'])
|
||||||
@has_access
|
@has_access
|
||||||
def add(self):
|
def add(self):
|
||||||
widget = self._add()
|
flash(__(
|
||||||
if not widget:
|
"To create a new slice, you can open a data source "
|
||||||
return redirect(self.get_redirect())
|
"through the `Sources` menu, or alter an existing slice "
|
||||||
|
"from the `Slices` menu"), "info")
|
||||||
sources = ConnectorRegistry.sources
|
return redirect('/superset/welcome')
|
||||||
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)
|
|
||||||
|
|
||||||
appbuilder.add_view(
|
appbuilder.add_view(
|
||||||
SliceModelView,
|
SliceModelView,
|
||||||
|
Loading…
Reference in New Issue
Block a user