diff --git a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts index d9d004c56eb59..409b4a61dffff 100644 --- a/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts +++ b/src/platform/packages/shared/kbn-doc-links/src/get_doc_links.ts @@ -844,7 +844,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D installAndUninstallIntegrationAssets: `${FLEET_DOCS}install-uninstall-integration-assets.html`, elasticAgentInputConfiguration: `${FLEET_DOCS}elastic-agent-input-configuration.html`, policySecrets: `${FLEET_DOCS}agent-policy.html#agent-policy-secret-values`, - remoteESOoutput: `${FLEET_DOCS}monitor-elastic-agent.html#external-elasticsearch-monitoring`, + remoteESOoutput: `${FLEET_DOCS}remote-elasticsearch-output.html`, performancePresets: `${FLEET_DOCS}es-output-settings.html#es-output-settings-performance-tuning-settings`, scalingKubernetesResourcesAndLimits: `${FLEET_DOCS}scaling-on-kubernetes.html#_specifying_resources_and_limits_in_agent_manifests`, roleAndPrivileges: `${FLEET_DOCS}fleet-roles-and-privileges.html`, diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.test.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.test.tsx index 545d28aa58b39..be1abe5948860 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.test.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.test.tsx @@ -350,6 +350,7 @@ describe('EditOutputFlyout', () => { expect(utils.queryByTestId('serviceTokenSecretInput')).not.toBeNull(); + expect(utils.queryByTestId('remoteClusterConfigurationCallout')).not.toBeNull(); expect(utils.queryByTestId('kibanaAPIKeyCallout')).not.toBeNull(); expect( (utils.getByTestId('settingsOutputsFlyout.kibanaURLInput') as HTMLInputElement).value @@ -376,12 +377,21 @@ describe('EditOutputFlyout', () => { is_default_monitoring: false, service_token: '1234', hosts: ['https://localhost:9200'], + kibana_url: 'http://localhost:5601', kibana_api_key: 'key', }); expect((utils.getByTestId('serviceTokenSecretInput') as HTMLInputElement).value).toEqual( '1234' ); + + expect(utils.queryByTestId('settingsOutputsFlyout.kibanaURLInput')).toBeNull(); + expect(utils.queryByTestId('kibanaAPIKeySecretInput')).toBeNull(); + + fireEvent.click(utils.getByTestId('syncIntegrationsSwitch')); + expect( + (utils.getByTestId('settingsOutputsFlyout.kibanaURLInput') as HTMLInputElement).value + ).toEqual('http://localhost:5601'); expect((utils.getByTestId('kibanaAPIKeySecretInput') as HTMLInputElement).value).toEqual('key'); fireEvent.click(utils.getByText('Save and apply settings')); @@ -390,9 +400,11 @@ describe('EditOutputFlyout', () => { expect(mockSendPutOutput).toHaveBeenCalledWith( 'outputR', expect.objectContaining({ + sync_integrations: true, secrets: { service_token: '1234', kibana_api_key: 'key' }, service_token: undefined, kibana_api_key: undefined, + kibana_url: 'http://localhost:5601', }) ); }); diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_remote_es.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_remote_es.tsx index 17f7c9ca2abeb..105dc76e591e5 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_remote_es.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_remote_es.tsx @@ -13,6 +13,9 @@ import { EuiFormRow, EuiSpacer, EuiSwitch, + EuiButton, + EuiLink, + EuiCode, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; @@ -21,6 +24,8 @@ import { MultiRowInput } from '../multi_row_input'; import { ExperimentalFeaturesService } from '../../../../services'; +import { useStartServices } from '../../../../hooks'; + import type { OutputFormInputsType } from './use_output_form'; import { SecretFormRow } from './output_form_secret_form_row'; import { SSLFormSection } from './ssl_form_section'; @@ -38,6 +43,7 @@ export interface IsConvertedToSecret { } export const OutputFormRemoteEsSection: React.FunctionComponent = (props) => { + const { docLinks } = useStartServices(); const { inputs, useSecretsStorage, onToggleSecretStorage } = props; const [isConvertedToSecret, setIsConvertedToSecret] = React.useState({ serviceToken: false, @@ -45,6 +51,8 @@ export const OutputFormRemoteEsSection: React.FunctionComponent = (props) sslKey: false, }); const { enableSyncIntegrationsOnRemote, enableSSLSecrets } = ExperimentalFeaturesService.get(); + const [isRemoteClusterInstructionsOpen, setIsRemoteClusterInstructionsOpen] = + React.useState(false); const [isFirstLoad, setIsFirstLoad] = React.useState(true); @@ -192,7 +200,7 @@ export const OutputFormRemoteEsSection: React.FunctionComponent = (props) title={ } data-test-subj="serviceTokenCallout" @@ -212,13 +220,14 @@ export const OutputFormRemoteEsSection: React.FunctionComponent = (props) helpText={ } {...inputs.syncIntegrationsInput.formRowProps} > = (props) } /> - - } - {...inputs.kibanaURLInput.formRowProps} - > - + + } - )} - /> - - - {!useSecretsStorage ? ( - - } - {...inputs.kibanaAPIKeyInput.formRowProps} - useSecretsStorage={useSecretsStorage} - onToggleSecretStorage={onToggleSecretAndClearValue} - > - + {isRemoteClusterInstructionsOpen ? ( + setIsRemoteClusterInstructionsOpen(false)}> + + + ) : ( + setIsRemoteClusterInstructionsOpen(true)} fill={true}> + + )} - /> - - ) : ( - - + + + + + ), + }} + /> + +
    +
  1. + + + + ), + }} + /> + +
  2. +
  3. + + + + ), + leaderIndex: fleet-synced-integrations, + followerIndex: ( + + fleet-synced-integrations-ccr- + {inputs.nameInput.props.value || ''} + + ), + }} + /> + +
  4. +
  5. + +
  6. +
+ + )} + + + + } + {...inputs.kibanaURLInput.formRowProps} + > + + + + {!useSecretsStorage ? ( + } - )} - /> - - )} - - - } - data-test-subj="kibanaAPIKeyCallout" - > - - {` POST /_security/api_key + {...inputs.kibanaAPIKeyInput.formRowProps} + useSecretsStorage={useSecretsStorage} + onToggleSecretStorage={onToggleSecretAndClearValue} + > + +
+ ) : ( + + + + )} + + + } + data-test-subj="kibanaAPIKeyCallout" + > + + {` POST /_security/api_key { "name": "integration_sync_api_key", "role_descriptors": { @@ -326,9 +434,11 @@ export const OutputFormRemoteEsSection: React.FunctionComponent = (props) } } }`} - - - + + + + + )} ) : null}