Skip to content

Commit

Permalink
add theme$ to UpdateButton
Browse files Browse the repository at this point in the history
  • Loading branch information
hop-dev committed Jan 5, 2022
1 parent 5d87462 commit f3cc956
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ export function Detail() {
<OverviewPage packageInfo={packageInfo} integrationInfo={integrationInfo} />
</Route>
<Route path={INTEGRATIONS_ROUTING_PATHS.integration_details_settings}>
<SettingsPage packageInfo={packageInfo} />
<SettingsPage packageInfo={packageInfo} theme$={services.theme.theme$} />
</Route>
<Route path={INTEGRATIONS_ROUTING_PATHS.integration_details_assets}>
<AssetsPage packageInfo={packageInfo} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import {

import { i18n } from '@kbn/i18n';

import type { Observable } from 'rxjs';
import type { CoreTheme } from 'kibana/public';

import type { PackageInfo, UpgradePackagePolicyDryRunResponse } from '../../../../../types';
import { InstallStatus } from '../../../../../types';
import {
Expand Down Expand Up @@ -90,9 +93,10 @@ const LatestVersionLink = ({ name, version }: { name: string; version: string })

interface Props {
packageInfo: PackageInfo;
theme$: Observable<CoreTheme>;
}

export const SettingsPage: React.FC<Props> = memo(({ packageInfo }: Props) => {
export const SettingsPage: React.FC<Props> = memo(({ packageInfo, theme$ }: Props) => {
const { name, title, removable, latestVersion, version, keepPoliciesUpToDate } = packageInfo;
const [dryRunData, setDryRunData] = useState<UpgradePackagePolicyDryRunResponse | null>();
const [isUpgradingPackagePolicies, setIsUpgradingPackagePolicies] = useState<boolean>(false);
Expand Down Expand Up @@ -291,6 +295,7 @@ export const SettingsPage: React.FC<Props> = memo(({ packageInfo }: Props) => {
dryRunData={dryRunData}
isUpgradingPackagePolicies={isUpgradingPackagePolicies}
setIsUpgradingPackagePolicies={setIsUpgradingPackagePolicies}
theme$={theme$}
/>
</p>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {
EuiConfirmModal,
EuiSpacer,
} from '@elastic/eui';
import type { Observable } from 'rxjs';
import type { CoreTheme } from 'kibana/public';

import type {
GetAgentPoliciesResponse,
Expand All @@ -43,6 +45,7 @@ interface UpdateButtonProps extends Pick<PackageInfo, 'name' | 'title' | 'versio
packagePolicyIds?: string[];
isUpgradingPackagePolicies?: boolean;
setIsUpgradingPackagePolicies?: React.Dispatch<React.SetStateAction<boolean>>;
theme$: Observable<CoreTheme>;
}

/*
Expand Down Expand Up @@ -73,6 +76,7 @@ export const UpdateButton: React.FunctionComponent<UpdateButtonProps> = ({
setIsUpgradingPackagePolicies = () => {},
title,
version,
theme$,
}) => {
const history = useHistory();
const { getPath } = useLink();
Expand Down Expand Up @@ -174,14 +178,16 @@ export const UpdateButton: React.FunctionComponent<UpdateButtonProps> = ({
id="xpack.fleet.integrations.packageUpdateSuccessTitle"
defaultMessage="Updated {title} and upgraded policies"
values={{ title }}
/>
/>,
{ theme$ }
),
text: toMountPoint(
<FormattedMessage
id="xpack.fleet.integrations.packageUpdateSuccessDescription"
defaultMessage="Successfully updated {title} and upgraded policies"
values={{ title }}
/>
/>,
{ theme$ }
),
});

Expand All @@ -197,6 +203,7 @@ export const UpdateButton: React.FunctionComponent<UpdateButtonProps> = ({
setIsUpgradingPackagePolicies,
title,
version,
theme$,
]);

const updateModal = (
Expand Down

0 comments on commit f3cc956

Please sign in to comment.