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

View file

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