Merge feature/task-status-history-and-ceo-priority into main
Deploy Canina / deploy (push) Successful in 39s

This commit is contained in:
devops committed 2026-10-20 13:37:01 +00:00
commit de42b3126b
1 file changed
+65 -8
@@ -157,8 +157,28 @@ export default function TasksManagementPage() {
}
};
const getStatusTransitionsSummary = (logsRaw: any) => {
const list = Array.isArray(logsRaw) ? logsRaw : (typeof logsRaw === 'object' && logsRaw ? [logsRaw] : []);
let inProgressCount = 0;
let testCount = 0;
let qaRejectedCount = 0;
let qaPassedCount = 0;
list.forEach((entry: any) => {
const st = String(entry?.status || '');
if (st.includes('STARTED') || st === 'IN_PROGRESS') inProgressCount += 1;
if (st.includes('COMPLETED') || st === 'TEST') testCount += 1;
if (st === 'QA_FAILED') qaRejectedCount += 1;
if (st === 'QA_PASSED') qaPassedCount += 1;
});
return { inProgressCount, testCount, qaRejectedCount, qaPassedCount, totalEvents: list.length };
};
const getPriorityBadge = (priority: string) => {
switch (priority) {
case 'CEO_EXPEDITE':
return <span className="px-1.5 py-0.5 text-[9px] font-black bg-purple-700 text-white rounded animate-pulse shadow-sm shadow-purple-300">⚡ فوری مدیرعامل</span>;
case 'CRITICAL':
return <span className="px-1.5 py-0.5 text-[9px] font-black bg-rose-600 text-white rounded">فوری / بحرانی</span>;
case 'HIGH':
@@ -308,6 +328,7 @@ export default function TasksManagementPage() {
className="w-full px-3 py-2 text-xs bg-gray-50 border border-gray-200 rounded-xl focus:bg-white focus:outline-none focus:border-purple-500 font-bold text-gray-700"
>
<option value="ALL">همه اولویت‌ها</option>
<option value="CEO_EXPEDITE">⚡ فوری مدیرعامل (CEO_EXPEDITE)</option>
<option value="CRITICAL">بحرانی / فوری</option>
<option value="HIGH">بالا</option>
<option value="MEDIUM">متوسط</option>
@@ -514,16 +535,52 @@ export default function TasksManagementPage() {
/>
</div>
{/* Execution Logs */}
{/* Status History & Transitions Summary */}
{activeTaskModal.executionLogs && (() => {
const summary = getStatusTransitionsSummary(activeTaskModal.executionLogs);
return (
<div className="p-3 bg-purple-50/50 rounded-2xl border border-purple-100 space-y-2">
<div className="font-bold text-purple-900 text-[11px] flex items-center justify-between">
<span>آمار چرخه‌ها و وضعیت‌های طی‌شده تسک:</span>
<span className="font-mono text-[10px] text-purple-700 bg-white px-2 py-0.5 rounded-full border border-purple-200">
{summary.totalEvents} رکورد ثبتی
</span>
</div>
<div className="grid grid-cols-2 sm:grid-cols-4 gap-2">
<div className="bg-white p-2 rounded-xl border border-blue-100 text-center shadow-xs">
<span className="block text-[10px] text-gray-500 font-bold">دفعات ارجاع به اجرا</span>
<span className="text-xs font-black text-blue-700 font-mono">{summary.inProgressCount} بار</span>
</div>
<div className="bg-white p-2 rounded-xl border border-amber-100 text-center shadow-xs">
<span className="block text-[10px] text-gray-500 font-bold">بررسی تست و QA</span>
<span className="text-xs font-black text-amber-700 font-mono">{summary.testCount} بار</span>
</div>
<div className="bg-white p-2 rounded-xl border border-rose-100 text-center shadow-xs">
<span className="block text-[10px] text-gray-500 font-bold">عدم تایید QA</span>
<span className="text-xs font-black text-rose-700 font-mono">{summary.qaRejectedCount} بار</span>
</div>
<div className="bg-white p-2 rounded-xl border border-emerald-100 text-center shadow-xs">
<span className="block text-[10px] text-gray-500 font-bold">تاییدیه کیفی</span>
<span className="text-xs font-black text-emerald-700">{summary.qaPassedCount > 0 ? 'دارد (تایید)' : 'در جریان'}</span>
</div>
</div>
</div>
);
})()}
{/* Execution Logs Timeline */}
{activeTaskModal.executionLogs && (
<div className="pt-2 space-y-1">
<div className="font-bold text-gray-600 text-[11px]">تاریخچه اقدامات انجام‌شده روی این تسک:</div>
<div className="space-y-1 max-h-36 overflow-y-auto">
<div className="pt-2 space-y-1.5">
<div className="font-bold text-gray-600 text-[11px] flex items-center justify-between">
<span>تایم‌لاین رویدادها و تغییر وضعیت‌ها:</span>
<span className="text-[10px] text-gray-400">(به وقت تهران)</span>
</div>
<div className="space-y-1.5 max-h-48 overflow-y-auto p-1">
{renderExecutionLogs(activeTaskModal.executionLogs).map((lg: any, i: number) => (
<div key={i} className="text-[10px] p-2 bg-gray-50 rounded-lg flex items-center justify-between">
<span className="font-bold text-gray-800">{lg.note || JSON.stringify(lg)}</span>
<span className="text-gray-400 font-mono">
{lg.timestamp ? new Date(lg.timestamp).toLocaleTimeString('fa-IR') : '-'}
<div key={i} className="text-[10px] p-2.5 bg-gray-50 hover:bg-gray-100/70 rounded-xl flex items-start justify-between gap-3 border border-gray-100 transition-colors">
<span className="font-bold text-gray-800 leading-relaxed text-right flex-1">{lg.note || JSON.stringify(lg)}</span>
<span className="text-gray-400 font-mono text-[9px] whitespace-nowrap dir-ltr pt-0.5">
{lg.timestamp ? new Date(lg.timestamp).toLocaleString('fa-IR', { hour: '2-digit', minute: '2-digit', second: '2-digit', day: '2-digit', month: '2-digit' }) : '-'}
</span>
</div>
))}