fix: MVC show saved query (#10781)

* fix: MVC show saved query

* remove it completely

* fix lint
This commit is contained in:
Daniel Vaz Gaspar 2020-09-04 23:52:03 +01:00 committed by GitHub
parent bc4f98e5b8
commit c1ff1c5d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 54 deletions

View File

@ -1,33 +0,0 @@
{#
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
#}
{% extends "appbuilder/general/model/show.html" %}
{% block show_form %}
{{ super() }}
<div
id="schedule-info"
style="padding: 0 10px;"
data-bootstrap="{{ bootstrap_data }}"
></div>
{% endblock %}
{% block tail_js %}
{{ super() }}
{{ js_bundle("showSavedQuery") }}
{% endblock %}

View File

@ -21,7 +21,7 @@ from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.security.decorators import has_access, has_access_api
from flask_babel import lazy_gettext as _
from superset import db, get_feature_flags
from superset import db
from superset.constants import RouteMethod
from superset.models.sql_lab import Query, SavedQuery, TableSchema, TabState
from superset.typing import FlaskResponse
@ -75,32 +75,12 @@ class SavedQueryView(
"changed_on": _("Changed on"),
}
show_template = "superset/models/savedquery/show.html"
def pre_add(self, item: "SavedQueryView") -> None:
item.user = g.user
def pre_update(self, item: "SavedQueryView") -> None:
self.pre_add(item)
@has_access
@expose("show/<pk>")
def show(self, pk: int) -> FlaskResponse:
pk = self._deserialize_pk_if_composite(pk)
widgets = self._show(pk)
query = self.datamodel.get(pk).to_json()
query["extra_json"] = json.loads(query["extra_json"])
payload = {"common": {"feature_flags": get_feature_flags(), "query": query}}
return self.render_template(
self.show_template,
pk=pk,
title=self.show_title,
widgets=widgets,
related_views=self._related_views,
bootstrap_data=json.dumps(payload, default=utils.json_iso_dttm_ser),
)
class SavedQueryViewApi(SavedQueryView): # pylint: disable=too-many-ancestors
include_route_methods = {