Example #1
0
def handle_open_summary_dialog(action_context: ActionContext):
    dialog = dialog_builder.Dialog(
        title="Update Summary",
        submit_label="Update",
        state=action_context.incident.pk,
        elements=[
            dialog_builder.TextArea(
                label="Summary",
                name="summary",
                optional=False,
                value=action_context.incident.summary,
            )
        ],
    )

    dialog.send_open_dialog(UPDATE_SUMMARY_DIALOG, action_context.trigger_id)
def handle_page_teams(context: ActionContext):
    dialog = dialog_builder.Dialog(
        title="Escalate to anoter team",
        submit_label="Escalate",
        elements=[
            dialog_builder.Text(
                label="Message",
                name="message",
                placeholder="Why do you need them?",
                hint="You might be waking this person up. Please make this friendly and clear.",
            )
        ],
        state=context.value,
    )

    dialog.send_open_dialog(PAGE_SPECIALIST_DIALOG, context.trigger_id)
Example #3
0
def handle_open_impact_dialog(action_context: ActionContext):
    dialog = dialog_builder.Dialog(
        title="Update Impact",
        submit_label="Update",
        state=action_context.incident.pk,
        elements=[
            dialog_builder.TextArea(
                label="Impact",
                name="impact",
                optional=False,
                value=action_context.incident.impact,
            )
        ],
    )

    dialog.send_open_dialog(UPDATE_IMPACT_DIALOG, action_context.trigger_id)
def handle_page_incident_lead(context: ActionContext):
    dialog = dialog_builder.Dialog(
        title="Page an Incdent Lead",
        submit_label="Page",
        elements=[
            dialog_builder.Text(
                label="Message",
                name="message",
                placeholder="Why do you need them?",
                hint=
                "You might be waking this person up. Please make this friendly and clear.",
            )
        ],
        state=context.incident.pk,
    )

    dialog.send_open_dialog(PAGE_LEAD_DIALOG, context.trigger_id)
Example #5
0
def handle_open_status_page_dialog(action_context: ActionContext):
    try:
        status_page = StatusPage.objects.get(incident=action_context.incident)
        values = status_page.get_from_statuspage()

        if values.get("status") == "resolved":
            logger.info(
                f"Status Page incident '{values.get('name')}' has been resolved"
            )
            status_page.incident.comms_channel().post_in_channel(
                "The status page can't be updated after it has been resolved.")
            return

    except models.ObjectDoesNotExist:
        values = {
            "name": "We're experiencing some issues at the moment",
            "status": "investigating",
            "message":
            "We're getting all the information we need to fix this and will update the status page as soon as we can.",
            "impact_override": "major",
            "component_id": None,
            "component_status": "operational",
        }

    dialog = dialog_builder.Dialog(
        title="Statuspage Update",
        submit_label="Update",
        state=action_context.incident.pk,
        elements=[
            dialog_builder.Text(
                label="Name",
                name="name",
                value=values.get("name"),
                hint=
                "Make this concise and clear - it's what will show in the apps",
            ),
            dialog_builder.SelectWithOptions(
                [
                    ("Investigating", "investigating"),
                    ("Identified", "identified"),
                    ("Monitoring", "monitoring"),
                    ("Resolved", "resolved"),
                ],
                label="Status",
                name="incident_status",
                value=values.get("status"),
            ),
            dialog_builder.TextArea(
                label="Description",
                name="message",
                optional=True,
                value=values.get("message"),
            ),
            dialog_builder.SelectWithOptions(
                [
                    ("Minor", "minor"),
                    ("Major", "major"),
                    ("Critical", "critical"),
                ],
                label="Severity",
                name="impact_override",
                optional=True,
                value=values.get("impact_override"),
            ),
            dialog_builder.SelectWithOptions(
                StatusPage.get_components(),
                label="Affected component",
                name="component_id",
                optional=True,
                value=values.get("component_id"),
            ),
            dialog_builder.SelectWithOptions(
                [
                    ("Operational", "operational"),
                    ("Under maintenance", "under_maintenance"),
                    ("Degraded performance", "degraded_performance"),
                    ("Partial outage", "partial_outage"),
                    ("Major outage", "major_outage"),
                ],
                label="Component status",
                name="component_status",
                optional=True,
                value=values.get("component_status"),
            ),
        ],
    )

    dialog.send_open_dialog(STATUS_PAGE_UPDATE, action_context.trigger_id)