[APM] Hide “Create configuration” for users without write access (#88149)

* [APM] Hide “Create configuration” for read-only user

* also hide description

* disable create button

* fix ts error for EuiButton
This commit is contained in:
Søren Louv-Jansen 2021-01-13 19:00:01 +01:00 committed by GitHub
parent e2dc9464fa
commit badd2b35f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 21 deletions

View file

@ -61,29 +61,38 @@ export function AgentConfigurationList({ status, data, refetch }: Props) {
</h2>
}
body={
<>
<p>
{i18n.translate(
'xpack.apm.agentConfig.configTable.emptyPromptText',
{
defaultMessage:
"Let's change that! You can fine-tune agent configuration directly from Kibana without having to redeploy. Get started by creating your first configuration.",
}
)}
</p>
</>
<p>
{i18n.translate('xpack.apm.agentConfig.configTable.emptyPromptText', {
defaultMessage:
"Let's change that! You can fine-tune agent configuration directly from Kibana without having to redeploy. Get started by creating your first configuration.",
})}
</p>
}
actions={
<EuiButton
color="primary"
fill
href={createAgentConfigurationHref(search, basePath)}
<EuiToolTip
content={
!canSave &&
i18n.translate(
'xpack.apm.settings.agentConfig.createConfigButton.tooltip',
{
defaultMessage:
"You don't have permissions to create agent configurations",
}
)
}
>
{i18n.translate(
'xpack.apm.agentConfig.configTable.createConfigButtonLabel',
{ defaultMessage: 'Create configuration' }
)}
</EuiButton>
<EuiButton
color="primary"
fill
href={createAgentConfigurationHref(search, basePath)}
isDisabled={!canSave}
>
{i18n.translate(
'xpack.apm.agentConfig.configTable.createConfigButtonLabel',
{ defaultMessage: 'Create configuration' }
)}
</EuiButton>
</EuiToolTip>
}
/>
);

View file

@ -248,7 +248,7 @@ export function ApmIndices() {
fill
onClick={handleApplyChangesEvent}
isLoading={isSaving}
disabled={!canSave}
isDisabled={!canSave}
>
{i18n.translate(
'xpack.apm.settings.apmIndices.applyButton',