feat: Implement web-based SSH terminal with session management, command logging, and host interaction.
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
This commit is contained in:
@@ -139,6 +139,8 @@ class TerminalCommandLogRepository:
|
||||
async def list_global(
|
||||
self,
|
||||
query: Optional[str] = None,
|
||||
time_filter: str = "all",
|
||||
pinned_only: bool = False,
|
||||
host_id: Optional[str] = None,
|
||||
user_id: Optional[str] = None,
|
||||
limit: int = 50,
|
||||
@@ -146,13 +148,6 @@ class TerminalCommandLogRepository:
|
||||
) -> List[TerminalCommandLog]:
|
||||
"""
|
||||
List command logs globally with optional filters.
|
||||
|
||||
Args:
|
||||
query: Optional search query
|
||||
host_id: Optional host ID to filter by
|
||||
user_id: Optional user ID to filter by
|
||||
limit: Maximum number of results
|
||||
offset: Number of results to skip
|
||||
"""
|
||||
conditions = [TerminalCommandLog.is_blocked == False]
|
||||
|
||||
@@ -164,6 +159,23 @@ class TerminalCommandLogRepository:
|
||||
|
||||
if query:
|
||||
conditions.append(TerminalCommandLog.command.ilike(f"%{query}%"))
|
||||
|
||||
if pinned_only:
|
||||
conditions.append(TerminalCommandLog.is_pinned == True)
|
||||
|
||||
if time_filter != "all":
|
||||
now = datetime.now(timezone.utc)
|
||||
if time_filter == "today":
|
||||
cutoff = now.replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
elif time_filter == "week":
|
||||
cutoff = now - timedelta(days=7)
|
||||
elif time_filter == "month":
|
||||
cutoff = now - timedelta(days=30)
|
||||
else:
|
||||
cutoff = None
|
||||
|
||||
if cutoff:
|
||||
conditions.append(TerminalCommandLog.created_at >= cutoff)
|
||||
|
||||
stmt = (
|
||||
select(TerminalCommandLog)
|
||||
|
||||
Reference in New Issue
Block a user