diff --git a/ide/server/smarperfServer.py b/ide/server/smarperfServer.py index b96ae7588cbc044170237716b69670faafbb695a..07a838dbbec8c42701269de40868a2beb710ea6d 100644 --- a/ide/server/smarperfServer.py +++ b/ide/server/smarperfServer.py @@ -45,7 +45,7 @@ def is_linux(): return platform.system() == 'Linux' -def open_web(url): +def openWeb(url): webbrowser.open(url) @@ -74,16 +74,19 @@ class SpRequestHandler(http.server.BaseHTTPRequestHandler): global version global serveInfo - def do_get(self): + def log_message(self, format, *args): + return + + def do_GET(self): parse_result = urlparse(self.path) if parse_result.path == '/application/serverInfo': - self.server_info_handler() + self.serverInfo_handler() elif parse_result.path.startswith('/application'): self.application_handler(parse_result) else: self.send_error(404, 'Not found') - def do_post(self): + def do_POST(self): parse_result = urlparse(self.path) if parse_result.path.startswith('/logger'): self.console_handler() @@ -108,8 +111,8 @@ class SpRequestHandler(http.server.BaseHTTPRequestHandler): response = {"success": False, "code": -1, "message": str(e), "data": None} self.wfile.write(bytes(json.dumps(response), "utf-8")) return - suffix_str = os.path.splitext(url.split("/")[-1])[1] - file_name = f"upload/{datetime.now().strftime('%Y%m%d%H%M%S%f')}{suffix_str}" + suffixStr = os.path.splitext(url.split("/")[-1])[1] + file_name = f"upload/{datetime.now().strftime('%Y%m%d%H%M%S%f')}{suffixStr}" os.makedirs(os.path.dirname(file_name), exist_ok=True) try: with open(file_name, "wb") as f: @@ -150,15 +153,15 @@ class SpRequestHandler(http.server.BaseHTTPRequestHandler): def check_due(self, file_name): now = datetime.now() datetime_str = os.path.splitext(os.path.basename(file_name))[0] - file_date = datetime.strptime(datetime_str, "%Y%m%d%H%M%S%f") - return (now - file_date).total_seconds() > 3600 + fileDate = datetime.strptime(datetime_str, "%Y%m%d%H%M%S%f") + return (now - fileDate).total_seconds() > 3600 def console_handler(self): self.check_dir('./logger') - now_date = datetime.now() - now = now_date.strftime("%Y-%m-%d") - file_name = f"{now}.txt" - with open("./logger/" + file_name, "a") as dst: + nowDate = datetime.now() + now = nowDate.strftime("%Y-%m-%d") + fileName = f"{now}.txt" + with open(os.path.join("logger", fileName), "a") as dst: content_type = self.headers.get("Content-Type") if content_type and content_type.startswith("application/json"): content_length = int(self.headers.get("Content-Length", 0)) @@ -202,7 +205,7 @@ class SpRequestHandler(http.server.BaseHTTPRequestHandler): except FileNotFoundError: self.send_error(404, 'File not found') - def server_info_handler(self): + def serverInfo_handler(self): self.send_response(200) self.send_header("Access-Control-Allow-Origin", "*") self.send_header("request_info", serveInfo) @@ -261,7 +264,7 @@ class SpServer: def start(self): print(f'HTTPS[{PORT}] SmartPerf Server Start') if is_windows(): - open_web("https://127.0.0.1:9000/application/") + openWeb("https://127.0.0.1:9000/application/") self.httpd.serve_forever() diff --git a/ide/src/base-ui/BaseElement.ts b/ide/src/base-ui/BaseElement.ts index 9ec9820b03e9dcea39bd7decd2b73bbe8d43fc21..6add895e166a26262b64f723060081d31abe60fa 100644 --- a/ide/src/base-ui/BaseElement.ts +++ b/ide/src/base-ui/BaseElement.ts @@ -15,7 +15,8 @@ export function element(tag: string): (el: unknown) => void { return (el: unknown): void => { - if (!customElements.get(tag)) {//@ts-ignore + if (!customElements.get(tag)) { + //@ts-ignore customElements.define(tag, el); } }; diff --git a/ide/src/base-ui/chart/column/LitChartColumn.ts b/ide/src/base-ui/chart/column/LitChartColumn.ts index 786b813a41f72e27603ce2f01f0858d66b560298..f8991d4a107811b2cf4f5d524f7966a680690ef1 100644 --- a/ide/src/base-ui/chart/column/LitChartColumn.ts +++ b/ide/src/base-ui/chart/column/LitChartColumn.ts @@ -78,7 +78,7 @@ export class LitChartColumn extends BaseElement { let y = ev.pageY - rect.top; this.data.forEach((it) => { if (contains(it.bgFrame!, x, y)) { - it.hover = true;//@ts-ignore + it.hover = true; //@ts-ignore this.litChartColumnCfg?.hoverHandler?.(it.obj.no); } else { it.hover = false; @@ -89,7 +89,7 @@ export class LitChartColumn extends BaseElement { if (pillars.length > 0) { let titleEl = ``; let messageEl = pillars.map((it) => ``).join(''); - let sumEl = `