connect tailscale node status through platform gateway
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -55,6 +55,24 @@ export function formatPipelineTime(value?: number | null) {
|
||||
return new Date(ms).toLocaleString();
|
||||
}
|
||||
|
||||
export function formatPipelineRelativeTime(value?: number | null) {
|
||||
if (!value) return '-';
|
||||
const ms = value < 10_000_000_000 ? value * 1000 : value;
|
||||
const seconds = Math.max(0, Math.floor((Date.now() - ms) / 1000));
|
||||
if (seconds < 60) return '방금 전';
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
if (minutes < 60) return `${minutes}분 전`;
|
||||
const hours = Math.floor(minutes / 60);
|
||||
if (hours < 24) return `${hours}시간 전`;
|
||||
const days = Math.floor(hours / 24);
|
||||
if (days < 30) return `${days}일 전`;
|
||||
return new Intl.DateTimeFormat('ko-KR', { month: 'short', day: 'numeric' }).format(new Date(ms));
|
||||
}
|
||||
|
||||
export function formatRepositoryName(repository: string) {
|
||||
return repository.replace('/', ' / ');
|
||||
}
|
||||
|
||||
export function pipelineStatusTone(status?: string | null): 'green' | 'amber' | 'red' | 'blue' | 'neutral' {
|
||||
const value = (status ?? '').toLowerCase();
|
||||
if (['success', 'succeeded', 'passed'].includes(value)) return 'green';
|
||||
@@ -64,6 +82,15 @@ export function pipelineStatusTone(status?: string | null): 'green' | 'amber' |
|
||||
return 'neutral';
|
||||
}
|
||||
|
||||
export function pipelineStatusDotClass(status?: string | null) {
|
||||
const value = (status ?? '').toLowerCase();
|
||||
if (['success', 'succeeded', 'passed'].includes(value)) return 'bg-emerald-400 shadow-[0_0_0_3px_rgba(52,211,153,0.15)]';
|
||||
if (['running', 'started'].includes(value)) return 'bg-sky-400 shadow-[0_0_0_3px_rgba(56,189,248,0.15)]';
|
||||
if (['pending', 'queued', 'blocked', 'created'].includes(value)) return 'bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.15)]';
|
||||
if (['failure', 'failed', 'error', 'killed', 'declined'].includes(value)) return 'bg-rose-400 shadow-[0_0_0_3px_rgba(251,113,133,0.15)]';
|
||||
return 'bg-muted-foreground/60';
|
||||
}
|
||||
|
||||
export function isActivePipelineStatus(status?: string | null) {
|
||||
const value = (status ?? '').toLowerCase();
|
||||
return ['running', 'started', 'pending', 'queued', 'blocked', 'created'].includes(value);
|
||||
|
||||
Reference in New Issue
Block a user