Skip to content
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

[Bug] Fix url redirection, add default render path #387

Merged
merged 5 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@

interface ResponseData {
ok: boolean;
resp: any;

Check warning on line 65 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
body: any;

Check warning on line 66 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}

export interface ResponseDetail<T> {
Expand All @@ -73,11 +73,11 @@
}

export interface TranslateResult {
[key: string]: any;

Check warning on line 76 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}

export interface QueryMessage {
text: any;

Check warning on line 80 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
className: string;
}

Expand All @@ -97,13 +97,13 @@
[key: string]: {
nodes: Tree;
expandedRow?: {};
selectedNodes?: { [key: string]: any };

Check warning on line 100 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
};
}

export interface DataRow {
rowId: number;
data: { [key: string]: any };

Check warning on line 106 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
}

interface MainProps {
Expand Down Expand Up @@ -153,7 +153,7 @@
}

const SUCCESS_MESSAGE = 'Success';
const errorQueryResponse = (queryResultResponseDetail: any) => {

Check warning on line 156 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const errorMessage =
queryResultResponseDetail.errorMessage +
', this query is not runnable. \n \n' +
Expand Down Expand Up @@ -181,7 +181,7 @@
const dataRows: DataRow[] = [];

const schema: object[] = _.get(responseObj, 'schema');
const datarows: any[][] = _.get(responseObj, 'datarows');

Check warning on line 184 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
let queryType = 'default';

for (const column of schema.values()) {
Expand All @@ -206,7 +206,7 @@
}

for (const [id, field] of datarows.entries()) {
const row: { [key: string]: any } = {};

Check warning on line 209 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
row.TABLE_NAME = field[index];
const dataRow: DataRow = {
rowId: id,
Expand All @@ -219,7 +219,7 @@
case 'describe':
case 'default':
for (const [id, field] of schema.entries()) {
let alias: any = null;

Check warning on line 222 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
try {
alias = _.get(field, 'alias');
} catch (e) {
Expand Down Expand Up @@ -291,7 +291,7 @@
refreshTree: false,
isAccelerationFlyoutOpened: false,
isCallOutVisible: false,
cluster: 'Indexes',
cluster: props.urlDataSource?'Data source Connections':'Indexes',

Check failure on line 294 in public/components/Main/main.tsx

View workflow job for this annotation

GitHub Actions / Lint

Replace `?'Data·source·Connections':` with `·?·'Data·source·Connections'·:·`
TackAdam marked this conversation as resolved.
Show resolved Hide resolved
dataSourceOptions: [],
selectedMDSDataConnectionId: this.props.dataSourceMDSId,
mdsClusterName: '',
Expand Down
29 changes: 25 additions & 4 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const WorkbenchApp = ({
setActionMenu,
}: WorkbenchAppDeps) => {
const isNavGroupEnabled = coreRefs?.chrome?.navGroup.getNavGroupEnabled();
const basePath = isNavGroupEnabled ? 'opensearch-query-workbench' : '';
const basePath = isNavGroupEnabled ? '/opensearch-query-workbench' : '';

return (
<HashRouter>
Expand All @@ -53,7 +53,7 @@ export const WorkbenchApp = ({
<Switch>
<Route
exact
path={`/${basePath}`}
path={isNavGroupEnabled ? basePath : `/${basePath}`}
render={(props) => (
<Main
httpClient={http}
Expand All @@ -72,7 +72,7 @@ export const WorkbenchApp = ({
/>
<Route
exact
path={`/${basePath}/:dataSource`}
path={`${basePath}/:dataSource`}
render={(props) => (
<Main
httpClient={http}
Expand All @@ -91,7 +91,7 @@ export const WorkbenchApp = ({
/>
<Route
exact
path={`/${basePath}/accelerate/:dataSource`}
path={`${basePath}/accelerate/:dataSource`}
render={(props) => (
<Main
httpClient={http}
Expand All @@ -108,6 +108,27 @@ export const WorkbenchApp = ({
/>
)}
/>
{basePath && (
TackAdam marked this conversation as resolved.
Show resolved Hide resolved
<Route
exact
path="/"
render={(props) => (
<Main
httpClient={http}
{...props}
setBreadcrumbs={chrome.setBreadcrumbs}
isAccelerationFlyoutOpen={false}
urlDataSource=""
notifications={notifications}
savedObjects={savedObjects}
dataSourceEnabled={dataSourceEnabled}
dataSourceManagement={dataSourceManagement}
dataSourceMDSId={dataSourceId}
setActionMenu={setActionMenu}
/>
)}
/>
)}
</Switch>
</EuiPageBody>
</EuiPage>
Expand Down
Loading