Skip to content

Commit

Permalink
Revert "Add materlized views, manual refresh option and minor fixes (o…
Browse files Browse the repository at this point in the history
…pensearch-project#159) (opensearch-project#161)"

This reverts commit 88970fb.

Signed-off-by: Eric <menwe@amazon.com>
  • Loading branch information
mengweieric committed Nov 13, 2023
1 parent 32a7495 commit efb347d
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 251 deletions.
8 changes: 3 additions & 5 deletions common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

export const PLUGIN_ID = 'queryWorkbenchDashboards';
export const PLUGIN_NAME = 'Query Workbench';
export const OPENSEARCH_ACC_DOCUMENTATION_URL =
'https://opensearch.org/docs/latest/dashboards/management/accelerate-external-data/';
export const ACC_INDEX_TYPE_DOCUMENTATION_URL =
'https://github.com/opensearch-project/opensearch-spark/blob/main/docs/index.md';
export const OPENSEARCH_ACC_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest';
export const ACC_INDEX_TYPE_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest';

export const SKIPPING_INDEX = `skipping_index`;
export const ON_LOAD_QUERY = `SHOW tables LIKE '%';`;
Expand Down Expand Up @@ -39,7 +37,7 @@ OPTIONS (
export const ACCELERATION_INDEX_TYPES = [
{ label: 'Skipping Index', value: 'skipping' },
{ label: 'Covering Index', value: 'covering' },
{ label: 'Materialized View', value: 'materialized' },
// { label: 'Materialized View', value: 'materialized' }, Hidden Option -> Until opensearch-spark feature is ready
];

export const ACCELERATION_AGGREGRATION_FUNCTIONS = [
Expand Down
6 changes: 2 additions & 4 deletions common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export interface FormErrorsType {
checkpointLocationError: string[];
}

export type AccelerationRefreshType = 'auto' | 'interval' | 'manual';

export interface CreateAccelerationForm {
dataSource: string;
database: string;
Expand All @@ -73,10 +71,10 @@ export interface CreateAccelerationForm {
accelerationIndexName: string;
primaryShardsCount: number;
replicaShardsCount: number;
refreshType: AccelerationRefreshType;
refreshType: 'interval' | 'auto';
checkpointLocation: string | undefined;
refreshIntervalOptions: RefreshIntervalType;
formErrors: FormErrorsType;
}

export type AsyncQueryLoadingStatus = 'SUCCESS' | 'FAILED' | 'RUNNING' | 'SCHEDULED' | 'CANCELED';
export type AsyncQueryLoadingStatus = "SUCCESS" | "FAILED" | "RUNNING" | "SCHEDULED" | "CANCELED"
14 changes: 1 addition & 13 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ interface MainState {
asyncLoading: boolean;
asyncLoadingStatus: AsyncQueryLoadingStatus;
asyncJobId: string;
isAccelerationFlyoutOpened: boolean;
}

const SUCCESS_MESSAGE = 'Success';
Expand Down Expand Up @@ -247,7 +246,6 @@ export class Main extends React.Component<MainProps, MainState> {
asyncLoading: false,
asyncLoadingStatus: 'SUCCESS',
asyncJobId: '',
isAccelerationFlyoutOpened: false,
};
this.httpClient = this.props.httpClient;
this.updateSQLQueries = _.debounce(this.updateSQLQueries, 250).bind(this);
Expand Down Expand Up @@ -791,7 +789,7 @@ export class Main extends React.Component<MainProps, MainState> {
});
}

handleDataSelect = (selectedItems: EuiComboBoxOptionOption[]) => {
handleDataSelect = (selectedItems: []) => {
if (selectedItems[0].label !== 'OpenSearch' && this.state.language === 'SQL') {
this.updateSQLQueries('');
}
Expand All @@ -800,12 +798,6 @@ export class Main extends React.Component<MainProps, MainState> {
});
};

setIsAccelerationFlyoutOpened = (value: boolean) => {
this.setState({
isAccelerationFlyoutOpened: value,
});
};

render() {
let page;
let link;
Expand All @@ -827,10 +819,6 @@ export class Main extends React.Component<MainProps, MainState> {
updateSQLQueries={this.updateSQLQueries}
selectedDatasource={this.state.selectedDatasource}
asyncLoading={this.state.asyncLoading}
openAccelerationFlyout={
this.props.isAccelerationFlyoutOpen && !this.state.isAccelerationFlyoutOpened
}
setIsAccelerationFlyoutOpened={this.setIsAccelerationFlyoutOpened}
/>
);
link = 'https://opensearch.org/docs/latest/search-plugins/sql/index/';
Expand Down
18 changes: 1 addition & 17 deletions public/components/SQLPage/SQLPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ interface SQLPageProps {
sqlTranslations: ResponseDetail<TranslateResult>[];
selectedDatasource: EuiComboBoxOptionOption[];
asyncLoading: boolean;
openAccelerationFlyout: boolean;
setIsAccelerationFlyoutOpened: (value: boolean) => void;
}

interface SQLPageState {
Expand Down Expand Up @@ -82,21 +80,6 @@ export class SQLPage extends React.Component<SQLPageProps, SQLPageState> {
});
};

componentDidUpdate(prevProps: SQLPageProps) {
const { selectedDatasource, openAccelerationFlyout } = this.props;
const prevDataSource = prevProps.selectedDatasource[0].label;
const currentDataSource = selectedDatasource[0].label;

if (
currentDataSource !== prevDataSource &&
currentDataSource !== 'OpenSearch' &&
openAccelerationFlyout
) {
this.setAccelerationFlyout();
this.props.setIsAccelerationFlyoutOpened(true);
}
}

render() {
const closeModal = () => this.setIsModalVisible(false);
const showModal = () => this.setIsModalVisible(true);
Expand Down Expand Up @@ -204,6 +187,7 @@ export class SQLPage extends React.Component<SQLPageProps, SQLPageState> {
this.props.selectedDatasource[0].label !== 'OpenSearch' && (
<EuiFlexItem grow={false}>
<EuiButton
fill={true}
className="sql-accelerate-button"
onClick={this.setAccelerationFlyout}
isDisabled={this.props.asyncLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Array [
<a
class="euiLink euiLink--primary"
href="https://opensearch.org/docs/latest/dashboards/management/accelerate-external-data/"
href="https://opensearch.org/docs/latest"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -132,7 +132,7 @@ Array [
<div
class="euiTextColor euiTextColor--subdued"
>
Select the data source to accelerate data from. External data sources may take time to load.
Select data connection where the data you want to accelerate resides.
</div>
</div>
<div
Expand Down Expand Up @@ -441,7 +441,7 @@ Array [
>
<a
class="euiLink euiLink--primary"
href="https://github.com/opensearch-project/opensearch-spark/blob/main/docs/index.md"
href="https://opensearch.org/docs/latest"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -670,7 +670,7 @@ Array [
class="euiRadio__label"
for="refresh-option-1"
>
Auto refresh
Auto Refresh
</label>
</div>
<div
Expand All @@ -690,35 +690,15 @@ Array [
class="euiRadio__label"
for="refresh-option-2"
>
Auto refresh by interval
</label>
</div>
<div
class="euiRadio euiRadioGroup__item"
>
<input
class="euiRadio__input"
id="refresh-option-3"
name="refresh type radio group"
type="radio"
value=""
/>
<div
class="euiRadio__circle"
/>
<label
class="euiRadio__label"
for="refresh-option-3"
>
Manual refresh
Refresh by interval
</label>
</div>
</div>
<div
class="euiFormHelpText euiFormRow__text"
id="some_html_id-help-0"
>
Specify how often the index should refresh, which publishes the most recent changes and make them available for search.
Specify how often the index should refresh, which publishes the most recent changes and make them available for search. Default is set to auto refresh when data at the source changes.
</div>
</div>
</div>
Expand Down Expand Up @@ -1201,7 +1181,7 @@ Array [
<a
className="euiLink euiLink--primary"
href="https://opensearch.org/docs/latest/dashboards/management/accelerate-external-data/"
href="https://opensearch.org/docs/latest"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -1263,7 +1243,7 @@ Array [
<div
className="euiTextColor euiTextColor--subdued"
>
Select the data source to accelerate data from. External data sources may take time to load.
Select data connection where the data you want to accelerate resides.
</div>
</div>,
<div
Expand Down Expand Up @@ -1655,7 +1635,7 @@ Array [
>
<a
className="euiLink euiLink--primary"
href="https://github.com/opensearch-project/opensearch-spark/blob/main/docs/index.md"
href="https://opensearch.org/docs/latest"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -1920,7 +1900,7 @@ Array [
className="euiRadio__label"
htmlFor="refresh-option-1"
>
Auto refresh
Auto Refresh
</label>
</div>
<div
Expand All @@ -1941,36 +1921,15 @@ Array [
className="euiRadio__label"
htmlFor="refresh-option-2"
>
Auto refresh by interval
</label>
</div>
<div
className="euiRadio euiRadioGroup__item"
>
<input
checked={false}
className="euiRadio__input"
id="refresh-option-3"
name="refresh type radio group"
onChange={[Function]}
type="radio"
/>
<div
className="euiRadio__circle"
/>
<label
className="euiRadio__label"
htmlFor="refresh-option-3"
>
Manual refresh
Refresh by interval
</label>
</div>
</div>
<div
className="euiFormHelpText euiFormRow__text"
id="some_html_id-help-0"
>
Specify how often the index should refresh, which publishes the most recent changes and make them available for search.
Specify how often the index should refresh, which publishes the most recent changes and make them available for search. Default is set to auto refresh when data at the source changes.
</div>
</div>
</div>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`Acceleration header renders acceleration flyout header 1`] = `
<a
className="euiLink euiLink--primary"
href="https://opensearch.org/docs/latest/dashboards/management/accelerate-external-data/"
href="https://opensearch.org/docs/latest"
rel="noopener noreferrer"
target="_blank"
>
Expand Down
Loading

0 comments on commit efb347d

Please sign in to comment.