From a557071ea6d0b57994b2a923da775934aa43b782 Mon Sep 17 00:00:00 2001
From: Marc Vilanova <39573146+mvilanova@users.noreply.github.com>
Date: Wed, 13 Nov 2024 15:40:41 -0800
Subject: [PATCH] Removes option to delete a signal definition (#5471)
* Removes delete dialog for signal definitions
* Removes delete endpoint and related service function
* removes delete test
---
src/dispatch/signal/service.py | 8 ---
src/dispatch/signal/views.py | 17 ------
.../dispatch/src/signal/DeleteDialog.vue | 35 ------------
.../static/dispatch/src/signal/Table.vue | 8 +--
tests/signal/test_signal_service.py | 55 +++++++++----------
5 files changed, 28 insertions(+), 95 deletions(-)
delete mode 100644 src/dispatch/static/dispatch/src/signal/DeleteDialog.vue
diff --git a/src/dispatch/signal/service.py b/src/dispatch/signal/service.py
index 751201594093..eff71818ccef 100644
--- a/src/dispatch/signal/service.py
+++ b/src/dispatch/signal/service.py
@@ -536,14 +536,6 @@ def update(*, db_session: Session, signal: Signal, signal_in: SignalUpdate) -> S
return signal
-def delete(*, db_session: Session, signal_id: int):
- """Deletes a signal definition."""
- signal = db_session.query(Signal).filter(Signal.id == signal_id).one()
- db_session.delete(signal)
- db_session.commit()
- return signal_id
-
-
def is_valid_uuid(val):
try:
uuid.UUID(str(val), version=4)
diff --git a/src/dispatch/signal/views.py b/src/dispatch/signal/views.py
index e8dab18aabe7..74202f39e4a8 100644
--- a/src/dispatch/signal/views.py
+++ b/src/dispatch/signal/views.py
@@ -36,7 +36,6 @@
create,
create_signal_engagement,
create_signal_filter,
- delete,
delete_signal_filter,
get,
get_by_primary_or_external_id,
@@ -330,19 +329,3 @@ def update_signal(
) from None
return signal
-
-
-@router.delete(
- "/{signal_id}",
- response_model=None,
- dependencies=[Depends(PermissionsDependency([SensitiveProjectActionPermission]))],
-)
-def delete_signal(db_session: DbSession, signal_id: Union[str, PrimaryKey]):
- """Deletes a signal."""
- signal = get_by_primary_or_external_id(db_session=db_session, signal_id=signal_id)
- if not signal:
- raise HTTPException(
- status_code=status.HTTP_404_NOT_FOUND,
- detail=[{"msg": "A signal with this id does not exist."}],
- )
- delete(db_session=db_session, signal_id=signal.id)
diff --git a/src/dispatch/static/dispatch/src/signal/DeleteDialog.vue b/src/dispatch/static/dispatch/src/signal/DeleteDialog.vue
deleted file mode 100644
index 7036ee81151d..000000000000
--- a/src/dispatch/static/dispatch/src/signal/DeleteDialog.vue
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- Delete Signal Definition?
-
-
- Are you sure you would like to delete this Signal Definition?
-
-
-
- Cancel
- Delete
-
-
-
-
-
-
diff --git a/src/dispatch/static/dispatch/src/signal/Table.vue b/src/dispatch/static/dispatch/src/signal/Table.vue
index 7b7a5fb1116f..0a438ba65f49 100644
--- a/src/dispatch/static/dispatch/src/signal/Table.vue
+++ b/src/dispatch/static/dispatch/src/signal/Table.vue
@@ -1,7 +1,6 @@
-
@@ -88,9 +87,6 @@
View / Edit
-
- Delete
-
@@ -104,12 +100,12 @@