Skip to content

Commit

Permalink
pr requested changes
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Sebastian <paulstn@amazon.com>
  • Loading branch information
paulstn committed Oct 25, 2023
1 parent ff41b4c commit a2a756c
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 74 deletions.
3 changes: 3 additions & 0 deletions common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ export const POLL_INTERVAL_MS = 2000;
export const ASYNC_QUERY_ENDPOINT = '/api/spark_sql_console';
export const ASYNC_QUERY_JOB_ENDPOINT = ASYNC_QUERY_ENDPOINT + '/job/';
export const ASYNC_QUERY_SESSION_ID = 'async-query-session-id';

export const SAMPLE_PPL_QUERY = 'source = <datasource>.<database>.<table> | head 10';
export const SAMPLE_SQL_QUERY = 'select * from <datasource>.<database>.<table> limit 10';
36 changes: 17 additions & 19 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -966,25 +966,23 @@ export class Main extends React.Component<MainProps, MainState> {
height: 'calc(100vh - 254px)',
}}
>
<EuiFlexItem grow={false}>
<EuiFlexGroup direction="row" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButtonIcon
display="base"
iconType="refresh"
size="m"
aria-label="refresh"
onClick={this.handleReloadTree}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<CreateButton
updateSQLQueries={this.updateSQLQueries}
selectedDatasource={this.state.selectedDatasource}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexGroup direction="row" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButtonIcon
display="base"
iconType="refresh"
size="m"
aria-label="refresh"
onClick={this.handleReloadTree}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<CreateButton
updateSQLQueries={this.updateSQLQueries}
selectedDatasource={this.state.selectedDatasource}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="l" />
<EuiFlexGroup
direction="column"
Expand Down
8 changes: 2 additions & 6 deletions public/components/PPLPage/PPLPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from '@elastic/eui';
import React from 'react';
import { ResponseDetail, TranslateResult } from '../Main/main';
import { SAMPLE_PPL_QUERY } from '../../../common/constants';

interface PPLPageProps {
onRun: (query: string) => void;
Expand Down Expand Up @@ -161,12 +162,7 @@ export class PPLPage extends React.Component<PPLPageProps, PPLPageState> {
</EuiButton>
</EuiFlexItem>
) : (
<EuiFlexItem
grow={false}
onClick={() =>
this.props.updatePPLQueries('source = <datasource>.<database>.<table> | head 10')
}
>
<EuiFlexItem grow={false} onClick={() => this.props.updatePPLQueries(SAMPLE_PPL_QUERY)}>
<EuiButton className="sql-editor-button" isDisabled={this.props.asyncLoading}>
Sample Query
</EuiButton>
Expand Down
7 changes: 2 additions & 5 deletions public/components/SQLPage/SQLPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import React from 'react';
import { CoreStart } from '../../../../../src/core/public';
import { ResponseDetail, TranslateResult } from '../Main/main';
import { CreateAcceleration } from '../acceleration/create/create_acceleration';
import { SAMPLE_SQL_QUERY } from '../../../common/constants';

interface SQLPageProps {
http: CoreStart['http'];
Expand Down Expand Up @@ -202,11 +203,7 @@ export class SQLPage extends React.Component<SQLPageProps, SQLPageState> {
) : (
<EuiFlexItem
grow={false}
onClick={() =>
this.props.updateSQLQueries(
'select * from <datasource>.<database>.<table> limit 10'
)
}
onClick={() => this.props.updateSQLQueries(SAMPLE_SQL_QUERY)}
>
<EuiButton className="sql-editor-button" isDisabled={this.props.asyncLoading}>
Sample Query
Expand Down
86 changes: 42 additions & 44 deletions public/components/SQLPage/table_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,52 +501,50 @@ export const TableView = ({ http, selectedItems, updateSQLQueries, refreshTree }

return (
<>
<>
{isLoadingBanner.flag ? (
<EuiFlexGroup alignItems="center" gutterSize="s" direction="column">
<EuiSpacer />
<EuiFlexItem>
<EuiLoadingSpinner size="l" />
</EuiFlexItem>
<EuiFlexItem grow={false}>Loading data</EuiFlexItem>
<EuiFlexItem grow={false}>
<div style={{ padding: '10px' }}>
<EuiFlexItem>
<EuiText textAlign="center" color="subdued">
Loading may take over 30 seconds
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiText textAlign="center" color="subdued">
Status: {isLoadingBanner.status}
</EuiText>
</EuiFlexItem>
</div>
</EuiFlexItem>
</EuiFlexGroup>
) : OpenSearchIndicesTree.length > 0 || treeDataDatabases.length > 0 ? (
{isLoadingBanner.flag ? (
<EuiFlexGroup alignItems="center" gutterSize="s" direction="column">
<EuiSpacer />
<EuiFlexItem>
<EuiLoadingSpinner size="l" />
</EuiFlexItem>
<EuiFlexItem grow={false}>Loading data</EuiFlexItem>
<EuiFlexItem grow={false}>
<div style={{ padding: '10px' }}>
<EuiFlexItem>
<EuiText textAlign="center" color="subdued">
Loading may take over 30 seconds
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiText textAlign="center" color="subdued">
Status: {isLoadingBanner.status}
</EuiText>
</EuiFlexItem>
</div>
</EuiFlexItem>
</EuiFlexGroup>
) : OpenSearchIndicesTree.length > 0 || treeDataDatabases.length > 0 ? (
<EuiFlexItem grow={false}>
{selectedItems[0].label === 'OpenSearch' ? (
<EuiTreeView aria-label="Sample Folder Tree" items={OpenSearchIndicesTree} />
) : (
<EuiTreeView aria-label="Sample Folder Tree" items={treeDataDatabases} />
)}
</EuiFlexItem>
) : (
<EuiFlexGroup alignItems="center" direction="column">
<EuiFlexItem grow={false}>
{selectedItems[0].label === 'OpenSearch' ? (
<EuiTreeView aria-label="Sample Folder Tree" items={OpenSearchIndicesTree} />
) : (
<EuiTreeView aria-label="Sample Folder Tree" items={treeDataDatabases} />
)}
<EuiEmptyPrompt
icon={<EuiIcon type="database" size="m" />}
iconColor="subdued"
titleSize="xs"
title={<p>No Data available</p>}
body={<p>{isLoadingBanner.status}</p>}
/>
</EuiFlexItem>
) : (
<EuiFlexGroup alignItems="center" direction="column">
<EuiFlexItem grow={false}>
<EuiEmptyPrompt
icon={<EuiIcon type="database" size="m" />}
iconColor="subdued"
titleSize="xs"
title={<p>No Data available</p>}
body={<p>{isLoadingBanner.status}</p>}
/>
</EuiFlexItem>
</EuiFlexGroup>
)}
{indexFlyout}
</>
</EuiFlexGroup>
)}
{indexFlyout}
</>
);
};

0 comments on commit a2a756c

Please sign in to comment.