mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.11`: - [[Cases] Change value type of text custom fields to string. (#168442)](https://github.com/elastic/kibana/pull/168442) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Antonio","email":"antonio.coelho@elastic.co"},"sourceCommit":{"committedDate":"2023-10-11T07:08:32Z","message":"[Cases] Change value type of text custom fields to string. (#168442)\n\n## Summary\r\n\r\nThe `value` field for custom fields of type `CustomFieldType.TEXT` is\r\nnow `string`(was previously `string[]`).\r\n\r\nI changed the UI and the backend, please double-check.\r\n\r\nTesting the UI:\r\n1. Created two custom fields of type `text`. One required one not\r\nrequired.\r\n2. Create Case Form:\r\n - Populate both fields\r\n - Populate only the required field\r\n3. Case Detail View\r\n - Edit the required text field\r\n - Edit the not-required text field\r\n - User actions should display correctly\r\n - Text box should show correctly\r\n - Text should show correctly(on not editing mode)\r\n - Deleting the text from the field should work correctly","sha":"ddf1568ba30db9e8fd5e96965ba613094e511ac5","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","Feature:Cases","backport:prev-minor","v8.11.0","v8.12.0"],"number":168442,"url":"https://github.com/elastic/kibana/pull/168442","mergeCommit":{"message":"[Cases] Change value type of text custom fields to string. (#168442)\n\n## Summary\r\n\r\nThe `value` field for custom fields of type `CustomFieldType.TEXT` is\r\nnow `string`(was previously `string[]`).\r\n\r\nI changed the UI and the backend, please double-check.\r\n\r\nTesting the UI:\r\n1. Created two custom fields of type `text`. One required one not\r\nrequired.\r\n2. Create Case Form:\r\n - Populate both fields\r\n - Populate only the required field\r\n3. Case Detail View\r\n - Edit the required text field\r\n - Edit the not-required text field\r\n - User actions should display correctly\r\n - Text box should show correctly\r\n - Text should show correctly(on not editing mode)\r\n - Deleting the text from the field should work correctly","sha":"ddf1568ba30db9e8fd5e96965ba613094e511ac5"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/168442","number":168442,"mergeCommit":{"message":"[Cases] Change value type of text custom fields to string. (#168442)\n\n## Summary\r\n\r\nThe `value` field for custom fields of type `CustomFieldType.TEXT` is\r\nnow `string`(was previously `string[]`).\r\n\r\nI changed the UI and the backend, please double-check.\r\n\r\nTesting the UI:\r\n1. Created two custom fields of type `text`. One required one not\r\nrequired.\r\n2. Create Case Form:\r\n - Populate both fields\r\n - Populate only the required field\r\n3. Case Detail View\r\n - Edit the required text field\r\n - Edit the not-required text field\r\n - User actions should display correctly\r\n - Text box should show correctly\r\n - Text should show correctly(on not editing mode)\r\n - Deleting the text from the field should work correctly","sha":"ddf1568ba30db9e8fd5e96965ba613094e511ac5"}}]}] BACKPORT--> Co-authored-by: Antonio <antonio.coelho@elastic.co>
This commit is contained in:
parent
4009e3f1f7
commit
71f0ef4c6d
31 changed files with 104 additions and 163 deletions
|
@ -132,7 +132,6 @@ export const MAX_CUSTOM_FIELDS_PER_CASE = 10 as const;
|
|||
export const MAX_CUSTOM_FIELD_KEY_LENGTH = 36 as const; // uuidv4 length
|
||||
export const MAX_CUSTOM_FIELD_LABEL_LENGTH = 50 as const;
|
||||
export const MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH = 160 as const;
|
||||
export const MAX_CUSTOM_FIELD_TEXT_VALUE_ITEMS = 10 as const;
|
||||
|
||||
/**
|
||||
* Cases features
|
||||
|
|
|
@ -105,7 +105,7 @@ const basicCase: Case = {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
@ -115,7 +115,7 @@ const basicCase: Case = {
|
|||
{
|
||||
key: 'second_custom_field_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['www.example.com'],
|
||||
value: 'www.example.com',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -141,7 +141,7 @@ describe('CasePostRequestRt', () => {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
@ -244,8 +244,8 @@ describe('CasePostRequestRt', () => {
|
|||
it('removes foo:bar attributes from customFields', () => {
|
||||
const customField = {
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: 'this is a text field value',
|
||||
};
|
||||
|
||||
const query = CasePostRequestRt.decode({
|
||||
|
@ -262,8 +262,8 @@ describe('CasePostRequestRt', () => {
|
|||
it('removes foo:bar attributes from field inside customFields', () => {
|
||||
const customField = {
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: 'this is a text field value',
|
||||
};
|
||||
|
||||
const query = CasePostRequestRt.decode({
|
||||
|
@ -280,8 +280,8 @@ describe('CasePostRequestRt', () => {
|
|||
it(`limits customFields to ${MAX_CUSTOM_FIELDS_PER_CASE}`, () => {
|
||||
const customFields = Array(MAX_CUSTOM_FIELDS_PER_CASE + 1).fill({
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: 'this is a text field value',
|
||||
});
|
||||
|
||||
expect(
|
||||
|
@ -310,8 +310,8 @@ describe('CasePostRequestRt', () => {
|
|||
customFields: [
|
||||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['#'.repeat(MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH + 1)],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: '#'.repeat(MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH + 1),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
@ -321,7 +321,7 @@ describe('CasePostRequestRt', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('throws an error when a text customFields is an empty array', () => {
|
||||
it('throws an error when a text customField is an empty string', () => {
|
||||
expect(
|
||||
PathReporter.report(
|
||||
CasePostRequestRt.decode({
|
||||
|
@ -329,25 +329,8 @@ describe('CasePostRequestRt', () => {
|
|||
customFields: [
|
||||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: [],
|
||||
},
|
||||
],
|
||||
})
|
||||
)
|
||||
).toContain('The length of the field value is too short. Array must be of length >= 1.');
|
||||
});
|
||||
|
||||
it('throws an error when a text customField is an array with an empty string', () => {
|
||||
expect(
|
||||
PathReporter.report(
|
||||
CasePostRequestRt.decode({
|
||||
...defaultRequest,
|
||||
customFields: [
|
||||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: [''],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: '',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
@ -629,8 +612,8 @@ describe('CasePatchRequestRt', () => {
|
|||
customFields: [
|
||||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
@ -719,8 +702,8 @@ describe('CasePatchRequestRt', () => {
|
|||
it(`limits customFields to ${MAX_CUSTOM_FIELDS_PER_CASE}`, () => {
|
||||
const customFields = Array(MAX_CUSTOM_FIELDS_PER_CASE + 1).fill({
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: 'this is a text field value',
|
||||
});
|
||||
|
||||
expect(
|
||||
|
@ -743,8 +726,8 @@ describe('CasePatchRequestRt', () => {
|
|||
customFields: [
|
||||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['#'.repeat(MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH + 1)],
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: '#'.repeat(MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH + 1),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
|
|
@ -23,7 +23,6 @@ import {
|
|||
MAX_ASSIGNEES_PER_CASE,
|
||||
MAX_CUSTOM_FIELDS_PER_CASE,
|
||||
MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH,
|
||||
MAX_CUSTOM_FIELD_TEXT_VALUE_ITEMS,
|
||||
} from '../../../constants';
|
||||
import {
|
||||
limitedStringSchema,
|
||||
|
@ -44,15 +43,10 @@ import { CaseConnectorRt } from '../../domain/connector/v1';
|
|||
import { CaseUserProfileRt, UserRt } from '../../domain/user/v1';
|
||||
import { CasesStatusResponseRt } from '../stats/v1';
|
||||
|
||||
const CaseCustomFieldTextWithValidationValueRt = limitedArraySchema({
|
||||
codec: limitedStringSchema({
|
||||
fieldName: 'value',
|
||||
min: 1,
|
||||
max: MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH,
|
||||
}),
|
||||
const CaseCustomFieldTextWithValidationValueRt = limitedStringSchema({
|
||||
fieldName: 'value',
|
||||
min: 1,
|
||||
max: MAX_CUSTOM_FIELD_TEXT_VALUE_ITEMS,
|
||||
max: MAX_CUSTOM_FIELD_TEXT_VALUE_LENGTH,
|
||||
});
|
||||
|
||||
const CaseCustomFieldTextWithValidationRt = rt.strict({
|
||||
|
|
|
@ -78,7 +78,7 @@ const basicCase = {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
@ -186,7 +186,7 @@ describe('CaseAttributesRt', () => {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('CaseCustomFieldRt', () => {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: 'text',
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
[
|
||||
|
@ -55,7 +55,7 @@ describe('CaseCustomFieldRt', () => {
|
|||
const query = CaseCustomFieldRt.decode({
|
||||
key: 'text_custom_field_1',
|
||||
type: 'text',
|
||||
value: [1],
|
||||
value: 1,
|
||||
});
|
||||
|
||||
expect(PathReporter.report(query)[0]).toContain('Invalid value 1 supplied');
|
||||
|
|
|
@ -17,7 +17,7 @@ export const CustomFieldToggleTypeRt = rt.literal(CustomFieldTypes.TOGGLE);
|
|||
const CaseCustomFieldTextRt = rt.strict({
|
||||
key: rt.string,
|
||||
type: CustomFieldTextTypeRt,
|
||||
value: rt.union([rt.array(rt.string), rt.null]),
|
||||
value: rt.union([rt.string, rt.null]),
|
||||
});
|
||||
|
||||
export const CaseCustomFieldToggleRt = rt.strict({
|
||||
|
|
|
@ -79,7 +79,7 @@ describe('Create case', () => {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
@ -191,7 +191,7 @@ describe('Create case', () => {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_custom_field_key',
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('Custom field', () => {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ describe('Custom field', () => {
|
|||
{
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -209,7 +209,7 @@ describe('Edit ', () => {
|
|||
await waitFor(() => {
|
||||
expect(onSubmit).toBeCalledWith({
|
||||
...customField,
|
||||
value: ['My text test value 1!!!'],
|
||||
value: 'My text test value 1!!!',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -108,7 +108,7 @@ const EditComponent: CustomFieldType<CaseCustomFieldText>['Edit'] = ({
|
|||
const { isValid, data } = await formState.submit();
|
||||
|
||||
if (isValid) {
|
||||
const value = isEmpty(data.value) ? null : [data.value];
|
||||
const value = isEmpty(data.value) ? null : data.value;
|
||||
|
||||
onSubmit({
|
||||
...customField,
|
||||
|
@ -121,7 +121,7 @@ const EditComponent: CustomFieldType<CaseCustomFieldText>['Edit'] = ({
|
|||
setIsEdit(false);
|
||||
};
|
||||
|
||||
const initialValue = customField?.value?.[0] ?? '';
|
||||
const initialValue = customField?.value ?? '';
|
||||
const title = customFieldConfiguration.label;
|
||||
const isTextFieldValid = formState.isValid;
|
||||
const isCustomFieldValueDefined = !isEmpty(customField?.value);
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('View ', () => {
|
|||
const customField = {
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
key: 'test_key_1',
|
||||
value: ['My text test value'],
|
||||
value: 'My text test value',
|
||||
};
|
||||
|
||||
it('renders correctly', async () => {
|
||||
|
|
|
@ -12,7 +12,7 @@ import type { CaseCustomFieldText } from '../../../../common/types/domain';
|
|||
import type { CustomFieldType } from '../types';
|
||||
|
||||
const ViewComponent: CustomFieldType<CaseCustomFieldText>['View'] = ({ customField }) => {
|
||||
const value = customField?.value?.[0] ?? '-';
|
||||
const value = customField?.value ?? '-';
|
||||
|
||||
return <EuiText data-test-subj={`text-custom-field-view-${customField?.key}`}>{value}</EuiText>;
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('addOrReplaceCustomField ', () => {
|
|||
const fieldToAdd: CaseUICustomField = {
|
||||
key: 'my_test_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['my_test_value'],
|
||||
value: 'my_test_value',
|
||||
};
|
||||
const res = addOrReplaceCustomField(customFieldsMock, fieldToAdd);
|
||||
expect(res).toMatchInlineSnapshot(
|
||||
|
@ -29,9 +29,7 @@ describe('addOrReplaceCustomField ', () => {
|
|||
Object {
|
||||
"key": "test_key_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"My text test value 1",
|
||||
],
|
||||
"value": "My text test value 1",
|
||||
},
|
||||
Object {
|
||||
"key": "test_key_2",
|
||||
|
@ -41,9 +39,7 @@ describe('addOrReplaceCustomField ', () => {
|
|||
Object {
|
||||
"key": "my_test_key",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"my_test_value",
|
||||
],
|
||||
"value": "my_test_value",
|
||||
},
|
||||
]
|
||||
`
|
||||
|
@ -69,9 +65,7 @@ describe('addOrReplaceCustomField ', () => {
|
|||
},
|
||||
"key": "test_key_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"My text test value 1",
|
||||
],
|
||||
"value": "My text test value 1",
|
||||
},
|
||||
Object {
|
||||
"key": "test_key_2",
|
||||
|
|
|
@ -512,12 +512,8 @@ describe('Utils', () => {
|
|||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('returns array of string when value is string', async () => {
|
||||
expect(convertCustomFieldValue('my text value')).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"my text value",
|
||||
]
|
||||
`);
|
||||
it('returns the string when the value is a non-empty string', async () => {
|
||||
expect(convertCustomFieldValue('my text value')).toMatchInlineSnapshot(`"my text value"`);
|
||||
});
|
||||
|
||||
it('returns null when value is empty string', async () => {
|
||||
|
|
|
@ -228,13 +228,9 @@ export const parseCaseUsers = ({
|
|||
};
|
||||
|
||||
export const convertCustomFieldValue = (value: string | boolean) => {
|
||||
let fieldValue = null;
|
||||
|
||||
if (!isEmpty(value) && typeof value === 'string') {
|
||||
fieldValue = [value];
|
||||
} else if (typeof value === 'boolean') {
|
||||
fieldValue = value;
|
||||
if (typeof value === 'string' && isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fieldValue;
|
||||
return value;
|
||||
};
|
||||
|
|
|
@ -1148,7 +1148,7 @@ export const getCaseUsersMockResponse = (): CaseUsers => {
|
|||
};
|
||||
|
||||
export const customFieldsMock: CaseUICustomField[] = [
|
||||
{ type: CustomFieldTypes.TEXT, key: 'test_key_1', value: ['My text test value 1'] },
|
||||
{ type: CustomFieldTypes.TEXT, key: 'test_key_1', value: 'My text test value 1' },
|
||||
{ type: CustomFieldTypes.TOGGLE, key: 'test_key_2', value: true },
|
||||
];
|
||||
|
||||
|
|
|
@ -448,7 +448,7 @@ describe('create', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_key',
|
||||
|
@ -640,7 +640,7 @@ describe('create', () => {
|
|||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'duplicated_key',
|
||||
|
@ -687,7 +687,7 @@ describe('create', () => {
|
|||
{
|
||||
key: 'second_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -713,7 +713,7 @@ describe('create', () => {
|
|||
{
|
||||
key: 'second_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['foobar'],
|
||||
value: 'foobar',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -742,7 +742,7 @@ describe('create', () => {
|
|||
{
|
||||
key: 'first_customField_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_customField_key',
|
||||
|
|
|
@ -939,7 +939,7 @@ describe('update', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_key',
|
||||
|
@ -994,7 +994,7 @@ describe('update', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ describe('update', () => {
|
|||
const customFields = Array(MAX_CUSTOM_FIELDS_PER_CASE + 1).fill({
|
||||
key: 'first_custom_field_key',
|
||||
type: 'text',
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
});
|
||||
|
||||
await expect(
|
||||
|
@ -1084,12 +1084,12 @@ describe('update', () => {
|
|||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -1115,7 +1115,7 @@ describe('update', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'missing_key',
|
||||
|
@ -1177,7 +1177,7 @@ describe('update', () => {
|
|||
{
|
||||
key: 'second_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['foobar'],
|
||||
value: 'foobar',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1352,7 +1352,7 @@ describe('utils', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('validators', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_key',
|
||||
|
@ -130,7 +130,7 @@ describe('validators', () => {
|
|||
{
|
||||
key: 'third_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['abc'],
|
||||
value: 'abc',
|
||||
},
|
||||
],
|
||||
|
||||
|
@ -187,7 +187,7 @@ describe('validators', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_key',
|
||||
|
@ -300,7 +300,7 @@ describe('validators', () => {
|
|||
{
|
||||
key: 'first_key',
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'second_key',
|
||||
|
|
|
@ -54,7 +54,7 @@ export interface CasePersistedAttributes {
|
|||
type CasePersistedCustomFields = Array<{
|
||||
key: string;
|
||||
type: string;
|
||||
value: null | unknown | unknown[];
|
||||
value: null | unknown;
|
||||
}>;
|
||||
|
||||
export type CaseTransformedAttributes = CaseAttributes;
|
||||
|
|
|
@ -99,7 +99,7 @@ describe('common utils', () => {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT as const,
|
||||
value: ['this is a text field value', 'this is second'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -324,10 +324,7 @@ describe('common utils', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"this is a text field value",
|
||||
"this is second",
|
||||
],
|
||||
"value": "this is a text field value",
|
||||
},
|
||||
],
|
||||
"description": "A description",
|
||||
|
@ -607,10 +604,7 @@ describe('common utils', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"this is a text field value",
|
||||
"this is second",
|
||||
],
|
||||
"value": "this is a text field value",
|
||||
},
|
||||
],
|
||||
"description": "This is a brand new case of a bad meanie defacing data",
|
||||
|
@ -938,10 +932,7 @@ describe('common utils', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"this is a text field value",
|
||||
"this is second",
|
||||
],
|
||||
"value": "this is a text field value",
|
||||
},
|
||||
],
|
||||
"description": "This is a brand new case of a bad meanie defacing data",
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('CustomFieldsUserActionBuilder', () => {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -77,9 +77,7 @@ describe('CustomFieldsUserActionBuilder', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"this is a text field value",
|
||||
],
|
||||
"value": "this is a text field value",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -155,12 +155,12 @@ const originalCasesWithCustomFields = [
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['old value'],
|
||||
value: 'old value',
|
||||
},
|
||||
{
|
||||
key: 'string_custom_field_2',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['old value 2'],
|
||||
value: 'old value 2',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -179,7 +179,7 @@ export const patchAddCustomFieldsToOriginalCasesRequest: PatchCasesArgs = {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -198,12 +198,12 @@ export const patchUpdateCustomFieldsCasesRequest: PatchCasesArgs = {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['updated value'],
|
||||
value: 'updated value',
|
||||
},
|
||||
{
|
||||
key: 'string_custom_field_2',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['old value 2'],
|
||||
value: 'old value 2',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -227,7 +227,7 @@ export const patchUpdateResetCustomFieldsCasesRequest: PatchCasesArgs = {
|
|||
{
|
||||
key: 'string_custom_field_2',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['new custom field 2'],
|
||||
value: 'new custom field 2',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -246,12 +246,12 @@ export const patchNewCustomFieldConfAdded: PatchCasesArgs = {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['new value'],
|
||||
value: 'new value',
|
||||
},
|
||||
{
|
||||
key: 'string_custom_field_2',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['old value 2'],
|
||||
value: 'old value 2',
|
||||
},
|
||||
{
|
||||
key: 'string_custom_field_3',
|
||||
|
@ -275,7 +275,7 @@ export const patchCustomFieldConfRemoved: PatchCasesArgs = {
|
|||
{
|
||||
key: 'string_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['new value'],
|
||||
value: 'new value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -257,9 +257,7 @@ describe('UserActionPersister', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"this is a text field value",
|
||||
],
|
||||
"value": "this is a text field value",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -311,9 +309,7 @@ describe('UserActionPersister', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"updated value",
|
||||
],
|
||||
"value": "updated value",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -403,9 +399,7 @@ describe('UserActionPersister', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_2",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"new custom field 2",
|
||||
],
|
||||
"value": "new custom field 2",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -457,9 +451,7 @@ describe('UserActionPersister', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"new value",
|
||||
],
|
||||
"value": "new value",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -511,9 +503,7 @@ describe('UserActionPersister', () => {
|
|||
Object {
|
||||
"key": "string_custom_field_1",
|
||||
"type": "text",
|
||||
"value": Array [
|
||||
"new value",
|
||||
],
|
||||
"value": "new value",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -357,7 +357,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'test_custom_field_2',
|
||||
|
@ -374,7 +374,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'test_custom_field_2',
|
||||
|
@ -988,12 +988,12 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -1032,7 +1032,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'key_does_not_exist',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -1065,7 +1065,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['hello'],
|
||||
value: 'hello',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -1108,7 +1108,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['hello'],
|
||||
value: 'hello',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
@ -203,7 +203,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'valid_key_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'valid_key_2',
|
||||
|
@ -218,7 +218,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'valid_key_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'valid_key_2',
|
||||
|
@ -438,12 +438,12 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'duplicated_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -474,7 +474,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'invalid_key',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -511,7 +511,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'text_custom_field',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['a'],
|
||||
value: 'a',
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
|
|
@ -390,7 +390,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'test_custom_field_2',
|
||||
|
@ -400,7 +400,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field_3',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value 3'],
|
||||
value: 'this is a text field value 3',
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -420,7 +420,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['new value'],
|
||||
value: 'new value',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -444,7 +444,7 @@ export default ({ getService }: FtrProviderContext): void => {
|
|||
{
|
||||
key: 'test_custom_field_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['new value'],
|
||||
value: 'new value',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
|
@ -1178,7 +1178,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
|
|||
{
|
||||
key: 'valid_key_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'valid_key_2',
|
||||
|
|
|
@ -480,7 +480,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
|
|||
{
|
||||
key: 'valid_key_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'valid_key_2',
|
||||
|
|
|
@ -479,7 +479,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
|
|||
{
|
||||
key: 'valid_key_1',
|
||||
type: CustomFieldTypes.TEXT,
|
||||
value: ['this is a text field value'],
|
||||
value: 'this is a text field value',
|
||||
},
|
||||
{
|
||||
key: 'valid_key_2',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue