fix docker build for vendored page agent
This commit is contained in:
@@ -3,14 +3,12 @@ import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useToast } from '../../components/toast';
|
||||
import { Badge, Button, Card, CardHeader, Modal } from '../../components/ui';
|
||||
import { PageTitle } from '../../layout/AppLayout';
|
||||
import type { AppRelease } from '../../types/application';
|
||||
import type { ApiApp, ApiAppComponent } from '../../types/runtime';
|
||||
import { LoadingModal, useMinimumLoading } from '../operations/operation-utils';
|
||||
import { AppSelector, useApps } from './ApplicationControls';
|
||||
import {
|
||||
getGiteaCommitDiff,
|
||||
listGiteaCommitsPage,
|
||||
listReleases,
|
||||
listSources,
|
||||
type GiteaCommit
|
||||
} from './application-api';
|
||||
@@ -68,11 +66,6 @@ function repositoryGitUrl(repository?: string | null) {
|
||||
return normalized ? `${giteaBaseUrl.replace(/\/$/, '')}/${normalized}.git` : '-';
|
||||
}
|
||||
|
||||
function releaseTime(release: AppRelease) {
|
||||
const value = new Date(release.createdAt).getTime();
|
||||
return Number.isNaN(value) ? 0 : value;
|
||||
}
|
||||
|
||||
function commitAuthor(commit: GiteaCommit) {
|
||||
return commit.author?.login
|
||||
|| commit.author?.username
|
||||
@@ -304,7 +297,6 @@ export function SourceManagementPage() {
|
||||
const { toast } = useToast();
|
||||
const { apps, selectedAppId, loading: appsLoading, selectApp } = useApps();
|
||||
const [sources, setSources] = useState<SourceComponent[]>([]);
|
||||
const [releases, setReleases] = useState<AppRelease[]>([]);
|
||||
const [sourcesLoading, setSourcesLoading] = useState(true);
|
||||
const [selectedSourceId, setSelectedSourceId] = useState('');
|
||||
const [selectedBranch, setSelectedBranch] = useState('release');
|
||||
@@ -328,33 +320,19 @@ export function SourceManagementPage() {
|
||||
const selectedSource = filteredSources.find((source) => source.id === selectedSourceId) ?? filteredSources[0] ?? null;
|
||||
const repository = splitRepository(selectedSource?.repository);
|
||||
const branch = selectedBranch || 'release';
|
||||
const latestBranchSha = commits.length > 0 ? commits[0]?.sha ?? '' : '';
|
||||
const branchOptions = useMemo(
|
||||
() => [...new Set(['release', 'develop', 'main', selectedSource?.branch].filter((item): item is string => Boolean(item)))],
|
||||
[selectedSource?.branch]
|
||||
);
|
||||
const latestRelease = useMemo(
|
||||
() => releases
|
||||
.filter((release) => release.appId === selectedSource?.appId && release.status === 'SUCCEEDED')
|
||||
.sort((a, b) => releaseTime(b) - releaseTime(a))[0],
|
||||
[releases, selectedSource?.appId]
|
||||
);
|
||||
const totalCommitPages = totalCommits === null ? null : Math.max(1, Math.ceil(totalCommits / commitPageSize));
|
||||
const selectedRepositoryGitUrl = repositoryGitUrl(selectedSource?.repository);
|
||||
|
||||
const refreshSources = () => {
|
||||
setSourcesLoading(true);
|
||||
Promise.all([
|
||||
listSources(),
|
||||
listReleases().catch(() => [])
|
||||
])
|
||||
.then(([sourceItems, releaseItems]) => {
|
||||
setSources(sourceItems);
|
||||
setReleases(releaseItems);
|
||||
})
|
||||
.catch(() => {
|
||||
setSources([]);
|
||||
setReleases([]);
|
||||
})
|
||||
listSources()
|
||||
.then((sourceItems) => setSources(sourceItems))
|
||||
.catch(() => setSources([]))
|
||||
.finally(() => setSourcesLoading(false));
|
||||
};
|
||||
|
||||
@@ -464,6 +442,18 @@ export function SourceManagementPage() {
|
||||
</label>
|
||||
</div>
|
||||
<div className="grid gap-3 rounded-md border border-border bg-muted/20 p-3 text-sm md:grid-cols-2">
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">조회 브랜치</p>
|
||||
<select
|
||||
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground outline-none focus:ring-2 focus:ring-ring"
|
||||
value={branch}
|
||||
onChange={(event) => setSelectedBranch(event.target.value)}
|
||||
>
|
||||
{branchOptions.map((option) => (
|
||||
<option key={option} value={option}>{option}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="min-w-0 md:col-span-2">
|
||||
<p className="text-xs text-muted-foreground">저장소</p>
|
||||
<div className="mt-2 rounded-md border border-border bg-background px-3 py-2">
|
||||
@@ -480,23 +470,13 @@ export function SourceManagementPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">버전</p>
|
||||
<p className="text-xs text-muted-foreground">SHA1</p>
|
||||
<div className="mt-2 rounded-md border border-border bg-background px-3 py-2">
|
||||
<p className="truncate text-sm font-medium">{latestRelease?.version ?? '-'}</p>
|
||||
<p className="truncate font-mono text-sm font-medium" title={latestBranchSha || '-'}>
|
||||
{latestBranchSha || '-'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">조회 브랜치</p>
|
||||
<select
|
||||
className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground outline-none focus:ring-2 focus:ring-ring"
|
||||
value={branch}
|
||||
onChange={(event) => setSelectedBranch(event.target.value)}
|
||||
>
|
||||
{branchOptions.map((option) => (
|
||||
<option key={option} value={option}>{option}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user