feat: surface codex app-server approval progress
This commit is contained in:
@@ -1296,6 +1296,74 @@ public final class BossUi {
|
||||
return card;
|
||||
}
|
||||
|
||||
JSONArray warnings = progress == null ? null : progress.optJSONArray("warnings");
|
||||
if (warnings != null && warnings.length() > 0) {
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "安全提醒"));
|
||||
int shown = 0;
|
||||
for (int i = 0; i < warnings.length(); i += 1) {
|
||||
JSONObject warning = warnings.optJSONObject(i);
|
||||
String message = warning == null ? "" : warning.optString("message", "").trim();
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
continue;
|
||||
}
|
||||
card.addView(detailRow(context, "!", message, "", false));
|
||||
shown += 1;
|
||||
if (shown >= 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray approvals = progress == null ? null : progress.optJSONArray("approvals");
|
||||
if (approvals != null && approvals.length() > 0) {
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "审批状态"));
|
||||
int shown = 0;
|
||||
for (int i = 0; i < approvals.length(); i += 1) {
|
||||
JSONObject approval = approvals.optJSONObject(i);
|
||||
String label = approval == null ? "" : approval.optString("label", "").trim();
|
||||
if (TextUtils.isEmpty(label)) {
|
||||
continue;
|
||||
}
|
||||
String status = approval.optString("status", "").trim();
|
||||
String detail = approval.optString("detail", "").trim();
|
||||
String riskLevel = approval.optString("riskLevel", "").trim();
|
||||
String rowLabel = TextUtils.isEmpty(status) ? label : label + " · " + status;
|
||||
card.addView(detailRow(context, "◇", rowLabel, riskLevel, false));
|
||||
if (!TextUtils.isEmpty(detail)) {
|
||||
card.addView(detailRow(context, "", detail, "", false, true));
|
||||
}
|
||||
shown += 1;
|
||||
if (shown >= 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray fileChanges = progress == null ? null : progress.optJSONArray("fileChanges");
|
||||
if (fileChanges != null && fileChanges.length() > 0) {
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "文件变更"));
|
||||
int shown = 0;
|
||||
for (int i = 0; i < fileChanges.length(); i += 1) {
|
||||
JSONObject fileChange = fileChanges.optJSONObject(i);
|
||||
String path = fileChange == null ? "" : fileChange.optString("path", "").trim();
|
||||
if (TextUtils.isEmpty(path)) {
|
||||
continue;
|
||||
}
|
||||
String kind = fileChange.optString("kind", "").trim();
|
||||
card.addView(detailRow(context, "▣", path, kind, false));
|
||||
shown += 1;
|
||||
if (shown >= 6) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fileChanges.length() > shown) {
|
||||
card.addView(detailRow(context, "", "再显示 " + (fileChanges.length() - shown) + " 个", "", false, true));
|
||||
}
|
||||
}
|
||||
|
||||
card.addView(divider(context));
|
||||
card.addView(sectionTitle(context, "分支详情"));
|
||||
JSONObject branch = progress == null ? null : progress.optJSONObject("branch");
|
||||
|
||||
Reference in New Issue
Block a user