diff --git a/frontend/common/access/hooks/useMapContentTypeToDisplayName.tsx b/frontend/common/access/hooks/useMapContentTypeToDisplayName.tsx index b93ba34bd2..1b4bdb2089 100644 --- a/frontend/common/access/hooks/useMapContentTypeToDisplayName.tsx +++ b/frontend/common/access/hooks/useMapContentTypeToDisplayName.tsx @@ -22,6 +22,7 @@ export function useMapContentTypeToDisplayName() { decisionenvironment: options?.isTitleCase ? t('Decision Environment') : t('decision environment'), + eventstream: options?.isTitleCase ? t('Event Stream') : t('event stream'), auditrule: options?.isTitleCase ? t('Rule Audit') : t('rule audit'), team: options?.isTitleCase ? t('Team') : t('team'), organization: options?.isTitleCase ? t('Organization') : t('organization'), diff --git a/frontend/eda/event-streams/EventStreamPage/EventStreamUserAccess.tsx b/frontend/eda/event-streams/EventStreamPage/EventStreamUserAccess.tsx index 85ffc5422d..a6aefb0cf2 100644 --- a/frontend/eda/event-streams/EventStreamPage/EventStreamUserAccess.tsx +++ b/frontend/eda/event-streams/EventStreamPage/EventStreamUserAccess.tsx @@ -8,7 +8,7 @@ export function EventStreamUserAccess() { ); diff --git a/frontend/eda/event-streams/EventStreams.tsx b/frontend/eda/event-streams/EventStreams.tsx index a3c544235e..06003592ef 100644 --- a/frontend/eda/event-streams/EventStreams.tsx +++ b/frontend/eda/event-streams/EventStreams.tsx @@ -8,7 +8,9 @@ import { useEventStreamActions } from './hooks/useEventStreamActions'; import { useEventStreamColumns } from './hooks/useEventStreamColumns'; import { useEventStreamFilters } from './hooks/useEventStreamFilters'; import { useEventStreamsActions } from './hooks/useEventStreamsActions'; -import { PlusCircleIcon } from '@patternfly/react-icons'; +import { CubesIcon, PlusCircleIcon } from '@patternfly/react-icons'; +import { useOptions } from '../../common/crud/useOptions'; +import { ActionsResponse, OptionsResponse } from '../interfaces/OptionsResponse'; export function EventStreams() { const { t } = useTranslation(); @@ -21,6 +23,8 @@ export function EventStreams() { tableColumns, }); const toolbarActions = useEventStreamsActions(view); + const { data } = useOptions>(edaAPI`/event-streams/`); + const canCreateEventStream = Boolean(data && data.actions && data.actions['POST']); const rowActions = useEventStreamActions(view); return ( @@ -38,11 +42,24 @@ export function EventStreams() { toolbarFilters={toolbarFilters} rowActions={rowActions} errorStateTitle={t('Error loading event streams')} - emptyStateTitle={t('There are currently no event streams created for your organization.')} - emptyStateDescription={t('Please create an event stream by using the button below.')} + emptyStateTitle={ + canCreateEventStream + ? t('There are currently no event streams created for your organization.') + : t('You do not have permission to create an event stream.') + } + emptyStateDescription={ + canCreateEventStream + ? t('Please create an event stream by using the button below.') + : t( + 'Please contact your organization administrator if there is an issue with your access.' + ) + } + emptyStateIcon={canCreateEventStream ? undefined : CubesIcon} emptyStateButtonIcon={} - emptyStateButtonText={t('Create event stream')} - emptyStateButtonClick={() => pageNavigate(EdaRoute.CreateEventStream)} + emptyStateButtonText={canCreateEventStream ? t('Create event stream') : undefined} + emptyStateButtonClick={ + canCreateEventStream ? () => pageNavigate(EdaRoute.CreateEventStream) : undefined + } {...view} defaultSubtitle={t('Event stream')} />