Skip to content

Commit

Permalink
Get Kibana version from semver function
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Jul 6, 2021
1 parent 603e340 commit da26bcc
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, { useCallback, useMemo } from 'react';
import { EuiText, EuiButton, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import semver from 'semver';

import type { AgentPolicy, PackagePolicy } from '../../types';
import { sendGetOneAgentPolicy, useKibanaVersion } from '../../hooks';
Expand All @@ -19,7 +20,13 @@ import { AdvancedAgentAuthenticationSettings } from './advanced_agent_authentica

export const DownloadStep = () => {
const kibanaVersion = useKibanaVersion();
const kibanaVersionURLString = useMemo(() => kibanaVersion.replace(/\./g, '-'), [kibanaVersion]);
const kibanaVersionURLString = useMemo(
() =>
`${semver.major(kibanaVersion)}-${semver.minor(kibanaVersion)}-${semver.patch(
kibanaVersion
)}`,
[kibanaVersion]
);
return {
title: i18n.translate('xpack.fleet.agentEnrollment.stepDownloadAgentTitle', {
defaultMessage: 'Download the Elastic Agent to your host',
Expand Down

0 comments on commit da26bcc

Please sign in to comment.