From 6fe9a3913578d1560132064c90e43cc1f4922ec4 Mon Sep 17 00:00:00 2001 From: dedemorton Date: Tue, 5 Apr 2022 18:55:53 -0700 Subject: [PATCH 1/6] Edit text strings and links in add logstash output UI --- packages/kbn-doc-links/src/get_doc_links.ts | 3 ++- .../fleet/public/applications/fleet/app.tsx | 2 +- .../components/edit_output_flyout/index.tsx | 19 +++++-------------- .../output_form_validators.test.tsx | 2 +- .../output_form_validators.tsx | 2 +- .../logstash_instructions/index.tsx | 12 ++++++------ .../fleet/server/types/models/output.test.ts | 2 +- .../fleet/server/types/models/output.ts | 4 ++-- 8 files changed, 19 insertions(+), 27 deletions(-) diff --git a/packages/kbn-doc-links/src/get_doc_links.ts b/packages/kbn-doc-links/src/get_doc_links.ts index 7d58f177e0764..122486a1d0e9d 100644 --- a/packages/kbn-doc-links/src/get_doc_links.ts +++ b/packages/kbn-doc-links/src/get_doc_links.ts @@ -159,6 +159,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => { }, logstash: { base: `${ELASTIC_WEBSITE_URL}guide/en/logstash/${DOC_LINK_VERSION}`, + inputElasticAgent: `${ELASTIC_WEBSITE_URL}guide/en/logstash/${DOC_LINK_VERSION}/plugins-inputs-elastic_agent.html`, }, functionbeat: { base: `${ELASTIC_WEBSITE_URL}guide/en/beats/functionbeat/${DOC_LINK_VERSION}`, @@ -579,7 +580,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => { guide: `${FLEET_DOCS}index.html`, fleetServer: `${FLEET_DOCS}fleet-server.html`, fleetServerAddFleetServer: `${FLEET_DOCS}add-a-fleet-server.html`, - settings: `${FLEET_DOCS}fleet-settings.html#fleet-server-hosts-setting`, + settings: `${FLEET_DOCS}fleet-settings.html`, settingsFleetServerHostSettings: `${FLEET_DOCS}fleet-settings.html#fleet-server-hosts-setting`, settingsFleetServerProxySettings: `${KIBANA_DOCS}fleet-settings-kb.html#fleet-data-visualizer-settings`, troubleshooting: `${FLEET_DOCS}fleet-troubleshooting.html`, diff --git a/x-pack/plugins/fleet/public/applications/fleet/app.tsx b/x-pack/plugins/fleet/public/applications/fleet/app.tsx index b5872b0a995a9..cd4ba97019766 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/app.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/app.tsx @@ -279,7 +279,7 @@ const FleetTopNav = memo( const topNavConfig: TopNavMenuData[] = [ { label: i18n.translate('xpack.fleet.appNavigation.sendFeedbackButton', { - defaultMessage: 'Send Feedback', + defaultMessage: 'Send feedback', }), iconType: 'popout', run: () => window.open(FEEDBACK_URL), diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx index 72642e68d85c1..e1c120160b45e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx @@ -46,7 +46,7 @@ export interface EditOutputFlyoutProps { const OUTPUT_TYPE_OPTIONS = [ { value: 'elasticsearch', text: 'Elasticsearch' }, - { value: 'logstash', text: 'Logstash (BETA)' }, + { value: 'logstash', text: 'Logstash (beta)' }, ]; export const EditOutputFlyout: React.FunctionComponent = ({ @@ -138,16 +138,7 @@ export const EditOutputFlyout: React.FunctionComponent = isLogstashOutput && ( - {i18n.translate('xpack.fleet.editOutputFlyout.learnMoreLink', { - defaultMessage: 'Learn more', - })} - - ), - }} + defaultMessage="Logstash output is in beta. Please send feedback to report bugs or suggest improvements." /> ) } @@ -203,13 +194,13 @@ export const EditOutputFlyout: React.FunctionComponent = helpText={ + ), diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx index 57b8681e834bb..b9d0b5106f613 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx @@ -72,7 +72,7 @@ describe('Output form validation', () => { const res = validateLogstashHosts(['https://test.fr:5044']); expect(res).toEqual([ - { index: 0, message: 'Invalid logstash host should not start with http(s)' }, + { index: 0, message: 'Host URL must begin with a domain name or IP address.' }, ]); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx index 13b90fe661f61..f97e9f3b4d6db 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx @@ -67,7 +67,7 @@ export function validateLogstashHosts(value: string[]) { if (val.match(/^http([s]){0,1}:\/\//)) { res.push({ message: i18n.translate('xpack.fleet.settings.outputForm.logstashHostProtocolError', { - defaultMessage: 'Invalid logstash host should not start with http(s)', + defaultMessage: 'Host URL must begin with a domain name or IP address', }), index: idx, }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx index 19ff2cbc61d77..51d8116a63c88 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx @@ -34,21 +34,21 @@ export const LogstashInstructions = () => { title={ } > <> + ), @@ -71,14 +71,14 @@ const CollapsibleCallout: React.FunctionComponent = ({ children setIsOpen(false)}> ) : ( setIsOpen(true)} fill={true}> )} diff --git a/x-pack/plugins/fleet/server/types/models/output.test.ts b/x-pack/plugins/fleet/server/types/models/output.test.ts index 8ad2b14299c73..98e180f9ed66e 100644 --- a/x-pack/plugins/fleet/server/types/models/output.test.ts +++ b/x-pack/plugins/fleet/server/types/models/output.test.ts @@ -19,7 +19,7 @@ describe('Output model', () => { it('should return an error for an invalid host with http scheme', () => { expect(validateLogstashHost('https://test.fr:5044')).toMatchInlineSnapshot( - `"Invalid logstash host should not start with http(s)"` + `"Host URL must begin with a domain name or IP address"` ); }); }); diff --git a/x-pack/plugins/fleet/server/types/models/output.ts b/x-pack/plugins/fleet/server/types/models/output.ts index 86b2a70a318fc..d04db384de983 100644 --- a/x-pack/plugins/fleet/server/types/models/output.ts +++ b/x-pack/plugins/fleet/server/types/models/output.ts @@ -11,7 +11,7 @@ import { outputType } from '../../../common/constants'; export function validateLogstashHost(val: string) { if (val.match(/^http([s]){0,1}:\/\//)) { - return 'Invalid logstash host should not start with http(s)'; + return 'Host URL must begin with a domain name or IP address'; } try { @@ -21,7 +21,7 @@ export function validateLogstashHost(val: string) { return 'Invalid host'; } } catch (err) { - return 'Invalid logstash host'; + return 'Invalid Logstash host'; } } From f08275a7894eac18ab0147f55b3b7081b7acd61e Mon Sep 17 00:00:00 2001 From: DeDe Morton Date: Tue, 5 Apr 2022 19:42:31 -0700 Subject: [PATCH 2/6] fix test to match --- .../edit_output_flyout/output_form_validators.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx index b9d0b5106f613..fa869e99c9b72 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx @@ -72,7 +72,7 @@ describe('Output form validation', () => { const res = validateLogstashHosts(['https://test.fr:5044']); expect(res).toEqual([ - { index: 0, message: 'Host URL must begin with a domain name or IP address.' }, + { index: 0, message: 'Host URL must begin with a domain name or IP address' }, ]); }); From 2e4dc703d9c97573c2ba8f6bfd3117ccc3796879 Mon Sep 17 00:00:00 2001 From: dedemorton Date: Wed, 6 Apr 2022 18:47:23 -0700 Subject: [PATCH 3/6] Add changes from review --- .../components/edit_output_flyout/index.tsx | 14 ++++++++++++-- .../output_form_validators.test.tsx | 2 +- .../edit_output_flyout/output_form_validators.tsx | 2 +- .../components/logstash_instructions/index.tsx | 11 ++--------- .../fleet/server/types/models/output.test.ts | 2 +- x-pack/plugins/fleet/server/types/models/output.ts | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx index e1c120160b45e..5c6325cede544 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx @@ -138,7 +138,17 @@ export const EditOutputFlyout: React.FunctionComponent = isLogstashOutput && ( + + + ), + }} /> ) } @@ -194,7 +204,7 @@ export const EditOutputFlyout: React.FunctionComponent = helpText={ diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx index fa869e99c9b72..ea0e1541fb41c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.test.tsx @@ -72,7 +72,7 @@ describe('Output form validation', () => { const res = validateLogstashHosts(['https://test.fr:5044']); expect(res).toEqual([ - { index: 0, message: 'Host URL must begin with a domain name or IP address' }, + { index: 0, message: 'Host address must begin with a domain name or IP address' }, ]); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx index f97e9f3b4d6db..9a95b9e834ec1 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/output_form_validators.tsx @@ -67,7 +67,7 @@ export function validateLogstashHosts(value: string[]) { if (val.match(/^http([s]){0,1}:\/\//)) { res.push({ message: i18n.translate('xpack.fleet.settings.outputForm.logstashHostProtocolError', { - defaultMessage: 'Host URL must begin with a domain name or IP address', + defaultMessage: 'Host address must begin with a domain name or IP address', }), index: idx, }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx index 51d8116a63c88..1fdffd1c8a30b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/logstash_instructions/index.tsx @@ -34,14 +34,14 @@ export const LogstashInstructions = () => { title={ } > <> { }} /> - - - - ), }, diff --git a/x-pack/plugins/fleet/server/types/models/output.test.ts b/x-pack/plugins/fleet/server/types/models/output.test.ts index 98e180f9ed66e..85aa6bd0a1242 100644 --- a/x-pack/plugins/fleet/server/types/models/output.test.ts +++ b/x-pack/plugins/fleet/server/types/models/output.test.ts @@ -19,7 +19,7 @@ describe('Output model', () => { it('should return an error for an invalid host with http scheme', () => { expect(validateLogstashHost('https://test.fr:5044')).toMatchInlineSnapshot( - `"Host URL must begin with a domain name or IP address"` + `"Host address must begin with a domain name or IP address"` ); }); }); diff --git a/x-pack/plugins/fleet/server/types/models/output.ts b/x-pack/plugins/fleet/server/types/models/output.ts index d04db384de983..2354412d073b2 100644 --- a/x-pack/plugins/fleet/server/types/models/output.ts +++ b/x-pack/plugins/fleet/server/types/models/output.ts @@ -11,7 +11,7 @@ import { outputType } from '../../../common/constants'; export function validateLogstashHost(val: string) { if (val.match(/^http([s]){0,1}:\/\//)) { - return 'Host URL must begin with a domain name or IP address'; + return 'Host address must begin with a domain name or IP address'; } try { From d43fb076a27346d65b95097a57240d62362d724d Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 7 Apr 2022 10:10:51 -0400 Subject: [PATCH 4/6] Fix tests --- x-pack/plugins/fleet/server/types/models/output.test.ts | 2 +- x-pack/test/fleet_api_integration/apis/outputs/crud.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/fleet/server/types/models/output.test.ts b/x-pack/plugins/fleet/server/types/models/output.test.ts index 85aa6bd0a1242..4441630653a99 100644 --- a/x-pack/plugins/fleet/server/types/models/output.test.ts +++ b/x-pack/plugins/fleet/server/types/models/output.test.ts @@ -14,7 +14,7 @@ describe('Output model', () => { }); it('should return an error for an invalid host', () => { - expect(validateLogstashHost('!@#%&!#!@')).toMatchInlineSnapshot(`"Invalid logstash host"`); + expect(validateLogstashHost('!@#%&!#!@')).toMatchInlineSnapshot(`"Invalid Logstash host"`); }); it('should return an error for an invalid host with http scheme', () => { diff --git a/x-pack/test/fleet_api_integration/apis/outputs/crud.ts b/x-pack/test/fleet_api_integration/apis/outputs/crud.ts index 14f2e53949cfc..43a3707a21963 100644 --- a/x-pack/test/fleet_api_integration/apis/outputs/crud.ts +++ b/x-pack/test/fleet_api_integration/apis/outputs/crud.ts @@ -148,7 +148,9 @@ export default function (providerContext: FtrProviderContext) { }) .expect(400); - expect(postResponse.message).match(/Invalid logstash host should not start with http\(s\)/); + expect(postResponse.message).match( + /Host address must begin with a domain name or IP address/ + ); }); it('should toggle default output when creating a new default output ', async function () { From dc5e7f4ab8b8d37de49c601115c042c1a36c9112 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 7 Apr 2022 13:04:15 -0400 Subject: [PATCH 5/6] Fix type --- packages/kbn-doc-links/src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kbn-doc-links/src/types.ts b/packages/kbn-doc-links/src/types.ts index 9a4ff1a58cf13..5e85d01c22ce2 100644 --- a/packages/kbn-doc-links/src/types.ts +++ b/packages/kbn-doc-links/src/types.ts @@ -141,6 +141,7 @@ export interface DocLinks { }; readonly logstash: { readonly base: string; + readonly inputElasticAgent: string; }; readonly functionbeat: { readonly base: string; From da98897ea6d8a9672ebb082ad6db4a504225de0b Mon Sep 17 00:00:00 2001 From: dedemorton Date: Thu, 7 Apr 2022 11:43:11 -0700 Subject: [PATCH 6/6] Fix I18N error --- .../sections/settings/components/edit_output_flyout/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx index 5c6325cede544..c0b8f158f43de 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx @@ -209,7 +209,7 @@ export const EditOutputFlyout: React.FunctionComponent = guideLink: (