Enhance ImagesViewSet and Images component with site and sector filtering

- Added site_id and sector_id query parameter support in ImagesViewSet for filtering content and task-linked images.
- Implemented event listeners in the Images component to refresh data on site and sector changes.
- Updated image prompt handling to allow undefined values.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-16 10:24:46 +00:00
parent 36b66b72f0
commit a492eb3560
3 changed files with 282 additions and 1 deletions

View File

@@ -153,6 +153,24 @@ export default function Images() {
loadImages();
}, [loadImages]);
// Listen for site and sector changes and refresh data
useEffect(() => {
const handleSiteChange = () => {
loadImages();
};
const handleSectorChange = () => {
loadImages();
};
window.addEventListener('siteChanged', handleSiteChange);
window.addEventListener('sectorChanged', handleSectorChange);
return () => {
window.removeEventListener('siteChanged', handleSiteChange);
window.removeEventListener('sectorChanged', handleSectorChange);
};
}, [loadImages]);
// Debounced search
useEffect(() => {
const timer = setTimeout(() => {
@@ -258,7 +276,7 @@ export default function Images() {
type: 'in_article',
position: img.position || idx + 1,
contentTitle: contentImages.content_title || `Content #${contentId}`,
prompt: img.prompt,
prompt: img.prompt || undefined,
status: 'pending',
progress: 0,
imageUrl: null,