Skip to content

Commit

Permalink
display an error message if no entities found on signal when snoozing (
Browse files Browse the repository at this point in the history
  • Loading branch information
wssheldon authored Mar 23, 2023
1 parent 2617e31 commit fa73df0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,26 @@ def snooze_button_click(
signal = signal_service.get(db_session=db_session, signal_id=instance.signal.id)
subject.id = signal.id

entities = entity_service.get_all(db_session=db_session, project_id=subject.project_id).all()
if not entities:
modal = Modal(
title="Unable to snooze",
close="Close",
blocks=[
Context(
elements=[
MarkdownText(
text="No entities found for this signal. Entity types are configured in the Dispatch UI."
)
]
)
],
).build()
if view_id := body.get("view", {}).get("id"):
client.views_update(view_id=view_id, view=modal)
else:
client.views_open(trigger_id=body["trigger_id"], view=modal)

blocks = [
title_input(placeholder="A name for your snooze filter."),
description_input(placeholder="Provide a description for your snooze filter."),
Expand Down

0 comments on commit fa73df0

Please sign in to comment.