Added React loading spinners to all dropdown elements in the OpenShift ImageSetConfiguration Generator application to provide visual feedback when the application is waiting for API responses.
- File:
frontend/src/components/LoadingSpinner.js - Purpose: Reusable spinner component with configurable size and positioning
- Features:
- Sizes: small (16px), medium (24px), large (32px)
- Inline positioning option for labels
- CSS animations with rotating border effect
- File:
frontend/src/components/LoadingSpinner.css - Purpose: Styling for the spinner with smooth rotation animation
- Features:
- Responsive sizing based on component props
- Smooth 1-second rotation animation
- Blue accent color matching application theme
- File:
frontend/src/App.js - Changes:
- Added
isLoadingReleasesstate for OCP releases API calls - Added
isLoadingChannelsstate for OCP channels API calls - Updated
fetchChannelsForVersionto track loading state - Updated
loadOcpReleasesto track loading state - Pass loading states to BasicConfig component
- Added
- File:
frontend/src/components/BasicConfig.js - Changes:
- Import LoadingSpinner component
- Added loading spinners to all dropdown labels when respective API calls are in progress
- Updated dropdown disabled states to include loading conditions
- Enhanced help text to show loading status for channels
- Improved user experience with contextual loading messages
- File:
frontend/src/components/PreviewGenerate.js - Changes:
- Import LoadingSpinner component
- Replaced generic loading text with actual spinner component
- Better visual feedback during YAML generation
-
OCP Releases Dropdown:
- Shows spinner in label while fetching releases from oc-mirror
- Dropdown disabled during loading
- Loading message in dropdown option
-
OCP Channels Dropdown:
- Shows spinner in label while fetching version-specific channels
- Dropdown disabled during loading
- Contextual help text showing loading progress
-
Generate Preview Button:
- Shows inline spinner during YAML generation
- Clear visual feedback with spinner and text
- Initial App Load: Spinner shown while fetching OCP releases
- Version Selection: Spinner shown while fetching channels for selected version
- Configuration Generation: Spinner shown during YAML preview generation
- Error States: Graceful fallback with appropriate messaging
const [isLoadingReleases, setIsLoadingReleases] = useState(false);
const [isLoadingChannels, setIsLoadingChannels] = useState(false);// In labels with inline spinner
<label htmlFor="dropdown">
Label Text
{isLoading && <LoadingSpinner size="small" inline />}
</label>
// In buttons
{isGenerating ? (
<>
<LoadingSpinner size="small" inline />
Generating...
</>
) : (
'Generate Preview'
)}disabled={isLoadingReleases || !hasRequiredData()}/api/versions- OCP releases fetching with loading state/api/channels/<version>- Version-specific channels with loading state/api/generate/preview- YAML generation with loading state
- ✅ Loading spinners appear during API calls
- ✅ Dropdowns are disabled during loading
- ✅ Contextual loading messages are displayed
- ✅ Error states gracefully handle failed API calls
- ✅ Loading states clear properly after completion
- Add timeout indicators for long-running operations
- Implement progress bars for file uploads/downloads
- Add skeleton loaders for complex UI components
- Consider adding global loading state for app-wide operations