mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 05:50:21 -05:00
feat: Add Playbook Manager, Saved Searches, and Timeline View components
- Implemented PlaybookManager for creating and managing investigation playbooks with templates. - Added SavedSearches component for managing bookmarked queries and recurring scans. - Introduced TimelineView for visualizing forensic event timelines with zoomable charts. - Enhanced backend processing with auto-queued jobs for dataset uploads and improved database concurrency. - Updated frontend components for better user experience and performance optimizations. - Documented changes in update log for future reference.
This commit is contained in:
45
_edit_models_processing.py
Normal file
45
_edit_models_processing.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from pathlib import Path
|
||||
p=Path(r'd:/Projects/Dev/ThreatHunt/backend/app/db/models.py')
|
||||
t=p.read_text(encoding='utf-8')
|
||||
if 'class ProcessingTask(Base):' in t:
|
||||
print('processing task model already exists')
|
||||
raise SystemExit(0)
|
||||
insert='''
|
||||
|
||||
# -- Persistent Processing Tasks (Phase 2) ---
|
||||
|
||||
class ProcessingTask(Base):
|
||||
__tablename__ = "processing_tasks"
|
||||
|
||||
id: Mapped[str] = mapped_column(String(32), primary_key=True, default=_new_id)
|
||||
hunt_id: Mapped[Optional[str]] = mapped_column(
|
||||
String(32), ForeignKey("hunts.id", ondelete="CASCADE"), nullable=True, index=True
|
||||
)
|
||||
dataset_id: Mapped[Optional[str]] = mapped_column(
|
||||
String(32), ForeignKey("datasets.id", ondelete="CASCADE"), nullable=True, index=True
|
||||
)
|
||||
job_id: Mapped[Optional[str]] = mapped_column(String(64), nullable=True, index=True)
|
||||
stage: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
||||
status: Mapped[str] = mapped_column(String(20), default="queued", index=True)
|
||||
progress: Mapped[float] = mapped_column(Float, default=0.0)
|
||||
message: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
error: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_utcnow)
|
||||
started_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
completed_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), default=_utcnow, onupdate=_utcnow
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("ix_processing_tasks_hunt_stage", "hunt_id", "stage"),
|
||||
Index("ix_processing_tasks_dataset_stage", "dataset_id", "stage"),
|
||||
)
|
||||
'''
|
||||
# insert before Playbook section
|
||||
marker='\n\n# -- Playbook / Investigation Templates (Feature 3) ---\n'
|
||||
if marker not in t:
|
||||
raise SystemExit('marker not found for insertion')
|
||||
t=t.replace(marker, insert+marker)
|
||||
p.write_text(t,encoding='utf-8')
|
||||
print('added ProcessingTask model')
|
||||
Reference in New Issue
Block a user