From 767d298af9d3bfc82ab6061822c6db9154c77fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=88=9F?= <13007110208@163.com> Date: Thu, 27 Feb 2025 19:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=964?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqllineage.py | 9 ++------- templates/index.html | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/sqllineage.py b/sqllineage.py index 9543a04..ff8b234 100644 --- a/sqllineage.py +++ b/sqllineage.py @@ -1,26 +1,22 @@ -from flask import Flask, render_template, request, jsonify +from flask import Flask, render_template, request, jsonify,send_file from utils.sql_parse import parse_create_table_sql from utils.log import Log app = Flask(__name__) log = Log().getlog() - @app.route('/') def index(): - return render_template('index.html') - + return send_file('templates/index.html') @app.route('/a') def index_a(): return render_template('a.html') - @app.route('/b') def index_b(): return render_template('b.html') - @app.route('/convert', methods=['POST']) def convert_sql(): sql_input = request.form['sql'] @@ -43,7 +39,6 @@ def convert_sql(): log.info("SQL result: %s", result) return jsonify(result) - if __name__ == '__main__': # 指定host和port,这里使用0.0.0.0可以让服务器被外部访问 app.run(host='0.0.0.0', port=8778, debug=True) diff --git a/templates/index.html b/templates/index.html index 6530f03..a9ea56c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -81,6 +81,14 @@ min-height: 1.2em; padding: 8px; border-radius: 4px; + /*设置高度*/ + overflow: hidden; + overflow-y: auto; + word-wrap: break-word; + overflow-wrap: break-word; + word-break: break-all; + /*设置宽度*/ + max-width: 100%; } .status-success { @@ -102,8 +110,6 @@ background: #e3f2fd; color: var(--primary-color); } - - @@ -144,7 +150,7 @@ const {createApp, ref, onMounted, computed} = Vue; const API_CONFIG = { - ENDPOINT: 'http://10.23.0.209:8778/convert', + ENDPOINT: 'http://localhost:8778/convert', DEFAULT_HEADERS: { 'Content-Type': 'application/x-www-form-urlencoded' }, @@ -182,13 +188,15 @@ }); const statusClass = computed(() => { + // 控制台打印 + console.log(`1Status: ${statusType.value} - ${statusMessage.value}`); + return statusType.value ? `status-${statusType.value}` : ''; }); - const setStatus = (message, type = 'info', timeout = 3000) => { + const setStatus = (message, type = 'info', timeout = 10000) => { statusMessage.value = message; statusType.value = type; - if (timeout) { setTimeout(() => { statusMessage.value = ''; @@ -307,4 +315,4 @@ }).mount('#app'); - \ No newline at end of file +