feat: show feishu notification status
This commit is contained in:
@@ -887,7 +887,8 @@ input:focus {
|
||||
.attachment-item span,
|
||||
.workflow-card em,
|
||||
.workflow-card small,
|
||||
.workflow-error {
|
||||
.workflow-error,
|
||||
.workflow-notification {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -1042,18 +1043,33 @@ input:focus {
|
||||
|
||||
.node-status span,
|
||||
.node-status small,
|
||||
.workflow-error {
|
||||
.workflow-error,
|
||||
.workflow-notification {
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.workflow-error {
|
||||
.workflow-error,
|
||||
.workflow-notification {
|
||||
margin: 0;
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.workflow-error {
|
||||
background: #fff1f0;
|
||||
color: #b42318;
|
||||
}
|
||||
|
||||
.workflow-notification {
|
||||
background: #f5fbf7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.workflow-notification[data-notification-status="failed"] {
|
||||
background: #fff1f0;
|
||||
color: #b42318;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.status-running,
|
||||
|
||||
@@ -734,6 +734,34 @@
|
||||
return html;
|
||||
}
|
||||
|
||||
function notificationLabel(notification) {
|
||||
if (!notification) {
|
||||
return "暂无飞书通知记录";
|
||||
}
|
||||
return notification.status_label || notification.send_status || "飞书通知状态未知";
|
||||
}
|
||||
|
||||
function renderNotificationSummary(card, notification) {
|
||||
var panel = card.querySelector(".workflow-notification");
|
||||
if (!panel) {
|
||||
panel = document.createElement("p");
|
||||
panel.className = "workflow-notification";
|
||||
card.insertBefore(panel, card.querySelector("ol"));
|
||||
}
|
||||
var text = notificationLabel(notification);
|
||||
if (notification && notification.receiver) {
|
||||
text += " · " + notification.receiver;
|
||||
}
|
||||
if (notification && notification.sent_at) {
|
||||
text += " · " + notification.sent_at;
|
||||
}
|
||||
if (notification && notification.error_message) {
|
||||
text += " · " + notification.error_message;
|
||||
}
|
||||
panel.textContent = text;
|
||||
panel.setAttribute("data-notification-status", notification ? notification.send_status || "" : "none");
|
||||
}
|
||||
|
||||
async function refreshWorkflowCard(batchId, workflow_type) {
|
||||
if (!summaryPanel || !batchId) {
|
||||
return "";
|
||||
@@ -788,6 +816,7 @@
|
||||
} else if (riskSummary) {
|
||||
riskSummary.remove();
|
||||
}
|
||||
renderNotificationSummary(card, payload.latest_notification);
|
||||
var list = card.querySelector("ol");
|
||||
list.innerHTML = "";
|
||||
(payload.nodes || []).forEach(function (node) {
|
||||
|
||||
Reference in New Issue
Block a user