diff --git a/auto_sync_commit_metadata.json b/auto_sync_commit_metadata.json index 32c0370e7..a1ef1a880 100644 --- a/auto_sync_commit_metadata.json +++ b/auto_sync_commit_metadata.json @@ -1,4 +1,4 @@ { - "last_github_commit": "1f789157e21658a5da2291f2cd969bff78b7a275", - "last_gitfarm_commit": "b04c1f2631339082ca46d57b951249766a017715" + "last_github_commit": "b17afd337e002f3bf7a0fb89424840e838312d49", + "last_gitfarm_commit": "73dfd1fd06ba2cf4b104da0f5a1fe1bb31789ba7" } \ No newline at end of file diff --git a/common/constants/data_sources.ts b/common/constants/data_sources.ts index c396951a8..542383991 100644 --- a/common/constants/data_sources.ts +++ b/common/constants/data_sources.ts @@ -35,7 +35,7 @@ export const ACCELERATION_TIME_INTERVAL = [ ]; export const ACCELERATION_ADD_FIELDS_TEXT = '(add fields here)'; -export const ACCELERATION_INDEX_NAME_REGEX = /^[a-z][a-z_]*$/; +export const ACCELERATION_INDEX_NAME_REGEX = /^[a-z0-9_]+$/; export const ACCELERATION_S3_URL_REGEX = /^(s3|s3a):\/\/[a-zA-Z0-9.\-]+/; export const SPARK_HIVE_TABLE_REGEX = /Provider:\s*hive/; export const TIMESTAMP_DATATYPE = 'timestamp'; @@ -60,7 +60,7 @@ export const ACCELERATION_INDEX_NAME_INFO = `All OpenSearch acceleration indices - 'Materialized View' indices also enable users to define their index name, but they do not have a suffix. - An example of a 'Materialized View' index name might look like: \`flint_mydatasource_mydb_mytable_myindexname\`. ##### Note: -- All user given index names must be in lowercase letters. Index name cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \, |, ?, #, >, or < are not allowed. +- All user given index names must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \, |, ?, #, >, or < are not allowed. `; export const SKIPPING_INDEX_ACCELERATION_METHODS = [ diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/__snapshots__/create_acceleration.test.tsx.snap b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/__snapshots__/create_acceleration.test.tsx.snap index a7e3d0fab..5e0c5a775 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/__snapshots__/create_acceleration.test.tsx.snap +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/__snapshots__/create_acceleration.test.tsx.snap @@ -435,7 +435,7 @@ Array [ class="euiFormLabel euiFormRow__label" for="random_html_id" > - Index type + Acceleration type
- Select the type of index you want to create. Each index type has benefits and costs. + Select the type of acceleration according to your use case.
@@ -1031,7 +1031,7 @@ Array [ class="euiFormHelpText euiFormRow__text" id="random_html_id-help-0" > - Must be in lowercase letters. Cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. + Must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. @@ -1834,7 +1834,7 @@ Array [ className="euiFormLabel euiFormRow__label" htmlFor="random_html_id" > - Index type + Acceleration type
- Select the type of index you want to create. Each index type has benefits and costs. + Select the type of acceleration according to your use case.
, @@ -2528,7 +2528,7 @@ Array [ className="euiFormHelpText euiFormRow__text" id="random_html_id-help-0" > - Must be in lowercase letters. Cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. + Must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. , diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/utils.test.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/utils.test.tsx index f60b78233..c4dedaffd 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/utils.test.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/__tests__/utils.test.tsx @@ -132,7 +132,7 @@ describe('validateRefreshInterval', () => { describe('validateIndexName', () => { it('should return an array with an error message when the index name is invalid', () => { - expect(validateIndexName('_invalid')).toEqual(['Enter a valid index name']); + expect(validateIndexName('Iinvalid')).toEqual(['Enter a valid index name']); expect(validateIndexName('-invalid')).toEqual(['Enter a valid index name']); expect(validateIndexName('InVal1d')).toEqual(['Enter a valid index name']); expect(validateIndexName('invalid_with spaces')).toEqual(['Enter a valid index name']); @@ -147,9 +147,13 @@ describe('validateIndexName', () => { it('should use the ACCELERATION_INDEX_NAME_REGEX pattern to validate the index name', () => { expect(ACCELERATION_INDEX_NAME_REGEX.test('valid_name')).toBe(true); + expect(ACCELERATION_INDEX_NAME_REGEX.test('_valid_name')).toBe(true); + expect(ACCELERATION_INDEX_NAME_REGEX.test('23valid_name')).toBe(true); + expect(ACCELERATION_INDEX_NAME_REGEX.test('___1__')).toBe(true); + expect(ACCELERATION_INDEX_NAME_REGEX.test('23')).toBe(true); expect(ACCELERATION_INDEX_NAME_REGEX.test('invalid name')).toBe(false); expect(ACCELERATION_INDEX_NAME_REGEX.test('-invalid')).toBe(false); - expect(ACCELERATION_INDEX_NAME_REGEX.test('_invalid')).toBe(false); + expect(ACCELERATION_INDEX_NAME_REGEX.test('_invalid')).toBe(true); expect(ACCELERATION_INDEX_NAME_REGEX.test('invalid.')).toBe(false); expect(ACCELERATION_INDEX_NAME_REGEX.test('invalid<')).toBe(false); expect(ACCELERATION_INDEX_NAME_REGEX.test('invalid*')).toBe(false); diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/create_acceleration.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/create_acceleration.tsx index 2f5895dba..c6f3ddbb4 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/create_acceleration.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/create_acceleration.tsx @@ -229,6 +229,7 @@ export const CreateAcceleration = ({ diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/utils.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/utils.tsx index 55d72aebf..297397315 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/utils.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/create/utils.tsx @@ -64,7 +64,7 @@ export const validateWatermarkDelay = ( }; export const validateIndexName = (value: string) => { - // Check if the value does not begin with underscores or hyphens and all characters are lower case + // Check if the value contains lower case letters, numbers and underscore return !ACCELERATION_INDEX_NAME_REGEX.test(value) ? ['Enter a valid index name'] : []; }; diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/define_index_options.test.tsx.snap b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/define_index_options.test.tsx.snap index dce481c0a..ad9200b27 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/define_index_options.test.tsx.snap +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/define_index_options.test.tsx.snap @@ -96,7 +96,7 @@ Array [ className="euiFormHelpText euiFormRow__text" id="random_html_id-help-0" > - Must be in lowercase letters. Cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. + Must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. , @@ -200,7 +200,7 @@ Array [ className="euiFormHelpText euiFormRow__text" id="random_html_id-help-0" > - Must be in lowercase letters. Cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. + Must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. , @@ -298,7 +298,7 @@ Array [ className="euiFormHelpText euiFormRow__text" id="random_html_id-help-0" > - Must be in lowercase letters. Cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. + Must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. , diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_advanced_settings.test.tsx.snap b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_advanced_settings.test.tsx.snap index 22848cba5..40151f9b2 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_advanced_settings.test.tsx.snap +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_advanced_settings.test.tsx.snap @@ -154,7 +154,7 @@ exports[`Advanced Index settings acceleration components renders acceleration in className="euiFormHelpText euiFormRow__text" id="random_html_id-help-0" > - Must be in lowercase letters. Cannot begin with underscores. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. + Must be in lowercase letters, numbers and underscore. Spaces, commas, and characters -, :, ", *, +, /, \\, |, ?, #, >, or < are not allowed. Prefix and suffix are added to the name of generated OpenSearch index. , diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_type_selector.test.tsx.snap b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_type_selector.test.tsx.snap index 86c904d9b..0a4b47c08 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_type_selector.test.tsx.snap +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/__tests__/__snapshots__/index_type_selector.test.tsx.snap @@ -24,7 +24,7 @@ Array [ className="euiFormLabel euiFormRow__label" htmlFor="random_html_id" > - Index type + Acceleration type
- Select the type of index you want to create. Each index type has benefits and costs. + Select the type of acceleration according to your use case.
, @@ -171,7 +171,7 @@ Array [ className="euiFormLabel euiFormRow__label" htmlFor="random_html_id" > - Index type + Acceleration type
- Select the type of index you want to create. Each index type has benefits and costs. + Select the type of acceleration according to your use case.
, diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/define_index_options.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/define_index_options.tsx index 51e2221d4..63f829977 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/define_index_options.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/define_index_options.tsx @@ -91,7 +91,7 @@ export const DefineIndexOptions = ({ <> { - setAccelerationFormData({ - ...accelerationFormData, - refreshType: optionId, - }); + setAccelerationFormData( + producer((accData) => { + accData.refreshType = optionId; + accData.formErrors.checkpointLocationError = []; + accData.formErrors.refreshIntervalError = []; + }) + ); setRefreshTypeSelected(optionId); }; diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/index_type_selector.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/index_type_selector.tsx index 64fb19e57..c16962058 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/index_type_selector.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/index_type_selector.tsx @@ -98,8 +98,8 @@ export const IndexTypeSelector = ({ diff --git a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/preview_sql_defintion.tsx b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/preview_sql_defintion.tsx index b0c61b756..9ce5c8e42 100644 --- a/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/preview_sql_defintion.tsx +++ b/public/components/datasources/components/manage/accelerations/create_accelerations_flyout/selectors/preview_sql_defintion.tsx @@ -26,11 +26,13 @@ import { accelerationQueryBuilder } from '../visual_editors/query_builder'; interface PreviewSQLDefinitionProps { accelerationFormData: CreateAccelerationForm; setAccelerationFormData: React.Dispatch>; + resetFlyout: () => void; } export const PreviewSQLDefinition = ({ accelerationFormData, setAccelerationFormData, + resetFlyout, }: PreviewSQLDefinitionProps) => { const { setToast } = useToast(); const [isPreviewStale, setIsPreviewStale] = useState(false); @@ -96,12 +98,13 @@ export const PreviewSQLDefinition = ({ queryToRun: accelerationQueryBuilder(accelerationFormData), }, }); + resetFlyout(); } }; const queryWorkbenchButton = sqlWorkbenchPLuginExists ? ( - - Open in Query Workbench + + Continue in Query Workbench ) : ( <>