Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import {
AnnouncementEntity,
getActiveAnnouncements,
} from '../../../rest/announcementsAPI';

type AnnouncementsWidgetV2Props = WidgetCommonProps & {
type?: EntityType[];
};
Comment thread
gitar-bot[bot] marked this conversation as resolved.
Outdated
import {
getEntityFQN,
getEntityType,
Expand Down Expand Up @@ -62,7 +66,10 @@ const DUMMY_ANNOUNCEMENTS: AnnouncementEntity[] = [
},
];

const AnnouncementsWidgetV2 = ({ isEditView }: WidgetCommonProps) => {
const AnnouncementsWidgetV2 = ({
isEditView,
type,
}: AnnouncementsWidgetV2Props) => {
const { t } = useTranslation();
const navigate = useNavigate();
const [announcements, setAnnouncements] = useState<AnnouncementEntity[]>(
Expand All @@ -79,17 +86,17 @@ const AnnouncementsWidgetV2 = ({ isEditView }: WidgetCommonProps) => {
try {
const res = await getActiveAnnouncements();
const filtered = (res.data ?? []).filter((announcement) => {
const type = getEntityType(announcement.entityLink ?? '');
const entityType = getEntityType(announcement.entityLink ?? '');

return type === EntityType.DOMAIN || type === EntityType.DATA_PRODUCT;
return type ? type.includes(entityType as EntityType) : true;
});
setAnnouncements(filtered);
} catch {
setAnnouncements([]);
} finally {
setLoading(false);
}
}, [isEditView]);
}, [isEditView, type]);

useEffect(() => {
fetchAnnouncements();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ const DataMarketplacePage = () => {
</div>
<div className="marketplace-grid-wrapper" dir="ltr">
<div className="p-x-box">
<AnnouncementsWidgetV2 widgetKey="announcements" />
<AnnouncementsWidgetV2
type={[EntityType.DOMAIN, EntityType.DATA_PRODUCT]}
Comment thread
gitar-bot[bot] marked this conversation as resolved.
Outdated
widgetKey="announcements"
/>
Comment on lines +147 to +150
Comment on lines +147 to +150
</div>
<ReactGridLayout
className="grid-container p-x-box"
Expand Down
Loading