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 all commits
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',
dataSourceOptions: [],
selectedMDSDataConnectionId: this.props.dataSourceMDSId,
mdsClusterName: '',
Expand Down
8 changes: 4 additions & 4 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
}

export const WorkbenchApp = ({
basename,

Check failure on line 33 in public/components/app.tsx

View workflow job for this annotation

GitHub Actions / Lint

'basename' is defined but never used. Allowed unused args must match /^_/u
notifications,
http,
navigation,

Check failure on line 36 in public/components/app.tsx

View workflow job for this annotation

GitHub Actions / Lint

'navigation' is defined but never used. Allowed unused args must match /^_/u
chrome,
savedObjects,
dataSourceEnabled,
Expand All @@ -42,7 +42,7 @@
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 @@
<Switch>
<Route
exact
path={`/${basePath}`}
path={isNavGroupEnabled ? [`${basePath}`, `/`] : `/${basePath}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path={isNavGroupEnabled ? [`${basePath}`, `/`] : `/${basePath}`}
path={isNavGroupEnabled ? [`${basePath}`, `/`] : `${basePath}`}

Copy link
Contributor Author

@TackAdam TackAdam Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the url re-direction to work correctly while the new home page is disabled the "/" is required or the following fail:

path={/${basePath}/:dataSource}
path={/${basePath}/accelerate/:dataSource}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, yeah you are right.

render={(props) => (
<Main
httpClient={http}
Expand All @@ -72,7 +72,7 @@
/>
<Route
exact
path={`/${basePath}/:dataSource`}
path={`${basePath}/:dataSource`}
render={(props) => (
<Main
httpClient={http}
Expand All @@ -91,7 +91,7 @@
/>
<Route
exact
path={`/${basePath}/accelerate/:dataSource`}
path={`${basePath}/accelerate/:dataSource`}
render={(props) => (
<Main
httpClient={http}
Expand Down
Loading