-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ResponseOps][Connectors] Fix form callout message #244892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const getSecretFields = (fields: FieldsMap): FieldsMap => | ||
| Object.keys(fields) | ||
| .filter((fieldPath) => fieldPath.includes('secrets')) | ||
| .filter((fieldPath) => fieldPath.includes('secrets') && fields[fieldPath].label) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to exclude empty labels from the callout logic. It was no issue before, but in the generator, the authType is hidden, users won't update it and therefore shouldn't show up in this callout.
|
Pinging @elastic/response-ops (Team:ResponseOps) |
...tions_ui/public/application/sections/action_connector_form/encrypted_fields_callout.test.tsx
Show resolved
Hide resolved
I added a label in 2296dbb |
…om/jcger/kibana into issue-244865-connector-callout-fix
💚 Build Succeeded
Metrics [docs]Async chunks
History
|

Summary
Fixes #244865 - The label prop was being passed by to the wrapped component instead of the wrapper component.
I also had to exclude empty labels from the callout logic. It was no issue before, but in the generator, the authType is hidden, users won't update it and therefore shouldn't show up in this callout.
Screenshot
QA
(optional) Add webhook connector
diff --git a/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts b/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts index fefd2a67514e..534be6c8c3f5 100644 --- a/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts +++ b/src/platform/packages/shared/kbn-connector-specs/src/all_specs.ts @@ -13,3 +13,4 @@ export * from './specs/greynoise'; export * from './specs/shodan'; export * from './specs/urlvoid'; export * from './specs/virustotal'; +export * from './specs/webhook'; diff --git a/src/platform/packages/shared/kbn-connector-specs/src/specs/webhook.ts b/src/platform/packages/shared/kbn-connector-specs/src/specs/webhook.ts new file mode 100644 index 000000000000..b5f1e6375ae2 --- /dev/null +++ b/src/platform/packages/shared/kbn-connector-specs/src/specs/webhook.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the "Elastic License + * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { z } from '@kbn/zod/v4'; +import type { ConnectorSpec } from '../connector_spec'; + +export const SingleFileWebhookConnector: ConnectorSpec = { + metadata: { + id: '.sf-webhook', + displayName: 'Single File Webhook', + description: 'demo', + minimumLicense: 'gold', + supportedFeatureIds: ['workflows'], + }, + + schema: z.object({ + method: z + .enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']) + .meta({ + label: 'Method', + }) + .default('POST'), + url: z.url().meta({ label: 'URL', placeholder: 'https://...' }), + authType: z.string().meta({ disabled: true }), + }), + + authTypes: ['none', 'basic', 'bearer'], + + actions: { + submit: { + isTool: true, + input: z.object({ + body: z.string(), + }), + handler: async (ctx, input) => { + try { + ctx.client.request({ + method, + url, + data: input.body, + }); + + return { + ok: true, + message: 'Successfully connected to Single File Webhook', + }; + } catch (error) { + return { + ok: false, + message: `Failed to connect: ${error}`, + }; + } + }, + }, + }, + + test: { + handler: async (ctx) => { + try { + await ctx.client.get('https://webhook.site/fcc6fb22-63c1-4568-9be4-f453012bf8f5'); + return { + ok: true, + message: 'Successfully connected to Single File Webhook', + }; + } catch (error) { + return { + ok: false, + message: `Failed to connect: ${error}`, + }; + } + }, + description: 'Verifies webhook connection alive', + }, +};Create/Edit a connector, check that the callout message at the bottom works as expected. It points out that the secrets need to be reentered on every update