Skip to content

Commit

Permalink
chore: remove unused component files (#2923)
Browse files Browse the repository at this point in the history
**Changes:**
Removes legacy web components and routes in favor of React components, specifically:
- Removes `backend-ai-environment-view` and `backend-ai-session-view-next` components
- Removes unused React component definitions and routes for sessions, container registry, keypair info, and error logs
- Updates app routing to remove environment and session page handlers

**Rationale:**
This change continues the migration from Web Components to React-based UI components by removing duplicate/legacy implementations that have been replaced by their React counterparts.

**Review Requirements:**
- Verify that session and environment pages load correctly with React components
- Confirm no regressions in navigation and routing
- Check that removed components are fully replaced by React equivalents
  • Loading branch information
yomybaby committed Dec 9, 2024
1 parent 297abe0 commit 7794961
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 355 deletions.
84 changes: 1 addition & 83 deletions react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import App from './App';
import BAIIntervalView from './components/BAIIntervalView';
import { jotaiStore, useWebComponentInfo } from './components/DefaultProviders';
import Flex from './components/Flex';
import FlexActivityIndicator from './components/FlexActivityIndicator';
import ResourceGroupSelectForCurrentProject from './components/ResourceGroupSelectForCurrentProject';
import SourceCodeViewer from './components/SourceCodeViewer';
import { loadCustomThemeConfig } from './helper/customThemeConfig';
Expand All @@ -15,10 +14,9 @@ import { ThemeModeProvider } from './hooks/useThemeMode';
import { Tag, theme } from 'antd';
import dayjs from 'dayjs';
import { Provider as JotaiProvider } from 'jotai';
import React, { Suspense } from 'react';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { useTranslation } from 'react-i18next';
import { Route, Routes } from 'react-router-dom';

// To maintain compatibility with various manager versions, the WebUI client uses directives to manipulate GraphQL queries.
// This can cause Relay to show "Warning: RelayResponseNormalizer: Payload did not contain a value for field" in the browser console during development.
Expand All @@ -44,7 +42,6 @@ loadCustomThemeConfig();
const DefaultProviders = React.lazy(
() => import('./components/DefaultProviders'),
);
const SessionList = React.lazy(() => import('./pages/SessionListPage'));
const ResetPasswordRequired = React.lazy(
() => import('./components/ResetPasswordRequired'),
);
Expand All @@ -55,40 +52,12 @@ const UserInfoModal = React.lazy(() => import('./components/UserInfoModal'));
const UserSettingsModal = React.lazy(
() => import('./components/UserSettingModal'),
);
const UserDropdownMenu = React.lazy(
() => import('./components/UserDropdownMenu'),
);
const SessionLauncherPage = React.lazy(
() => import('./pages/SessionLauncherPage'),
);
const ContainerRegistryList = React.lazy(
() => import('./components/ContainerRegistryList'),
);
const KeypairInfoModal = React.lazy(
() => import('./components/KeypairInfoModal'),
);
const SignoutModal = React.lazy(() => import('./components/SignoutModal'));

const ErrorLogList = React.lazy(() => import('./components/ErrorLogList'));

const BatchSessionScheduledTimeSetting = React.lazy(
() => import('./components/BatchSessionScheduledTimeSetting'),
);

customElements.define(
'backend-ai-react-session-list',
reactToWebComponent((props) => {
return (
<DefaultProviders {...props}>
<Routes>
<Route path="/session" element={<SessionList />} />
<Route path="/session/start" element={<SessionLauncherPage />} />
</Routes>
</DefaultProviders>
);
}),
);

customElements.define(
'backend-ai-react-reset-password-required-modal',
reactToWebComponent((props) => (
Expand Down Expand Up @@ -131,17 +100,6 @@ customElements.define(
}),
);

customElements.define(
'backend-ai-react-user-dropdown-menu',
reactToWebComponent((props) => {
return (
<DefaultProviders {...props}>
<UserDropdownMenu />
</DefaultProviders>
);
}),
);

customElements.define(
'backend-ai-react-source-code-viewer',
reactToWebComponent((props) => {
Expand Down Expand Up @@ -225,35 +183,6 @@ const ResourceGroupSelectInWebComponent = (props: ReactWebComponentProps) => {
);
};

customElements.define(
'backend-ai-react-container-registry-list',
reactToWebComponent((props) => {
return (
<DefaultProviders {...props}>
<Suspense fallback={<FlexActivityIndicator />}>
<ContainerRegistryList />
</Suspense>
</DefaultProviders>
);
}),
);

customElements.define(
'backend-ai-react-keypair-info-modal',
reactToWebComponent((props) => {
return (
<DefaultProviders {...props}>
<KeypairInfoModal
open={props.value === 'true'}
onRequestClose={() => {
props.dispatchEvent('close', null);
}}
/>
</DefaultProviders>
);
}),
);

customElements.define(
'backend-ai-react-signout-modal',
reactToWebComponent((props) => {
Expand Down Expand Up @@ -283,17 +212,6 @@ root.render(
</React.StrictMode>,
);

customElements.define(
'backend-ai-react-error-log-list',
reactToWebComponent((props) => {
return (
<DefaultProviders {...props}>
<ErrorLogList />
</DefaultProviders>
);
}),
);

customElements.define(
'backend-ai-react-batch-session-scheduled-time-setting',
reactToWebComponent((props) => {
Expand Down
6 changes: 0 additions & 6 deletions src/backend-ai-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ const loadPage =
case 'job':
import('./components/backend-ai-session-view.js');
break;
case 'session':
import('./components/backend-ai-session-view-next.js');
break;
// temporally block experiment
/*
case 'experiment':
Expand All @@ -117,9 +114,6 @@ const loadPage =
case 'user':
import('./components/backend-ai-credential-view.js');
break;
case 'environment':
import('./components/backend-ai-environment-view.js');
break;
case 'settings':
import('./components/backend-ai-settings-view.js');
break;
Expand Down
197 changes: 0 additions & 197 deletions src/components/backend-ai-environment-view.ts

This file was deleted.

Loading

0 comments on commit 7794961

Please sign in to comment.