mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
Correlations: Don't show Add button in empty call-to-action page when user has no sufficient permissions (#66006)
Do not show add correlation button if user has no permissions to add new correlations
This commit is contained in:
parent
f27326f7d9
commit
90b15d41bf
@ -162,7 +162,9 @@ export default function CorrelationsPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{showEmptyListCTA && <EmptyCorrelationsCTA onClick={() => setIsAdding(true)} />}
|
||||
{showEmptyListCTA && (
|
||||
<EmptyCorrelationsCTA canWriteCorrelations={canWriteCorrelations} onClick={() => setIsAdding(true)} />
|
||||
)}
|
||||
|
||||
{
|
||||
// This error is not actionable, it'd be nice to have a recovery button
|
||||
|
@ -1,14 +1,16 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Card } from '@grafana/ui';
|
||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||
|
||||
interface Props {
|
||||
onClick?: () => void;
|
||||
canWriteCorrelations: boolean;
|
||||
}
|
||||
export const EmptyCorrelationsCTA = ({ onClick }: Props) => {
|
||||
export const EmptyCorrelationsCTA = ({ onClick, canWriteCorrelations }: Props) => {
|
||||
// TODO: if there are no datasources show a different message
|
||||
|
||||
return (
|
||||
return canWriteCorrelations ? (
|
||||
<EmptyListCTA
|
||||
title="You haven't defined any correlation yet."
|
||||
buttonIcon="gf-glue"
|
||||
@ -16,5 +18,10 @@ export const EmptyCorrelationsCTA = ({ onClick }: Props) => {
|
||||
buttonTitle="Add correlation"
|
||||
proTip="you can also define correlations via datasource provisioning"
|
||||
/>
|
||||
) : (
|
||||
<Card>
|
||||
<Card.Heading>There are no correlations configured yet.</Card.Heading>
|
||||
<Card.Description>Please contact your administrator to create new correlations.</Card.Description>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user