Skip to content

Commit

Permalink
disabled button and tooltip for readonly users
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Oct 8, 2024
1 parent 385c8b2 commit 5f032ab
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
EuiSpacer,
EuiText,
EuiTextAlign,
EuiToolTip,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { NoDataViewsPromptComponentProps } from '@kbn/shared-ux-prompt-no-data-views-types';
Expand Down Expand Up @@ -66,13 +67,30 @@ const PromptAddDataViews = ({

const footer = dataViewsDocLink ? (
<>
{canCreateNewDataView && (
{canCreateNewDataView ? (
<EuiButton onClick={onClickCreate} fill={true} data-test-subj="createDataViewButton">
<FormattedMessage
id="sharedUXPackages.noDataViewsPrompt.addDataViewText"
defaultMessage="Create data view"
/>
</EuiButton>
) : (
<EuiToolTip
position="right"
content={
<FormattedMessage
id="sharedUXPackages.noDataViewsPrompt.addDataViewTooltipNoPrivilege"
defaultMessage="Ask your administrator for the permissions required to create a data view."
/>
}
>
<EuiButton disabled data-test-subj="createDataViewButton">
<FormattedMessage
id="sharedUXPackages.noDataViewsPrompt.addDataViewTextNoPrivilege"
defaultMessage="Create data view"
/>
</EuiButton>
</EuiToolTip>
)}
<EuiHorizontalRule />
<DocumentationLink href={dataViewsDocLink} data-test-subj="docLinkDataViews" />
Expand Down

0 comments on commit 5f032ab

Please sign in to comment.