diff --git a/common/constants/data_sources.ts b/common/constants/data_sources.ts
index c396951a8a..5423839914 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 a7e3d0fabd..5e0c5a7754 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 f60b782331..c4dedaffd1 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 2f5895dba8..c6f3ddbb40 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 55d72aebf1..297397315c 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 dce481c0a5..ad9200b27a 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 22848cba53..40151f9b28 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 86c904d9bb..0a4b47c084 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 51e2221d48..63f829977d 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 64fb19e573..c169620588 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 b0c61b7560..9ce5c8e42b 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
) : (
<>>