Skip to content

Commit cd403cd

Browse files
committed
refactor: set default page to start instead of summary page
1 parent c43c314 commit cd403cd

11 files changed

+29
-24
lines changed

react/src/App.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ const InteractiveLoginPage = React.lazy(
6262
);
6363
const ImportAndRunPage = React.lazy(() => import('./pages/ImportAndRunPage'));
6464

65-
const RedirectToSummary = () => {
65+
const RedirectToStart = () => {
6666
useSuspendedBackendaiClient();
67-
const pathName = '/summary';
67+
const pathName = '/start';
6868
document.dispatchEvent(
6969
new CustomEvent('move-to-from-react', {
7070
detail: {
@@ -73,7 +73,7 @@ const RedirectToSummary = () => {
7373
},
7474
}),
7575
);
76-
return <Navigate to="/summary" replace />;
76+
return <Navigate to="/start" replace />;
7777
};
7878

7979
const router = createBrowserRouter([
@@ -110,17 +110,17 @@ const router = createBrowserRouter([
110110
children: [
111111
{
112112
path: '/',
113-
element: <RedirectToSummary />,
113+
element: <RedirectToStart />,
114114
},
115115
{
116116
//for electron dev mode
117117
path: '/build/electron-app/app/index.html',
118-
element: <RedirectToSummary />,
118+
element: <RedirectToStart />,
119119
},
120120
{
121121
//for electron prod mode
122122
path: '/app/index.html',
123-
element: <RedirectToSummary />,
123+
element: <RedirectToStart />,
124124
},
125125
{
126126
path: '/start',
@@ -140,7 +140,7 @@ const router = createBrowserRouter([
140140
</>
141141
);
142142
},
143-
handle: { labelKey: 'webui.menu.Summary' },
143+
handle: { labelKey: 'start' },
144144
},
145145
{
146146
path: '/job',

react/src/components/MainLayout/WebUISider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
408408
<BAIMenu
409409
isAdminMenu={true}
410410
selectedKeys={[
411-
location.pathname.split('/')[1] || 'summary',
411+
location.pathname.split('/')[1] || 'start',
412412
// TODO: After matching first path of 'storage-settings' and 'agent', remove this code
413413
location.pathname.split('/')[1] === 'storage-settings' ? 'agent' : '',
414414
// TODO: After 'SessionListPage' is completed and used as the main page, remove this code

react/src/pages/StartPage.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ const StartPage: React.FC<StartPageProps> = (props) => {
107107
secondary
108108
icon={
109109
// FIXME: workaround for displaying proper icon
110-
<img
111-
src="react/src/components/icons/URLStart.svg"
112-
alt="URL start"
113-
></img>
110+
<img src="/resources/icons/URLStart.svg" alt="URL start"></img>
114111
// <URLStartIcon />
115112
}
116113
title={

resources/icons/URLStart.svg

+7
Loading

src/backend-ai-app.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const navigate =
5050
}
5151
let page;
5252
if (['/', 'build', '/build', 'app', '/app'].includes(path)) {
53-
page = 'summary';
53+
page = 'start';
5454
} else if (path[0] === '/') {
5555
page = path.slice(1);
5656
} else {
@@ -85,7 +85,7 @@ const loadPage =
8585
(page, params: Record<string, unknown> = {}) =>
8686
(dispatch) => {
8787
switch (page) {
88-
case 'summary':
88+
case 'start':
8989
import('./components/backend-ai-summary-view.js').then((module) => {
9090
// TODO: after page changing?
9191
});

src/components/backend-ai-error-view.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ export default class BackendAIErrorView extends BackendAIPage {
7070
* @param {string} url - page to redirect from the current page.
7171
*/
7272
_moveTo(url = '') {
73-
const page = url !== '' ? url : 'summary';
74-
globalThis.history.pushState({}, '', '/summary');
73+
const page = url !== '' ? url : 'start';
74+
globalThis.history.pushState({}, '', '/start');
7575
store.dispatch(navigate(decodeURIComponent('/' + page), {}));
7676
document.dispatchEvent(
7777
new CustomEvent('react-navigate', {
@@ -98,7 +98,7 @@ export default class BackendAIErrorView extends BackendAIPage {
9898
fullwidth
9999
id="go-to-summary"
100100
label="${_t('button.GoBackToSummaryPage')}"
101-
@click="${() => this._moveTo('summary')}"
101+
@click="${() => this._moveTo('start')}"
102102
></mwc-button>
103103
</div>
104104
</div>

src/components/backend-ai-permission-denied-view.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default class BackendAIPermissionDeniedView extends BackendAIPage {
113113
* @param {string} url - page to redirect from the current page.
114114
*/
115115
_moveTo(url = '') {
116-
const page = url !== '' ? url : 'summary';
116+
const page = url !== '' ? url : 'start';
117117
globalThis.history.pushState({}, '', '/summary');
118118
store.dispatch(navigate(decodeURIComponent('/' + page), {}));
119119
}
@@ -135,7 +135,7 @@ export default class BackendAIPermissionDeniedView extends BackendAIPage {
135135
fullwidth
136136
id="go-to-summary"
137137
label="${_t('button.GoBackToSummaryPage')}"
138-
@click="${() => this._moveTo('summary')}"
138+
@click="${() => this._moveTo('start')}"
139139
></mwc-button>
140140
</div>
141141
</div>

src/components/backend-ai-storage-list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ export default class BackendAiStorageList extends BackendAIPage {
10801080
* @param {string} url - page to redirect from the current page.
10811081
*/
10821082
_moveTo(url = '') {
1083-
const page = url !== '' ? url : 'summary';
1083+
const page = url !== '' ? url : 'start';
10841084
// globalThis.history.pushState({}, '', page);
10851085
store.dispatch(navigate(decodeURIComponent(page), {}));
10861086

src/components/backend-ai-storage-proxy-list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export default class BackendAIStorageProxyList extends BackendAIPage {
249249
* @param {string} url - page to redirect from the current page.
250250
*/
251251
_moveTo(url = '') {
252-
const page = url !== '' ? url : 'summary';
252+
const page = url !== '' ? url : 'start';
253253
// globalThis.history.pushState({}, '', page);
254254
store.dispatch(navigate(decodeURIComponent(page), {}));
255255

src/components/backend-ai-summary-view.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ export default class BackendAISummary extends BackendAIPage {
477477
* @param {string} search
478478
*/
479479
_moveTo(url = '', search: string | undefined = undefined) {
480-
const page = url !== '' ? url : 'summary';
480+
const page = url !== '' ? url : 'start';
481481
// globalThis.history.pushState({}, '', page);
482482
store.dispatch(navigate(decodeURIComponent(page), {}));
483483

src/components/backend-ai-webui.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ export default class BackendAIWebUI extends connect(store)(LitElement) {
145145
@property({ type: Number }) sidepanelWidth = 250;
146146
@property({ type: Object }) supports = Object();
147147
@property({ type: Array }) availablePages = [
148-
'summary',
148+
// 'summary',
149+
'start',
149150
'verify-email',
150151
'change-password',
151152
'job',
@@ -719,7 +720,7 @@ export default class BackendAIWebUI extends connect(store)(LitElement) {
719720
*/
720721
_loadPageElement() {
721722
if (this._page === 'index.html' || this._page === '') {
722-
this._page = 'summary';
723+
this._page = 'start';
723724
navigate(decodeURIComponent('/'));
724725
}
725726
}

0 commit comments

Comments
 (0)