Skip to content

Commit 9c4d704

Browse files
author
secus
committed
feat: Improve container error handling and environment variables UI
- Add comprehensive container error handling for ContainerCreating, waiting to start, and BadRequest errors - Create errorHandlers utility for consistent error analysis across components - Improve LogsPage with better retry logic and user-friendly messages (15 retries, 4-6s intervals) - Enhanced DeploymentDetailPage error handling for all operations (env vars, scaling, restart, delete) - Add container status warning banner for pending/updating deployments - Redesign environment variables UI to handle long values properly: - Use textarea for editing long values with Ctrl+Enter to save - Add responsive layout with proper text wrapping and scrolling - Show character count and tooltips for long values - Improve add/edit forms with better validation and UX - Replace scary error messages with educational, user-friendly notifications - All container startup errors now show helpful context instead of raw API errors
1 parent c921583 commit 9c4d704

3 files changed

Lines changed: 382 additions & 186 deletions

File tree

apps/container-engine-frontend/src/components/DeploymentDetail/LogsPage.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useState, useEffect, useRef } from 'react';
33
import { ClipboardDocumentListIcon, CubeIcon } from "@heroicons/react/24/outline";
44
import { useParams } from 'react-router-dom';
55
import api from '../../api/api';
6+
import { shouldRetryContainerError, getContainerErrorMessage, analyzeContainerError } from '../../utils/errorHandlers';
67

78
export default function LogsPage() {
89
const { deploymentId } = useParams();
@@ -108,24 +109,20 @@ export default function LogsPage() {
108109
setError('Authentication failed. Please login again.');
109110
} else if (err?.response?.status === 404) {
110111
setError('Deployment not found or no logs available.');
111-
} else if (err?.response?.status === 400 && err?.response?.data?.message?.includes('ContainerCreating')) {
112-
if (retryCount < 10) {
113-
setError(`Container is starting up... (Retry ${retryCount + 1}/10)`);
114-
setTimeout(() => loadHistoricalLogs(retryCount + 1), 3000);
115-
return;
116-
} else {
117-
setError('Container is taking longer than expected to start. Please refresh manually.');
118-
}
119-
} else if (err?.response?.status === 400 && err?.response?.data?.message?.includes('waiting to start')) {
120-
if (retryCount < 10) {
121-
setError(`Container is being created... (Retry ${retryCount + 1}/10)`);
122-
setTimeout(() => loadHistoricalLogs(retryCount + 1), 3000);
123-
return;
112+
} else if (shouldRetryContainerError(err, retryCount, 15)) {
113+
const errorMessage = getContainerErrorMessage(err, retryCount, 15);
114+
const analysis = analyzeContainerError(err);
115+
116+
setError(errorMessage);
117+
setTimeout(() => loadHistoricalLogs(retryCount + 1), analysis.retryDelay || 4000);
118+
return;
119+
} else {
120+
const analysis = analyzeContainerError(err);
121+
if (analysis.isContainerError) {
122+
setError(getContainerErrorMessage(err, retryCount, 15));
124123
} else {
125-
setError('Container is taking longer than expected to start. Please refresh manually.');
124+
setError('Failed to load log history');
126125
}
127-
} else {
128-
setError('Failed to load log history');
129126
}
130127
} finally {
131128
setIsLoadingHistory(false);

0 commit comments

Comments
 (0)