mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Connectors] Pass data-test-subj into JSON editor with message variables (#172642)
This commit is contained in:
parent
f9233bd2ad
commit
69395c611e
14 changed files with 28 additions and 22 deletions
|
@ -67,7 +67,7 @@ const BedrockParamsFields: React.FunctionComponent<ActionParamsProps<BedrockActi
|
|||
paramsProperty={'body'}
|
||||
inputTargetValue={body}
|
||||
label={i18n.BODY}
|
||||
aria-label={i18n.BODY_DESCRIPTION}
|
||||
ariaLabel={i18n.BODY_DESCRIPTION}
|
||||
errors={errors.body as string[]}
|
||||
onDocumentsChange={(json: string) => {
|
||||
editSubActionParams({ body: json });
|
||||
|
@ -77,7 +77,7 @@ const BedrockParamsFields: React.FunctionComponent<ActionParamsProps<BedrockActi
|
|||
editSubActionParams({ body: '' });
|
||||
}
|
||||
}}
|
||||
data-test-subj="bedrock-bodyJsonEditor"
|
||||
dataTestSubj="bedrock-bodyJsonEditor"
|
||||
/>
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
|
|
|
@ -96,9 +96,9 @@ export const CreateStep: FunctionComponent<Props> = ({ display, readOnly }) => (
|
|||
componentProps={{
|
||||
euiCodeEditorProps: {
|
||||
isReadOnly: readOnly,
|
||||
'data-test-subj': 'webhookCreateIncidentJson',
|
||||
['aria-label']: i18n.CODE_EDITOR,
|
||||
},
|
||||
dataTestSubj: 'webhookCreateIncidentJson',
|
||||
messageVariables: casesVars,
|
||||
paramsProperty: 'createIncidentJson',
|
||||
buttonTitle: i18n.ADD_CASES_VARIABLE,
|
||||
|
|
|
@ -104,9 +104,9 @@ export const UpdateStep: FunctionComponent<Props> = ({ display, readOnly }) => (
|
|||
euiCodeEditorProps: {
|
||||
height: '200px',
|
||||
isReadOnly: readOnly,
|
||||
'data-test-subj': 'webhookUpdateIncidentJson',
|
||||
['aria-label']: i18n.CODE_EDITOR,
|
||||
},
|
||||
dataTestSubj: 'webhookUpdateIncidentJson',
|
||||
messageVariables: [...casesVars, ...urlVars],
|
||||
paramsProperty: 'updateIncidentJson',
|
||||
buttonTitle: i18n.ADD_CASES_VARIABLE,
|
||||
|
@ -192,9 +192,9 @@ export const UpdateStep: FunctionComponent<Props> = ({ display, readOnly }) => (
|
|||
euiCodeEditorProps: {
|
||||
height: '200px',
|
||||
isReadOnly: readOnly,
|
||||
'data-test-subj': 'webhookCreateCommentJson',
|
||||
['aria-label']: i18n.CODE_EDITOR,
|
||||
},
|
||||
dataTestSubj: 'webhookCreateCommentJson',
|
||||
messageVariables: [...commentVars, ...urlVars],
|
||||
paramsProperty: 'createCommentJson',
|
||||
buttonTitle: i18n.ADD_CASES_VARIABLE,
|
||||
|
|
|
@ -89,7 +89,7 @@ const D3ParamsFields: React.FunctionComponent<ActionParamsProps<D3SecurityAction
|
|||
label={i18n.translate('xpack.stackConnectors.components.d3security.bodyFieldLabel', {
|
||||
defaultMessage: 'Body',
|
||||
})}
|
||||
aria-label={i18n.translate(
|
||||
ariaLabel={i18n.translate(
|
||||
'xpack.stackConnectors.components.d3security.bodyCodeEditorAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Code editor',
|
||||
|
@ -104,6 +104,7 @@ const D3ParamsFields: React.FunctionComponent<ActionParamsProps<D3SecurityAction
|
|||
editSubActionParams({ body: '' });
|
||||
}
|
||||
}}
|
||||
dataTestSubj="actionJsonEditor"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -196,10 +196,10 @@ export const IndexParamsFields = ({
|
|||
<JsonEditorWithMessageVariables
|
||||
messageVariables={messageVariables}
|
||||
paramsProperty={'documents'}
|
||||
data-test-subj="documentToIndex"
|
||||
dataTestSubj="documentToIndex"
|
||||
inputTargetValue={documentToIndex}
|
||||
label={documentsFieldLabel}
|
||||
aria-label={i18n.translate('xpack.stackConnectors.components.index.jsonDocAriaLabel', {
|
||||
ariaLabel={i18n.translate('xpack.stackConnectors.components.index.jsonDocAriaLabel', {
|
||||
defaultMessage: 'Code editor',
|
||||
})}
|
||||
errors={errors.documents as string[]}
|
||||
|
|
|
@ -67,7 +67,7 @@ const ParamsFields: React.FunctionComponent<ActionParamsProps<ActionParams>> = (
|
|||
label={i18n.translate('xpack.stackConnectors.components.genAi.bodyFieldLabel', {
|
||||
defaultMessage: 'Body',
|
||||
})}
|
||||
aria-label={i18n.translate('xpack.stackConnectors.components.genAi.bodyCodeEditorAriaLabel', {
|
||||
ariaLabel={i18n.translate('xpack.stackConnectors.components.genAi.bodyCodeEditorAriaLabel', {
|
||||
defaultMessage: 'Code editor',
|
||||
})}
|
||||
errors={errors.body as string[]}
|
||||
|
@ -79,7 +79,7 @@ const ParamsFields: React.FunctionComponent<ActionParamsProps<ActionParams>> = (
|
|||
editSubActionParams({ body: '' });
|
||||
}
|
||||
}}
|
||||
data-test-subj="genAi-bodyJsonEditor"
|
||||
dataTestSubj="genAi-bodyJsonEditor"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -83,10 +83,11 @@ const JsonEditorComponent: React.FC<JsonEditorProps> = ({
|
|||
messageVariables={messageVariables}
|
||||
paramsProperty={'subActionParams'}
|
||||
inputTargetValue={jsonEditorValue}
|
||||
aria-label={i18n.JSON_EDITOR_ARIA}
|
||||
ariaLabel={i18n.JSON_EDITOR_ARIA}
|
||||
onDocumentsChange={onAdvancedEditorChange}
|
||||
errors={jsonEditorErrors}
|
||||
label={i18n.ALERT_FIELDS_LABEL}
|
||||
dataTestSubj="actionJsonEditor"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -373,7 +373,7 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
|
|||
editAction('customDetails', '', index);
|
||||
}
|
||||
}}
|
||||
data-test-subj="customDetailsJsonEditor"
|
||||
dataTestSubj="customDetailsJsonEditor"
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<LinksList
|
||||
|
|
|
@ -307,7 +307,7 @@ const TinesParamsFields: React.FunctionComponent<ActionParamsProps<TinesExecuteA
|
|||
paramsProperty={'body'}
|
||||
inputTargetValue={body}
|
||||
label={i18n.BODY_LABEL}
|
||||
aria-label={i18n.BODY_ARIA_LABEL}
|
||||
ariaLabel={i18n.BODY_ARIA_LABEL}
|
||||
errors={errors.body as string[]}
|
||||
onDocumentsChange={(json: string) => {
|
||||
editSubActionParams({ body: json });
|
||||
|
@ -317,7 +317,7 @@ const TinesParamsFields: React.FunctionComponent<ActionParamsProps<TinesExecuteA
|
|||
editSubActionParams({ body: '' });
|
||||
}
|
||||
}}
|
||||
data-test-subj="tines-bodyJsonEditor"
|
||||
dataTestSubj="tines-bodyJsonEditor"
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
)}
|
||||
|
|
|
@ -27,7 +27,7 @@ const TorqParamsFields: React.FunctionComponent<ActionParamsProps<TorqActionPara
|
|||
paramsProperty={'body'}
|
||||
inputTargetValue={body}
|
||||
label={i18n.BODY_FIELD_LABEL}
|
||||
aria-label={i18n.BODY_FIELD_ARIA_LABEL}
|
||||
ariaLabel={i18n.BODY_FIELD_ARIA_LABEL}
|
||||
errors={errors.body as string[]}
|
||||
onDocumentsChange={(json: string) => {
|
||||
editAction('body', json, index);
|
||||
|
@ -37,6 +37,7 @@ const TorqParamsFields: React.FunctionComponent<ActionParamsProps<TorqActionPara
|
|||
editAction('body', '', index);
|
||||
}
|
||||
}}
|
||||
dataTestSubj="actionJsonEditor"
|
||||
euiCodeEditorProps={{
|
||||
options: {
|
||||
renderValidationDecorations: body && errors?.body?.length ? 'on' : 'off',
|
||||
|
|
|
@ -27,7 +27,7 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<WebhookActi
|
|||
label={i18n.translate('xpack.stackConnectors.components.webhook.bodyFieldLabel', {
|
||||
defaultMessage: 'Body',
|
||||
})}
|
||||
aria-label={i18n.translate(
|
||||
ariaLabel={i18n.translate(
|
||||
'xpack.stackConnectors.components.webhook.bodyCodeEditorAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Code editor',
|
||||
|
@ -42,6 +42,7 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<WebhookActi
|
|||
editAction('body', '', index);
|
||||
}
|
||||
}}
|
||||
dataTestSubj="actionJsonEditor"
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -39,11 +39,12 @@ interface Props {
|
|||
inputTargetValue?: string | null;
|
||||
label: string;
|
||||
errors?: string[];
|
||||
areaLabel?: string;
|
||||
ariaLabel?: string;
|
||||
onDocumentsChange: (data: string) => void;
|
||||
helpText?: JSX.Element;
|
||||
onBlur?: () => void;
|
||||
showButtonTitle?: boolean;
|
||||
dataTestSubj?: string;
|
||||
euiCodeEditorProps?: { [key: string]: any };
|
||||
}
|
||||
|
||||
|
@ -61,11 +62,12 @@ export const JsonEditorWithMessageVariables: React.FunctionComponent<Props> = ({
|
|||
inputTargetValue,
|
||||
label,
|
||||
errors,
|
||||
areaLabel,
|
||||
ariaLabel,
|
||||
onDocumentsChange,
|
||||
helpText,
|
||||
onBlur,
|
||||
showButtonTitle,
|
||||
dataTestSubj,
|
||||
euiCodeEditorProps = {},
|
||||
}) => {
|
||||
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();
|
||||
|
@ -154,7 +156,7 @@ export const JsonEditorWithMessageVariables: React.FunctionComponent<Props> = ({
|
|||
|
||||
return (
|
||||
<EuiFormRow
|
||||
data-test-subj="actionJsonEditor"
|
||||
data-test-subj={dataTestSubj}
|
||||
fullWidth
|
||||
error={errors}
|
||||
isInvalid={errors && errors.length > 0 && inputTargetValue !== undefined}
|
||||
|
@ -191,7 +193,7 @@ export const JsonEditorWithMessageVariables: React.FunctionComponent<Props> = ({
|
|||
width="100%"
|
||||
height="200px"
|
||||
data-test-subj={`${paramsProperty}JsonEditor`}
|
||||
aria-label={areaLabel}
|
||||
aria-label={ariaLabel}
|
||||
{...euiCodeEditorProps}
|
||||
editorDidMount={onEditorMount}
|
||||
onChange={(xjson: string) => {
|
||||
|
|
|
@ -39,7 +39,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await commonScreenshots.takeScreenshot('index-connector', screenshotDirectories);
|
||||
const saveTestButton = await testSubjects.find('create-connector-flyout-save-test-btn');
|
||||
await saveTestButton.click();
|
||||
await testSubjects.setValue('actionJsonEditor', indexDocument);
|
||||
await testSubjects.setValue('documentToIndex', indexDocument);
|
||||
await commonScreenshots.takeScreenshot('index-params-test', screenshotDirectories);
|
||||
const flyOutCancelButton = await testSubjects.find('euiFlyoutCloseButton');
|
||||
await flyOutCancelButton.click();
|
||||
|
|
|
@ -42,7 +42,7 @@ export const EMAIL_CONNECTOR_SERVICE_SELECTOR = '[data-test-subj="emailServiceSe
|
|||
|
||||
export const FORM_VALIDATION_ERROR = '.euiFormErrorText';
|
||||
|
||||
export const JSON_EDITOR = "[data-test-subj='actionJsonEditor']";
|
||||
export const JSON_EDITOR = "[data-test-subj='documentToIndex']";
|
||||
|
||||
export const INDEX_SELECTOR = "[data-test-subj='.index-siem-ActionTypeSelectOption']";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue