Merge pull request 'feat(ui): birleşik metrik hesaplaması ekle' (#4) from deployment-dev into master
Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
@@ -150,7 +150,24 @@ export function HomePage() {
|
|||||||
.slice(0, 10);
|
.slice(0, 10);
|
||||||
}, [mergedRuns, deployRuns]);
|
}, [mergedRuns, deployRuns]);
|
||||||
|
|
||||||
const lastRunDuration = useMemo(() => formatDuration(mergedRuns[0]?.durationMs), [mergedRuns]);
|
const combinedTotals = useMemo(() => {
|
||||||
|
const jobSuccess = metrics?.dailyStats.reduce((acc, d) => acc + (d.success || 0), 0) ?? 0;
|
||||||
|
const jobTotal = metrics?.dailyStats.reduce((acc, d) => acc + (d.total || 0), 0) ?? 0;
|
||||||
|
const deploySuccess =
|
||||||
|
deploymentMetrics?.dailyStats.reduce((acc, d) => acc + (d.success || 0), 0) ?? 0;
|
||||||
|
const deployTotal =
|
||||||
|
deploymentMetrics?.dailyStats.reduce((acc, d) => acc + (d.total || 0), 0) ?? 0;
|
||||||
|
const totalRuns = jobTotal + deployTotal;
|
||||||
|
const successRate = totalRuns
|
||||||
|
? Math.round(((jobSuccess + deploySuccess) / totalRuns) * 100)
|
||||||
|
: 0;
|
||||||
|
return { totalRuns, successRate };
|
||||||
|
}, [metrics, deploymentMetrics]);
|
||||||
|
|
||||||
|
const lastRunDuration = useMemo(() => {
|
||||||
|
const latest = activityItems[0];
|
||||||
|
return formatDuration(latest?.durationMs);
|
||||||
|
}, [activityItems]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid gap-6">
|
<div className="grid gap-6">
|
||||||
@@ -163,7 +180,7 @@ export function HomePage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="text-xs text-muted-foreground flex items-center gap-2">
|
<div className="text-xs text-muted-foreground flex items-center gap-2">
|
||||||
<FontAwesomeIcon icon={faClockRotateLeft} className="h-3.5 w-3.5" />
|
<FontAwesomeIcon icon={faClockRotateLeft} className="h-3.5 w-3.5" />
|
||||||
{metrics?.totals.totalRuns ?? 0} toplam koşu
|
{combinedTotals.totalRuns} toplam koşu
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="h-48 min-w-0">
|
<CardContent className="h-48 min-w-0">
|
||||||
@@ -210,13 +227,13 @@ export function HomePage() {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<span>Başarı Oranı</span>
|
<span>Başarı Oranı</span>
|
||||||
<span className="text-lg font-semibold text-foreground">
|
<span className="text-lg font-semibold text-foreground">
|
||||||
{metrics?.totals.successRate ?? 0}%
|
{combinedTotals.successRate}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<span>Toplam Çalıştırma</span>
|
<span>Toplam Çalıştırma</span>
|
||||||
<span className="text-lg font-semibold text-foreground">
|
<span className="text-lg font-semibold text-foreground">
|
||||||
{metrics?.totals.totalRuns ?? 0}
|
{combinedTotals.totalRuns}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
|
|||||||
Reference in New Issue
Block a user