Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _setup_js_deps(self):
try:
node_version = self._run_command(["node", "--version"]).decode("utf-8").rstrip()
except OSError:
log.fatal("Cannot find node executable. Please install node" " and try again.")
log.fatal("Cannot find node executable. Please install node and try again.")
sys.exit(1)

if node_version[2] is not None:
Expand Down Expand Up @@ -408,9 +408,9 @@ def run(self):
"dispatch.plugins": [
"dispatch_atlassian_confluence = dispatch.plugins.dispatch_atlassian_confluence.plugin:ConfluencePagePlugin",
"dispatch_atlassian_confluence_document = dispatch.plugins.dispatch_atlassian_confluence.docs.plugin:ConfluencePageDocPlugin",
"dispatch_aws_sqs = dispatch.plugins.dispatch_aws.plugin:AWSSQSSignalConsumerPlugin",
"dispatch_aws_alb_auth = dispatch.plugins.dispatch_core.plugin:AwsAlbAuthProviderPlugin",
"dispatch_auth_mfa = dispatch.plugins.dispatch_core.plugin:DispatchMfaPlugin",
"dispatch_aws_alb_auth = dispatch.plugins.dispatch_core.plugin:AwsAlbAuthProviderPlugin",
"dispatch_aws_sqs = dispatch.plugins.dispatch_aws.plugin:AWSSQSSignalConsumerPlugin",
"dispatch_basic_auth = dispatch.plugins.dispatch_core.plugin:BasicAuthProviderPlugin",
"dispatch_contact = dispatch.plugins.dispatch_core.plugin:DispatchContactPlugin",
"dispatch_header_auth = dispatch.plugins.dispatch_core.plugin:HeaderAuthProviderPlugin",
Expand All @@ -427,13 +427,13 @@ def run(self):
"google_gmail_email = dispatch.plugins.dispatch_google.gmail.plugin:GoogleGmailEmailPlugin",
"google_groups_participants = dispatch.plugins.dispatch_google.groups.plugin:GoogleGroupParticipantGroupPlugin",
"jira_ticket = dispatch.plugins.dispatch_jira.plugin:JiraTicketPlugin",
"microsoft_teams_conference = dispatch.plugins.dispatch_microsoft_teams.conference.plugin:MicrosoftTeamsConferencePlugin",
"openai_artificial_intelligence = dispatch.plugins.dispatch_openai.plugin:OpenAIPlugin",
"opsgenie_oncall = dispatch.plugins.dispatch_opsgenie.plugin:OpsGenieOncallPlugin",
"pagerduty_oncall = dispatch.plugins.dispatch_pagerduty.plugin:PagerDutyOncallPlugin",
"slack_contact = dispatch.plugins.dispatch_slack.plugin:SlackContactPlugin",
"slack_conversation = dispatch.plugins.dispatch_slack.plugin:SlackConversationPlugin",
"zoom_conference = dispatch.plugins.dispatch_zoom.plugin:ZoomConferencePlugin",
"microsoft_teams_conference = dispatch.plugins.dispatch_microsoft_teams.conference.plugin:MicrosoftTeamsConferencePlugin",
],
},
)
2 changes: 0 additions & 2 deletions src/dispatch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@


class BaseConfigurationModel(BaseModel):
"""Base configuration model used by all config options."""

pass


Expand Down
28 changes: 28 additions & 0 deletions src/dispatch/plugins/bases/investigation_tooling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
.. module: dispatch.plugins.bases.investigation_tooling
:platform: Unix
:copyright: (c) 2019 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Marc Vilanova <mvilanova@netflix.com>
"""

from dispatch.case.models import Case
from dispatch.plugins.base import Plugin


class InvestigationToolingPlugin(Plugin):
"""Investigation tooling base plugin class."""

type = "investigation-tooling"

def create_investigation(self, case: Case, **kwargs):
"""Creates a new investigation.

Args:
case: Case object
kwargs: Optional kwargs.

Returns:
Additional context.
"""
raise NotImplementedError
9 changes: 5 additions & 4 deletions src/dispatch/plugins/dispatch_slack/case/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@


class CaseNotificationActions(DispatchEnum):
add_user = "case-add-user"
do_nothing = "case-do-not-add-user"
edit = "case-notification-edit"
migrate = "case-notification-migrate"
escalate = "case-notification-escalate"
investigate = "case-notification-investigate"
invite_user_case = ConversationButtonActions.invite_user_case
join_incident = "case-notification-join-incident"
migrate = "case-notification-migrate"
reopen = "case-notification-reopen"
resolve = "case-notification-resolve"
triage = "case-notification-triage"
user_mfa = "case-notification-user-mfa"
invite_user_case = ConversationButtonActions.invite_user_case
do_nothing = "case-do-not-add-user"
add_user = "case-add-user"


class CasePaginateActions(DispatchEnum):
Expand Down
54 changes: 54 additions & 0 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2926,3 +2926,57 @@ def handle_engagement_deny_submission_event(
channel=case.conversation.channel_id,
ts=thread_ts,
)


@app.action(
CaseNotificationActions.investigate, middleware=[button_context_middleware, db_middleware]
)
def investigate_button_click(
ack: Ack, body: dict, db_session: Session, context: BoltContext, client: WebClient
):
ack()

case = case_service.get(db_session=db_session, case_id=context["subject"].id)

if not case:
log.error("Unable to open an investigation. Case not found.")
client.chat_postMessage(
text=":warning: Unable to open an investigation. Case not found.",
channel=case.conversation.channel_id,
thread_ts=case.conversation.thread_id,
)
return

investigation_plugin = plugin_service.get_active_instance(
db_session=db_session,
project_id=case.project.id,
plugin_type="investigation-tooling",
)

if not investigation_plugin:
log.error("Unable to open an investigation. No investigation tooling plugin found.")
client.chat_postMessage(
text=f":warning: Unable to open an investigation. Investigation tooling plugin is not enabled for project {case.project.name}.",
channel=case.conversation.channel_id,
thread_ts=case.conversation.thread_id,
)
return

result = investigation_plugin.instance.create_investigation(case=case)

if not result:
log.error(
"Unable to open an investigation. Investigation tooling plugin failed to create an investigation."
)
client.chat_postMessage(
text=":warning: Unable to open an investigation. Investigation tooling plugin failed to create an investigation.",
channel=case.conversation.channel_id,
thread_ts=case.conversation.thread_id,
)
return

client.chat_postMessage(
text=f":mag: {result}",
channel=case.conversation.channel_id,
thread_ts=case.conversation.thread_id,
)
23 changes: 14 additions & 9 deletions src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ def create_case_message(case: Case, channel_id: str) -> list[Block]:
)
else:
action_buttons = [
Button(
text=":mag: Investigate",
action_id=CaseNotificationActions.investigate,
value=button_metadata,
),
Button(
text=":white_check_mark: Resolve",
action_id=CaseNotificationActions.resolve,
Expand All @@ -175,15 +180,15 @@ def create_case_message(case: Case, channel_id: str) -> list[Block]:
value=button_metadata,
),
]
if case.status == CaseStatus.new:
action_buttons.insert(
0,
Button(
text=":mag: Triage",
action_id=CaseNotificationActions.triage,
value=button_metadata,
),
)
# if case.status == CaseStatus.new:
# action_buttons.insert(
# 0,
# Button(
# text=":mag: Triage",
# action_id=CaseNotificationActions.triage,
# value=button_metadata,
# ),
# )
blocks.extend([Actions(elements=action_buttons)])

return Message(blocks=blocks).build()["blocks"]
Expand Down
Loading