You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/07/07 20:13:21 UTC
(superset) 01/01: chore: clean up more flask/jinja html views
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch clean_html
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 80a7a5bbc8723aa57ca0250c146d27ac5ac93751
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Jul 7 13:12:24 2025 -0700
chore: clean up more flask/jinja html views
Grepping through the code base, it appears all these jinja/html files are unused at this time.
---
superset/templates/appbuilder/navbar.html | 46 ----------
superset/templates/superset/export_dashboards.html | 34 --------
.../fab_overrides/list_with_checkboxes.html | 99 ----------------------
.../form_view/columnar_to_database_view/edit.html | 25 ------
.../form_view/database_schemas_selector.html | 70 ---------------
superset/templates/superset/import_dashboards.html | 68 ---------------
.../templates/superset/models/database/add.html | 28 ------
.../templates/superset/models/database/edit.html | 28 ------
.../templates/superset/models/database/macros.html | 91 --------------------
.../templates/superset/reports/slice_data.html | 50 -----------
superset/templates/superset/traceback.html | 33 --------
11 files changed, 572 deletions(-)
diff --git a/superset/templates/appbuilder/navbar.html b/superset/templates/appbuilder/navbar.html
deleted file mode 100644
index ae5213b53e..0000000000
--- a/superset/templates/appbuilder/navbar.html
+++ /dev/null
@@ -1,46 +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.
-#}
-{% set menu = appbuilder.menu %}
-{% set app_icon_width = appbuilder.app.config['APP_ICON_WIDTH'] %}
-{% set logo_target_path = appbuilder.app.config['LOGO_TARGET_PATH'] or '/' %}
-{% set root_path = logo_target_path if not logo_target_path.startswith('/') else '/superset' + logo_target_path if current_user.username is defined else '#' %}
-
-{% block navbar %}
- <div id="app-menu">
- <div class="navbar navbar-static-top {{menu.extra_classes}}" role="navigation">
- <div class="container-fluid">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="{{ root_path }}">
- <img
- width="{{ app_icon_width }}"
- src="{{ assets_prefix }}{{ appbuilder.app_icon }}"
- alt="{{ appbuilder.app_name }}"
- loading="lazy"
- />
- </a>
- </div>
- </div>
- </div>
- </div>
-{% endblock %}
diff --git a/superset/templates/superset/export_dashboards.html b/superset/templates/superset/export_dashboards.html
deleted file mode 100644
index 775256ff26..0000000000
--- a/superset/templates/superset/export_dashboards.html
+++ /dev/null
@@ -1,34 +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.
-#}
-{% import "superset/macros.html" as macros %}
-<script nonce="{{ macros.get_nonce() }}">
- window.onload = function() {
-
- // See issue #7353, window.open fails
- var a = document.createElement('a');
- a.href = window.location + '&action=go';
- a.download = 'dashboards.json';
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
-
- window.location = '{{ dashboards_url }}';
-
- };
-</script>
diff --git a/superset/templates/superset/fab_overrides/list_with_checkboxes.html b/superset/templates/superset/fab_overrides/list_with_checkboxes.html
deleted file mode 100644
index 508ea083de..0000000000
--- a/superset/templates/superset/fab_overrides/list_with_checkboxes.html
+++ /dev/null
@@ -1,99 +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.
-#}
-{% import 'appbuilder/general/lib.html' as lib %}
-{% extends 'appbuilder/general/widgets/base_list.html' %}
-
-
- {% block begin_content scoped %}
- <div class="table-responsive">
- <table class="table table-bordered table-hover">
- {% endblock %}
-
- {% block begin_loop_header scoped %}
- <thead>
- <tr>
- {% if actions %}
- <th class="action_checkboxes">
- <input id="check_all" class="action_check_all" name="check_all" type="checkbox">
- </th>
- {% endif %}
-
- {% if can_show or can_edit or can_delete %}
- <th class="col-md-1 col-lg-1 col-sm-1" ></th>
- {% endif %}
-
- {% for item in include_columns %}
- {% if item in order_columns %}
- {% set res = item | get_link_order(modelview_name) %}
- {% if res == 2 %}
- <th><a href={{ item | link_order(modelview_name) }}>{{label_columns.get(item)}}
- <i class="fa fa-chevron-up pull-right"></i></a></th>
- {% elif res == 1 %}
- <th><a href={{ item | link_order(modelview_name) }}>{{label_columns.get(item)}}
- <i class="fa fa-chevron-down pull-right"></i></a></th>
- {% else %}
- <th><a href={{ item | link_order(modelview_name) }}>{{label_columns.get(item)}}
- <i class="fa fa-arrows-v pull-right"></i></a></th>
- {% endif %}
- {% else %}
- <th>{{label_columns.get(item)}}</th>
- {% endif %}
- {% endfor %}
- </tr>
- </thead>
- {% endblock %}
-
- {% block begin_loop_values %}
- {% for item in value_columns %}
- {% set pk = pks[loop.index-1] %}
- <tr>
- {% if actions %}
- <td>
- <input id="{{pk}}" class="action_check" name="rowid" value="{{pk}}" type="checkbox">
- </td>
- {% endif %}
- {% if can_show or can_edit or can_delete %}
- <td><center>
- {{ lib.btn_crud(can_show, can_edit, can_delete, pk, modelview_name, filters) }}
- </center></td>
- {% endif %}
- {% for value in include_columns %}
- <td>
- {% if item[value].__class__.__name__ == 'bool' %}
- <input
- class="form-control"
- type="checkbox"
- data-toggle="tooltip" rel="tooltip" title="{{_('Use the edit button to change this field')}}"
- {{'checked' if item[value] }}
- name="{{ '{}__{}'.format(pk, value) }}"
- id="{{ '{}__{}'.format(pk, value) }}"
- disabled readonly/>
- {% else %}
- {{ item[value] }}
- {% endif %}
- </td>
- {% endfor %}
- </tr>
- {% endfor %}
- {% endblock %}
-
- {% block end_content scoped %}
- </table>
- </div>
- {% endblock %}
diff --git a/superset/templates/superset/form_view/columnar_to_database_view/edit.html b/superset/templates/superset/form_view/columnar_to_database_view/edit.html
deleted file mode 100644
index 2bec3aa12a..0000000000
--- a/superset/templates/superset/form_view/columnar_to_database_view/edit.html
+++ /dev/null
@@ -1,25 +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.
-#}
-{% import 'superset/form_view/database_schemas_selector.html' as schemas_selector %}
-{% extends 'appbuilder/general/model/edit.html' %}
-
-{% block tail_js %}
- {{ super() }}
- {{ schemas_selector }}
-{% endblock %}
diff --git a/superset/templates/superset/form_view/database_schemas_selector.html b/superset/templates/superset/form_view/database_schemas_selector.html
deleted file mode 100644
index 619c8ff4b2..0000000000
--- a/superset/templates/superset/form_view/database_schemas_selector.html
+++ /dev/null
@@ -1,70 +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.
-#}
-{% import "superset/macros.html" as macros %}
-<script nonce="{{ macros.get_nonce() }}">
- var db = $("#database");
- var schema = $("#schema");
-
- // this element is a text input
- // copy it here so it can be reused later
- var any_schema_is_allowed = schema.clone();
-
- update_schemas_allowed_for_csv_upload(db.val());
- db.change(function () {
- update_schemas_allowed_for_csv_upload(db.val());
- });
-
- function update_schemas_allowed_for_csv_upload(db_id) {
- $.ajax({
- method: "GET",
- url: `/api/v1/database/${db_id}/schemas_access_for_file_upload/`,
- dataType: 'json',
- contentType: "application/json; charset=utf-8"
- }).done(function (data) {
- change_schema_field_in_formview(data ? data.schemas.sort() : [])
- }).fail(function (error) {
- var errorMsg = error.responseJSON.error;
- alert("ERROR: " + errorMsg);
- });
- }
-
- function escape(htmlStr) {
- return htmlStr.replace(/&/g, "&")
- .replace(/</g, "<")
- .replace(/>/g, ">")
- .replace(/"/g, """)
- .replace(/'/g, "'");
-
- }
-
- function change_schema_field_in_formview(schemas_allowed) {
- if (schemas_allowed && schemas_allowed.length > 0) {
- var dropdown_schema_lists = '<select id="schema" name="schema" required>';
- schemas_allowed.forEach(function (schema_allowed) {
- dropdown_schema_lists += (
- `<option value="${escape(schema_allowed)}">${escape(schema_allowed)}</option>`
- );
- });
- dropdown_schema_lists += '</select>';
- $("#schema").replaceWith(dropdown_schema_lists);
- } else {
- $("#schema").replaceWith(any_schema_is_allowed)
- }
- }
-</script>
diff --git a/superset/templates/superset/import_dashboards.html b/superset/templates/superset/import_dashboards.html
deleted file mode 100644
index 226df0207e..0000000000
--- a/superset/templates/superset/import_dashboards.html
+++ /dev/null
@@ -1,68 +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/base.html" %}
-
-{% block title %}{{ _("Import dashboards") }}{% endblock %}
-
-{% block content %}
- <div class="container">
- <div class="panel">
- <div class="panel-heading"><h3>{{ _("Import Dashboard(s)") }}</h3></div>
- <div class="panel-body">
-
- <form method="post" enctype="multipart/form-data">
- <input
- type="hidden"
- name="csrf_token"
- id="csrf_token"
- value="{{ csrf_token() if csrf_token else '' }}" />
- <table class="table table-bordered">
- <tr>
- <td>{{ _("File") }}</td>
- <td>
- <label class="btn btn-default btn-sm" for="my-file-selector">
- <input
- id="my-file-selector"
- type="file"
- name="file"
- accept=".json"
- style="display:none;"
- onchange="$('#upload-file-info').html(this.files[0].name)"/>
- {{ _("Choose File") }}
- </label>
- <span class='label label-info' id="upload-file-info"></span>
- </td>
- </tr>
- <tr>
- <td>{{ _("Database") }}</td>
- <td>
- <select id="db_id" name="db_id" class="form-control input-sm" style="width: 300px">
- {% for db in databases %}
- <option value="{{ db.id }}">{{ db.name }}</option>
- {% endfor %}
- </select>
- </td>
- </tr>
- </table>
- <input type="submit" value="{{ _("Upload") }}" class="btn btn-primary btn-sm" />
- </form>
- </div>
- </div>
- </div>
-{% endblock %}
diff --git a/superset/templates/superset/models/database/add.html b/superset/templates/superset/models/database/add.html
deleted file mode 100644
index 6188c07f81..0000000000
--- a/superset/templates/superset/models/database/add.html
+++ /dev/null
@@ -1,28 +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/add.html" %}
-
-{% import "superset/models/database/macros.html" as macros %}
-{% block tail_js %}
- {{ super() }}
- {{ macros.testconn() }}
- {{ macros.expand_extra_textarea() }}
- {{ macros.expand_encrypted_extra_textarea() }}
- {{ macros.expand_server_cert_textarea() }}
-{% endblock %}
diff --git a/superset/templates/superset/models/database/edit.html b/superset/templates/superset/models/database/edit.html
deleted file mode 100644
index c7b80daee0..0000000000
--- a/superset/templates/superset/models/database/edit.html
+++ /dev/null
@@ -1,28 +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/edit.html" %}
-
-{% import "superset/models/database/macros.html" as macros %}
-{% block tail_js %}
- {{ super() }}
- {{ macros.testconn() }}
- {{ macros.expand_extra_textarea() }}
- {{ macros.expand_encrypted_extra_textarea() }}
- {{ macros.expand_server_cert_textarea() }}
-{% endblock %}
diff --git a/superset/templates/superset/models/database/macros.html b/superset/templates/superset/models/database/macros.html
deleted file mode 100644
index 5f86e7df3b..0000000000
--- a/superset/templates/superset/models/database/macros.html
+++ /dev/null
@@ -1,91 +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.
-#}
-{% import "superset/macros.html" as macros %}
-{% macro testconn() %}
- <script nonce="{{ macros.get_nonce() }}">
- $("#sqlalchemy_uri").parent()
- .append('<button id="testconn" class="btn btn-sm btn-primary">{{ _("Test Connection") }}</button>');
- $("#testconn").click(function(e) {
- e.preventDefault();
- var url = "/api/v1/database/test_connection/";
- var csrf_token = "{{ csrf_token() if csrf_token else '' }}";
-
- $.ajaxSetup({
- beforeSend: function(xhr, settings) {
- if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
- xhr.setRequestHeader("X-CSRFToken", csrf_token);
- }
- }
- });
-
- var data = {};
- const extra = $("#extra").val();
- const encryptedExtra = $("#encrypted_extra").val();
- try{
- data = JSON.stringify({
- uri: $.trim($("#sqlalchemy_uri").val()),
- name: $('#database_name').val(),
- impersonate_user: $('#impersonate_user').is(':checked'),
- extra: extra ? JSON.parse(extra) : {},
- encrypted_extra: encryptedExtra ? JSON.parse(encryptedExtra) : {},
- server_cert: $("#server_cert").val(),
- })
- } catch(parse_error){
- alert("Malformed JSON in the extra fields: " + parse_error);
- return false
- }
-
- $.ajax({
- method: "POST",
- url: url,
- data: data,
- dataType: 'json',
- contentType: "application/json; charset=utf-8"
- }).done(function(data) {
- alert("Seems OK!");
- }).fail(function(error) {
- var respJSON = error.responseJSON;
- var errorMsg = error.responseText;
- if (respJSON && respJSON.error) {
- errorMsg = respJSON.error;
- }
- alert("ERROR: " + errorMsg);
- });
- return false;
- });
- </script>
-{% endmacro %}
-
-{% macro expand_extra_textarea() %}
- <script nonce="{{ macros.get_nonce() }}">
- $('#extra').attr('rows', '5');
- </script>
-{% endmacro %}
-
-{% macro expand_encrypted_extra_textarea() %}
- <script nonce="{{ macros.get_nonce() }}">
- $('#encrypted_extra').attr('rows', '5');
- </script>
-{% endmacro %}
-
-{% macro expand_server_cert_textarea() %}
- <script nonce="{{ macros.get_nonce() }}">
- $('#server_cert').attr('rows', '5');
- </script>
-{% endmacro %}
diff --git a/superset/templates/superset/reports/slice_data.html b/superset/templates/superset/reports/slice_data.html
deleted file mode 100644
index c478cd00ef..0000000000
--- a/superset/templates/superset/reports/slice_data.html
+++ /dev/null
@@ -1,50 +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.
-#}
-<!DOCTYPE html>
-<html>
- <head>
- </head>
- <body>
- <p></p>
- <b><a href="{{ link }}">Explore this data in Superset</a></b>
- <p></p>
- <table border='1' cellspacing='0' cellpadding='3'
- style='border: 1px solid #c0c0c0; border-collapse: collapse;'>
- <thead>
- <tr>
- <th colspan={{ columns | length }} bgcolor='#c0c0c0'>{{ name }}</th>
- </tr>
- <tr>
- {%- for column in columns %}
- <th bgcolor='#f0f0f0'>{{ column.decode('utf-8') | replace('_', ' ') | title }}</th>
- {%- endfor %}
- </tr>
- </thead>
- <tbody>
- {%- for row in rows %}
- <tr>
- {%- for column in row %}
- <td>{{ column.decode('utf-8') }}</td>
- {%- endfor %}
- </tr>
- {%- endfor %}
- </tbody>
- </table>
- </body>
-</html>
diff --git a/superset/templates/superset/traceback.html b/superset/templates/superset/traceback.html
deleted file mode 100644
index 548c431dfd..0000000000
--- a/superset/templates/superset/traceback.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.
-#}}
-<!DOCTYPE html>
-<html>
- <body>
- <h1>Sorry, something went wrong</h1>
- <h3>500 - Internal Server Error</h3>
- <hr />
- <h2>Stacktrace</h2>
- <hr />
- <code>
- <pre>
- {{ error_msg }}
- </pre>
- </code>
- </body>
-</html>