-
Notifications
You must be signed in to change notification settings - Fork 42
Add materialized view visual builder and query builders #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { ACCELERATION_INDEX_NAME_REGEX } from '../../../../common/constants'; | ||
|
|
||
| export const pluralizeTime = (timeWindow: number) => { | ||
| return timeWindow > 1 ? 's' : ''; | ||
|
ps48 marked this conversation as resolved.
|
||
| }; | ||
|
|
||
| export const validateIndexName = (value: string) => { | ||
|
ps48 marked this conversation as resolved.
|
||
| // Check if the value does not begin with underscores or hyphens and all characters are lower case | ||
| return ACCELERATION_INDEX_NAME_REGEX.test(value); | ||
| }; | ||
119 changes: 119 additions & 0 deletions
119
public/components/acceleration/selectors/define_index_options.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { | ||
| EuiButton, | ||
| EuiFieldText, | ||
| EuiFlexGroup, | ||
| EuiFlexItem, | ||
| EuiFormRow, | ||
| EuiIconTip, | ||
| EuiLink, | ||
| EuiMarkdownFormat, | ||
| EuiModal, | ||
| EuiModalBody, | ||
| EuiModalFooter, | ||
| EuiModalHeader, | ||
| EuiModalHeaderTitle, | ||
| EuiSpacer, | ||
| EuiText, | ||
| } from '@elastic/eui'; | ||
| import React, { ChangeEvent, useState } from 'react'; | ||
| import { ACCELERATION_INDEX_NAME_INFO } from '../../../../common/constants'; | ||
| import { CreateAccelerationForm } from '../../../../common/types'; | ||
| import { validateIndexName } from '../create/utils'; | ||
|
|
||
| interface DefineIndexOptionsProps { | ||
| accelerationFormData: CreateAccelerationForm; | ||
| setAccelerationFormData: React.Dispatch<React.SetStateAction<CreateAccelerationForm>>; | ||
| } | ||
|
|
||
| export const DefineIndexOptions = ({ | ||
| accelerationFormData, | ||
| setAccelerationFormData, | ||
| }: DefineIndexOptionsProps) => { | ||
| const [indexName, setIndexName] = useState(''); | ||
| const [modalComponent, setModalComponent] = useState(<></>); | ||
|
|
||
| const modalValue = ( | ||
| <EuiModal maxWidth={850} onClose={() => setModalComponent(<></>)}> | ||
| <EuiModalHeader> | ||
| <EuiModalHeaderTitle> | ||
| <h1>Acceleration index naming</h1> | ||
| </EuiModalHeaderTitle> | ||
| </EuiModalHeader> | ||
| <EuiModalBody> | ||
| <EuiFlexGroup> | ||
| <EuiFlexItem grow={false}> | ||
| <EuiMarkdownFormat>{ACCELERATION_INDEX_NAME_INFO}</EuiMarkdownFormat> | ||
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| </EuiModalBody> | ||
| <EuiModalFooter> | ||
| <EuiButton onClick={() => setModalComponent(<></>)} fill> | ||
| Close | ||
| </EuiButton> | ||
| </EuiModalFooter> | ||
| </EuiModal> | ||
| ); | ||
|
|
||
| const onChangeIndexName = (e: ChangeEvent<HTMLInputElement>) => { | ||
| setAccelerationFormData({ ...accelerationFormData, accelerationIndexName: e.target.value }); | ||
| setIndexName(e.target.value); | ||
| }; | ||
|
|
||
| const getPreprend = () => { | ||
| const dataSource = | ||
| accelerationFormData.dataSource !== '' | ||
| ? accelerationFormData.dataSource | ||
| : '{Datasource Name}'; | ||
| const database = | ||
| accelerationFormData.database !== '' ? accelerationFormData.database : '{Database Name}'; | ||
| const dataTable = | ||
| accelerationFormData.dataTable !== '' ? accelerationFormData.dataTable : '{Table Name}'; | ||
| const prependValue = `flint_${dataSource}_${database}_${dataTable}_`; | ||
| return [ | ||
| prependValue, | ||
| <EuiIconTip type="iInCircle" color="subdued" content={prependValue} position="top" />, | ||
| ]; | ||
| }; | ||
|
|
||
| const getAppend = () => { | ||
| const appendValue = | ||
| accelerationFormData.accelerationIndexType === 'materialized' ? '' : '_index'; | ||
| return appendValue; | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <EuiText data-test-subj="define-index-header"> | ||
| <h3>Index settings</h3> | ||
| </EuiText> | ||
| <EuiSpacer size="s" /> | ||
| <EuiFormRow | ||
| label="Index name" | ||
| helpText='Must be in lowercase letters. Cannot begin with underscores or hyphens. Spaces, commas, and characters :, ", *, +, /, \, |, ?, #, >, or < are not allowed. | ||
| Prefix and suffix are added to the name of generated OpenSearch index.' | ||
| labelAppend={ | ||
| <EuiText size="xs"> | ||
| <EuiLink onClick={() => setModalComponent(modalValue)}>Help</EuiLink> | ||
| </EuiText> | ||
| } | ||
| > | ||
| <EuiFieldText | ||
| placeholder="Enter index name" | ||
| value={accelerationFormData.accelerationIndexType === 'skipping' ? 'skipping' : indexName} | ||
| onChange={onChangeIndexName} | ||
| aria-label="Enter Index Name" | ||
| prepend={getPreprend()} | ||
| append={getAppend()} | ||
| disabled={accelerationFormData.accelerationIndexType === 'skipping'} | ||
| isInvalid={validateIndexName(indexName)} | ||
| /> | ||
| </EuiFormRow> | ||
| {modalComponent} | ||
| </> | ||
| ); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.