feat: improve UI display depending on user persmissions
This commit is contained in:

committed by
Ali BARIN

parent
017a881494
commit
5d2e9ccc67
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
||||
|
||||
import AppConnectionRow from 'components/AppConnectionRow';
|
||||
import NoResultFound from 'components/NoResultFound';
|
||||
import Can from 'components/Can';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
import * as URLS from 'config/urls';
|
||||
import useAppConnections from 'hooks/useAppConnections';
|
||||
@@ -16,11 +17,15 @@ function AppConnections(props) {
|
||||
|
||||
if (!hasConnections) {
|
||||
return (
|
||||
<NoResultFound
|
||||
to={URLS.APP_ADD_CONNECTION(appKey)}
|
||||
text={formatMessage('app.noConnections')}
|
||||
data-test="connections-no-results"
|
||||
/>
|
||||
<Can I="create" a="Connection" passThrough>
|
||||
{(allowed) => (
|
||||
<NoResultFound
|
||||
text={formatMessage('app.noConnections')}
|
||||
data-test="connections-no-results"
|
||||
{...(allowed && { to: URLS.APP_ADD_CONNECTION(appKey) })}
|
||||
/>
|
||||
)}
|
||||
</Can>
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user