Skip to content

Commit

Permalink
Update form validations and tests for acceleration (#133)
Browse files Browse the repository at this point in the history
* update form validaitons

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* update snapshots, add skipping validator

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* update sqlpage snapshot

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* add tests for acceleration create

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* update acceleration builder tests

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* update PR comments

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* adding fix for windows snapshots

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* update snapshot files

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

---------

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
  • Loading branch information
ps48 committed Oct 3, 2023
1 parent 9fd9314 commit b506714
Show file tree
Hide file tree
Showing 62 changed files with 15,135 additions and 1,199 deletions.
9 changes: 9 additions & 0 deletions common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ export const ACCELERATION_TIME_INTERVAL = [
{ text: 'week(s)', value: 'week' },
];

export const SKIPPING_INDEX_ACCELERATION_METHODS = [
{ value: 'PARTITION', text: 'Partition' },
{ value: 'VALUE_SET', text: 'Value Set' },
{ value: 'MIN_MAX', text: 'Min Max' },
];

export const ACCELERATION_ADD_FIELDS_TEXT = '(add fields here)';
export const ACCELERATION_INDEX_NAME_REGEX = /^[a-z][a-z_\-]*$/;
export const ACCELERATION_S3_URL_REGEX = /^(s3|s3a):\/\/[a-zA-Z0-9.\-]+\/.*/;
export const ACCELERATION_DEFUALT_SKIPPING_INDEX_NAME = 'skipping';

export const ACCELERATION_INDEX_NAME_INFO = `All OpenSearch acceleration indices have a naming format of pattern: \`prefix_<index name>_suffix\`. They share a common prefix structure, which is \`flint_<data source name>_<database name>_<table name>_\`. Additionally, they may have a suffix that varies based on the index type.
##### Skipping Index
Expand Down
21 changes: 19 additions & 2 deletions common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ export interface MaterializedViewColumn {
fieldAlias?: string;
}

export type SkippingIndexAccMethodType = 'PARTITION' | 'VALUE_SET' | 'MIN_MAX';

export interface SkippingIndexRowType {
id: string;
fieldName: string;
dataType: string;
accelerationMethod: 'PARTITION' | 'VALUE_SET' | 'MIN_MAX';
accelerationMethod: SkippingIndexAccMethodType;
}

export interface DataTableFieldsType {
Expand All @@ -43,6 +45,20 @@ export interface materializedViewQueryType {
groupByTumbleValue: GroupByTumbleType;
}

export interface FormErrorsType {
dataSourceError: string[];
databaseError: string[];
dataTableError: string[];
skippingIndexError: string[];
coveringIndexError: string[];
materializedViewError: string[];
indexNameError: string[];
primaryShardsError: string[];
replicaShardsError: string[];
refreshIntervalError: string[];
checkpointLocationError: string[];
}

export interface CreateAccelerationForm {
dataSource: string;
database: string;
Expand All @@ -57,5 +73,6 @@ export interface CreateAccelerationForm {
replicaShardsCount: number;
refreshType: 'interval' | 'auto';
checkpointLocation: string | undefined;
refreshIntervalOptions: RefreshIntervalType | undefined;
refreshIntervalOptions: RefreshIntervalType;
formErrors: FormErrorsType;
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@
},
"devDependencies": {
"@testing-library/user-event": "^13.1.9",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/react-test-renderer": "^16.9.1",
"cypress": "^5.0.0",
"eslint": "^6.8.0",
"husky": "^4.2.5",
"jest-raw-loader": "^1.0.1",
"lint-staged": "^10.2.0",
"mutationobserver-shim": "^0.3.3",
"jest-dom": "^4.0.0",
"ts-jest": "^29.1.0"
},
"resolutions": {
Expand Down
7 changes: 5 additions & 2 deletions public/ace-themes/sql_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/


import * as ace from 'brace';

ace.define('ace/theme/sql_console', ['require', 'exports', 'module', 'ace/lib/dom'], function (acequire, exports, module) {
ace.define('ace/theme/sql_console', ['require', 'exports', 'module', 'ace/lib/dom'], function (
acequire,
exports,
module
) {
exports.isDark = false;
exports.cssClass = 'ace-sql-console';
exports.cssText = require('../index.scss');
Expand Down
Loading

0 comments on commit b506714

Please sign in to comment.