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

Fix workbench routes to support modal mounting #401

Merged
merged 1 commit into from
Oct 11, 2024
Merged
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
73 changes: 24 additions & 49 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 @@ -44,69 +44,44 @@
const isNavGroupEnabled = coreRefs?.chrome?.navGroup.getNavGroupEnabled();
const basePath = isNavGroupEnabled ? '/opensearch-query-workbench' : '';

const renderMain = (props: any, isAccelerationFlyoutOpen: boolean, urlDataSource: string) => {

Check warning on line 47 in public/components/app.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
return (
<Main
httpClient={http}
{...props}
setBreadcrumbs={chrome.setBreadcrumbs}
isAccelerationFlyoutOpen={isAccelerationFlyoutOpen}
urlDataSource={urlDataSource}
notifications={notifications}
savedObjects={savedObjects}
dataSourceEnabled={dataSourceEnabled}
dataSourceManagement={dataSourceManagement}
dataSourceMDSId={dataSourceId}
setActionMenu={setActionMenu}
/>
);
};

return (
<HashRouter>
<I18nProvider>
<div>
<EuiPage>
<EuiPageBody>
<Switch>
<Route
exact
path={isNavGroupEnabled ? [`${basePath}`, `/`] : `/${basePath}`}
render={(props) => (
<Main
httpClient={http}
{...props}
setBreadcrumbs={chrome.setBreadcrumbs}
isAccelerationFlyoutOpen={false}
urlDataSource=""
notifications={notifications}
savedObjects={savedObjects}
dataSourceEnabled={dataSourceEnabled}
dataSourceManagement={dataSourceManagement}
dataSourceMDSId={dataSourceId}
setActionMenu={setActionMenu}
/>
)}
/>
<Route
exact
path={`${basePath}/:dataSource`}
render={(props) => (
<Main
httpClient={http}
{...props}
setBreadcrumbs={chrome.setBreadcrumbs}
isAccelerationFlyoutOpen={false}
urlDataSource={props.match.params.dataSource}
notifications={notifications}
savedObjects={savedObjects}
dataSourceEnabled={dataSourceEnabled}
dataSourceManagement={dataSourceManagement}
dataSourceMDSId={dataSourceId}
setActionMenu={setActionMenu}
/>
)}
render={(props) => renderMain(props, false, props.match.params.dataSource)}
/>
<Route
exact
path={`${basePath}/accelerate/:dataSource`}
render={(props) => (
<Main
httpClient={http}
{...props}
setBreadcrumbs={chrome.setBreadcrumbs}
isAccelerationFlyoutOpen={true}
urlDataSource={props.match.params.dataSource}
notifications={notifications}
savedObjects={savedObjects}
dataSourceEnabled={dataSourceEnabled}
dataSourceManagement={dataSourceManagement}
dataSourceMDSId={dataSourceId}
setActionMenu={setActionMenu}
/>
)}
render={(props) => renderMain(props, true, props.match.params.dataSource)}
/>
<Route
path={isNavGroupEnabled ? [`${basePath}`, `/`] : `/${basePath}`}
render={(props) => renderMain(props, false, '')}
/>
</Switch>
</EuiPageBody>
Expand Down
Loading