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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user