Skip to content

Commit 72a98ab

Browse files
committed
fix(FR-1680): redirect from the root page to the start page is not working (#4642)
resolves #4641 (FR-1680) This PR removes the Import & Run page and its corresponding menu item from the WebUI. The changes include: 1. Removing the `ImportAndRunPage.tsx` component 2. Removing the `import` menu key from the `MenuKeys` type 3. Removing the Import & Run menu item from the sidebar 4. Removing the `BAIExampleStartIcon` import that was only used for this page 5. Adding a redirect to the start page when the current page is 'start' **Checklist:** (if applicable) - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after
1 parent 1b47b77 commit 72a98ab

File tree

3 files changed

+7
-65
lines changed

3 files changed

+7
-65
lines changed

react/src/components/MainLayout/WebUISider.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import { MenuItemType } from 'antd/lib/menu/interface';
4141
import {
4242
filterOutEmpty,
4343
BAIEndpointsIcon,
44-
BAIExampleStartIcon,
4544
BAIModelStoreIcon,
4645
BAIMyEnvironmentsIcon,
4746
BAIPipelinesIcon,
@@ -93,7 +92,6 @@ export type MenuKeys =
9392
| 'model-store'
9493
| 'ai-agent'
9594
| 'chat'
96-
| 'import'
9795
| 'data'
9896
| 'my-environment'
9997
| 'agent-summary'
@@ -208,12 +206,6 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
208206
key: 'chat',
209207
group: 'playground',
210208
},
211-
{
212-
label: <WebUILink to="/import">{t('webui.menu.Import&Run')}</WebUILink>,
213-
icon: <BAIExampleStartIcon style={{ color: token.colorPrimary }} />,
214-
key: 'import',
215-
group: 'workload',
216-
},
217209
{
218210
label: <WebUILink to="/data">{t('webui.menu.Data')}</WebUILink>,
219211
icon: <CloudUploadOutlined style={{ color: token.colorPrimary }} />,

react/src/pages/ImportAndRunPage.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/components/backend-ai-webui.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,13 @@ export default class BackendAIWebUI extends connect(store)(LitElement) {
655655
this._page = 'error';
656656
this._moveTo('/error');
657657
}
658+
// since we need to add search params, redirect to the start page after error validation
659+
// if you move this block to the previous error-validation block, it may cause an error
660+
if (this._page === 'start') {
661+
const url = new URL(window.location.href);
662+
const hasSearchParam = url.search.length > 0;
663+
this._moveTo(hasSearchParam ? `/start${url.search}` : '/start');
664+
}
658665
}
659666

660667
showUpdateNotifier(): void {

0 commit comments

Comments
 (0)