def create_tactical_report_dialog(incident_id: int, command: dict = None, db_session=None): """Creates a dialog with the most recent tactical report data, if it exists.""" # we load the most recent tactical report tactical_report = report_service.get_most_recent_by_incident_id_and_type( db_session=db_session, incident_id=incident_id, report_type=ReportTypes.tactical_report ) conditions = actions = needs = "" if tactical_report: conditions = tactical_report.details.get("conditions") actions = tactical_report.details.get("actions") needs = tactical_report.details.get("needs") dialog = { "callback_id": command["command"], "title": "Tactical Report", "submit_label": "Submit", "elements": [ {"type": "textarea", "label": "Conditions", "name": "conditions", "value": conditions}, {"type": "textarea", "label": "Actions", "name": "actions", "value": actions}, {"type": "textarea", "label": "Needs", "name": "needs", "value": needs}, ], } dispatch_slack_service.open_dialog_with_user(slack_client, command["trigger_id"], dialog)
def create_executive_report_dialog(incident_id: int, command: dict = None, db_session=None): """Creates a dialog with the most recent executive report data, if it exists.""" # we load the most recent executive report executive_report = report_service.get_most_recent_by_incident_id_and_type( db_session=db_session, incident_id=incident_id, report_type=ReportTypes.executive_report ) current_status = overview = next_steps = "" if executive_report: current_status = executive_report.details.get("current_status") overview = executive_report.details.get("overview") next_steps = executive_report.details.get("next_steps") dialog = { "callback_id": command["command"], "title": "Executive Report", "submit_label": "Submit", "elements": [ { "type": "textarea", "label": "Current Status", "name": "current_status", "value": current_status, }, {"type": "textarea", "label": "Overview", "name": "overview", "value": overview}, {"type": "textarea", "label": "Next Steps", "name": "next_steps", "value": next_steps}, ], } dispatch_slack_service.open_dialog_with_user(slack_client, command["trigger_id"], dialog)
def create_executive_report_dialog( user_id: str, user_email: str, channel_id: str, incident_id: int, config: SlackConversationConfiguration = None, command: dict = None, db_session=None, slack_client=None, ): """Creates a dialog with the most recent executive report data, if it exists.""" # we load the most recent executive report executive_report = report_service.get_most_recent_by_incident_id_and_type( db_session=db_session, incident_id=incident_id, report_type=ReportTypes.executive_report) current_status = overview = next_steps = "" if executive_report: current_status = executive_report.details.get("current_status") overview = executive_report.details.get("overview") next_steps = executive_report.details.get("next_steps") dialog = { "callback_id": command["command"], "title": "Executive Report", "submit_label": "Submit", "elements": [ { "type": "textarea", "label": "Current Status", "name": "current_status", "value": current_status, }, { "type": "textarea", "label": "Overview", "name": "overview", "value": overview }, { "type": "textarea", "label": "Next Steps", "name": "next_steps", "value": next_steps, "hint": f"Use {config.slack_command_update_notifications_group} to update the list of recipients of this report.", }, ], } dispatch_slack_service.open_dialog_with_user(slack_client, command["trigger_id"], dialog)