diff --git a/.hypothesis/constants/0ba82ca4ea63f3bc b/.hypothesis/constants/0ba82ca4ea63f3bc new file mode 100644 index 0000000..b7a563c --- /dev/null +++ b/.hypothesis/constants/0ba82ca4ea63f3bc @@ -0,0 +1,4 @@ +# file: /home/anti/Tools/DECNET/.venv/bin/pytest +# hypothesis_version: 6.151.12 + +['__main__'] \ No newline at end of file diff --git a/.hypothesis/unicode_data/16.0.0/codec-utf-8.json.gz b/.hypothesis/unicode_data/16.0.0/codec-utf-8.json.gz index 8cf48f5..3e73967 100644 Binary files a/.hypothesis/unicode_data/16.0.0/codec-utf-8.json.gz and b/.hypothesis/unicode_data/16.0.0/codec-utf-8.json.gz differ diff --git a/decnet_web/src/components/Layout.tsx b/decnet_web/src/components/Layout.tsx index 1d8c82b..0fb109f 100644 --- a/decnet_web/src/components/Layout.tsx +++ b/decnet_web/src/components/Layout.tsx @@ -1,6 +1,7 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { NavLink } from 'react-router-dom'; import { Menu, X, Search, Activity, LayoutDashboard, Terminal, Settings, LogOut, Server } from 'lucide-react'; +import api from '../utils/api'; import './Layout.css'; interface LayoutProps { @@ -12,12 +13,27 @@ interface LayoutProps { const Layout: React.FC = ({ children, onLogout, onSearch }) => { const [sidebarOpen, setSidebarOpen] = useState(true); const [search, setSearch] = useState(''); + const [systemActive, setSystemActive] = useState(false); const handleSearchSubmit = (e: React.FormEvent) => { e.preventDefault(); onSearch(search); }; + useEffect(() => { + const fetchStatus = async () => { + try { + const res = await api.get('/stats'); + setSystemActive(res.data.deployed_deckies > 0); + } catch (err) { + console.error('Failed to fetch system status', err); + } + }; + fetchStatus(); + const interval = setInterval(fetchStatus, 10000); + return () => clearInterval(interval); + }, []); + return (
{/* Sidebar */} @@ -60,7 +76,9 @@ const Layout: React.FC = ({ children, onLogout, onSearch }) => { />
- SYSTEM: ACTIVE + + SYSTEM: {systemActive ? 'ACTIVE' : 'INACTIVE'} +
diff --git a/decnet_web/src/components/LiveLogs.tsx b/decnet_web/src/components/LiveLogs.tsx index 8e5363a..575e1f5 100644 --- a/decnet_web/src/components/LiveLogs.tsx +++ b/decnet_web/src/components/LiveLogs.tsx @@ -196,8 +196,8 @@ const LiveLogs: React.FC = () => { onClick={handleToggleLive} style={{ display: 'flex', alignItems: 'center', gap: '8px', - border: `1px solid ${streaming ? 'var(--text-color)' : 'var(--border-color)'}`, - color: streaming ? 'var(--text-color)' : 'var(--dim-color)', + border: `1px solid ${streaming ? 'var(--text-color)' : 'var(--accent-color)'}`, + color: streaming ? 'var(--text-color)' : 'var(--accent-color)', minWidth: '120px', justifyContent: 'center' }} > diff --git a/pyproject.toml b/pyproject.toml index 9af6750..55a0736 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,11 @@ dev = [ [project.scripts] decnet = "decnet.cli:app" +[tool.pytest.ini_options] +filterwarnings = [ + "ignore::pytest.PytestUnhandledThreadExceptionWarning", +] + [tool.setuptools.packages.find] where = ["."] include = ["decnet*"] diff --git a/tests/test_fleet_api.py b/tests/test_fleet_api.py index 1a9db6d..2e0c41b 100644 --- a/tests/test_fleet_api.py +++ b/tests/test_fleet_api.py @@ -4,6 +4,7 @@ from fastapi.testclient import TestClient from decnet.web.api import app import decnet.config from pathlib import Path +from decnet.env import DECNET_ADMIN_USER, DECNET_ADMIN_PASSWORD TEST_STATE_FILE = Path("test-decnet-state.json") @@ -64,7 +65,7 @@ def mock_state_file(): def test_get_deckies_endpoint(mock_state_file): with TestClient(app) as _client: # Login to get token - _login_resp = _client.post("/api/v1/auth/login", json={"username": "admin", "password": "admin"}) + _login_resp = _client.post("/api/v1/auth/login", json={"username": DECNET_ADMIN_USER, "password": DECNET_ADMIN_PASSWORD}) _token = _login_resp.json()["access_token"] _response = _client.get("/api/v1/deckies", headers={"Authorization": f"Bearer {_token}"}) @@ -76,7 +77,7 @@ def test_get_deckies_endpoint(mock_state_file): def test_stats_includes_deployed_count(mock_state_file): with TestClient(app) as _client: - _login_resp = _client.post("/api/v1/auth/login", json={"username": "admin", "password": "admin"}) + _login_resp = _client.post("/api/v1/auth/login", json={"username": DECNET_ADMIN_USER, "password": DECNET_ADMIN_PASSWORD}) _token = _login_resp.json()["access_token"] _response = _client.get("/api/v1/stats", headers={"Authorization": f"Bearer {_token}"})