From 62f7edec318de3c394720f61b8fe02f4e7f9e65e Mon Sep 17 00:00:00 2001 From: lxb <1580622474@qq.com> Date: Thu, 5 Dec 2024 16:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=AE=9E=E7=8E=B0=E4=BA=86?= =?UTF-8?q?=E5=86=85=E5=AD=98=E3=80=81=E5=AD=98=E5=82=A8=E6=94=BB=E5=9D=9A?= =?UTF-8?q?=E3=80=81GPU=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.py | 4 +- web/css/style_1.css | 58 ++++++++++++++ web/index.html | 9 ++- web/js/script.js | 180 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+), 3 deletions(-) create mode 100644 web/css/style_1.css create mode 100644 web/js/script.js diff --git a/client.py b/client.py index e18f25a..42a731b 100644 --- a/client.py +++ b/client.py @@ -112,8 +112,8 @@ def get_memory_info(error_dict): result_dict = dict() try: mem = psutil.virtual_memory() - result_dict["total"] = mem.total - result_dict["used"] = mem.used + result_dict["total"] = mem.total / 1024 + result_dict["used"] = mem.used / 1024 except Exception as e: error_dict['memory'] = e diff --git a/web/css/style_1.css b/web/css/style_1.css new file mode 100644 index 0000000..9d8698e --- /dev/null +++ b/web/css/style_1.css @@ -0,0 +1,58 @@ +#header-container { + background-color: beige; +} + +.card { + border-style: solid; + border-width: 2px; + border-color: black; + /* background-color: aqua; */ + padding: 5px; + margin: 5px; + border-radius: 8px; +} + +.server-name { + background-color: black; + color: white; + border-radius: 8px; + padding: 4px 10px; + font-size: 26px; +} + +.gpu-info { + /* background-color: aqua; */ + border-style: solid; + border-width: 1px; + border-color: #ccc; + border-radius: 8px; + margin-top: 5px; + padding: 4px 8px; + margin-bottom: 5px; + background-color: #f9f9f9; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); +} + +.process-item { + color: rgb(26, 92, 247); + font-weight: bold; +} + +/*占用状态*/ +.state-free { + color: green; +} +.state-occupy { + color: red; +} +.state-light-occupy { + color: orange; +} +.state-super-occupy { + color: rgb(255, 0, 0); + font-weight: bold; + font-size: 20px; + background-color: rgb(255, 255, 0); + border-radius: 8px; + padding: 1px 6px; +} \ No newline at end of file diff --git a/web/index.html b/web/index.html index 2b89fbf..32e0425 100644 --- a/web/index.html +++ b/web/index.html @@ -4,8 +4,15 @@