mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Response Ops] [Connectors] Move connectors type UI components to stack_connectors
plugin (#140444)
* Initial commit of stack connectors plugin * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * Fixing up xmatters. Moving library functions around * [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs' * Fixing up webhook * Fixing up teams and slack * Fixing up index, email, pagerduty, server log * Fixing i18n * wip * Moving well know email route to stack connectors plugin * Fixing types * Fixing unit tests * Adding index.ts * Cleanup * Updating READMEs * [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs' * Moving to domain specific folders and updating codeowners * Fixing codeowners * Fixing types * Initial commit moving client code to stack connectors plugin * Updated all imports * Updating email * Updating index * Updating stack connectors * Updating cases connectors * Cleanup * Splitting test_utils * Fixing all imports * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * Fixing types and limits * Fixing unit tests * Fixing CI * Updating codeowners Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
712f8801d6
commit
d41e5ab127
234 changed files with 3322 additions and 3240 deletions
|
@ -1314,7 +1314,7 @@ module.exports = {
|
|||
{
|
||||
// typescript for front and back end
|
||||
files: [
|
||||
'x-pack/plugins/{alerting,stack_alerts,stack_connectors,actions,task_manager,event_log}/**/*.{ts,tsx}',
|
||||
'x-pack/plugins/{alerting,stack_alerts,actions,task_manager,event_log}/**/*.{ts,tsx}',
|
||||
],
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
@ -1322,7 +1322,7 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
// typescript only for back end
|
||||
files: ['x-pack/plugins/triggers_actions_ui/server/**/*.ts'],
|
||||
files: ['x-pack/plugins/{stack_connectors,triggers_actions_ui}/server/**/*.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
},
|
||||
|
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -331,7 +331,9 @@ x-pack/examples/files_example @elastic/kibana-app-services
|
|||
/x-pack/plugins/event_log/ @elastic/response-ops
|
||||
/x-pack/plugins/task_manager/ @elastic/response-ops
|
||||
/x-pack/plugins/stack_connectors/ @elastic/response-ops
|
||||
/x-pack/plugins/stack_connectors/public/connector_types/stack/ @elastic/response-ops-execution
|
||||
/x-pack/plugins/stack_connectors/server/connector_types/stack/ @elastic/response-ops-execution
|
||||
/x-pack/plugins/stack_connectors/public/connector_types/cases/ @elastic/response-ops-cases
|
||||
/x-pack/plugins/stack_connectors/server/connector_types/cases/ @elastic/response-ops-cases
|
||||
/x-pack/test/alerting_api_integration/ @elastic/response-ops
|
||||
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/response-ops
|
||||
|
|
|
@ -108,6 +108,7 @@ pageLoadAssetSize:
|
|||
snapshotRestore: 79032
|
||||
spaces: 57868
|
||||
stackAlerts: 29684
|
||||
stackConnectors: 36314
|
||||
synthetics: 40958
|
||||
telemetry: 51957
|
||||
telemetryManagementSection: 38586
|
||||
|
|
|
@ -12,6 +12,6 @@ module.exports = {
|
|||
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/plugins/stack_connectors',
|
||||
coverageReporters: ['text', 'html'],
|
||||
collectCoverageFrom: [
|
||||
'<rootDir>/x-pack/plugins/stack_connectors/{common,server}/**/*.{js,ts,tsx}',
|
||||
'<rootDir>/x-pack/plugins/stack_connectors/{common,public,server}/**/*.{js,ts,tsx}',
|
||||
],
|
||||
};
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
"version": "8.0.0",
|
||||
"kibanaVersion": "kibana",
|
||||
"configPath": ["xpack", "stack_connectors"],
|
||||
"requiredPlugins": ["actions"],
|
||||
"ui": false
|
||||
"requiredPlugins": ["actions", "esUiShared", "triggersActionsUi"],
|
||||
"ui": true
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { getConnectorType as getCasesWebhookConnectorType } from './webhook';
|
|
@ -23,7 +23,7 @@ import {
|
|||
} from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { Field, TextField } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||
import { PasswordField } from '../../../password_field';
|
||||
import { PasswordField } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from '../translations';
|
||||
const { emptyField } = fieldValidators;
|
||||
|
|
@ -10,8 +10,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui';
|
|||
import { FIELD_TYPES, UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { Field } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||
import { JsonFieldWrapper } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { containsTitleAndDesc } from '../validator';
|
||||
import { JsonFieldWrapper } from '../../../json_field_wrapper';
|
||||
import { casesVars } from '../action_variables';
|
||||
import { HTTP_VERBS } from '../webhook_connectors';
|
||||
import * as i18n from '../translations';
|
|
@ -10,7 +10,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
|
|||
import { UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { Field } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||
import { MustacheTextFieldWrapper } from '../../../mustache_text_field_wrapper';
|
||||
import { MustacheTextFieldWrapper } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { containsExternalId, containsExternalIdOrTitle } from '../validator';
|
||||
import { urlVars, urlVarsExt } from '../action_variables';
|
||||
import * as i18n from '../translations';
|
|
@ -10,10 +10,9 @@ import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
|||
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui';
|
||||
import { FIELD_TYPES, UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { Field } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { JsonFieldWrapper, MustacheTextFieldWrapper } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { containsCommentsOrEmpty, containsTitleAndDesc, isUrlButCanBeEmpty } from '../validator';
|
||||
import { MustacheTextFieldWrapper } from '../../../mustache_text_field_wrapper';
|
||||
import { casesVars, commentVars, urlVars } from '../action_variables';
|
||||
import { JsonFieldWrapper } from '../../../json_field_wrapper';
|
||||
import { HTTP_VERBS } from '../webhook_connectors';
|
||||
import { styles } from './update.styles';
|
||||
import * as i18n from '../translations';
|
|
@ -0,0 +1,477 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const CREATE_URL_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateUrlText',
|
||||
{
|
||||
defaultMessage: 'Create case URL is required.',
|
||||
}
|
||||
);
|
||||
export const CREATE_INCIDENT_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateIncidentText',
|
||||
{
|
||||
defaultMessage: 'Create case object is required and must be valid JSON.',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_METHOD_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateMethodText',
|
||||
{
|
||||
defaultMessage: 'Create case method is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_RESPONSE_KEY_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateIncidentResponseKeyText',
|
||||
{
|
||||
defaultMessage: 'Create case response case id key is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const UPDATE_URL_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredUpdateUrlText',
|
||||
{
|
||||
defaultMessage: 'Update case URL is required.',
|
||||
}
|
||||
);
|
||||
export const UPDATE_INCIDENT_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredUpdateIncidentText',
|
||||
{
|
||||
defaultMessage: 'Update case object is required and must be valid JSON.',
|
||||
}
|
||||
);
|
||||
|
||||
export const UPDATE_METHOD_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredUpdateMethodText',
|
||||
{
|
||||
defaultMessage: 'Update case method is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_COMMENT_URL_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateCommentUrlText',
|
||||
{
|
||||
defaultMessage: 'Create comment URL must be URL format.',
|
||||
}
|
||||
);
|
||||
export const CREATE_COMMENT_MESSAGE = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateCommentIncidentText',
|
||||
{
|
||||
defaultMessage: 'Create comment object must be valid JSON.',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_COMMENT_METHOD_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredCreateCommentMethodText',
|
||||
{
|
||||
defaultMessage: 'Create comment method is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const GET_INCIDENT_URL_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredGetIncidentUrlText',
|
||||
{
|
||||
defaultMessage: 'Get case URL is required.',
|
||||
}
|
||||
);
|
||||
export const GET_RESPONSE_EXTERNAL_TITLE_KEY_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredGetIncidentResponseExternalTitleKeyText',
|
||||
{
|
||||
defaultMessage: 'Get case response external case title key is re quired.',
|
||||
}
|
||||
);
|
||||
export const GET_RESPONSE_EXTERNAL_CREATED_KEY_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredGetIncidentResponseCreatedKeyText',
|
||||
{
|
||||
defaultMessage: 'Get case response created date key is required.',
|
||||
}
|
||||
);
|
||||
export const GET_RESPONSE_EXTERNAL_UPDATED_KEY_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredGetIncidentResponseUpdatedKeyText',
|
||||
{
|
||||
defaultMessage: 'Get case response updated date key is required.',
|
||||
}
|
||||
);
|
||||
export const GET_INCIDENT_VIEW_URL_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredGetIncidentViewUrlKeyText',
|
||||
{
|
||||
defaultMessage: 'View case URL is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const MISSING_VARIABLES = (variables: string[]) =>
|
||||
i18n.translate('xpack.stackConnectors.components.casesWebhook.error.missingVariables', {
|
||||
defaultMessage:
|
||||
'Missing required {variableCount, plural, one {variable} other {variables}}: {variables}',
|
||||
values: { variableCount: variables.length, variables: variables.join(', ') },
|
||||
});
|
||||
|
||||
export const USERNAME_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredAuthUserNameText',
|
||||
{
|
||||
defaultMessage: 'Username is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const SUMMARY_REQUIRED = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.error.requiredWebhookSummaryText',
|
||||
{
|
||||
defaultMessage: 'Title is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const KEY_LABEL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.keyTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Key',
|
||||
}
|
||||
);
|
||||
|
||||
export const VALUE_LABEL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.valueTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Value',
|
||||
}
|
||||
);
|
||||
|
||||
export const ADD_BUTTON = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.addHeaderButton',
|
||||
{
|
||||
defaultMessage: 'Add',
|
||||
}
|
||||
);
|
||||
|
||||
export const DELETE_BUTTON = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.deleteHeaderButton',
|
||||
{
|
||||
defaultMessage: 'Delete',
|
||||
description: 'Delete HTTP header',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_INCIDENT_METHOD = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createIncidentMethodTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Case Method',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_INCIDENT_URL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createIncidentUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Case URL',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_INCIDENT_JSON = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createIncidentJsonTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Case Object',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_INCIDENT_JSON_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createIncidentJsonHelpText',
|
||||
{
|
||||
defaultMessage:
|
||||
'JSON object to create case. Use the variable selector to add Cases data to the payload.',
|
||||
}
|
||||
);
|
||||
|
||||
export const JSON = i18n.translate('xpack.stackConnectors.components.casesWebhook.jsonFieldLabel', {
|
||||
defaultMessage: 'JSON',
|
||||
});
|
||||
export const CODE_EDITOR = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.jsonCodeEditorAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Code editor',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_INCIDENT_RESPONSE_KEY = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createIncidentResponseKeyTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Case Response Case Key',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_INCIDENT_RESPONSE_KEY_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createIncidentResponseKeyHelpText',
|
||||
{
|
||||
defaultMessage: 'JSON key in create case response that contains the external case id',
|
||||
}
|
||||
);
|
||||
|
||||
export const ADD_CASES_VARIABLE = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.addVariable',
|
||||
{
|
||||
defaultMessage: 'Add variable',
|
||||
}
|
||||
);
|
||||
|
||||
export const GET_INCIDENT_URL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.getIncidentUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Get Case URL',
|
||||
}
|
||||
);
|
||||
export const GET_INCIDENT_URL_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.getIncidentUrlHelp',
|
||||
{
|
||||
defaultMessage:
|
||||
'API URL to GET case details JSON from external system. Use the variable selector to add external system id to the url.',
|
||||
}
|
||||
);
|
||||
|
||||
export const GET_INCIDENT_TITLE_KEY = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.getIncidentResponseExternalTitleKeyTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Get Case Response External Title Key',
|
||||
}
|
||||
);
|
||||
export const GET_INCIDENT_TITLE_KEY_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.getIncidentResponseExternalTitleKeyHelp',
|
||||
{
|
||||
defaultMessage: 'JSON key in get case response that contains the external case title',
|
||||
}
|
||||
);
|
||||
|
||||
export const EXTERNAL_INCIDENT_VIEW_URL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.viewIncidentUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'External Case View URL',
|
||||
}
|
||||
);
|
||||
export const EXTERNAL_INCIDENT_VIEW_URL_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.viewIncidentUrlHelp',
|
||||
{
|
||||
defaultMessage:
|
||||
'URL to view case in external system. Use the variable selector to add external system id or external system title to the url.',
|
||||
}
|
||||
);
|
||||
|
||||
export const UPDATE_INCIDENT_METHOD = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.updateIncidentMethodTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Update Case Method',
|
||||
}
|
||||
);
|
||||
|
||||
export const UPDATE_INCIDENT_URL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.updateIncidentUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Update Case URL',
|
||||
}
|
||||
);
|
||||
export const UPDATE_INCIDENT_URL_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.updateIncidentUrlHelp',
|
||||
{
|
||||
defaultMessage: 'API URL to update case.',
|
||||
}
|
||||
);
|
||||
|
||||
export const UPDATE_INCIDENT_JSON = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.updateIncidentJsonTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Update Case Object',
|
||||
}
|
||||
);
|
||||
export const UPDATE_INCIDENT_JSON_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.updateIncidentJsonHelpl',
|
||||
{
|
||||
defaultMessage:
|
||||
'JSON object to update case. Use the variable selector to add Cases data to the payload.',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_COMMENT_METHOD = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentMethodTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Comment Method',
|
||||
}
|
||||
);
|
||||
export const CREATE_COMMENT_URL = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Comment URL',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_COMMENT_URL_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentUrlHelp',
|
||||
{
|
||||
defaultMessage: 'API URL to add comment to case.',
|
||||
}
|
||||
);
|
||||
|
||||
export const CREATE_COMMENT_JSON = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentJsonTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Create Comment Object',
|
||||
}
|
||||
);
|
||||
export const CREATE_COMMENT_JSON_HELP = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentJsonHelp',
|
||||
{
|
||||
defaultMessage:
|
||||
'JSON object to create a comment. Use the variable selector to add Cases data to the payload.',
|
||||
}
|
||||
);
|
||||
|
||||
export const HAS_AUTH = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.hasAuthSwitchLabel',
|
||||
{
|
||||
defaultMessage: 'Require authentication for this webhook',
|
||||
}
|
||||
);
|
||||
|
||||
export const USERNAME = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.userTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Username',
|
||||
}
|
||||
);
|
||||
|
||||
export const PASSWORD = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.passwordTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Password',
|
||||
}
|
||||
);
|
||||
|
||||
export const HEADERS_SWITCH = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.viewHeadersSwitch',
|
||||
{
|
||||
defaultMessage: 'Add HTTP header',
|
||||
}
|
||||
);
|
||||
|
||||
export const HEADERS_TITLE = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.httpHeadersTitle',
|
||||
{
|
||||
defaultMessage: 'Headers in use',
|
||||
}
|
||||
);
|
||||
|
||||
export const AUTH_TITLE = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.authenticationLabel',
|
||||
{
|
||||
defaultMessage: 'Authentication',
|
||||
}
|
||||
);
|
||||
|
||||
export const STEP_1 = i18n.translate('xpack.stackConnectors.components.casesWebhook.step1', {
|
||||
defaultMessage: 'Set up connector',
|
||||
});
|
||||
|
||||
export const STEP_2 = i18n.translate('xpack.stackConnectors.components.casesWebhook.step2', {
|
||||
defaultMessage: 'Create case',
|
||||
});
|
||||
|
||||
export const STEP_2_DESCRIPTION = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.step2Description',
|
||||
{
|
||||
defaultMessage:
|
||||
'Set fields to create the case in the external system. Check your service’s API documentation to understand what fields are required',
|
||||
}
|
||||
);
|
||||
|
||||
export const STEP_3 = i18n.translate('xpack.stackConnectors.components.casesWebhook.step3', {
|
||||
defaultMessage: 'Get case information',
|
||||
});
|
||||
|
||||
export const STEP_3_DESCRIPTION = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.step3Description',
|
||||
{
|
||||
defaultMessage:
|
||||
'Set fields to add comments to the case in external system. For some systems, this may be the same method as creating updates in cases. Check your service’s API documentation to understand what fields are required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const STEP_4 = i18n.translate('xpack.stackConnectors.components.casesWebhook.step4', {
|
||||
defaultMessage: 'Comments and updates',
|
||||
});
|
||||
|
||||
export const STEP_4A = i18n.translate('xpack.stackConnectors.components.casesWebhook.step4a', {
|
||||
defaultMessage: 'Create update in case',
|
||||
});
|
||||
|
||||
export const STEP_4A_DESCRIPTION = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.step4aDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Set fields to create updates to the case in external system. For some systems, this may be the same method as adding comments to cases.',
|
||||
}
|
||||
);
|
||||
|
||||
export const STEP_4B = i18n.translate('xpack.stackConnectors.components.casesWebhook.step4b', {
|
||||
defaultMessage: 'Add comment in case',
|
||||
});
|
||||
|
||||
export const STEP_4B_DESCRIPTION = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.step4bDescription',
|
||||
{
|
||||
defaultMessage:
|
||||
'Set fields to add comments to the case in external system. For some systems, this may be the same method as creating updates in cases.',
|
||||
}
|
||||
);
|
||||
|
||||
export const NEXT = i18n.translate('xpack.stackConnectors.components.casesWebhook.next', {
|
||||
defaultMessage: 'Next',
|
||||
});
|
||||
|
||||
export const PREVIOUS = i18n.translate('xpack.stackConnectors.components.casesWebhook.previous', {
|
||||
defaultMessage: 'Previous',
|
||||
});
|
||||
|
||||
export const CASE_TITLE_DESC = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.caseTitleDesc',
|
||||
{
|
||||
defaultMessage: 'Kibana case title',
|
||||
}
|
||||
);
|
||||
|
||||
export const CASE_DESCRIPTION_DESC = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.caseDescriptionDesc',
|
||||
{
|
||||
defaultMessage: 'Kibana case description',
|
||||
}
|
||||
);
|
||||
|
||||
export const CASE_TAGS_DESC = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.caseTagsDesc',
|
||||
{
|
||||
defaultMessage: 'Kibana case tags',
|
||||
}
|
||||
);
|
||||
|
||||
export const CASE_COMMENT_DESC = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.caseCommentDesc',
|
||||
{
|
||||
defaultMessage: 'Kibana case comment',
|
||||
}
|
||||
);
|
||||
|
||||
export const EXTERNAL_ID_DESC = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.externalIdDesc',
|
||||
{
|
||||
defaultMessage: 'External system id',
|
||||
}
|
||||
);
|
||||
|
||||
export const EXTERNAL_TITLE_DESC = i18n.translate(
|
||||
'xpack.stackConnectors.components.casesWebhook.externalTitleDesc',
|
||||
{
|
||||
defaultMessage: 'External system title',
|
||||
}
|
||||
);
|
||||
|
||||
export const DOC_LINK = i18n.translate('xpack.stackConnectors.components.casesWebhook.docLink', {
|
||||
defaultMessage: 'Configuring Webhook - Case Management connector.',
|
||||
});
|
|
@ -5,12 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import type {
|
||||
CasesWebhookPublicConfigurationType,
|
||||
CasesWebhookSecretConfigurationType,
|
||||
ExecutorSubActionPushParams,
|
||||
} from '@kbn/stack-connectors-plugin/server/connector_types/cases/cases_webhook/types';
|
||||
import { UserConfiguredActionConnector } from '../../../../types';
|
||||
} from '../../../../server/connector_types/cases/cases_webhook/types';
|
||||
|
||||
export interface CasesWebhookActionParams {
|
||||
subAction: string;
|
|
@ -11,9 +11,9 @@ import {
|
|||
ValidationFunc,
|
||||
} from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { containsChars, isUrl } from '@kbn/es-ui-shared-plugin/static/validators/string';
|
||||
import { templateActionVariable } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from './translations';
|
||||
import { casesVars, commentVars, urlVars, urlVarsExt } from './action_variables';
|
||||
import { templateActionVariable } from '../../../lib';
|
||||
|
||||
const errorCode: ERROR_CODE = 'ERR_FIELD_MISSING';
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application/type_registry';
|
||||
import { registerConnectorTypes } from '../..';
|
||||
import type { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { registrationServicesMock } from '../../../mocks';
|
||||
|
||||
const CONNECTOR_TYPE_ID = '.cases-webhook';
|
||||
let connectorTypeModel: ConnectorTypeModel;
|
||||
|
||||
beforeAll(() => {
|
||||
const connectorTypeRegistry = new TypeRegistry<ConnectorTypeModel>();
|
||||
registerConnectorTypes({ connectorTypeRegistry, services: registrationServicesMock });
|
||||
const getResult = connectorTypeRegistry.get(CONNECTOR_TYPE_ID);
|
||||
if (getResult !== null) {
|
||||
connectorTypeModel = getResult;
|
||||
}
|
||||
});
|
||||
|
||||
describe('connectorTypeRegistry.get() works', () => {
|
||||
test('connector type static data is as expected', () => {
|
||||
expect(connectorTypeModel.id).toEqual(CONNECTOR_TYPE_ID);
|
||||
expect(connectorTypeModel.iconClass).toEqual('logoWebhook');
|
||||
});
|
||||
});
|
||||
|
||||
describe('webhook action params validation', () => {
|
||||
test('action params validation succeeds when action params is valid', async () => {
|
||||
const actionParams = {
|
||||
subActionParams: { incident: { title: 'some title {{test}}' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: { 'subActionParams.incident.title': [] },
|
||||
});
|
||||
});
|
||||
|
||||
test('params validation fails when body is not valid', async () => {
|
||||
const actionParams = {
|
||||
subActionParams: { incident: { title: '' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: {
|
||||
'subActionParams.incident.title': ['Title is required.'],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
|
@ -7,10 +7,13 @@
|
|||
|
||||
import { lazy } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ActionTypeModel, GenericValidationResult } from '../../../../types';
|
||||
import type {
|
||||
ActionTypeModel as ConnectorTypeModel,
|
||||
GenericValidationResult,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { CasesWebhookActionParams, CasesWebhookConfig, CasesWebhookSecrets } from './types';
|
||||
|
||||
export function getActionType(): ActionTypeModel<
|
||||
export function getConnectorType(): ConnectorTypeModel<
|
||||
CasesWebhookConfig,
|
||||
CasesWebhookSecrets,
|
||||
CasesWebhookActionParams
|
||||
|
@ -19,14 +22,14 @@ export function getActionType(): ActionTypeModel<
|
|||
id: '.cases-webhook',
|
||||
iconClass: 'logoWebhook',
|
||||
selectMessage: i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.casesWebhookAction.selectMessageText',
|
||||
'xpack.stackConnectors.components.casesWebhook.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Send a request to a Case Management web service.',
|
||||
}
|
||||
),
|
||||
isExperimental: true,
|
||||
actionTypeTitle: i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.casesWebhookAction.actionTypeTitle',
|
||||
'xpack.stackConnectors.components.casesWebhookxpack.stackConnectors.components.casesWebhook.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'Webhook - Case Management data',
|
||||
}
|
|
@ -7,15 +7,15 @@
|
|||
|
||||
import React from 'react';
|
||||
import CasesWebhookActionConnectorFields from './webhook_connectors';
|
||||
import { ConnectorFormTestProvider, waitForComponentToUpdate } from '../test_utils';
|
||||
import { ConnectorFormTestProvider, waitForComponentToUpdate } from '../../lib/test_utils';
|
||||
import { act, render } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { MockCodeEditor } from '../../../code_editor.mock';
|
||||
import { MockCodeEditor } from '@kbn/triggers-actions-ui-plugin/public/application/code_editor.mock';
|
||||
import * as i18n from './translations';
|
||||
const kibanaReactPath = '../../../../../../../../src/plugins/kibana_react/public';
|
||||
const kibanaReactPath = '../../../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana', () => {
|
||||
const originalModule = jest.requireActual('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public', () => {
|
||||
const originalModule = jest.requireActual('@kbn/triggers-actions-ui-plugin/public');
|
||||
return {
|
||||
...originalModule,
|
||||
useKibana: () => ({
|
|
@ -17,8 +17,8 @@ import {
|
|||
EuiStepsHorizontal,
|
||||
EuiStepStatus,
|
||||
} from '@elastic/eui';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { ActionConnectorFieldsProps } from '../../../../types';
|
||||
import type { ActionConnectorFieldsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from './translations';
|
||||
import { AuthStep, CreateStep, GetStep, UpdateStep } from './steps';
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
import React from 'react';
|
||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
import WebhookParamsFields from './webhook_params';
|
||||
import { MockCodeEditor } from '../../../code_editor.mock';
|
||||
import { MockCodeEditor } from '@kbn/triggers-actions-ui-plugin/public/application/code_editor.mock';
|
||||
import { CasesWebhookActionConnector } from './types';
|
||||
|
||||
const kibanaReactPath = '../../../../../../../../src/plugins/kibana_react/public';
|
||||
const kibanaReactPath = '../../../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
jest.mock(kibanaReactPath, () => {
|
||||
const original = jest.requireActual(kibanaReactPath);
|
|
@ -8,20 +8,22 @@
|
|||
import React, { useCallback, useEffect, useMemo } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiCallOut, EuiComboBox, EuiFormRow, EuiSpacer } from '@elastic/eui';
|
||||
import { ActionParamsProps } from '../../../../types';
|
||||
import type { ActionParamsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
TextAreaWithMessageVariables,
|
||||
TextFieldWithMessageVariables,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { CasesWebhookActionConnector, CasesWebhookActionParams } from './types';
|
||||
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
|
||||
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
|
||||
|
||||
const CREATE_COMMENT_WARNING_TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.textAreaWithMessageVariable.createCommentWarningTitle',
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentWarningTitle',
|
||||
{
|
||||
defaultMessage: 'Unable to share case comments',
|
||||
}
|
||||
);
|
||||
|
||||
const CREATE_COMMENT_WARNING_DESC = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.textAreaWithMessageVariable.createCommentWarningDesc',
|
||||
'xpack.stackConnectors.components.casesWebhook.createCommentWarningDesc',
|
||||
{
|
||||
defaultMessage:
|
||||
'Configure the Create Comment URL and Create Comment Objects fields for the connector to share comments externally.',
|
||||
|
@ -108,12 +110,9 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<CasesWebhoo
|
|||
errors['subActionParams.incident.title'].length > 0 &&
|
||||
incident.title !== undefined
|
||||
}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.casesWebhook.titleFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Summary (required)',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('xpack.stackConnectors.components.casesWebhook.titleFieldLabel', {
|
||||
defaultMessage: 'Summary (required)',
|
||||
})}
|
||||
>
|
||||
<TextFieldWithMessageVariables
|
||||
index={index}
|
||||
|
@ -131,7 +130,7 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<CasesWebhoo
|
|||
paramsProperty={'description'}
|
||||
inputTargetValue={incident.description ?? undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.casesWebhook.descriptionTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.casesWebhook.descriptionTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Description',
|
||||
}
|
||||
|
@ -139,12 +138,9 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<CasesWebhoo
|
|||
/>
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.casesWebhook.tagsFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Tags',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('xpack.stackConnectors.components.casesWebhook.tagsFieldLabel', {
|
||||
defaultMessage: 'Tags',
|
||||
})}
|
||||
error={errors['subActionParams.incident.tags'] as string[]}
|
||||
>
|
||||
<EuiComboBox
|
||||
|
@ -182,7 +178,7 @@ const WebhookParamsFields: React.FunctionComponent<ActionParamsProps<CasesWebhoo
|
|||
paramsProperty={'comments'}
|
||||
inputTargetValue={comments && comments.length > 0 ? comments[0].comment : undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.casesWebhook.commentsTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.casesWebhook.commentsTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Additional comments',
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { getCasesWebhookConnectorType } from './cases_webhook';
|
||||
export { getJiraConnectorType } from './jira';
|
||||
export { getResilientConnectorType } from './resilient';
|
||||
export {
|
||||
getServiceNowITSMConnectorType,
|
||||
getServiceNowSIRConnectorType,
|
||||
getServiceNowITOMConnectorType,
|
||||
} from './servicenow';
|
||||
export { getSwimlaneConnectorType } from './swimlane';
|
||||
export { getXmattersConnectorType } from './xmatters';
|
|
@ -6,9 +6,11 @@
|
|||
*/
|
||||
|
||||
import { HttpSetup } from '@kbn/core/public';
|
||||
import { ActionTypeExecutorResult } from '@kbn/actions-plugin/common';
|
||||
import { BASE_ACTION_API_PATH } from '../../../constants';
|
||||
import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../rewrite_response_body';
|
||||
import { ActionTypeExecutorResult, BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common';
|
||||
import {
|
||||
ConnectorExecutorResult,
|
||||
rewriteResponseToCamelCase,
|
||||
} from '../../lib/rewrite_response_body';
|
||||
import { Fields, Issue, IssueTypes } from './types';
|
||||
|
||||
export async function getIssueTypes({
|
|
@ -5,4 +5,4 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export { getActionType as getWebhookActionType } from './webhook';
|
||||
export { getConnectorType as getJiraConnectorType } from './jira';
|
|
@ -5,26 +5,26 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeRegistry } from '../../../type_registry';
|
||||
import { registerBuiltInActionTypes } from '..';
|
||||
import { ActionTypeModel } from '../../../../types';
|
||||
import { registrationServicesMock } from '../../../../mocks';
|
||||
import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application/type_registry';
|
||||
import { registerConnectorTypes } from '../..';
|
||||
import type { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { registrationServicesMock } from '../../../mocks';
|
||||
|
||||
const ACTION_TYPE_ID = '.jira';
|
||||
let actionTypeModel: ActionTypeModel;
|
||||
const CONNECTOR_TYPE_ID = '.jira';
|
||||
let connectorTypeModel: ConnectorTypeModel;
|
||||
|
||||
beforeAll(() => {
|
||||
const actionTypeRegistry = new TypeRegistry<ActionTypeModel>();
|
||||
registerBuiltInActionTypes({ actionTypeRegistry, services: registrationServicesMock });
|
||||
const getResult = actionTypeRegistry.get(ACTION_TYPE_ID);
|
||||
const connectorTypeRegistry = new TypeRegistry<ConnectorTypeModel>();
|
||||
registerConnectorTypes({ connectorTypeRegistry, services: registrationServicesMock });
|
||||
const getResult = connectorTypeRegistry.get(CONNECTOR_TYPE_ID);
|
||||
if (getResult !== null) {
|
||||
actionTypeModel = getResult;
|
||||
connectorTypeModel = getResult;
|
||||
}
|
||||
});
|
||||
|
||||
describe('actionTypeRegistry.get() works', () => {
|
||||
test('action type static data is as expected', () => {
|
||||
expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID);
|
||||
describe('connectorTypeRegistry.get() works', () => {
|
||||
test('connector type static data is as expected', () => {
|
||||
expect(connectorTypeModel.id).toEqual(CONNECTOR_TYPE_ID);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -34,7 +34,7 @@ describe('jira action params validation', () => {
|
|||
subActionParams: { incident: { summary: 'some title {{test}}' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await actionTypeModel.validateParams(actionParams)).toEqual({
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: { 'subActionParams.incident.summary': [], 'subActionParams.incident.labels': [] },
|
||||
});
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ describe('jira action params validation', () => {
|
|||
subActionParams: { incident: { summary: '' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await actionTypeModel.validateParams(actionParams)).toEqual({
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: {
|
||||
'subActionParams.incident.summary': ['Summary is required.'],
|
||||
'subActionParams.incident.labels': [],
|
||||
|
@ -60,7 +60,7 @@ describe('jira action params validation', () => {
|
|||
},
|
||||
};
|
||||
|
||||
expect(await actionTypeModel.validateParams(actionParams)).toEqual({
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: {
|
||||
'subActionParams.incident.summary': [],
|
||||
'subActionParams.incident.labels': ['Labels cannot contain spaces.'],
|
|
@ -7,24 +7,24 @@
|
|||
|
||||
import { lazy } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { GenericValidationResult, ActionTypeModel } from '../../../../types';
|
||||
import type {
|
||||
GenericValidationResult,
|
||||
ActionTypeModel as ConnectorTypeModel,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { JiraConfig, JiraSecrets, JiraActionParams } from './types';
|
||||
|
||||
export const JIRA_DESC = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Create an incident in Jira.',
|
||||
}
|
||||
);
|
||||
export const JIRA_DESC = i18n.translate('xpack.stackConnectors.components.jira.selectMessageText', {
|
||||
defaultMessage: 'Create an incident in Jira.',
|
||||
});
|
||||
|
||||
export const JIRA_TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.actionTypeTitle',
|
||||
'xpack.stackConnectors.components.jira.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'Jira',
|
||||
}
|
||||
);
|
||||
|
||||
export function getActionType(): ActionTypeModel<JiraConfig, JiraSecrets, JiraActionParams> {
|
||||
export function getConnectorType(): ConnectorTypeModel<JiraConfig, JiraSecrets, JiraActionParams> {
|
||||
return {
|
||||
id: '.jira',
|
||||
iconClass: lazy(() => import('./logo')),
|
|
@ -8,11 +8,11 @@
|
|||
import React from 'react';
|
||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
import JiraConnectorFields from './jira_connectors';
|
||||
import { ConnectorFormTestProvider } from '../test_utils';
|
||||
import { ConnectorFormTestProvider } from '../../lib/test_utils';
|
||||
import { act, render } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
describe('JiraActionConnectorFields renders', () => {
|
||||
test('Jira connector fields are rendered', () => {
|
|
@ -6,15 +6,13 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { ActionConnectorFieldsProps } from '../../../../types';
|
||||
|
||||
import * as i18n from './translations';
|
||||
import {
|
||||
import type {
|
||||
ActionConnectorFieldsProps,
|
||||
ConfigFieldSchema,
|
||||
SimpleConnectorForm,
|
||||
SecretsFieldSchema,
|
||||
} from '../../simple_connector_form';
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { SimpleConnectorForm } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from './translations';
|
||||
|
||||
const configFormSchema: ConfigFieldSchema[] = [
|
||||
{ id: 'apiUrl', label: i18n.API_URL_LABEL, isUrlField: true },
|
|
@ -11,11 +11,11 @@ import { useGetIssueTypes } from './use_get_issue_types';
|
|||
import { useGetFieldsByIssueType } from './use_get_fields_by_issue_type';
|
||||
import { useGetIssues } from './use_get_issues';
|
||||
import { useGetSingleIssue } from './use_get_single_issue';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { act, fireEvent, render, waitFor, within } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
jest.mock('./use_get_issue_types');
|
||||
jest.mock('./use_get_fields_by_issue_type');
|
||||
jest.mock('./use_get_issues');
|
|
@ -18,15 +18,16 @@ import {
|
|||
EuiFlexItem,
|
||||
EuiSpacer,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { ActionParamsProps } from '../../../../types';
|
||||
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
|
||||
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
|
||||
import type { ActionParamsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
TextAreaWithMessageVariables,
|
||||
TextFieldWithMessageVariables,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { JiraActionParams } from './types';
|
||||
import { useGetIssueTypes } from './use_get_issue_types';
|
||||
import { useGetFieldsByIssueType } from './use_get_fields_by_issue_type';
|
||||
import { SearchIssues } from './search_issues';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
|
||||
const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionParams>> = ({
|
||||
actionConnector,
|
||||
|
@ -198,12 +199,9 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
<>
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.urgencySelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Issue type',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('xpack.stackConnectors.components.jira.urgencySelectFieldLabel', {
|
||||
defaultMessage: 'Issue type',
|
||||
})}
|
||||
>
|
||||
<EuiSelect
|
||||
fullWidth
|
||||
|
@ -223,7 +221,7 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.parentIssueSearchLabel',
|
||||
'xpack.stackConnectors.components.jira.parentIssueSearchLabel',
|
||||
{
|
||||
defaultMessage: 'Parent issue',
|
||||
}
|
||||
|
@ -252,7 +250,7 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.severitySelectFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.severitySelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Priority',
|
||||
}
|
||||
|
@ -284,12 +282,9 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
errors['subActionParams.incident.summary'].length > 0 &&
|
||||
incident.summary !== undefined
|
||||
}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.summaryFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Summary (required)',
|
||||
}
|
||||
)}
|
||||
label={i18n.translate('xpack.stackConnectors.components.jira.summaryFieldLabel', {
|
||||
defaultMessage: 'Summary (required)',
|
||||
})}
|
||||
>
|
||||
<TextFieldWithMessageVariables
|
||||
index={index}
|
||||
|
@ -308,7 +303,7 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.impactSelectFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.impactSelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Labels',
|
||||
}
|
||||
|
@ -358,7 +353,7 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
paramsProperty={'description'}
|
||||
inputTargetValue={incident.description ?? undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.descriptionTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.descriptionTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Description',
|
||||
}
|
||||
|
@ -372,7 +367,7 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
paramsProperty={'comments'}
|
||||
inputTargetValue={comments && comments.length > 0 ? comments[0].comment : undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.commentsTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.commentsTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Additional comments',
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { LogoProps } from '../types';
|
||||
import { LogoProps } from '../../types';
|
||||
|
||||
const Logo = (props: LogoProps) => (
|
||||
<svg
|
|
@ -9,7 +9,7 @@ import React, { useMemo, useEffect, useCallback, useState, memo } from 'react';
|
|||
import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
|
||||
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { useGetIssues } from './use_get_issues';
|
||||
import { useGetSingleIssue } from './use_get_single_issue';
|
||||
import * as i18n from './translations';
|
|
@ -8,93 +8,90 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const API_URL_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.apiUrlTextFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.apiUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'URL',
|
||||
}
|
||||
);
|
||||
|
||||
export const JIRA_PROJECT_KEY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.projectKey',
|
||||
'xpack.stackConnectors.components.jira.projectKey',
|
||||
{
|
||||
defaultMessage: 'Project key',
|
||||
}
|
||||
);
|
||||
|
||||
export const JIRA_EMAIL_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.emailTextFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.emailTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Email address',
|
||||
}
|
||||
);
|
||||
|
||||
export const JIRA_API_TOKEN_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.apiTokenTextFieldLabel',
|
||||
'xpack.stackConnectors.components.jira.apiTokenTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'API token',
|
||||
}
|
||||
);
|
||||
|
||||
export const SUMMARY_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.requiredSummaryTextField',
|
||||
'xpack.stackConnectors.components.jira.requiredSummaryTextField',
|
||||
{
|
||||
defaultMessage: 'Summary is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const ISSUE_TYPES_API_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.unableToGetIssueTypesMessage',
|
||||
'xpack.stackConnectors.components.jira.unableToGetIssueTypesMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get issue types',
|
||||
}
|
||||
);
|
||||
|
||||
export const FIELDS_API_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.unableToGetFieldsMessage',
|
||||
'xpack.stackConnectors.components.jira.unableToGetFieldsMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get fields',
|
||||
}
|
||||
);
|
||||
|
||||
export const ISSUES_API_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.unableToGetIssuesMessage',
|
||||
'xpack.stackConnectors.components.jira.unableToGetIssuesMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get issues',
|
||||
}
|
||||
);
|
||||
|
||||
export const GET_ISSUE_API_ERROR = (id: string) =>
|
||||
i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.unableToGetIssueMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get issue with id {id}',
|
||||
values: { id },
|
||||
}
|
||||
);
|
||||
i18n.translate('xpack.stackConnectors.components.jira.unableToGetIssueMessage', {
|
||||
defaultMessage: 'Unable to get issue with id {id}',
|
||||
values: { id },
|
||||
});
|
||||
|
||||
export const SEARCH_ISSUES_COMBO_BOX_ARIA_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.searchIssuesComboBoxAriaLabel',
|
||||
'xpack.stackConnectors.components.jira.searchIssuesComboBoxAriaLabel',
|
||||
{
|
||||
defaultMessage: 'Type to search',
|
||||
}
|
||||
);
|
||||
|
||||
export const SEARCH_ISSUES_PLACEHOLDER = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.searchIssuesComboBoxPlaceholder',
|
||||
'xpack.stackConnectors.components.jira.searchIssuesComboBoxPlaceholder',
|
||||
{
|
||||
defaultMessage: 'Type to search',
|
||||
}
|
||||
);
|
||||
|
||||
export const SEARCH_ISSUES_LOADING = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.searchIssuesLoading',
|
||||
'xpack.stackConnectors.components.jira.searchIssuesLoading',
|
||||
{
|
||||
defaultMessage: 'Loading...',
|
||||
}
|
||||
);
|
||||
|
||||
export const LABELS_WHITE_SPACES = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.jira.labelsSpacesErrorMessage',
|
||||
'xpack.stackConnectors.components.jira.labelsSpacesErrorMessage',
|
||||
{
|
||||
defaultMessage: 'Labels cannot contain spaces.',
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { ExecutorSubActionPushParams } from '@kbn/stack-connectors-plugin/server/connector_types/cases/jira/types';
|
||||
import { UserConfiguredActionConnector } from '../../../../types';
|
||||
import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import type { ExecutorSubActionPushParams } from '../../../../server/connector_types/cases/jira/types';
|
||||
|
||||
export type JiraActionConnector = UserConfiguredActionConnector<JiraConfig, JiraSecrets>;
|
||||
export interface JiraActionParams {
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { Fields } from './types';
|
||||
import { getFieldsByIssueType } from './api';
|
||||
import * as i18n from './translations';
|
|
@ -8,7 +8,7 @@
|
|||
import { useState, useEffect, useRef } from 'react';
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { IssueTypes } from './types';
|
||||
import { getIssueTypes } from './api';
|
||||
import * as i18n from './translations';
|
|
@ -8,7 +8,7 @@
|
|||
import { isEmpty, debounce } from 'lodash/fp';
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { Issue } from './types';
|
||||
import { getIssues } from './api';
|
||||
import * as i18n from './translations';
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { Issue } from './types';
|
||||
import { getIssue } from './api';
|
||||
import * as i18n from './translations';
|
|
@ -6,8 +6,11 @@
|
|||
*/
|
||||
|
||||
import { HttpSetup } from '@kbn/core/public';
|
||||
import { BASE_ACTION_API_PATH } from '../../../constants';
|
||||
import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../rewrite_response_body';
|
||||
import { BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common';
|
||||
import {
|
||||
ConnectorExecutorResult,
|
||||
rewriteResponseToCamelCase,
|
||||
} from '../../lib/rewrite_response_body';
|
||||
|
||||
export async function getIncidentTypes({
|
||||
http,
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { getConnectorType as getResilientConnectorType } from './resilient';
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { LogoProps } from '../types';
|
||||
import { LogoProps } from '../../types';
|
||||
|
||||
const Logo = (props: LogoProps) => (
|
||||
<svg
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application/type_registry';
|
||||
import { registerConnectorTypes } from '../..';
|
||||
import type { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { registrationServicesMock } from '../../../mocks';
|
||||
|
||||
const CONNECTOR_TYPE_ID = '.resilient';
|
||||
let connectorTypeModel: ConnectorTypeModel;
|
||||
|
||||
beforeAll(() => {
|
||||
const connectorTypeRegistry = new TypeRegistry<ConnectorTypeModel>();
|
||||
registerConnectorTypes({ connectorTypeRegistry, services: registrationServicesMock });
|
||||
const getResult = connectorTypeRegistry.get(CONNECTOR_TYPE_ID);
|
||||
if (getResult !== null) {
|
||||
connectorTypeModel = getResult;
|
||||
}
|
||||
});
|
||||
|
||||
describe('connectorTypeRegistry.get() works', () => {
|
||||
test('connector type static data is as expected', () => {
|
||||
expect(connectorTypeModel.id).toEqual(CONNECTOR_TYPE_ID);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resilient action params validation', () => {
|
||||
test('action params validation succeeds when action params is valid', async () => {
|
||||
const actionParams = {
|
||||
subActionParams: { incident: { name: 'some title {{test}}' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: { 'subActionParams.incident.name': [] },
|
||||
});
|
||||
});
|
||||
|
||||
test('params validation fails when body is not valid', async () => {
|
||||
const actionParams = {
|
||||
subActionParams: { incident: { name: '' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: {
|
||||
'subActionParams.incident.name': ['Name is required.'],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
|
@ -7,24 +7,24 @@
|
|||
|
||||
import { lazy } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { GenericValidationResult, ActionTypeModel } from '../../../../types';
|
||||
import type {
|
||||
GenericValidationResult,
|
||||
ActionTypeModel as ConnectorTypeModel,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ResilientConfig, ResilientSecrets, ResilientActionParams } from './types';
|
||||
|
||||
export const DESC = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Create an incident in IBM Resilient.',
|
||||
}
|
||||
);
|
||||
export const DESC = i18n.translate('xpack.stackConnectors.components.resilient.selectMessageText', {
|
||||
defaultMessage: 'Create an incident in IBM Resilient.',
|
||||
});
|
||||
|
||||
export const TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.actionTypeTitle',
|
||||
'xpack.stackConnectors.components.resilient.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'Resilient',
|
||||
}
|
||||
);
|
||||
|
||||
export function getActionType(): ActionTypeModel<
|
||||
export function getConnectorType(): ConnectorTypeModel<
|
||||
ResilientConfig,
|
||||
ResilientSecrets,
|
||||
ResilientActionParams
|
|
@ -8,11 +8,11 @@
|
|||
import React from 'react';
|
||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
import ResilientConnectorFields from './resilient_connectors';
|
||||
import { ConnectorFormTestProvider } from '../test_utils';
|
||||
import { ConnectorFormTestProvider } from '../../lib/test_utils';
|
||||
import { act, render } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
describe('ResilientActionConnectorFields renders', () => {
|
||||
test('alerting Resilient connector fields are rendered', () => {
|
|
@ -6,14 +6,13 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { ActionConnectorFieldsProps } from '../../../../types';
|
||||
import * as i18n from './translations';
|
||||
import {
|
||||
import type {
|
||||
ActionConnectorFieldsProps,
|
||||
ConfigFieldSchema,
|
||||
SecretsFieldSchema,
|
||||
SimpleConnectorForm,
|
||||
} from '../../simple_connector_form';
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { SimpleConnectorForm } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from './translations';
|
||||
|
||||
const configFormSchema: ConfigFieldSchema[] = [
|
||||
{ id: 'apiUrl', label: i18n.API_URL_LABEL, isUrlField: true },
|
|
@ -14,7 +14,7 @@ import { EuiComboBoxOptionOption } from '@elastic/eui';
|
|||
|
||||
jest.mock('./use_get_incident_types');
|
||||
jest.mock('./use_get_severity');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const useGetIncidentTypesMock = useGetIncidentTypes as jest.Mock;
|
||||
const useGetSeverityMock = useGetSeverity as jest.Mock;
|
|
@ -16,15 +16,16 @@ import {
|
|||
EuiSelectOption,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { ActionParamsProps } from '../../../../types';
|
||||
import type { ActionParamsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
TextAreaWithMessageVariables,
|
||||
TextFieldWithMessageVariables,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ResilientActionParams } from './types';
|
||||
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
|
||||
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
|
||||
|
||||
import { useGetIncidentTypes } from './use_get_incident_types';
|
||||
import { useGetSeverity } from './use_get_severity';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
|
||||
const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<ResilientActionParams>> = ({
|
||||
actionConnector,
|
||||
|
@ -169,7 +170,7 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
|
|||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.urgencySelectFieldLabel',
|
||||
'xpack.stackConnectors.components.resilient.urgencySelectFieldLabel',
|
||||
{ defaultMessage: 'Incident Type' }
|
||||
)}
|
||||
>
|
||||
|
@ -188,10 +189,9 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
|
|||
<EuiSpacer size="m" />
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.severity',
|
||||
{ defaultMessage: 'Severity' }
|
||||
)}
|
||||
label={i18n.translate('xpack.stackConnectors.components.resilient.severity', {
|
||||
defaultMessage: 'Severity',
|
||||
})}
|
||||
>
|
||||
<EuiSelect
|
||||
data-test-subj="severitySelect"
|
||||
|
@ -213,10 +213,9 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
|
|||
errors['subActionParams.incident.name'].length > 0 &&
|
||||
incident.name !== undefined
|
||||
}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.nameFieldLabel',
|
||||
{ defaultMessage: 'Name (required)' }
|
||||
)}
|
||||
label={i18n.translate('xpack.stackConnectors.components.resilient.nameFieldLabel', {
|
||||
defaultMessage: 'Name (required)',
|
||||
})}
|
||||
>
|
||||
<TextFieldWithMessageVariables
|
||||
index={index}
|
||||
|
@ -234,7 +233,7 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
|
|||
paramsProperty={'description'}
|
||||
inputTargetValue={incident.description ?? undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.descriptionTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.resilient.descriptionTextAreaFieldLabel',
|
||||
{ defaultMessage: 'Description' }
|
||||
)}
|
||||
/>
|
||||
|
@ -245,7 +244,7 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
|
|||
paramsProperty={'comments'}
|
||||
inputTargetValue={comments && comments.length > 0 ? comments[0].comment : undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.commentsTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.resilient.commentsTextAreaFieldLabel',
|
||||
{ defaultMessage: 'Additional comments' }
|
||||
)}
|
||||
/>
|
|
@ -8,49 +8,46 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const API_URL_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.apiUrlTextFieldLabel',
|
||||
'xpack.stackConnectors.components.resilient.apiUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'URL',
|
||||
}
|
||||
);
|
||||
|
||||
export const ORG_ID_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.orgId',
|
||||
{
|
||||
defaultMessage: 'Organization ID',
|
||||
}
|
||||
);
|
||||
export const ORG_ID_LABEL = i18n.translate('xpack.stackConnectors.components.resilient.orgId', {
|
||||
defaultMessage: 'Organization ID',
|
||||
});
|
||||
|
||||
export const API_KEY_ID_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.apiKeyId',
|
||||
'xpack.stackConnectors.components.resilient.apiKeyId',
|
||||
{
|
||||
defaultMessage: 'API Key ID',
|
||||
}
|
||||
);
|
||||
|
||||
export const API_KEY_SECRET_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.apiKeySecret',
|
||||
'xpack.stackConnectors.components.resilient.apiKeySecret',
|
||||
{
|
||||
defaultMessage: 'API Key Secret',
|
||||
}
|
||||
);
|
||||
|
||||
export const NAME_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.requiredNameTextField',
|
||||
'xpack.stackConnectors.components.resilient.requiredNameTextField',
|
||||
{
|
||||
defaultMessage: 'Name is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const INCIDENT_TYPES_API_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.unableToGetIncidentTypesMessage',
|
||||
'xpack.stackConnectors.components.resilient.unableToGetIncidentTypesMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get incident types',
|
||||
}
|
||||
);
|
||||
|
||||
export const SEVERITY_API_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.resilient.unableToGetSeverityMessage',
|
||||
'xpack.stackConnectors.components.resilient.unableToGetSeverityMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get severity',
|
||||
}
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { ExecutorSubActionPushParams } from '@kbn/stack-connectors-plugin/server/connector_types/cases/resilient/types';
|
||||
import { UserConfiguredActionConnector } from '../../../../types';
|
||||
import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import type { ExecutorSubActionPushParams } from '../../../../server/connector_types/cases/resilient/types';
|
||||
|
||||
export type ResilientActionConnector = UserConfiguredActionConnector<
|
||||
ResilientConfig,
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { HttpSetup, ToastsApi } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { getIncidentTypes } from './api';
|
||||
import * as i18n from './translations';
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { HttpSetup, ToastsApi } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { getSeverity } from './api';
|
||||
import * as i18n from './translations';
|
||||
|
|
@ -10,12 +10,15 @@ import { HttpSetup } from '@kbn/core/public';
|
|||
import {
|
||||
ActionTypeExecutorResult,
|
||||
INTERNAL_BASE_ACTION_API_PATH,
|
||||
BASE_ACTION_API_PATH,
|
||||
} from '@kbn/actions-plugin/common';
|
||||
import { snExternalServiceConfig } from '@kbn/stack-connectors-plugin/common/servicenow_config';
|
||||
import { BASE_ACTION_API_PATH } from '../../../constants';
|
||||
import { snExternalServiceConfig } from '../../../../common/servicenow_config';
|
||||
import { API_INFO_ERROR } from './translations';
|
||||
import { AppInfo, RESTApiError, ServiceNowActionConnector } from './types';
|
||||
import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../rewrite_response_body';
|
||||
import {
|
||||
ConnectorExecutorResult,
|
||||
rewriteResponseToCamelCase,
|
||||
} from '../../lib/rewrite_response_body';
|
||||
import { Choice } from './types';
|
||||
|
||||
export async function getChoices({
|
|
@ -11,14 +11,14 @@ import { i18n } from '@kbn/i18n';
|
|||
import { SNStoreButton } from './sn_store_button';
|
||||
|
||||
const content = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.applicationRequiredCallout.content',
|
||||
'xpack.stackConnectors.components.serviceNow.applicationRequiredCallout.content',
|
||||
{
|
||||
defaultMessage: 'Please go to the ServiceNow app store and install the application',
|
||||
}
|
||||
);
|
||||
|
||||
const ERROR_MESSAGE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.applicationRequiredCallout.errorMessage',
|
||||
'xpack.stackConnectors.components.serviceNow.applicationRequiredCallout.errorMessage',
|
||||
{
|
||||
defaultMessage: 'Error message',
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ const ApplicationRequiredCalloutComponent: React.FC<Props> = ({ appId, message }
|
|||
data-test-subj="snApplicationCallout"
|
||||
color="danger"
|
||||
title={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.applicationRequiredCallout',
|
||||
'xpack.stackConnectors.components.serviceNow.applicationRequiredCallout',
|
||||
{
|
||||
defaultMessage: 'Elastic ServiceNow App not installed',
|
||||
}
|
|
@ -9,7 +9,7 @@ import React, { memo } from 'react';
|
|||
import { UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||
import { TextField } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { PasswordField } from '../../../password_field';
|
||||
import { PasswordField } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from '../translations';
|
||||
|
||||
interface Props {
|
|
@ -9,8 +9,8 @@ import React, { memo } from 'react';
|
|||
import { UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||
import { TextAreaField, TextField } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { PasswordField } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from '../translations';
|
||||
import { PasswordField } from '../../../password_field';
|
||||
|
||||
interface Props {
|
||||
readOnly: boolean;
|
|
@ -9,9 +9,9 @@ import React from 'react';
|
|||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { Credentials } from './credentials';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
|
||||
import { ConnectorFormTestProvider } from '../test_utils';
|
||||
import { ConnectorFormTestProvider } from '../../lib/test_utils';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
describe('Credentials', () => {
|
||||
const connector = {
|
|
@ -12,7 +12,7 @@ import { UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
|||
import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers';
|
||||
import { TextField } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import * as i18n from './translations';
|
||||
|
||||
interface Props {
|
||||
|
@ -31,7 +31,7 @@ const CredentialsApiUrlComponent: React.FC<Props> = ({ isLoading, readOnly, path
|
|||
<EuiFormRow fullWidth>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.triggersActionsUI.components.builtinActionTypes.serviceNowAction.apiUrlHelpLabel"
|
||||
id="xpack.stackConnectors.components.serviceNow.apiUrlHelpLabel"
|
||||
defaultMessage="Provide the full URL to the desired ServiceNow instance. If you don't have one, {instance}."
|
||||
values={{
|
||||
instance: (
|
|
@ -32,7 +32,7 @@ const DeprecatedCalloutComponent: React.FC<Props> = ({ onMigrate }) => {
|
|||
data-test-subj="snDeprecatedCallout"
|
||||
color="warning"
|
||||
title={i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.deprecatedCalloutTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.deprecatedCalloutTitle',
|
||||
{
|
||||
defaultMessage: 'This connector type is deprecated',
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ const DeprecatedCalloutComponent: React.FC<Props> = ({ onMigrate }) => {
|
|||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="{update} {create} "
|
||||
id="xpack.triggersActionsUI.components.builtinActionTypes.servicenow.appInstallationInfo"
|
||||
id="xpack.stackConnectors.components.serviceNow.appInstallationInfo"
|
||||
values={{
|
||||
update,
|
||||
create: (
|
||||
<span>
|
||||
{i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.deprecatedCalloutCreate',
|
||||
'xpack.stackConnectors.components.serviceNow.deprecatedCalloutCreate',
|
||||
{
|
||||
defaultMessage: 'or create a new one.',
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ const DeprecatedCalloutComponent: React.FC<Props> = ({ onMigrate }) => {
|
|||
export const DeprecatedCallout = memo(DeprecatedCalloutComponent);
|
||||
|
||||
const updateThisConnectorMessage = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.deprecatedCalloutMigrate',
|
||||
'xpack.stackConnectors.components.serviceNow.deprecatedCalloutMigrate',
|
||||
{
|
||||
defaultMessage: 'Update this connector,',
|
||||
}
|
|
@ -11,7 +11,7 @@ import {
|
|||
getConnectorDescriptiveTitle,
|
||||
getSelectedConnectorIcon,
|
||||
} from './helpers';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
|
||||
const deprecatedConnector: ActionConnector = {
|
||||
secrets: {},
|
|
@ -7,9 +7,12 @@
|
|||
|
||||
import { lazy, ComponentType } from 'react';
|
||||
import { EuiSelectOption } from '@elastic/eui';
|
||||
import {
|
||||
ActionConnector,
|
||||
deprecatedMessage,
|
||||
IErrorObject,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { AppInfo, Choice, RESTApiError } from './types';
|
||||
import { ActionConnector, IErrorObject } from '../../../../types';
|
||||
import { deprecatedMessage } from '../../../../common/connectors_selection';
|
||||
|
||||
export const DEFAULT_CORRELATION_ID = '{{rule.id}}:{{alert.id}}';
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
export {
|
||||
getServiceNowITSMActionType,
|
||||
getServiceNowSIRActionType,
|
||||
getServiceNowITOMActionType,
|
||||
getServiceNowITSMConnectorType,
|
||||
getServiceNowSIRConnectorType,
|
||||
getServiceNowITOMConnectorType,
|
||||
} from './servicenow';
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { LogoProps } from '../types';
|
||||
import { LogoProps } from '../../types';
|
||||
|
||||
function Logo(props: LogoProps) {
|
||||
return (
|
|
@ -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; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application/type_registry';
|
||||
import { registerConnectorTypes } from '../..';
|
||||
import type { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { registrationServicesMock } from '../../../mocks';
|
||||
|
||||
const SERVICENOW_ITSM_CONNECTOR_TYPE_ID = '.servicenow';
|
||||
const SERVICENOW_SIR_CONNECTOR_TYPE_ID = '.servicenow-sir';
|
||||
const SERVICENOW_ITOM_CONNECTOR_TYPE_ID = '.servicenow-itom';
|
||||
let connectorTypeRegistry: TypeRegistry<ConnectorTypeModel>;
|
||||
|
||||
beforeAll(() => {
|
||||
connectorTypeRegistry = new TypeRegistry<ConnectorTypeModel>();
|
||||
registerConnectorTypes({ connectorTypeRegistry, services: registrationServicesMock });
|
||||
});
|
||||
|
||||
describe('connectorTypeRegistry.get() works', () => {
|
||||
[
|
||||
SERVICENOW_ITSM_CONNECTOR_TYPE_ID,
|
||||
SERVICENOW_SIR_CONNECTOR_TYPE_ID,
|
||||
SERVICENOW_ITOM_CONNECTOR_TYPE_ID,
|
||||
].forEach((id) => {
|
||||
test(`${id}: connector type static data is as expected`, () => {
|
||||
const connectorTypeModel = connectorTypeRegistry.get(id);
|
||||
expect(connectorTypeModel.id).toEqual(id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('servicenow action params validation', () => {
|
||||
[SERVICENOW_ITSM_CONNECTOR_TYPE_ID, SERVICENOW_SIR_CONNECTOR_TYPE_ID].forEach((id) => {
|
||||
test(`${id}: action params validation succeeds when action params is valid`, async () => {
|
||||
const connectorTypeModel = connectorTypeRegistry.get(id);
|
||||
const actionParams = {
|
||||
subActionParams: { incident: { short_description: 'some title {{test}}' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: { ['subActionParams.incident.short_description']: [] },
|
||||
});
|
||||
});
|
||||
|
||||
test(`${id}: params validation fails when short_description is not valid`, async () => {
|
||||
const connectorTypeModel = connectorTypeRegistry.get(id);
|
||||
const actionParams = {
|
||||
subActionParams: { incident: { short_description: '' }, comments: [] },
|
||||
};
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: {
|
||||
['subActionParams.incident.short_description']: ['Short description is required.'],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test(`${SERVICENOW_ITOM_CONNECTOR_TYPE_ID}: action params validation succeeds when action params is valid`, async () => {
|
||||
const connectorTypeModel = connectorTypeRegistry.get(SERVICENOW_ITOM_CONNECTOR_TYPE_ID);
|
||||
const actionParams = { subActionParams: { severity: 'Critical' } };
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: { ['severity']: [] },
|
||||
});
|
||||
});
|
||||
|
||||
test(`${SERVICENOW_ITOM_CONNECTOR_TYPE_ID}: params validation fails when severity is not valid`, async () => {
|
||||
const connectorTypeModel = connectorTypeRegistry.get(SERVICENOW_ITOM_CONNECTOR_TYPE_ID);
|
||||
const actionParams = { subActionParams: { severity: null } };
|
||||
|
||||
expect(await connectorTypeModel.validateParams(actionParams)).toEqual({
|
||||
errors: { ['severity']: ['Severity is required.'] },
|
||||
});
|
||||
});
|
||||
});
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
import { lazy } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ActionTypeModel, GenericValidationResult } from '../../../../types';
|
||||
import type {
|
||||
ActionTypeModel as ConnectorTypeModel,
|
||||
GenericValidationResult,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
ServiceNowConfig,
|
||||
ServiceNowITOMActionParams,
|
||||
|
@ -18,48 +21,48 @@ import {
|
|||
import { getConnectorDescriptiveTitle, getSelectedConnectorIcon } from './helpers';
|
||||
|
||||
export const SERVICENOW_ITOM_TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNowITOM.actionTypeTitle',
|
||||
'xpack.stackConnectors.components.serviceNowITOM.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'ServiceNow ITOM',
|
||||
}
|
||||
);
|
||||
|
||||
export const SERVICENOW_ITOM_DESC = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNowITOM.selectMessageText',
|
||||
'xpack.stackConnectors.components.serviceNowITOM.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Create an event in ServiceNow ITOM.',
|
||||
}
|
||||
);
|
||||
|
||||
export const SERVICENOW_ITSM_DESC = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNowITSM.selectMessageText',
|
||||
'xpack.stackConnectors.components.serviceNowITSM.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Create an incident in ServiceNow ITSM.',
|
||||
}
|
||||
);
|
||||
|
||||
export const SERVICENOW_SIR_DESC = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNowSIR.selectMessageText',
|
||||
'xpack.stackConnectors.components.serviceNowSIR.selectMessageText',
|
||||
{
|
||||
defaultMessage: 'Create an incident in ServiceNow SecOps.',
|
||||
}
|
||||
);
|
||||
|
||||
export const SERVICENOW_ITSM_TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNowITSM.actionTypeTitle',
|
||||
'xpack.stackConnectors.components.serviceNowITSM.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'ServiceNow ITSM',
|
||||
}
|
||||
);
|
||||
|
||||
export const SERVICENOW_SIR_TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNowSIR.actionTypeTitle',
|
||||
'xpack.stackConnectors.components.serviceNowSIR.connectorTypeTitle',
|
||||
{
|
||||
defaultMessage: 'ServiceNow SecOps',
|
||||
}
|
||||
);
|
||||
|
||||
export function getServiceNowITSMActionType(): ActionTypeModel<
|
||||
export function getServiceNowITSMConnectorType(): ConnectorTypeModel<
|
||||
ServiceNowConfig,
|
||||
ServiceNowSecrets,
|
||||
ServiceNowITSMActionParams
|
||||
|
@ -97,7 +100,7 @@ export function getServiceNowITSMActionType(): ActionTypeModel<
|
|||
};
|
||||
}
|
||||
|
||||
export function getServiceNowSIRActionType(): ActionTypeModel<
|
||||
export function getServiceNowSIRConnectorType(): ConnectorTypeModel<
|
||||
ServiceNowConfig,
|
||||
ServiceNowSecrets,
|
||||
ServiceNowSIRActionParams
|
||||
|
@ -135,7 +138,7 @@ export function getServiceNowSIRActionType(): ActionTypeModel<
|
|||
};
|
||||
}
|
||||
|
||||
export function getServiceNowITOMActionType(): ActionTypeModel<
|
||||
export function getServiceNowITOMConnectorType(): ConnectorTypeModel<
|
||||
ServiceNowConfig,
|
||||
ServiceNowSecrets,
|
||||
ServiceNowITOMActionParams
|
|
@ -10,17 +10,17 @@ import { act, within } from '@testing-library/react';
|
|||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
import { render, act as reactAct } from '@testing-library/react';
|
||||
|
||||
import { ConnectorValidationFunc } from '../../../../types';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { updateActionConnector } from '../../../lib/action_connector_api';
|
||||
import { ConnectorValidationFunc } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { updateActionConnector } from '@kbn/triggers-actions-ui-plugin/public/application/lib/action_connector_api';
|
||||
import ServiceNowConnectorFields from './servicenow_connectors';
|
||||
import { getAppInfo } from './api';
|
||||
import { ConnectorFormTestProvider } from '../test_utils';
|
||||
import { ConnectorFormTestProvider } from '../../lib/test_utils';
|
||||
import { mount } from 'enzyme';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('../../../lib/action_connector_api');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/application/lib/action_connector_api');
|
||||
jest.mock('./api');
|
||||
|
||||
const useKibanaMock = useKibana as jest.Mocked<typeof useKibana>;
|
|
@ -8,23 +8,24 @@
|
|||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
|
||||
import { EuiSpacer } from '@elastic/eui';
|
||||
import { snExternalServiceConfig } from '@kbn/stack-connectors-plugin/common/servicenow_config';
|
||||
import { useFormContext, useFormData } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
|
||||
import { ActionConnectorFieldsProps } from '../../../../types';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import type { ActionConnectorFieldsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
HiddenField,
|
||||
updateActionConnector,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import type { ConnectorFormSchema } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { snExternalServiceConfig } from '../../../../common/servicenow_config';
|
||||
import { DeprecatedCallout } from './deprecated_callout';
|
||||
import { useGetAppInfo } from './use_get_app_info';
|
||||
import { ApplicationRequiredCallout } from './application_required_callout';
|
||||
import { isRESTApiError } from './helpers';
|
||||
import { InstallationCallout } from './installation_callout';
|
||||
import { UpdateConnector, UpdateConnectorFormSchema } from './update_connector';
|
||||
import { updateActionConnector } from '../../../lib/action_connector_api';
|
||||
import { Credentials } from './credentials';
|
||||
import * as i18n from './translations';
|
||||
import { ServiceNowActionConnector, ServiceNowConfig, ServiceNowSecrets } from './types';
|
||||
import { HiddenField } from '../../hidden_field';
|
||||
import { ConnectorFormSchema } from '../../../sections/action_connector_form/types';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export { ServiceNowConnectorFields as default };
|
|
@ -8,7 +8,11 @@
|
|||
import { act } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { AppMockRenderer, ConnectorFormTestProvider, createAppMockRenderer } from '../test_utils';
|
||||
import {
|
||||
AppMockRenderer,
|
||||
ConnectorFormTestProvider,
|
||||
createAppMockRenderer,
|
||||
} from '../../lib/test_utils';
|
||||
import ServiceNowConnectorFieldsNoApp from './servicenow_connectors_no_app';
|
||||
|
||||
describe('ServiceNowActionConnectorFields renders', () => {
|
|
@ -7,10 +7,9 @@
|
|||
|
||||
import React from 'react';
|
||||
import { useFormData } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
|
||||
import { ActionConnectorFieldsProps } from '../../../../types';
|
||||
import type { ActionConnectorFieldsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ConnectorFormSchema } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { Credentials } from './credentials';
|
||||
import { ConnectorFormSchema } from '../../../sections/action_connector_form/types';
|
||||
import { ServiceNowConfig, ServiceNowSecrets } from './types';
|
||||
|
||||
const ServiceNowConnectorFieldsNoApp: React.FC<ActionConnectorFieldsProps> = ({
|
|
@ -8,12 +8,12 @@
|
|||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { useChoices } from './use_choices';
|
||||
import ServiceNowITOMParamsFields from './servicenow_itom_params';
|
||||
|
||||
jest.mock('./use_choices');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const useChoicesMock = useChoices as jest.Mock;
|
||||
|
|
@ -7,10 +7,12 @@
|
|||
|
||||
import React, { useCallback, useEffect, useRef, useMemo } from 'react';
|
||||
import { EuiFormRow, EuiSpacer, EuiTitle, EuiSelect } from '@elastic/eui';
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { ActionParamsProps } from '../../../../types';
|
||||
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
|
||||
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
|
||||
import type { ActionParamsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
TextAreaWithMessageVariables,
|
||||
TextFieldWithMessageVariables,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
|
||||
import * as i18n from './translations';
|
||||
import { useChoices } from './use_choices';
|
|
@ -9,14 +9,14 @@ import React from 'react';
|
|||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
import { act } from '@testing-library/react';
|
||||
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { useGetChoices } from './use_get_choices';
|
||||
import ServiceNowITSMParamsFields from './servicenow_itsm_params';
|
||||
import { Choice } from './types';
|
||||
import { merge } from 'lodash';
|
||||
|
||||
jest.mock('./use_get_choices');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const useGetChoicesMock = useGetChoices as jest.Mock;
|
||||
|
|
@ -16,12 +16,13 @@ import {
|
|||
EuiLink,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { ActionParamsProps } from '../../../../types';
|
||||
import type { ActionParamsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
TextAreaWithMessageVariables,
|
||||
TextFieldWithMessageVariables,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ServiceNowITSMActionParams, Choice, Fields } from './types';
|
||||
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
|
||||
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
|
||||
import { useGetChoices } from './use_get_choices';
|
||||
import { choicesToEuiOptions, DEFAULT_CORRELATION_ID } from './helpers';
|
||||
|
||||
|
@ -252,7 +253,7 @@ const ServiceNowParamsFields: React.FunctionComponent<
|
|||
helpText={
|
||||
<EuiLink href={docLinks.links.alerting.serviceNowAction} target="_blank">
|
||||
<FormattedMessage
|
||||
id="xpack.triggersActionsUI.components.builtinActionTypes.serviceNowAction.correlationIDHelpLabel"
|
||||
id="xpack.stackConnectors.components.serviceNow.correlationIDHelpLabel"
|
||||
defaultMessage="Identifier for updating incidents"
|
||||
/>
|
||||
</EuiLink>
|
|
@ -8,8 +8,8 @@ import { EuiIconTip } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { connectorDeprecatedMessage } from '../../../../common/connectors_selection';
|
||||
import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { connectorDeprecatedMessage } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export { ServiceNowSelectableRowIcon as default };
|
||||
|
@ -32,7 +32,7 @@ export function ServiceNowSelectableRowIcon({
|
|||
}
|
||||
|
||||
const deprecatedTooltipTitle = i18n.translate(
|
||||
'xpack.triggersActionsUI.sections.actionForm.deprecatedTooltipTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.deprecatedTooltipTitle',
|
||||
{
|
||||
defaultMessage: 'Deprecated connector',
|
||||
}
|
|
@ -9,14 +9,14 @@ import React from 'react';
|
|||
import { act } from '@testing-library/react';
|
||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { useGetChoices } from './use_get_choices';
|
||||
import ServiceNowSIRParamsFields from './servicenow_sir_params';
|
||||
import { Choice } from './types';
|
||||
import { merge } from 'lodash';
|
||||
|
||||
jest.mock('./use_get_choices');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const useGetChoicesMock = useGetChoices as jest.Mock;
|
||||
|
|
@ -16,11 +16,12 @@ import {
|
|||
EuiLink,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { ActionParamsProps } from '../../../../types';
|
||||
import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables';
|
||||
import { TextFieldWithMessageVariables } from '../../text_field_with_message_variables';
|
||||
import type { ActionParamsProps } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import {
|
||||
TextAreaWithMessageVariables,
|
||||
TextFieldWithMessageVariables,
|
||||
useKibana,
|
||||
} from '@kbn/triggers-actions-ui-plugin/public';
|
||||
|
||||
import * as i18n from './translations';
|
||||
import { useGetChoices } from './use_get_choices';
|
||||
|
@ -239,7 +240,7 @@ const ServiceNowSIRParamsFields: React.FunctionComponent<
|
|||
helpText={
|
||||
<EuiLink href={docLinks.links.alerting.serviceNowSIRAction} target="_blank">
|
||||
<FormattedMessage
|
||||
id="xpack.triggersActionsUI.components.builtinActionTypes.serviceNowSIRAction.correlationIDHelpLabel"
|
||||
id="xpack.stackConnectors.components.serviceNowSIR.correlationIDHelpLabel"
|
||||
defaultMessage="Identifier for updating incidents"
|
||||
/>
|
||||
</EuiLink>
|
|
@ -8,146 +8,143 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const API_URL_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.apiUrlTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.apiUrlTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'ServiceNow instance URL',
|
||||
}
|
||||
);
|
||||
|
||||
export const API_URL_INVALID = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.invalidApiUrlTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.invalidApiUrlTextField',
|
||||
{
|
||||
defaultMessage: 'URL is invalid.',
|
||||
}
|
||||
);
|
||||
|
||||
export const AUTHENTICATION_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.authenticationLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.authenticationLabel',
|
||||
{
|
||||
defaultMessage: 'Authentication',
|
||||
}
|
||||
);
|
||||
|
||||
export const USERNAME_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.usernameTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.usernameTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Username',
|
||||
}
|
||||
);
|
||||
|
||||
export const USERNAME_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.requiredUsernameTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredUsernameTextField',
|
||||
{
|
||||
defaultMessage: 'Username is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const PASSWORD_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.passwordTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.passwordTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Password',
|
||||
}
|
||||
);
|
||||
|
||||
export const TITLE_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.common.requiredShortDescTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredShortDescTextField',
|
||||
{
|
||||
defaultMessage: 'Short description is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const INCIDENT = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.title',
|
||||
{
|
||||
defaultMessage: 'Incident',
|
||||
}
|
||||
);
|
||||
export const INCIDENT = i18n.translate('xpack.stackConnectors.components.serviceNow.title', {
|
||||
defaultMessage: 'Incident',
|
||||
});
|
||||
|
||||
export const SECURITY_INCIDENT = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenowSIR.title',
|
||||
'xpack.stackConnectors.components.serviceNowSIR.title',
|
||||
{
|
||||
defaultMessage: 'Security Incident',
|
||||
}
|
||||
);
|
||||
|
||||
export const SHORT_DESCRIPTION_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.titleFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.titleFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Short description (required)',
|
||||
}
|
||||
);
|
||||
|
||||
export const DESCRIPTION_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.descriptionTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.descriptionTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Description',
|
||||
}
|
||||
);
|
||||
|
||||
export const COMMENTS_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.commentsTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.commentsTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Additional comments',
|
||||
}
|
||||
);
|
||||
|
||||
export const CHOICES_API_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.unableToGetChoicesMessage',
|
||||
'xpack.stackConnectors.components.serviceNow.unableToGetChoicesMessage',
|
||||
{
|
||||
defaultMessage: 'Unable to get choices',
|
||||
}
|
||||
);
|
||||
|
||||
export const CATEGORY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.categoryTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.categoryTitle',
|
||||
{
|
||||
defaultMessage: 'Category',
|
||||
}
|
||||
);
|
||||
|
||||
export const SUBCATEGORY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.subcategoryTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.subcategoryTitle',
|
||||
{
|
||||
defaultMessage: 'Subcategory',
|
||||
}
|
||||
);
|
||||
|
||||
export const URGENCY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.urgencySelectFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.urgencySelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Urgency',
|
||||
}
|
||||
);
|
||||
|
||||
export const SEVERITY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.severitySelectFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.severitySelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Severity',
|
||||
}
|
||||
);
|
||||
|
||||
export const IMPACT_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.impactSelectFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.impactSelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Impact',
|
||||
}
|
||||
);
|
||||
|
||||
export const PRIORITY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.prioritySelectFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.prioritySelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Priority',
|
||||
}
|
||||
);
|
||||
|
||||
export const API_INFO_ERROR = (status: number) =>
|
||||
i18n.translate('xpack.triggersActionsUI.components.builtinActionTypes.servicenow.apiInfoError', {
|
||||
i18n.translate('xpack.stackConnectors.components.serviceNow.apiInfoError', {
|
||||
values: { status },
|
||||
defaultMessage: 'Received status: {status} when attempting to get application information',
|
||||
});
|
||||
|
||||
export const FETCH_ERROR = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.fetchErrorMsg',
|
||||
'xpack.stackConnectors.components.serviceNow.fetchErrorMsg',
|
||||
{
|
||||
defaultMessage:
|
||||
'Failed to fetch. Check the URL or the CORS configuration of your ServiceNow instance.',
|
||||
|
@ -155,7 +152,7 @@ export const FETCH_ERROR = i18n.translate(
|
|||
);
|
||||
|
||||
export const INSTALLATION_CALLOUT_TITLE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.installationCalloutTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.installationCalloutTitle',
|
||||
{
|
||||
defaultMessage:
|
||||
'To use this connector, first install the Elastic app from the ServiceNow app store.',
|
||||
|
@ -163,218 +160,206 @@ export const INSTALLATION_CALLOUT_TITLE = i18n.translate(
|
|||
);
|
||||
|
||||
export const UPDATE_SUCCESS_TOAST_TITLE = (connectorName: string) =>
|
||||
i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.updateSuccessToastTitle',
|
||||
{
|
||||
defaultMessage: '{connectorName} connector updated',
|
||||
values: {
|
||||
connectorName,
|
||||
},
|
||||
}
|
||||
);
|
||||
i18n.translate('xpack.stackConnectors.components.serviceNow.updateSuccessToastTitle', {
|
||||
defaultMessage: '{connectorName} connector updated',
|
||||
values: {
|
||||
connectorName,
|
||||
},
|
||||
});
|
||||
|
||||
export const UPDATE_SUCCESS_TOAST_TEXT = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.updateCalloutText',
|
||||
'xpack.stackConnectors.components.serviceNow.updateCalloutText',
|
||||
{
|
||||
defaultMessage: 'Connector has been updated.',
|
||||
}
|
||||
);
|
||||
|
||||
export const VISIT_SN_STORE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.visitSNStore',
|
||||
'xpack.stackConnectors.components.serviceNow.visitSNStore',
|
||||
{
|
||||
defaultMessage: 'Visit ServiceNow app store',
|
||||
}
|
||||
);
|
||||
|
||||
export const SETUP_DEV_INSTANCE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.setupDevInstance',
|
||||
'xpack.stackConnectors.components.serviceNow.setupDevInstance',
|
||||
{
|
||||
defaultMessage: 'setup a developer instance',
|
||||
}
|
||||
);
|
||||
|
||||
export const SN_INSTANCE_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.snInstanceLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.snInstanceLabel',
|
||||
{
|
||||
defaultMessage: 'ServiceNow instance',
|
||||
}
|
||||
);
|
||||
|
||||
export const UNKNOWN = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.unknown',
|
||||
{
|
||||
defaultMessage: 'UNKNOWN',
|
||||
}
|
||||
);
|
||||
export const UNKNOWN = i18n.translate('xpack.stackConnectors.components.serviceNow.unknown', {
|
||||
defaultMessage: 'UNKNOWN',
|
||||
});
|
||||
|
||||
export const CORRELATION_ID = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.correlationID',
|
||||
'xpack.stackConnectors.components.serviceNow.correlationID',
|
||||
{
|
||||
defaultMessage: 'Correlation ID (optional)',
|
||||
}
|
||||
);
|
||||
|
||||
export const CORRELATION_DISPLAY = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.correlationDisplay',
|
||||
'xpack.stackConnectors.components.serviceNow.correlationDisplay',
|
||||
{
|
||||
defaultMessage: 'Correlation display (optional)',
|
||||
}
|
||||
);
|
||||
|
||||
export const EVENT = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenowITOM.event',
|
||||
{
|
||||
defaultMessage: 'Event',
|
||||
}
|
||||
);
|
||||
export const EVENT = i18n.translate('xpack.stackConnectors.components.serviceNowITOM.event', {
|
||||
defaultMessage: 'Event',
|
||||
});
|
||||
|
||||
/**
|
||||
* ITOM
|
||||
*/
|
||||
export const SOURCE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.sourceTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.sourceTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Source',
|
||||
}
|
||||
);
|
||||
|
||||
export const EVENT_CLASS = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.eventClassTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.eventClassTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Source instance',
|
||||
}
|
||||
);
|
||||
|
||||
export const RESOURCE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.resourceTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.resourceTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Resource',
|
||||
}
|
||||
);
|
||||
|
||||
export const NODE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.nodeTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.nodeTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Node',
|
||||
}
|
||||
);
|
||||
|
||||
export const METRIC_NAME = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.metricNameTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.metricNameTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Metric name',
|
||||
}
|
||||
);
|
||||
|
||||
export const TYPE = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.typeTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.typeTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Type',
|
||||
}
|
||||
);
|
||||
|
||||
export const MESSAGE_KEY = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.messageKeyTextAreaFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.messageKeyTextAreaFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Message key',
|
||||
}
|
||||
);
|
||||
|
||||
export const SEVERITY_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.requiredSeverityTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredSeverityTextField',
|
||||
{
|
||||
defaultMessage: 'Severity is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const SEVERITY_REQUIRED_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.severityRequiredSelectFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.severityRequiredSelectFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Severity (required)',
|
||||
}
|
||||
);
|
||||
|
||||
export const CLIENTID_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.clientIdTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.clientIdTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Client ID',
|
||||
}
|
||||
);
|
||||
|
||||
export const CLIENTSECRET_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.clientSecretTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.clientSecretTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Client Secret',
|
||||
}
|
||||
);
|
||||
|
||||
export const KEY_ID_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.keyIdTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.keyIdTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'JWT Verifier Key ID',
|
||||
}
|
||||
);
|
||||
|
||||
export const USER_IDENTIFIER_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.userEmailTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.userEmailTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'User Identifier',
|
||||
}
|
||||
);
|
||||
|
||||
export const PRIVATE_KEY_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.privateKeyTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.privateKeyTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Private Key',
|
||||
}
|
||||
);
|
||||
|
||||
export const PRIVATE_KEY_PASSWORD_LABEL = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.privateKeyPassTextFieldLabel',
|
||||
'xpack.stackConnectors.components.serviceNow.privateKeyPassTextFieldLabel',
|
||||
{
|
||||
defaultMessage: 'Private Key Password',
|
||||
}
|
||||
);
|
||||
|
||||
export const PRIVATE_KEY_PASSWORD_HELPER_TEXT = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.privateKeyPassLabelHelpText',
|
||||
'xpack.stackConnectors.components.serviceNow.privateKeyPassLabelHelpText',
|
||||
{
|
||||
defaultMessage: 'This is only required if you have set a password on your private key',
|
||||
}
|
||||
);
|
||||
|
||||
export const CLIENTID_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.requiredClientIdTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredClientIdTextField',
|
||||
{
|
||||
defaultMessage: 'Client ID is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const PRIVATE_KEY_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.requiredPrivateKeyTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredPrivateKeyTextField',
|
||||
{
|
||||
defaultMessage: 'Private Key is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const KEYID_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.requiredKeyIdTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredKeyIdTextField',
|
||||
{
|
||||
defaultMessage: 'JWT Verifier Key ID is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const USER_IDENTIFIER_REQUIRED = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.requiredUserIdentifierTextField',
|
||||
'xpack.stackConnectors.components.serviceNow.requiredUserIdentifierTextField',
|
||||
{
|
||||
defaultMessage: 'User Identifier is required.',
|
||||
}
|
||||
);
|
||||
|
||||
export const IS_OAUTH = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.servicenow.useOAuth',
|
||||
{
|
||||
defaultMessage: 'Use OAuth authentication',
|
||||
}
|
||||
);
|
||||
export const IS_OAUTH = i18n.translate('xpack.stackConnectors.components.serviceNow.useOAuth', {
|
||||
defaultMessage: 'Use OAuth authentication',
|
||||
});
|
|
@ -5,12 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import type {
|
||||
ExecutorSubActionPushParamsITSM,
|
||||
ExecutorSubActionPushParamsSIR,
|
||||
ExecutorSubActionAddEventParams,
|
||||
} from '@kbn/stack-connectors-plugin/server/connector_types/cases/servicenow/types';
|
||||
import { UserConfiguredActionConnector } from '../../../../types';
|
||||
} from '../../../../server/connector_types/cases/servicenow/types';
|
||||
|
||||
export type ServiceNowActionConnector = UserConfiguredActionConnector<
|
||||
ServiceNowConfig,
|
|
@ -13,7 +13,7 @@ import { Props, UpdateConnector } from './update_connector';
|
|||
import { act } from 'react-dom/test-utils';
|
||||
import { render, act as reactAct } from '@testing-library/react';
|
||||
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const mountUpdateConnector = (props: Partial<Props> = {}, isOAuth: boolean = false) => {
|
||||
return mountWithIntl(
|
|
@ -21,58 +21,55 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { snExternalServiceConfig } from '@kbn/stack-connectors-plugin/common/servicenow_config';
|
||||
import { useForm, Form } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { snExternalServiceConfig } from '../../../../common/servicenow_config';
|
||||
import { CredentialsApiUrl } from './credentials_api_url';
|
||||
import { CredentialsAuth, OAuth } from './auth_types';
|
||||
import { SNStoreLink } from './sn_store_button';
|
||||
import { ApplicationRequiredCallout } from './application_required_callout';
|
||||
import { ServiceNowConfig, ServiceNowSecrets } from './types';
|
||||
|
||||
const title = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.updateFormTitle',
|
||||
{
|
||||
defaultMessage: 'Update ServiceNow connector',
|
||||
}
|
||||
);
|
||||
const title = i18n.translate('xpack.stackConnectors.components.serviceNow.updateFormTitle', {
|
||||
defaultMessage: 'Update ServiceNow connector',
|
||||
});
|
||||
|
||||
const step1InstallTitle = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.updateFormInstallTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.updateFormInstallTitle',
|
||||
{
|
||||
defaultMessage: 'Install the Elastic ServiceNow app',
|
||||
}
|
||||
);
|
||||
|
||||
const step2InstanceUrlTitle = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.updateFormUrlTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.updateFormUrlTitle',
|
||||
{
|
||||
defaultMessage: 'Enter your ServiceNow instance URL',
|
||||
}
|
||||
);
|
||||
|
||||
const step3CredentialsTitle = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.updateFormCredentialsTitle',
|
||||
'xpack.stackConnectors.components.serviceNow.updateFormCredentialsTitle',
|
||||
{
|
||||
defaultMessage: 'Provide authentication credentials',
|
||||
}
|
||||
);
|
||||
|
||||
const cancelButtonText = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.cancelButtonText',
|
||||
'xpack.stackConnectors.components.serviceNow.cancelButtonText',
|
||||
{
|
||||
defaultMessage: 'Cancel',
|
||||
}
|
||||
);
|
||||
|
||||
const confirmButtonText = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.confirmButtonText',
|
||||
'xpack.stackConnectors.components.serviceNow.confirmButtonText',
|
||||
{
|
||||
defaultMessage: 'Update',
|
||||
}
|
||||
);
|
||||
|
||||
const warningMessage = i18n.translate(
|
||||
'xpack.triggersActionsUI.components.builtinActionTypes.serviceNow.warningMessage',
|
||||
'xpack.stackConnectors.components.serviceNow.warningMessage',
|
||||
{
|
||||
defaultMessage: 'This updates all instances of this connector and cannot be reversed.',
|
||||
}
|
||||
|
@ -144,7 +141,7 @@ const UpdateConnectorComponent: React.FC<Props> = ({
|
|||
title: step1InstallTitle,
|
||||
children: (
|
||||
<FormattedMessage
|
||||
id="xpack.triggersActionsUI.components.builtinActionTypes.serviceNowAction.serviceNowAppRunning"
|
||||
id="xpack.stackConnectors.components.serviceNow.appRunning"
|
||||
defaultMessage="The Elastic App from the ServiceNow app store must be installed prior to running the update. {visitLink} to install the app"
|
||||
values={{
|
||||
visitLink: (
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { useChoices, UseChoices, UseChoicesProps } from './use_choices';
|
||||
import { getChoices } from './api';
|
||||
|
||||
jest.mock('./api');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const useKibanaMock = useKibana as jest.Mocked<typeof useKibana>;
|
||||
const getChoicesMock = getChoices as jest.Mock;
|
|
@ -8,7 +8,7 @@
|
|||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { Choice, Fields } from './types';
|
||||
import { useGetChoices } from './use_get_choices';
|
||||
|
|
@ -13,7 +13,7 @@ import { ServiceNowActionConnector } from './types';
|
|||
import { httpServiceMock } from '@kbn/core/public/mocks';
|
||||
|
||||
jest.mock('./api');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const getAppInfoMock = getAppInfo as jest.Mock;
|
||||
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
import { renderHook } from '@testing-library/react-hooks';
|
||||
|
||||
import { useKibana } from '../../../../common/lib/kibana';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { useKibana } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types';
|
||||
import { useGetChoices, UseGetChoices, UseGetChoicesProps } from './use_get_choices';
|
||||
import { getChoices } from './api';
|
||||
|
||||
jest.mock('./api');
|
||||
jest.mock('../../../../common/lib/kibana');
|
||||
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
|
||||
|
||||
const useKibanaMock = useKibana as jest.Mocked<typeof useKibana>;
|
||||
const getChoicesMock = getChoices as jest.Mock;
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
import { ActionConnector } from '../../../../types';
|
||||
import { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { getChoices } from './api';
|
||||
import { Choice } from './types';
|
||||
import * as i18n from './translations';
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue