feat(awooop): expose incident evidence links
This commit is contained in:
@@ -215,6 +215,13 @@ def _awooop_runs_button_row(incident_id: str) -> list[dict[str, str]]:
|
||||
}]
|
||||
|
||||
|
||||
def _awooop_runs_reply_markup(incident_id: str) -> dict | None:
|
||||
row = _awooop_runs_button_row(incident_id)
|
||||
if not row:
|
||||
return None
|
||||
return {"inline_keyboard": [row]}
|
||||
|
||||
|
||||
def _latest_remediation_history_item(history: dict[str, object] | None) -> dict[str, object]:
|
||||
if not history:
|
||||
return {}
|
||||
@@ -5549,6 +5556,7 @@ class TelegramGateway:
|
||||
await self._send_html_line_message(
|
||||
lines,
|
||||
failure_context="incident_detail",
|
||||
reply_markup=_awooop_runs_reply_markup(incident_id),
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@@ -5687,6 +5695,7 @@ class TelegramGateway:
|
||||
await self._send_html_line_message(
|
||||
lines,
|
||||
failure_context="incident_history",
|
||||
reply_markup=_awooop_runs_reply_markup(incident_id),
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@@ -5906,18 +5915,22 @@ class TelegramGateway:
|
||||
*,
|
||||
chat_id: str | int | None = None,
|
||||
failure_context: str,
|
||||
reply_markup: dict | None = None,
|
||||
) -> None:
|
||||
"""Send a multi-line HTML message without cutting Telegram tags in half."""
|
||||
chunks = _telegram_html_chunks(lines)
|
||||
for index, chunk in enumerate(chunks):
|
||||
try:
|
||||
payload: dict = {
|
||||
"chat_id": chat_id or self.alert_chat_id,
|
||||
"text": chunk,
|
||||
"parse_mode": "HTML",
|
||||
}
|
||||
if index == 0 and reply_markup:
|
||||
payload["reply_markup"] = reply_markup
|
||||
await self._send_request(
|
||||
"sendMessage",
|
||||
{
|
||||
"chat_id": chat_id or self.alert_chat_id,
|
||||
"text": chunk,
|
||||
"parse_mode": "HTML",
|
||||
},
|
||||
payload,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.warning(
|
||||
@@ -5927,12 +5940,15 @@ class TelegramGateway:
|
||||
chunk_count=len(chunks),
|
||||
error=str(exc),
|
||||
)
|
||||
fallback_payload: dict = {
|
||||
"chat_id": chat_id or self.alert_chat_id,
|
||||
"text": _plain_text_from_html(chunk),
|
||||
}
|
||||
if index == 0 and reply_markup:
|
||||
fallback_payload["reply_markup"] = reply_markup
|
||||
await self._send_request(
|
||||
"sendMessage",
|
||||
{
|
||||
"chat_id": chat_id or self.alert_chat_id,
|
||||
"text": _plain_text_from_html(chunk),
|
||||
},
|
||||
fallback_payload,
|
||||
)
|
||||
|
||||
async def send_alert_notification(
|
||||
|
||||
Reference in New Issue
Block a user