From c1ff1c5d7009f8f90ad9279442c2f9232f05b2ca Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Fri, 4 Sep 2020 23:52:03 +0100 Subject: [PATCH] fix: MVC show saved query (#10781) * fix: MVC show saved query * remove it completely * fix lint --- .../superset/models/savedquery/show.html | 33 ------------------- superset/views/sql_lab.py | 22 +------------ 2 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 superset/templates/superset/models/savedquery/show.html diff --git a/superset/templates/superset/models/savedquery/show.html b/superset/templates/superset/models/savedquery/show.html deleted file mode 100644 index 10da57212e..0000000000 --- a/superset/templates/superset/models/savedquery/show.html +++ /dev/null @@ -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() }} -
-{% endblock %} - -{% block tail_js %} - {{ super() }} - {{ js_bundle("showSavedQuery") }} -{% endblock %} diff --git a/superset/views/sql_lab.py b/superset/views/sql_lab.py index 606e9a61ef..a85fb53412 100644 --- a/superset/views/sql_lab.py +++ b/superset/views/sql_lab.py @@ -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/") - 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 = {