improve admin build release and notice screens
This commit is contained in:
@@ -87,6 +87,7 @@ export function BuildManagementPage() {
|
||||
const selectedComponent = componentOptions.find((source) => source.id === selectedComponentId) ?? componentOptions[0];
|
||||
const selectedTarget = selectedComponent?.buildTarget || buildTargetForType(selectedComponent?.type);
|
||||
const predicted = predictedArtifact(selectedComponent, branch, commitSha);
|
||||
const hasActiveJob = jobs.some((job) => job.status === 'PENDING' || job.status === 'RUNNING');
|
||||
|
||||
const refresh = async () => {
|
||||
setLoading(true);
|
||||
@@ -112,6 +113,26 @@ export function BuildManagementPage() {
|
||||
void refresh();
|
||||
}, [selectedAppId, selectedApp?.key]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasActiveJob) return;
|
||||
const timer = window.setInterval(() => {
|
||||
listBuildJobs(selectedApp?.key)
|
||||
.then((nextJobs) => setJobs(nextJobs))
|
||||
.catch((error: Error) => {
|
||||
toast({ type: 'error', message: `빌드 작업 갱신 실패: ${error.message}` });
|
||||
});
|
||||
}, 2000);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [hasActiveJob, selectedApp?.key, toast]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedJob) return;
|
||||
const nextSelectedJob = jobs.find((job) => job.id === selectedJob.id);
|
||||
if (nextSelectedJob && nextSelectedJob !== selectedJob) {
|
||||
setSelectedJob(nextSelectedJob);
|
||||
}
|
||||
}, [jobs, selectedJob]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!componentOptions.some((source) => source.id === selectedComponentId)) {
|
||||
const nextComponent = componentOptions[0];
|
||||
|
||||
@@ -28,7 +28,7 @@ type NoticeForm = {
|
||||
};
|
||||
|
||||
const emptyForm: NoticeForm = {
|
||||
appKey: 'launcher',
|
||||
appKey: 'Launcher',
|
||||
title: '',
|
||||
body: '',
|
||||
linkUrl: '',
|
||||
@@ -357,7 +357,7 @@ export function NoticesPage() {
|
||||
<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={form.appKey} onChange={(event) => setForm((prev) => ({ ...prev, appKey: event.target.value }))}>
|
||||
<option value="launcher">Launcher</option>
|
||||
<option value="Launcher">Launcher</option>
|
||||
{apps.map((app) => (
|
||||
<option key={app.id} value={app.key}>{app.name}</option>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user