Only show allocation if user has permission
prevents just a blank scetion in the details box if a sub user dosn't have the permission of `allocation.read` Also fixes the server router where it was set to `allocations` and not `allocation` making it not showup period even if the sub user had the correct permissions.
This commit is contained in:
parent
fc0f8ee48e
commit
c75a621c52
|
@ -6,6 +6,7 @@ import { bytesToHuman, megabytesToHuman } from '@/helpers';
|
|||
import TitledGreyBox from '@/components/elements/TitledGreyBox';
|
||||
import { ServerContext } from '@/state/server';
|
||||
import CopyOnClick from '@/components/elements/CopyOnClick';
|
||||
import Can from '@/elements/Can';
|
||||
|
||||
interface Stats {
|
||||
memory: number;
|
||||
|
@ -70,12 +71,14 @@ const ServerDetailsBlock = () => {
|
|||
/>
|
||||
{!status ? 'Connecting...' : status}
|
||||
</p>
|
||||
<CopyOnClick text={primaryAllocation}>
|
||||
<p css={tw`text-xs mt-2`}>
|
||||
<FontAwesomeIcon icon={faEthernet} fixedWidth css={tw`mr-1`}/>
|
||||
<code css={tw`ml-1`}>{primaryAllocation}</code>
|
||||
</p>
|
||||
</CopyOnClick>
|
||||
<Can action={'allocation.read'}>
|
||||
<CopyOnClick text={primaryAllocation}>
|
||||
<p css={tw`text-xs mt-2`}>
|
||||
<FontAwesomeIcon icon={faEthernet} fixedWidth css={tw`mr-1`}/>
|
||||
<code css={tw`ml-1`}>{primaryAllocation}</code>
|
||||
</p>
|
||||
</CopyOnClick>
|
||||
</Can>
|
||||
<p css={tw`text-xs mt-2`}>
|
||||
<FontAwesomeIcon icon={faMicrochip} fixedWidth css={tw`mr-1`}/> {stats.cpu.toFixed(2)}%
|
||||
</p>
|
||||
|
|
|
@ -100,7 +100,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
|
|||
<Can action={'backup.*'}>
|
||||
<NavLink to={`${match.url}/backups`}>Backups</NavLink>
|
||||
</Can>
|
||||
<Can action={'allocations.*'}>
|
||||
<Can action={'allocation.*'}>
|
||||
<NavLink to={`${match.url}/network`}>Network</NavLink>
|
||||
</Can>
|
||||
<Can action={'startup.*'}>
|
||||
|
|
Loading…
Reference in New Issue