|
|
|
|
@@ -113,11 +113,11 @@ const STATUS: Record<Ajuan['status'], BoardStatus> = {
|
|
|
|
|
closed: 'done',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const REASON: Record<BoardStatus, string> = {
|
|
|
|
|
checking: 'Pandu lagi baca perubahannya.',
|
|
|
|
|
const reasons = (reviewer: string): Record<BoardStatus, string> => ({
|
|
|
|
|
checking: `${reviewer} lagi baca perubahannya.`,
|
|
|
|
|
fix: '',
|
|
|
|
|
blocked: '',
|
|
|
|
|
manual: 'Pandu nggak bisa kasih hasil yang valid. Perlu dicek manual.',
|
|
|
|
|
manual: `${reviewer} nggak bisa kasih hasil yang valid. Perlu dicek manual.`,
|
|
|
|
|
ready: '',
|
|
|
|
|
gas: '',
|
|
|
|
|
parked: '',
|
|
|
|
|
@@ -125,7 +125,7 @@ const REASON: Record<BoardStatus, string> = {
|
|
|
|
|
sailing: 'Sudah di-merge. Pipeline deploy lagi jalan.',
|
|
|
|
|
failed: 'Sudah di-merge, tapi pipeline deploy-nya gagal.',
|
|
|
|
|
done: 'Sudah di-merge.',
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const ZONE: Record<BoardStatus, Zone> = {
|
|
|
|
|
checking: 'cek', fix: 'cek', blocked: 'cek', manual: 'cek', parked: 'cek',
|
|
|
|
|
@@ -133,7 +133,7 @@ const ZONE: Record<BoardStatus, Zone> = {
|
|
|
|
|
rejected: 'beres', sailing: 'beres', failed: 'beres', done: 'beres',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Decisions and deploys sit on top of Pandu's verdict.
|
|
|
|
|
// Decisions and deploys sit on top of the reviewer's verdict.
|
|
|
|
|
export function boardStatus(a: Ajuan): BoardStatus {
|
|
|
|
|
if (a.status === 'closed') {
|
|
|
|
|
if (a.closed_state !== 'merged') return 'done';
|
|
|
|
|
@@ -173,14 +173,14 @@ function publicEvidence(e: Evidence): Evidence {
|
|
|
|
|
|
|
|
|
|
const VERDICT_WORD: Record<string, string> = { go: 'aman', no_go: 'tahan', waiting: 'nunggu' };
|
|
|
|
|
|
|
|
|
|
function timelineText(kind: string, result: string | null, author: string | null): string {
|
|
|
|
|
function timelineText(kind: string, result: string | null, author: string | null, reviewer: string): string {
|
|
|
|
|
const r = result ?? '';
|
|
|
|
|
const verdict = r.match(/^(go|no_go|waiting) di (\w+)/);
|
|
|
|
|
if (kind === 'opened') return verdict ? `Diajukan${author ? ` ${author}` : ''}; Pandu: ${VERDICT_WORD[verdict[1]]}` : `Diajukan${author ? ` ${author}` : ''}`;
|
|
|
|
|
if (kind === 'new_commit') return verdict ? `Commit baru ${verdict[2].slice(0, 8)}; Pandu: ${VERDICT_WORD[verdict[1]]}` : 'Commit baru';
|
|
|
|
|
if (kind === 'mention') return r === 'dijawab' ? 'Ditanya; Pandu jawab di MR' : 'Ditanya';
|
|
|
|
|
if (kind === 'opened') return verdict ? `Diajukan${author ? ` ${author}` : ''}; ${reviewer}: ${VERDICT_WORD[verdict[1]]}` : `Diajukan${author ? ` ${author}` : ''}`;
|
|
|
|
|
if (kind === 'new_commit') return verdict ? `Commit baru ${verdict[2].slice(0, 8)}; ${reviewer}: ${VERDICT_WORD[verdict[1]]}` : 'Commit baru';
|
|
|
|
|
if (kind === 'mention') return r === 'dijawab' ? `Ditanya; ${reviewer} jawab di MR` : 'Ditanya';
|
|
|
|
|
if (kind === 'closed') return r === 'label dilepas' ? 'Label labuh dilepas' : r === 'MR merged' ? 'Di-merge' : 'MR ditutup';
|
|
|
|
|
if (kind === 'recheck') return verdict ? `Rubrik berubah; Pandu: ${VERDICT_WORD[verdict[1]]}` : 'Rubrik berubah, dicek ulang';
|
|
|
|
|
if (kind === 'recheck') return verdict ? `Rubrik berubah; ${reviewer}: ${VERDICT_WORD[verdict[1]]}` : 'Rubrik berubah, dicek ulang';
|
|
|
|
|
if (kind === 'gas') return r.startsWith('di-merge') ? 'Gas; di-merge' : r.startsWith('uji coba') ? 'Gas (uji coba)' : r.startsWith('dibatalkan') ? 'Gas dibatalkan' : r ? `Gas tidak jalan: ${r.replace(/^(ditolak|failed): /, '')}` : 'Gas';
|
|
|
|
|
if (kind === 'close') return r === 'MR ditutup' ? 'MR ditutup' : r.startsWith('dibatalkan') ? 'Tutup MR dibatalkan' : r.startsWith('uji coba') ? 'Tutup MR (uji coba)' : r ? `MR tidak ditutup: ${r.replace(/^(dilewati|failed): /, '')}` : 'Tutup MR';
|
|
|
|
|
if (kind === 'decided') return r.startsWith('dibatalkan') ? 'Keputusan dibatalkan' : r === 'diumumkan: tunda' ? 'Ditunda' : r === 'diumumkan: tolak' ? 'Ditolak' : r === 'diumumkan: undo' ? 'Keputusan dibatalkan' : 'Keputusan';
|
|
|
|
|
@@ -194,6 +194,7 @@ export function viewAjuan(
|
|
|
|
|
viewer: Viewer,
|
|
|
|
|
act: ActionState = { taken: false, gasQueuedAt: null, graceSeconds: 15, allowed: [], dry: false },
|
|
|
|
|
release: Release | null = null,
|
|
|
|
|
reviewer = 'Labuh',
|
|
|
|
|
): AjuanView {
|
|
|
|
|
const verdict: Checked | null = a.verdict_json ? JSON.parse(a.verdict_json) : null;
|
|
|
|
|
const status = boardStatus(a);
|
|
|
|
|
@@ -217,7 +218,7 @@ export function viewAjuan(
|
|
|
|
|
lane: laneOf(a.target_branch, cfg),
|
|
|
|
|
zone,
|
|
|
|
|
status,
|
|
|
|
|
reason: (rel && releaseReason(rel, act.dry)) ?? decisionReason(a, status, dry, gasAt !== null) ?? verdictReason ?? REASON[status],
|
|
|
|
|
reason: (rel && releaseReason(rel, act.dry)) ?? decisionReason(a, status, dry, gasAt !== null) ?? verdictReason ?? reasons(reviewer)[status],
|
|
|
|
|
findings: showVerdict ? verdict!.findings.map((f) => ({ kind: f.kind, text: f.text, evidence: f.evidence.map(publicEvidence) })) : [],
|
|
|
|
|
postDeploy: showVerdict ? verdict!.postDeploy.map((p) => ({ text: p.text, evidence: p.evidence.map(publicEvidence) })) : [],
|
|
|
|
|
overrides: showVerdict ? verdict!.overrides : [],
|
|
|
|
|
@@ -226,7 +227,7 @@ export function viewAjuan(
|
|
|
|
|
tokens: a.tokens,
|
|
|
|
|
since: a.created_at,
|
|
|
|
|
dockedAt: (a.status !== 'closed' && a.decision === 'tolak' ? a.decision_at : a.status_at) ?? a.updated_at,
|
|
|
|
|
timeline: events.filter((e) => e.done_at || e.kind === 'opened').map((e) => ({ at: e.done_at ?? e.created_at, text: timelineText(e.kind, e.result, a.author) })),
|
|
|
|
|
timeline: events.filter((e) => e.done_at || e.kind === 'opened').map((e) => ({ at: e.done_at ?? e.created_at, text: timelineText(e.kind, e.result, a.author, reviewer) })),
|
|
|
|
|
mine,
|
|
|
|
|
needsYou: viewer.approver ? status === 'ready' || status === 'failed' || rel?.state === 'proposed' : mine && (status === 'fix' || status === 'manual' || status === 'rejected'),
|
|
|
|
|
decision: a.decision ? { kind: a.decision, by: a.decision_by ?? '', at: a.decision_at ?? '', note: a.decision_note } : null,
|
|
|
|
|
|