track requesters for builds releases deployments and migrations
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -3,6 +3,7 @@ import { useEffect, useMemo, useState } from 'react';
|
||||
import { Badge, Button, Card, CardHeader, Modal } from '../../components/ui';
|
||||
import { useToast } from '../../components/toast';
|
||||
import { PageTitle } from '../../layout/AppLayout';
|
||||
import { readCurrentAdmin } from '../../lib/admin-app-permissions';
|
||||
import { formatDateTime } from '../../lib/date-format';
|
||||
import { LoadingModal, useMinimumLoading } from '../operations/operation-utils';
|
||||
import {
|
||||
@@ -48,6 +49,41 @@ function jobTime(job: LauncherBuildJob) {
|
||||
return Number.isNaN(value) ? 0 : value;
|
||||
}
|
||||
|
||||
function BuildWorker({ job }: { job: LauncherBuildJob }) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
const currentAdmin = readCurrentAdmin();
|
||||
const name = job.requestedByName
|
||||
|| job.createdByName
|
||||
|| job.requestedBy
|
||||
|| job.createdBy
|
||||
|| currentAdmin?.name
|
||||
|| currentAdmin?.email
|
||||
|| 'admin';
|
||||
const avatarUrl = job.requestedByAvatarUrl
|
||||
|| job.createdByAvatarUrl
|
||||
|| currentAdmin?.avatarUrl
|
||||
|| '';
|
||||
const initial = name.trim().charAt(0).toUpperCase() || '?';
|
||||
|
||||
return (
|
||||
<span className="inline-flex min-w-0 items-center gap-2">
|
||||
{avatarUrl && !failed ? (
|
||||
<img
|
||||
src={avatarUrl}
|
||||
alt=""
|
||||
className="size-6 shrink-0 rounded-full border border-border bg-muted object-cover"
|
||||
onError={() => setFailed(true)}
|
||||
/>
|
||||
) : (
|
||||
<span className="inline-flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-muted text-[11px] font-semibold text-muted-foreground">
|
||||
{initial}
|
||||
</span>
|
||||
)}
|
||||
<b className="truncate text-foreground">{name}</b>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const launcherBuildJobPageSize = 3;
|
||||
type BuildTarget = 'launcher-client' | 'launcher-backend';
|
||||
type BuildRange = 'week' | 'month' | 'all';
|
||||
@@ -405,6 +441,7 @@ export function LauncherBuildPage() {
|
||||
<div className="mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground">
|
||||
<span>브랜치 <b className="text-foreground">{job.branch}</b></span>
|
||||
<span>커밋 <b className="font-mono text-foreground">{job.commitSha || '-'}</b></span>
|
||||
<span className="inline-flex min-w-0 items-center gap-2">작업자 <BuildWorker job={job} /></span>
|
||||
<span>생성 <b className="text-foreground">{formatDate(job.createdAt)}</b></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Copy, FileText, Link2, RotateCcw } from 'lucide-react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Badge, Button, Card, CardHeader, Modal } from '../../components/ui';
|
||||
import { useToast } from '../../components/toast';
|
||||
import { CommitAuthor } from '../../components/commit-author';
|
||||
import { PageTitle } from '../../layout/AppLayout';
|
||||
import { cn } from '../../lib/utils';
|
||||
import type { GiteaRepo } from '../../types/application';
|
||||
@@ -688,7 +689,7 @@ export function LauncherSourcePage() {
|
||||
) : null}
|
||||
{!commitsLoading && !commitsError ? commits.map((commit) => (
|
||||
<tr key={commit.sha} className="border-b border-border last:border-0">
|
||||
<td className="whitespace-nowrap px-5 py-3 font-medium">{commitAuthor(commit)}</td>
|
||||
<td className="whitespace-nowrap px-5 py-3"><CommitAuthor commit={commit} /></td>
|
||||
<td className="whitespace-nowrap px-5 py-3 font-mono text-xs text-muted-foreground">{commit.sha.slice(0, 10)}</td>
|
||||
<td className="max-w-[360px] truncate px-5 py-3">{commitMessage(commit)}</td>
|
||||
<td className="whitespace-nowrap px-5 py-3 text-muted-foreground">{relativeTime(commitDate(commit))}</td>
|
||||
|
||||
@@ -29,6 +29,14 @@ export type LauncherBuildJob = {
|
||||
downloadUrl: string;
|
||||
artifact: string;
|
||||
status: 'PENDING' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELED';
|
||||
requestedBy?: string | null;
|
||||
requestedByName?: string | null;
|
||||
requestedByEmail?: string | null;
|
||||
requestedByAvatarUrl?: string | null;
|
||||
createdBy?: string | null;
|
||||
createdByName?: string | null;
|
||||
createdByEmail?: string | null;
|
||||
createdByAvatarUrl?: string | null;
|
||||
logs?: string | null;
|
||||
startedAt?: string | null;
|
||||
finishedAt?: string | null;
|
||||
@@ -97,12 +105,16 @@ export type GiteaCommit = {
|
||||
username?: string;
|
||||
full_name?: string;
|
||||
name?: string;
|
||||
avatar_url?: string;
|
||||
avatarUrl?: string;
|
||||
} | null;
|
||||
committer?: {
|
||||
login?: string;
|
||||
username?: string;
|
||||
full_name?: string;
|
||||
name?: string;
|
||||
avatar_url?: string;
|
||||
avatarUrl?: string;
|
||||
} | null;
|
||||
created?: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user