split launcher source and build by component

This commit is contained in:
2026-07-02 14:47:58 +09:00
parent fedf9481f8
commit d226230b25
3 changed files with 237 additions and 67 deletions
+53 -20
View File
@@ -7,8 +7,10 @@ import { formatDateTime } from '../../lib/date-format';
import { LoadingModal, useMinimumLoading } from '../operations/operation-utils';
import {
createLauncherBuildJob,
getLauncherSource,
listLauncherBuildJobs,
listLauncherVersions,
type LauncherSource,
type LauncherBuildJob,
type LauncherVersion
} from './launcher-api';
@@ -43,6 +45,7 @@ function jobTime(job: LauncherBuildJob) {
}
const launcherBuildJobPageSize = 3;
type BuildTarget = 'launcher-client' | 'launcher-backend';
function sanitizeObjectKeyPart(value: string) {
return value
@@ -70,7 +73,9 @@ function launcherArtifactKey(version: string, branch: string, commitSha: string,
export function LauncherBuildPage() {
const { toast } = useToast();
const [target, setTarget] = useState<BuildTarget>('launcher-client');
const [versions, setVersions] = useState<LauncherVersion[]>([]);
const [source, setSource] = useState<LauncherSource | null>(null);
const [version, setVersion] = useState('');
const [branch, setBranch] = useState('release');
const [commitSha, setCommitSha] = useState('');
@@ -81,10 +86,16 @@ export function LauncherBuildPage() {
const loadingVisible = useMinimumLoading(loading);
const activeVersion = useMemo(() => versions.find((item) => item.isActive) ?? versions[0], [versions]);
const isBackend = target === 'launcher-backend';
const backendSource = source?.backend;
const clientSource = source?.client;
const artifactName = `autonomy-studio-launcher-${version || activeVersion?.version || '0.0.0'}.deb`;
const backendImageName = backendSource?.image || 'localhost:5000/studio-launcher-be';
const backendImageTag = `${backendImageName.replace(/\/$/, '')}:${version || '0.1.0'}`;
const backendDockerfile = backendSource?.dockerfile || 'Dockerfile';
const uploadPath = launcherArtifactKey(version || activeVersion?.version || '0.0.0', branch, commitSha, artifactName);
const downloadUrl = r2PublicBaseUrl ? `${r2PublicBaseUrl.replace(/\/$/, '')}/${encodeObjectKey(uploadPath)}` : '백엔드 R2 설정 기준으로 생성됩니다.';
const sortedJobs = useMemo(() => [...jobs].sort((a, b) => jobTime(b) - jobTime(a)), [jobs]);
const sortedJobs = useMemo(() => [...jobs].filter((job) => job.target === target).sort((a, b) => jobTime(b) - jobTime(a)), [jobs, target]);
const totalPages = Math.max(1, Math.ceil(sortedJobs.length / launcherBuildJobPageSize));
const currentPage = Math.min(page, totalPages);
const pageStart = (currentPage - 1) * launcherBuildJobPageSize;
@@ -93,14 +104,15 @@ export function LauncherBuildPage() {
const refresh = () => {
setLoading(true);
Promise.all([listLauncherVersions(), listLauncherBuildJobs()])
.then(([nextVersions, nextJobs]) => {
Promise.all([listLauncherVersions(), listLauncherBuildJobs(), getLauncherSource()])
.then(([nextVersions, nextJobs, nextSource]) => {
setVersions(nextVersions);
setJobs(nextJobs);
setSource(nextSource.source);
const nextVersion = nextVersions.find((item) => item.isActive) ?? nextVersions[0];
setVersion(nextVersion?.version ?? '');
setBranch(nextVersion?.branch ?? 'release');
setCommitSha(nextVersion?.commitSha ?? '');
setBranch(target === 'launcher-backend' ? nextSource.source.backend?.branch ?? 'release' : nextSource.source.client?.branch ?? nextVersion?.branch ?? 'release');
setCommitSha(target === 'launcher-backend' ? nextSource.source.backend?.commitSha ?? '' : nextSource.source.client?.commitSha ?? nextVersion?.commitSha ?? '');
})
.catch((error: Error) => {
toast({ type: 'error', title: '런처 버전 조회 실패', message: error.message });
@@ -112,6 +124,18 @@ export function LauncherBuildPage() {
refresh();
}, []);
useEffect(() => {
if (!source) return;
if (target === 'launcher-backend') {
setBranch(source.backend?.branch ?? 'release');
setCommitSha(source.backend?.commitSha ?? '');
return;
}
setBranch(source.client?.branch ?? activeVersion?.branch ?? 'release');
setCommitSha(source.client?.commitSha ?? activeVersion?.commitSha ?? '');
}, [activeVersion?.branch, activeVersion?.commitSha, source, target]);
useEffect(() => {
if (!hasActiveJob) return;
const timer = window.setInterval(() => {
@@ -135,14 +159,14 @@ export function LauncherBuildPage() {
const createJob = () => {
setLoading(true);
createLauncherBuildJob({
target: 'launcher-client',
repository: activeVersion?.repository ?? undefined,
target,
repository: isBackend ? backendSource?.repository ?? undefined : clientSource?.repository ?? activeVersion?.repository ?? undefined,
branch,
commitSha: commitSha.trim() || undefined,
version: version.trim(),
uploadPath,
artifact: artifactName,
downloadUrl: r2PublicBaseUrl ? downloadUrl : undefined
uploadPath: isBackend ? backendDockerfile : uploadPath,
artifact: isBackend ? backendImageName.replace(/^localhost:5000\//, '') : artifactName,
downloadUrl: isBackend ? backendImageTag : r2PublicBaseUrl ? downloadUrl : undefined
})
.then(({ job }) => {
setJobs((prev) => [job, ...prev]);
@@ -161,7 +185,7 @@ export function LauncherBuildPage() {
<PageTitle
eyebrow="런처 운영"
title="빌드 관리"
description="런처 설치 파일을 만들고 내부 파일 서버 업로드 위치를 관리합니다."
description="런처 클라이언트 설치 파일과 백엔드 컨테이너 이미지를 구성요소별로 빌드합니다."
actions={
<Button className="h-8 px-3 text-[13px]" onClick={createJob} disabled={!version.trim()}>
<Play className="size-4" />
@@ -170,12 +194,21 @@ export function LauncherBuildPage() {
}
/>
<div className="mb-4 flex flex-wrap gap-2">
<Button variant={target === 'launcher-client' ? 'default' : 'outline'} onClick={() => setTarget('launcher-client')}>
클라이언트
</Button>
<Button variant={target === 'launcher-backend' ? 'default' : 'outline'} onClick={() => setTarget('launcher-backend')}>
백엔드
</Button>
</div>
<div className="grid gap-4 xl:grid-cols-[420px_minmax(0,1fr)]">
<Card className="min-w-0 overflow-hidden">
<CardHeader title="빌드 요청" description="브랜치와 커밋 기준으로 런처 설치 파일을 생성합니다." />
<CardHeader title="빌드 요청" description={isBackend ? '브랜치와 커밋 기준으로 런처 백엔드 이미지를 빌드하고 레지스트리에 푸시합니다.' : '브랜치와 커밋 기준으로 런처 설치 파일을 생성합니다.'} />
<div className="space-y-4 p-5">
<label className="block">
<span className="text-xs font-medium text-muted-foreground">버전</span>
<span className="text-xs font-medium text-muted-foreground">{isBackend ? '이미지 태그' : '버전'}</span>
<input className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring" value={version} onChange={(event) => setVersion(event.target.value)} />
</label>
<label className="block">
@@ -191,18 +224,18 @@ export function LauncherBuildPage() {
<input className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 font-mono text-sm text-foreground outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-ring" value={commitSha} onChange={(event) => setCommitSha(event.target.value)} placeholder="비워두면 브랜치 최신 커밋" />
</label>
<div className="rounded-md border border-border bg-background p-3">
<p className="text-xs text-muted-foreground">예상 산출물</p>
<p className="mt-2 break-all font-mono text-xs text-foreground">{artifactName}</p>
<p className="mt-2 text-xs text-muted-foreground">R2 Object Key</p>
<p className="mt-1 break-all font-mono text-xs text-foreground">{uploadPath}</p>
<p className="mt-2 text-xs text-muted-foreground">다운로드 URL</p>
<p className="mt-1 break-all font-mono text-xs text-foreground">{downloadUrl}</p>
<p className="text-xs text-muted-foreground">{isBackend ? '이미지' : '예상 산출물'}</p>
<p className="mt-2 break-all font-mono text-xs text-foreground">{isBackend ? backendImageTag : artifactName}</p>
<p className="mt-2 text-xs text-muted-foreground">{isBackend ? 'Dockerfile' : 'R2 Object Key'}</p>
<p className="mt-1 break-all font-mono text-xs text-foreground">{isBackend ? backendDockerfile : uploadPath}</p>
<p className="mt-2 text-xs text-muted-foreground">{isBackend ? 'Repository' : '다운로드 URL'}</p>
<p className="mt-1 break-all font-mono text-xs text-foreground">{isBackend ? backendSource?.repository || '-' : downloadUrl}</p>
</div>
</div>
</Card>
<Card className="min-w-0 overflow-hidden">
<CardHeader title="빌드 작업 목록" description="생성된 런처 빌드 작업과 업로드 계획입니다." />
<CardHeader title="빌드 작업 목록" description={isBackend ? '런처 백엔드 이미지 빌드 작업입니다.' : '생성된 런처 클라이언트 빌드 작업과 업로드 계획입니다.'} />
<div className="flex justify-end px-4 pt-4">
<Button variant="outline" className="h-8 px-3 text-[13px]" onClick={refresh} disabled={loading}>
<RotateCcw className={loading ? 'size-4 animate-spin' : 'size-4'} />
+159 -46
View File
@@ -3,57 +3,129 @@ import { useEffect, useMemo, useState } from 'react';
import { Badge, Button, Card, CardHeader } from '../../components/ui';
import { useToast } from '../../components/toast';
import { PageTitle } from '../../layout/AppLayout';
import { cn } from '../../lib/utils';
import type { GiteaRepo } from '../../types/application';
import { LoadingModal, useMinimumLoading } from '../operations/operation-utils';
import { getLauncherSource, listLauncherVersions, listPlatformRepos, updateLauncherSource, type LauncherVersion } from './launcher-api';
import {
getLauncherSource,
listLauncherVersions,
listPlatformRepos,
listStudioRepos,
updateLauncherSource,
type LauncherVersion
} from './launcher-api';
const giteaBaseUrl = import.meta.env.VITE_GITEA_BASE_URL ?? 'http://localhost:3000';
const giteaSshBaseUrl = import.meta.env.VITE_GITEA_SSH_BASE_URL ?? 'ssh://git@localhost:2222';
const giteaAppOrg = import.meta.env.VITE_GITEA_APP_ORG ?? 'platform';
type SourceTarget = 'launcher-client' | 'launcher-backend';
type SourceForm = {
repository: string;
branch: string;
commitSha: string;
image: string;
dockerfile: string;
};
const targetLabels: Record<SourceTarget, { title: string; description: string; defaultOrg: string }> = {
'launcher-client': {
title: '클라이언트',
description: '사용자 PC에 설치되는 Electron .deb 빌드 소스입니다.',
defaultOrg: 'platform'
},
'launcher-backend': {
title: '백엔드',
description: 'portal-api 런처 백엔드 컨테이너 이미지 빌드 소스입니다.',
defaultOrg: 'studio'
}
};
function repoFullName(repo: GiteaRepo) {
return (repo as GiteaRepo & { fullName?: string }).fullName ?? repo.full_name ?? normalizeRepository(repo.name);
}
function normalizeRepository(repository?: string | null) {
function normalizeRepository(repository?: string | null, fallbackOrg = giteaAppOrg) {
if (!repository) return '';
const value = repository.replace(/^\/+|\/+$/g, '');
return value.includes('/') ? value : `${giteaAppOrg}/${value}`;
return value.includes('/') ? value : `${fallbackOrg}/${value}`;
}
function httpCloneUrl(repository?: string | null) {
const normalizedRepository = normalizeRepository(repository);
function httpCloneUrl(repository?: string | null, fallbackOrg?: string) {
const normalizedRepository = normalizeRepository(repository, fallbackOrg);
return normalizedRepository ? `${giteaBaseUrl.replace(/\/$/, '')}/${normalizedRepository}.git` : '-';
}
function sshCloneUrl(repository?: string | null) {
const normalizedRepository = normalizeRepository(repository);
function sshCloneUrl(repository?: string | null, fallbackOrg?: string) {
const normalizedRepository = normalizeRepository(repository, fallbackOrg);
return normalizedRepository ? `${giteaSshBaseUrl.replace(/\/$/, '')}/${normalizedRepository}.git` : '-';
}
function emptyForm(): SourceForm {
return {
repository: '',
branch: 'release',
commitSha: '',
image: 'localhost:5000/studio-launcher-be',
dockerfile: 'Dockerfile'
};
}
export function LauncherSourcePage() {
const { toast } = useToast();
const [activeTarget, setActiveTarget] = useState<SourceTarget>('launcher-client');
const [versions, setVersions] = useState<LauncherVersion[]>([]);
const [repos, setRepos] = useState<GiteaRepo[]>([]);
const [repository, setRepository] = useState('');
const [branch, setBranch] = useState('release');
const [commitSha, setCommitSha] = useState('');
const [forms, setForms] = useState<Record<SourceTarget, SourceForm>>({
'launcher-client': emptyForm(),
'launcher-backend': emptyForm()
});
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
const loadingVisible = useMinimumLoading(loading);
const activeVersion = useMemo(() => versions.find((version) => version.isActive) ?? versions[0], [versions]);
const activeForm = forms[activeTarget];
const activeTargetMeta = targetLabels[activeTarget];
const updateForm = (patch: Partial<SourceForm>) => {
setForms((prev) => ({
...prev,
[activeTarget]: {
...prev[activeTarget],
...patch
}
}));
};
const refresh = () => {
setLoading(true);
Promise.all([listLauncherVersions(), listPlatformRepos(), getLauncherSource()])
.then(([nextVersions, nextRepos, sourceResult]) => {
setVersions(nextVersions);
setRepos(nextRepos);
Promise.all([listLauncherVersions(), listPlatformRepos(), listStudioRepos(), getLauncherSource()])
.then(([nextVersions, platformRepos, studioRepos, sourceResult]) => {
const mergedRepos = [...platformRepos, ...studioRepos];
const nextVersion = nextVersions.find((version) => version.isActive) ?? nextVersions[0];
setRepository(sourceResult.source.repository ?? nextVersion?.repository ?? (nextRepos[0] ? repoFullName(nextRepos[0]) : ''));
setBranch(sourceResult.source.branch ?? nextVersion?.branch ?? 'release');
setCommitSha(sourceResult.source.commitSha ?? nextVersion?.commitSha ?? '');
const clientRepository = sourceResult.source.client?.repository ?? sourceResult.source.repository ?? nextVersion?.repository ?? (platformRepos[0] ? repoFullName(platformRepos[0]) : '');
const backendRepository = sourceResult.source.backend?.repository ?? (studioRepos[0] ? repoFullName(studioRepos[0]) : '');
setVersions(nextVersions);
setRepos(mergedRepos);
setForms({
'launcher-client': {
repository: clientRepository,
branch: sourceResult.source.client?.branch ?? sourceResult.source.branch ?? nextVersion?.branch ?? 'release',
commitSha: sourceResult.source.client?.commitSha ?? sourceResult.source.commitSha ?? nextVersion?.commitSha ?? '',
image: '',
dockerfile: ''
},
'launcher-backend': {
repository: backendRepository,
branch: sourceResult.source.backend?.branch ?? 'release',
commitSha: sourceResult.source.backend?.commitSha ?? '',
image: sourceResult.source.backend?.image ?? 'localhost:5000/studio-launcher-be',
dockerfile: sourceResult.source.backend?.dockerfile ?? 'Dockerfile'
}
});
})
.catch((error: Error) => {
toast({ type: 'error', title: '소스 정보 조회 실패', message: error.message });
@@ -66,15 +138,18 @@ export function LauncherSourcePage() {
}, []);
const save = () => {
if (!repository.trim()) return;
if (!activeForm.repository.trim()) return;
setSaving(true);
updateLauncherSource({
repository: repository.trim(),
branch: branch.trim() || undefined,
commitSha: commitSha.trim() || undefined
target: activeTarget,
repository: activeForm.repository.trim(),
branch: activeForm.branch.trim() || undefined,
commitSha: activeForm.commitSha.trim() || undefined,
image: activeTarget === 'launcher-backend' ? activeForm.image.trim() || undefined : undefined,
dockerfile: activeTarget === 'launcher-backend' ? activeForm.dockerfile.trim() || undefined : undefined
})
.then(() => {
toast({ type: 'success', title: '소스 연결', message: '런처 소스 연결을 저장했습니다.' });
toast({ type: 'success', title: '소스 연결', message: `${activeTargetMeta.title} 소스 연결을 저장했습니다.` });
refresh();
})
.catch((error: Error) => {
@@ -93,7 +168,7 @@ export function LauncherSourcePage() {
<PageTitle
eyebrow="런처 운영"
title="소스 관리"
description="런처 클라이언트와 관련 소스 저장소를 연결합니다."
description="런처 클라이언트와 백엔드 소스 저장소를 구성요소별로 연결합니다."
actions={
<Button variant="outline" className="h-8 px-3 text-[13px]" onClick={refresh} disabled={loading}>
<RotateCcw className={loading ? 'size-4 animate-spin' : 'size-4'} />
@@ -102,27 +177,41 @@ export function LauncherSourcePage() {
}
/>
<div className="mb-4 flex flex-wrap gap-2">
{(Object.keys(targetLabels) as SourceTarget[]).map((target) => (
<Button
key={target}
variant={activeTarget === target ? 'default' : 'outline'}
onClick={() => setActiveTarget(target)}
>
{targetLabels[target].title}
</Button>
))}
</div>
<div className="grid gap-4 xl:grid-cols-[minmax(0,620px)_minmax(0,1fr)]">
<Card className="min-w-0 overflow-hidden">
<CardHeader title="소스 연결" description="런처 빌드에 사용할 저장소와 기준 브랜치를 선택합니다." />
<CardHeader title={`${activeTargetMeta.title} 소스 연결`} description={activeTargetMeta.description} />
<div className="grid gap-4 p-5 md:grid-cols-3">
<label className="block md:col-span-2">
<span className="text-xs font-medium text-muted-foreground">저장소</span>
<select
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring"
value={repository}
onChange={(event) => setRepository(event.target.value)}
>
{repos.length === 0 ? <option value="">등록된 저장소 없음</option> : null}
{repos.map((repo) => <option key={repoFullName(repo)} value={repoFullName(repo)}>{repoFullName(repo)}</option>)}
</select>
<input
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-ring"
value={activeForm.repository}
onChange={(event) => updateForm({ repository: event.target.value })}
list="launcher-source-repositories"
placeholder={`${activeTargetMeta.defaultOrg}/repository`}
/>
<datalist id="launcher-source-repositories">
{repos.map((repo) => <option key={repoFullName(repo)} value={repoFullName(repo)} />)}
</datalist>
</label>
<label className="block">
<span className="text-xs font-medium text-muted-foreground">브랜치</span>
<select
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring"
value={branch}
onChange={(event) => setBranch(event.target.value)}
value={activeForm.branch}
onChange={(event) => updateForm({ branch: event.target.value })}
>
<option value="develop">develop</option>
<option value="release">release</option>
@@ -133,13 +222,35 @@ export function LauncherSourcePage() {
<span className="text-xs font-medium text-muted-foreground">Commit SHA</span>
<input
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 font-mono text-sm text-foreground outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-ring"
value={commitSha}
onChange={(event) => setCommitSha(event.target.value)}
value={activeForm.commitSha}
onChange={(event) => updateForm({ commitSha: event.target.value })}
placeholder="비워두면 브랜치 최신 커밋 기준"
/>
</label>
{activeTarget === 'launcher-backend' ? (
<>
<label className="block md:col-span-2">
<span className="text-xs font-medium text-muted-foreground">이미지 이름</span>
<input
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 font-mono text-sm text-foreground outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-ring"
value={activeForm.image}
onChange={(event) => updateForm({ image: event.target.value })}
placeholder="localhost:5000/studio-launcher-be"
/>
</label>
<label className="block">
<span className="text-xs font-medium text-muted-foreground">Dockerfile</span>
<input
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 font-mono text-sm text-foreground outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-ring"
value={activeForm.dockerfile}
onChange={(event) => updateForm({ dockerfile: event.target.value })}
placeholder="Dockerfile"
/>
</label>
</>
) : null}
<div className="flex justify-end md:col-span-3">
<Button onClick={save} disabled={!repository.trim() || saving}>
<Button onClick={save} disabled={!activeForm.repository.trim() || saving}>
<Link2 className="size-4" />
저장
</Button>
@@ -148,17 +259,19 @@ export function LauncherSourcePage() {
</Card>
<Card className="min-w-0 overflow-hidden">
<CardHeader title="현재 연결" description="런처 빌드 기준입니다." />
<CardHeader title="현재 연결" description={`${activeTargetMeta.title} 빌드 기준입니다.`} />
<div className="space-y-4 p-5 text-sm">
<div className="flex items-center justify-between gap-3">
<span className="text-muted-foreground">버전</span>
<Badge tone={activeVersion?.isActive ? 'green' : 'neutral'}>{activeVersion?.version ?? '-'}</Badge>
<span className="text-muted-foreground">기준</span>
<Badge tone={activeTarget === 'launcher-client' && activeVersion?.isActive ? 'green' : 'neutral'}>
{activeTarget === 'launcher-client' ? activeVersion?.version ?? '-' : activeForm.image || '-'}
</Badge>
</div>
<div>
<p className="text-xs text-muted-foreground">HTTP Clone URL</p>
<div className="mt-2 flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2">
<p className="min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground">{httpCloneUrl(repository)}</p>
<Button variant="ghost" className="size-8 px-0" onClick={() => copy(httpCloneUrl(repository))} aria-label="HTTP clone URL 복사">
<p className="min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground">{httpCloneUrl(activeForm.repository, activeTargetMeta.defaultOrg)}</p>
<Button variant="ghost" className="size-8 px-0" onClick={() => copy(httpCloneUrl(activeForm.repository, activeTargetMeta.defaultOrg))} aria-label="HTTP clone URL 복사">
<Copy className="size-4" />
</Button>
</div>
@@ -166,14 +279,14 @@ export function LauncherSourcePage() {
<div>
<p className="text-xs text-muted-foreground">SSH Clone URL</p>
<div className="mt-2 flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2">
<p className="min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground">{sshCloneUrl(repository)}</p>
<Button variant="ghost" className="size-8 px-0" onClick={() => copy(sshCloneUrl(repository))} aria-label="SSH clone URL 복사">
<p className="min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground">{sshCloneUrl(activeForm.repository, activeTargetMeta.defaultOrg)}</p>
<Button variant="ghost" className="size-8 px-0" onClick={() => copy(sshCloneUrl(activeForm.repository, activeTargetMeta.defaultOrg))} aria-label="SSH clone URL 복사">
<Copy className="size-4" />
</Button>
</div>
</div>
{repository ? (
<a className="inline-flex items-center gap-1.5 text-xs text-primary" href={`${giteaBaseUrl.replace(/\/$/, '')}/${normalizeRepository(repository)}`} target="_blank" rel="noreferrer">
{activeForm.repository ? (
<a className="inline-flex items-center gap-1.5 text-xs text-primary" href={`${giteaBaseUrl.replace(/\/$/, '')}/${normalizeRepository(activeForm.repository, activeTargetMeta.defaultOrg)}`} target="_blank" rel="noreferrer">
저장소 열기
<ExternalLink className="size-3.5" />
</a>
+25 -1
View File
@@ -40,6 +40,18 @@ export type LauncherSource = {
repository?: string | null;
branch?: string | null;
commitSha?: string | null;
client?: {
repository?: string | null;
branch?: string | null;
commitSha?: string | null;
};
backend?: {
repository?: string | null;
branch?: string | null;
commitSha?: string | null;
image?: string | null;
dockerfile?: string | null;
};
};
export type LauncherAppLink = {
@@ -115,7 +127,14 @@ export function getLauncherSource() {
return apiRequest<{ source: LauncherSource }>('/launcher/source');
}
export function updateLauncherSource(input: { repository: string; branch?: string; commitSha?: string }) {
export function updateLauncherSource(input: {
target?: 'launcher-client' | 'launcher-backend';
repository: string;
branch?: string;
commitSha?: string;
image?: string;
dockerfile?: string;
}) {
return apiRequest<{ source: LauncherSource }>('/launcher/source', {
method: 'PATCH',
body: JSON.stringify(input)
@@ -127,6 +146,11 @@ export function listPlatformRepos(limit = 50) {
.then((result) => result.repos);
}
export function listStudioRepos(limit = 50) {
return apiRequest<{ owner: string | null; repos: GiteaRepo[] }>(`/gitea/repos?owner=studio&limit=${limit}`)
.then((result) => result.repos);
}
export function listLauncherBuildJobs() {
return apiRequest<LauncherBuildJob[]>('/launcher/builds');
}