Skip to content

Commit

Permalink
[Fleet] Remove disabled uninstall button for some integrations (#98970)…
Browse files Browse the repository at this point in the history
… (#99049)

* Update integration settings tab. Remove uninstall button for some integrations.

* Fix i18n & type/logic

Co-authored-by: John Schulz <[email protected]>
  • Loading branch information
kibanamachine and John Schulz authored May 3, 2021
1 parent d5295e7 commit 8875fc2
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ const UpdatesAvailableMsgContainer = styled.span`
`;

const NoteLabel = () => (
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteLabel"
defaultMessage="Note:"
/>
<strong>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteLabel"
defaultMessage="Note:"
/>
</strong>
);
const UpdatesAvailableMsg = () => (
<UpdatesAvailableMsgContainer>
Expand Down Expand Up @@ -171,69 +173,64 @@ export const SettingsPage: React.FC<Props> = memo(({ packageInfo }: Props) => {
</p>
</div>
) : (
<div>
<EuiTitle>
<h4>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallTitle"
defaultMessage="Uninstall {title}"
values={{
title,
}}
/>
</h4>
</EuiTitle>
<EuiSpacer size="s" />
<p>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallDescription"
defaultMessage="Remove Kibana and Elasticsearch assets that were installed by this integration."
/>
</p>
</div>
removable && (
<>
<div>
<EuiTitle>
<h4>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallTitle"
defaultMessage="Uninstall"
/>
</h4>
</EuiTitle>
<EuiSpacer size="s" />
<p>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallDescription"
defaultMessage="Remove Kibana and Elasticsearch assets that were installed by this integration."
/>
</p>
</div>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<p>
<InstallationButton
{...packageInfo}
disabled={!packagePoliciesData || packageHasUsages}
/>
</p>
</EuiFlexItem>
</EuiFlexGroup>
</>
)
)}
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<p>
<InstallationButton
{...packageInfo}
disabled={
!packagePoliciesData || removable === false ? true : packageHasUsages
}
/>
</p>
</EuiFlexItem>
</EuiFlexGroup>
{packageHasUsages && removable === true && (
<p>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteDetail"
defaultMessage="{strongNote} {title} cannot be uninstalled because there are active agents that use this integration. To uninstall, remove all {title} integrations from your agent policies."
values={{
title,
strongNote: (
<strong>
<NoteLabel />
</strong>
),
}}
/>
<EuiText color="subdued">
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteDetail"
defaultMessage="{strongNote} {title} cannot be uninstalled because there are active agents that use this integration. To uninstall, remove all {title} integrations from your agent policies."
values={{
title,
strongNote: <NoteLabel />,
}}
/>
</EuiText>
</p>
)}
{removable === false && (
<p>
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallUninstallableNoteDetail"
defaultMessage="{strongNote} The {title} integration is installed by default and cannot be removed."
values={{
title,
strongNote: (
<strong>
<NoteLabel />
</strong>
),
}}
/>
<EuiText color="subdued">
<FormattedMessage
id="xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallUninstallableNoteDetail"
defaultMessage="{strongNote} The {title} integration is installed by default and cannot be removed."
values={{
title,
strongNote: <NoteLabel />,
}}
/>
</EuiText>
</p>
)}
</div>
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -8516,7 +8516,6 @@
"xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteDetail": "{strongNote} {title}をアンインストールできません。この統合を使用しているアクティブなエージェントがあります。アンインストールするには、エージェントポリシーからすべての{title}統合を削除します。",
"xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteLabel": "注:",
"xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallUninstallableNoteDetail": "{strongNote} {title}統合は既定でインストールされているため、削除できません。",
"xpack.fleet.integrations.settings.packageUninstallTitle": "{title}をアンインストール",
"xpack.fleet.integrations.settings.packageVersionTitle": "{title}バージョン",
"xpack.fleet.integrations.settings.versionInfo.installedVersion": "インストールされているバージョン",
"xpack.fleet.integrations.settings.versionInfo.latestVersion": "最新バージョン",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -8600,7 +8600,6 @@
"xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteDetail": "{strongNote}{title} 无法卸载,因为存在使用此集成的活动代理。要卸载,请从您的代理策略中移除所有 {title} 集成。",
"xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallNoteLabel": "注意:",
"xpack.fleet.integrations.settings.packageUninstallNoteDescription.packageUninstallUninstallableNoteDetail": "{strongNote} {title} 集成默认安装,无法移除。",
"xpack.fleet.integrations.settings.packageUninstallTitle": "卸载 {title}",
"xpack.fleet.integrations.settings.packageVersionTitle": "{title} 版本",
"xpack.fleet.integrations.settings.versionInfo.installedVersion": "已安装版本",
"xpack.fleet.integrations.settings.versionInfo.latestVersion": "最新版本",
Expand Down

0 comments on commit 8875fc2

Please sign in to comment.