Skip to content

Commit

Permalink
feat: User setting for the classic session launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby authored and agatha197 committed Oct 2, 2024
1 parent c1f51bd commit 8e8623a
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 136 deletions.
30 changes: 4 additions & 26 deletions react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ const SessionListPage = React.lazy(() => import('./pages/SessionListPage'));
const SessionLauncherPage = React.lazy(
() => import('./pages/SessionLauncherPage'),
);
const NeoSessionLauncherSwitchAlert = React.lazy(
() => import('./components/NeoSessionLauncherSwitchAlert'),
);
const ResourcePolicyPage = React.lazy(
() => import('./pages/ResourcePolicyPage'),
);
Expand Down Expand Up @@ -142,15 +139,6 @@ const router = createBrowserRouter([
{
path: '/job',
handle: { labelKey: 'webui.menu.Sessions' },
Component: () => {
const { token } = theme.useToken();
useSuspendedBackendaiClient(); // make sure the client is ready
return (
<NeoSessionLauncherSwitchAlert
style={{ marginBottom: token.paddingContentVerticalLG }}
/>
);
},
},
{
path: '/serving',
Expand Down Expand Up @@ -211,21 +199,18 @@ const router = createBrowserRouter([
handle: { labelKey: 'webui.menu.Import&Run' },
Component: () => {
const { token } = theme.useToken();
const [is2409Launcher] = useBAISettingUserState(
'use_2409_session_launcher',
const [classicSessionLauncher] = useBAISettingUserState(
'classic_session_launcher',
);
return (
<BAIErrorBoundary>
<NeoSessionLauncherSwitchAlert
style={{ marginBottom: token.paddingContentVerticalLG }}
/>
{is2409Launcher ? null : <ImportAndRunPage />}
{classicSessionLauncher ? null : <ImportAndRunPage />}
{/* @ts-ignore */}
<backend-ai-import-view
active
class="page"
name="import"
sessionLauncherType={is2409Launcher ? 'classic' : 'neo'}
sessionLauncherType={classicSessionLauncher ? 'classic' : 'neo'}
/>
</BAIErrorBoundary>
);
Expand Down Expand Up @@ -330,13 +315,6 @@ const router = createBrowserRouter([
align="stretch"
style={{ paddingBottom: token.paddingContentVerticalLG }}
>
<NeoSessionLauncherSwitchAlert
onChange={(value) => {
if (value === 'current') {
webuiNavigate('/job');
}
}}
/>
<LocationStateBreadCrumb />
<Suspense
fallback={
Expand Down
88 changes: 0 additions & 88 deletions react/src/components/NeoSessionLauncherSwitchAlert.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion react/src/hooks/useBAISetting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { atomFamily } from 'jotai/utils';

interface UserSettings {
has_opened_tour_neo_session_validation?: boolean;
use_2409_session_launcher?: boolean;
desktop_notification?: boolean;
compact_sidebar?: boolean;
preserve_login?: boolean;
Expand All @@ -17,6 +16,7 @@ interface UserSettings {
auto_logout?: boolean;
summary_items?: Array<Omit<SummaryItem, 'data'>>;
selected_language?: string;
classic_session_launcher?: boolean;
}

interface GeneralSettings {
Expand Down
12 changes: 12 additions & 0 deletions react/src/pages/UserSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const UserPreferencesPage = () => {
const [desktopNotification, setDesktopNotification] = useBAISettingUserState(
'desktop_notification',
);
const [isClassicSessionLauncher, setIsClassicSessionLauncher] =
useBAISettingUserState('classic_session_launcher');
const [compactSidebar, setCompactSidebar] =
useBAISettingUserState('compact_sidebar');
const [selectedLanguage, setSelectedLanguage] =
Expand All @@ -52,6 +54,16 @@ const UserPreferencesPage = () => {
{
title: t('usersettings.Preferences'),
settingItems: [
{
type: 'checkbox',
title: t('usersettings.ClassicSessionLauncher'),
description: t('usersettings.DescClassicSessionLauncher'),
defaultValue: false,
value: isClassicSessionLauncher,
onChange: (e) => {
setIsClassicSessionLauncher(e.target.checked);
},
},
{
type: 'checkbox',
title: t('usersettings.DesktopNotification'),
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Passen Sie an, wie die Backend.AI-WebUI auf Ihrem Gerät aussieht.",
"ThemeMode": "Themenmodus",
"BootstrapScriptEmpty": "Das Skript ist leer. \nBitte geben Sie das Skript ein.",
"BootstrapScriptDeleted": "Bootstrap-Skript gelöscht"
"BootstrapScriptDeleted": "Bootstrap-Skript gelöscht",
"ClassicSessionLauncher": "Klassischer Sitzungsstarter",
"DescClassicSessionLauncher": "Verwenden Sie den klassischen Sitzungsstarter anstelle des neuesten Sitzungsstarters. \nDer klassische Sitzungsstarter verfügt möglicherweise nicht über die neuesten Funktionen."
},
"webTerminalUsageGuide": {
"CopyGuide": "Erweiterte Web-Terminal-Nutzung: Terminal-Inhalte kopieren",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Προσαρμόστε την εμφάνιση του Backend.AI WebUI στη συσκευή σας.",
"ThemeMode": "Λειτουργία θέματος",
"BootstrapScriptEmpty": "Το σενάριο είναι κενό. \nΕισαγάγετε το σενάριο.",
"BootstrapScriptDeleted": "Το σενάριο Bootstrap διαγράφηκε"
"BootstrapScriptDeleted": "Το σενάριο Bootstrap διαγράφηκε",
"ClassicSessionLauncher": "Classic Session Launcher",
"DescClassicSessionLauncher": "Χρησιμοποιήστε το κλασικό πρόγραμμα εκκίνησης περιόδου σύνδεσης αντί για το πιο πρόσφατο πρόγραμμα εκκίνησης συνεδρίας. \nΤο κλασικό πρόγραμμα εκκίνησης περιόδου λειτουργίας ενδέχεται να μην έχει τις πιο πρόσφατες δυνατότητες."
},
"webTerminalUsageGuide": {
"CopyGuide": "Σύνθετη χρήση τερματικού Web: Αντιγραφή περιεχομένου τερματικού",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,9 @@
"DarkMode": "Dark Mode",
"DescThemeMode": "Customize how Backend.AI WebUI looks on your device.",
"BootstrapScriptEmpty": "The script is empty. \nPlease enter the script.",
"BootstrapScriptDeleted": "Bootstrap script deleted"
"BootstrapScriptDeleted": "Bootstrap script deleted",
"ClassicSessionLauncher": "Classic Session Launcher",
"DescClassicSessionLauncher": "Use the classic session launcher instead of the latest session launcher. The classic session launcher may not have the latest features."
},
"webTerminalUsageGuide": {
"CopyGuide": "Advanced Web Terminal Usage: Copy terminal contents",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,9 @@
"DescThemeMode": "Personalice el aspecto de Backend.AI WebUI en su dispositivo.",
"ThemeMode": "Modo temático",
"BootstrapScriptEmpty": "El guión está vacío. \nPor favor ingrese el guión.",
"BootstrapScriptDeleted": "Se eliminó el script de arranque"
"BootstrapScriptDeleted": "Se eliminó el script de arranque",
"ClassicSessionLauncher": "Lanzador de sesión clásico",
"DescClassicSessionLauncher": "Utilice el iniciador de sesión clásico en lugar del iniciador de sesión más reciente. \nEs posible que el iniciador de sesiones clásico no tenga las funciones más recientes."
},
"webTerminalUsageGuide": {
"CopyGuide": "Uso avanzado del terminal web: Copiar el contenido del terminal",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,9 @@
"DescThemeMode": "Mukauta miltä Backend.AI WebUI näyttää laitteessasi.",
"ThemeMode": "Teematila",
"BootstrapScriptEmpty": "Käsikirjoitus on tyhjä. \nAnna käsikirjoitus.",
"BootstrapScriptDeleted": "Bootstrap-skripti poistettu"
"BootstrapScriptDeleted": "Bootstrap-skripti poistettu",
"ClassicSessionLauncher": "Klassinen istunnon käynnistysohjelma",
"DescClassicSessionLauncher": "Käytä klassista istunnon käynnistysohjelmaa uusimman istunnon käynnistysohjelman sijaan. \nKlassisessa istunnon käynnistysohjelmassa ei välttämättä ole uusimpia ominaisuuksia."
},
"webTerminalUsageGuide": {
"CopyGuide": "Edistynyt verkkopäätteen käyttö: Kopioi terminaalin sisältö",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Personnalisez l'apparence de Backend.AI WebUI sur votre appareil.",
"ThemeMode": "Mode Thème",
"BootstrapScriptEmpty": "Le script est vide. \nVeuillez entrer le script.",
"BootstrapScriptDeleted": "Script d'amorçage supprimé"
"BootstrapScriptDeleted": "Script d'amorçage supprimé",
"ClassicSessionLauncher": "Lanceur de session classique",
"DescClassicSessionLauncher": "Utilisez le lanceur de session classique au lieu du dernier lanceur de session. \nLe lanceur de session classique ne dispose peut-être pas des dernières fonctionnalités."
},
"webTerminalUsageGuide": {
"CopyGuide": "Utilisation avancée du terminal Web : copier le contenu du terminal",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@
"DescThemeMode": "Sesuaikan tampilan Backend.AI WebUI di perangkat Anda.",
"ThemeMode": "Modus Tema",
"BootstrapScriptEmpty": "Skripnya kosong. \nSilakan masukkan skripnya.",
"BootstrapScriptDeleted": "Skrip bootstrap dihapus"
"BootstrapScriptDeleted": "Skrip bootstrap dihapus",
"ClassicSessionLauncher": "Peluncur Sesi Klasik",
"DescClassicSessionLauncher": "Gunakan peluncur sesi klasik, bukan peluncur sesi terbaru. \nPeluncur sesi klasik mungkin tidak memiliki fitur terbaru."
},
"webTerminalUsageGuide": {
"CopyGuide": "Penggunaan Terminal Web Tingkat Lanjut: Salin konten terminal",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@
"DescThemeMode": "Personalizza l'aspetto di Backend.AI WebUI sul tuo dispositivo.",
"ThemeMode": "Modalità tema",
"BootstrapScriptEmpty": "La sceneggiatura è vuota. \nInserisci la sceneggiatura.",
"BootstrapScriptDeleted": "Script di bootstrap eliminato"
"BootstrapScriptDeleted": "Script di bootstrap eliminato",
"ClassicSessionLauncher": "Avvio sessioni classiche",
"DescClassicSessionLauncher": "Utilizza il classico avvio della sessione invece dell'ultimo avvio della sessione. \nIl classico launcher della sessione potrebbe non avere le funzionalità più recenti."
},
"webTerminalUsageGuide": {
"CopyGuide": "Utilizzo avanzato del terminale Web: copia il contenuto del terminale",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Backend.AI WebUI がデバイス上でどのように見えるかをカスタマイズします。",
"ThemeMode": "テーマモード",
"BootstrapScriptEmpty": "スクリプトが空です。\nスクリプトを入力してください。",
"BootstrapScriptDeleted": "ブートストラップ スクリプトが削除されました"
"BootstrapScriptDeleted": "ブートストラップ スクリプトが削除されました",
"ClassicSessionLauncher": "クラシックセッションランチャー",
"DescClassicSessionLauncher": "最新のセッション ランチャーの代わりにクラシック セッション ランチャーを使用します。\nクラシック セッション ランチャーには最新の機能が含まれていない可能性があります。"
},
"webTerminalUsageGuide": {
"CopyGuide": "高度なWeb端末の使用法:端末の内容をコピーする",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,9 @@
"DescThemeMode": "Backend.AI WebUI가 장치에서 어떻게 보이는지 설정합니다.",
"ThemeMode": "화면 모드",
"BootstrapScriptEmpty": "스크립트가 비어있습니다. 스크립트를 입력해 주세요.",
"BootstrapScriptDeleted": "부트스트랩 스크립트가 삭제되었습니다."
"BootstrapScriptDeleted": "부트스트랩 스크립트가 삭제되었습니다.",
"ClassicSessionLauncher": "Classic 세션 런처",
"DescClassicSessionLauncher": "최신 세션 런처 대신 Classic 세션 런처를 사용합니다. Classic 세션 런처에는 최신 기능이 존재하지 않을 수 있습니다."
},
"webTerminalUsageGuide": {
"CopyGuide": "웹 터미널 고급 사용법: 터미널 내용 복사하기",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/mn.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,9 @@
"DescThemeMode": "Backend.AI WebUI төхөөрөмж дээрээ хэрхэн харагдахыг тохируулна уу.",
"ThemeMode": "Загварын горим",
"BootstrapScriptEmpty": "Скрипт хоосон байна. \nСкриптийг оруулна уу.",
"BootstrapScriptDeleted": "Bootstrap скриптийг устгасан"
"BootstrapScriptDeleted": "Bootstrap скриптийг устгасан",
"ClassicSessionLauncher": "Сонгодог сесс эхлүүлэгч",
"DescClassicSessionLauncher": "Хамгийн сүүлийн үеийн сесс эхлүүлэгчийн оронд сонгодог сесс эхлүүлэгчийг ашиглаарай. \nСонгодог сесс эхлүүлэгч нь хамгийн сүүлийн үеийн функцгүй байж магадгүй."
},
"webTerminalUsageGuide": {
"CopyGuide": "Дэвшилтэт вэб терминалын хэрэглээ: Терминалын агуулгыг хуулах",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,9 @@
"DescThemeMode": "Sesuaikan rupa Backend.AI WebUI pada peranti anda.",
"ThemeMode": "Mod Tema",
"BootstrapScriptEmpty": "Skripnya kosong. \nSila masukkan skrip.",
"BootstrapScriptDeleted": "Skrip Bootstrap dipadamkan"
"BootstrapScriptDeleted": "Skrip Bootstrap dipadamkan",
"ClassicSessionLauncher": "Pelancar Sesi Klasik",
"DescClassicSessionLauncher": "Gunakan pelancar sesi klasik dan bukannya pelancar sesi terbaharu. \nPelancar sesi klasik mungkin tidak mempunyai ciri terkini."
},
"webTerminalUsageGuide": {
"CopyGuide": "Penggunaan Terminal Web Lanjutan: Salin kandungan terminal",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Dostosuj wygląd Backend.AI WebUI na swoim urządzeniu.",
"ThemeMode": "Tryb tematyczny",
"BootstrapScriptEmpty": "Skrypt jest pusty. \nProszę wprowadzić skrypt.",
"BootstrapScriptDeleted": "Usunięto skrypt Bootstrap"
"BootstrapScriptDeleted": "Usunięto skrypt Bootstrap",
"ClassicSessionLauncher": "Klasyczny program uruchamiający sesję",
"DescClassicSessionLauncher": "Użyj klasycznego programu uruchamiającego sesję zamiast najnowszego programu uruchamiającego sesję. \nKlasyczny program uruchamiający sesję może nie mieć najnowszych funkcji."
},
"webTerminalUsageGuide": {
"CopyGuide": "Zaawansowane korzystanie z terminala internetowego: Skopiuj zawartość terminala",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Personalize a aparência do Backend.AI WebUI em seu dispositivo.",
"ThemeMode": "Modo Tema",
"BootstrapScriptEmpty": "O script está vazio. \nPor favor insira o roteiro.",
"BootstrapScriptDeleted": "Script de inicialização excluído"
"BootstrapScriptDeleted": "Script de inicialização excluído",
"ClassicSessionLauncher": "Lançador de sessão clássico",
"DescClassicSessionLauncher": "Use o inicializador de sessão clássico em vez do inicializador de sessão mais recente. \nO iniciador de sessão clássico pode não ter os recursos mais recentes."
},
"webTerminalUsageGuide": {
"CopyGuide": "Uso avançado do terminal da Web: Copiar o conteúdo do terminal",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,9 @@
"DescThemeMode": "Personalize a aparência do Backend.AI WebUI em seu dispositivo.",
"ThemeMode": "Modo Tema",
"BootstrapScriptEmpty": "O script está vazio. \nPor favor insira o roteiro.",
"BootstrapScriptDeleted": "Script de inicialização excluído"
"BootstrapScriptDeleted": "Script de inicialização excluído",
"ClassicSessionLauncher": "Lançador de sessão clássico",
"DescClassicSessionLauncher": "Use o inicializador de sessão clássico em vez do inicializador de sessão mais recente. \nO iniciador de sessão clássico pode não ter os recursos mais recentes."
},
"webTerminalUsageGuide": {
"CopyGuide": "Uso avançado do terminal da Web: Copiar o conteúdo do terminal",
Expand Down
4 changes: 3 additions & 1 deletion resources/i18n/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,9 @@
"DarkMode": "โหมดมืด",
"DescThemeMode": "ปรับแต่งลักษณะการแสดงผลของ Backend.AI WebUI บนอุปกรณ์ของคุณ",
"BootstrapScriptEmpty": "สคริปต์ว่างเปล่า \nกรุณาป้อนสคริปต์",
"BootstrapScriptDeleted": "ลบสคริปต์บูตสแตรปแล้ว"
"BootstrapScriptDeleted": "ลบสคริปต์บูตสแตรปแล้ว",
"ClassicSessionLauncher": "ตัวเปิดเซสชันคลาสสิก",
"DescClassicSessionLauncher": "ใช้ตัวเรียกใช้เซสชันแบบคลาสสิกแทนตัวเรียกใช้เซสชันล่าสุด \nตัวเรียกใช้เซสชันแบบคลาสสิกอาจไม่มีคุณสมบัติล่าสุด"
},
"webTerminalUsageGuide": {
"CopyGuide": "คำแนะนำการใช้งานเทอร์มินัลเว็บขั้นสูง: คัดลอกเนื้อหาเทอร์มินัล",
Expand Down
Loading

0 comments on commit 8e8623a

Please sign in to comment.