diff --git a/dashboard/pages/index.tsx b/dashboard/pages/index.tsx index 4814f4c9..910a14dd 100644 --- a/dashboard/pages/index.tsx +++ b/dashboard/pages/index.tsx @@ -44,9 +44,9 @@ import { toast } from 'react-toastify'; import RequireSetup from 'utils/router/RequireSetup'; import InstanceTabs from 'pages/InstanceTabs/InstanceTabs'; import ProfilePage from 'pages/settings/profile'; -import CoreSettings from 'pages/settings/CoreSettings'; import UserSettings from 'pages/settings/UserSettings'; - +import GlobalTabs from 'pages/settings/GlobalSettings'; +import GenericSetting from 'pages/settings/GenericSettings'; const queryClient = new QueryClient({ defaultOptions: { @@ -68,12 +68,20 @@ const InstanceTabList = [ 'tunnels', ]; -export const CoreSettingsTabList = [ +const GlobalTabList = [ + { + title: 'Global Settings', + path: 'core-settings', + content: , + }, { - title: 'General', - path: 'general', - content: , + title: 'Version Info', + path: 'version', + content: , }, +]; + +export const CoreSettingsTabList = [ { title: 'Users', path: 'users', @@ -324,6 +332,13 @@ export default function App() { key={i} /> ))} + {GlobalTabList.map((tab, i) => ( + + ))} } /> }> diff --git a/dashboard/src/components/DashboardLayout/GlobalInstanceSetting.tsx b/dashboard/src/components/DashboardLayout/GlobalInstanceSetting.tsx new file mode 100644 index 00000000..7c8c04f6 --- /dev/null +++ b/dashboard/src/components/DashboardLayout/GlobalInstanceSetting.tsx @@ -0,0 +1,80 @@ +import { useEffect, useMemo, useState } from 'react'; +import { RadioGroup } from '@headlessui/react'; +import { useContext } from 'react'; +import clsx from 'clsx'; +import { BrowserLocationContext } from 'data/BrowserLocationContext'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faAngleRight, faAngleDown } from '@fortawesome/free-solid-svg-icons'; +import { tabs } from 'pages/settings/GlobalSettings'; +import { useGlobalSettings } from 'data/GlobalSettings'; + +export const GlobalInstanceSetting = ({ + className = '', + children, +}: { + className?: string; + children?: React.ReactNode; +}) => { + + const { setPathname } = useContext(BrowserLocationContext); + const setActive = useMemo(() => location.pathname.split('/')[2], [location.pathname]); + const { data: globalSettings } = useGlobalSettings(); + + const [ expand, setExpand ] = useState(false); + + useEffect(() => { + if (location.pathname == '/dashboard/core-settings' || location.pathname == '/dashboard/version') { + setExpand(true); + } + }, []) + + return ( + + setExpand(!expand)}> + GLOBAL SETTINGS + + + + {expand && + tabs.map((tab) => ( + (tab.title !== 'Playitgg' || globalSettings?.playit_enabled) && + + + + ))} + {children} + + ); +}; diff --git a/dashboard/src/components/DashboardLayout/LeftNav.tsx b/dashboard/src/components/DashboardLayout/LeftNav.tsx index b939678d..d41163bb 100644 --- a/dashboard/src/components/DashboardLayout/LeftNav.tsx +++ b/dashboard/src/components/DashboardLayout/LeftNav.tsx @@ -11,6 +11,7 @@ import { SelectedInstanceInfo } from './SelectedInstanceInfo'; import { InstanceContext } from 'data/InstanceContext'; import IntegrationsList from './IntegrationsList'; import { PlayitggOverview } from 'components/PlayitggOverview'; +import { GlobalInstanceSetting } from './GlobalInstanceSetting'; export default function LeftNav({ className }: { className?: string }) { const { showCreateInstance, setShowCreateInstance } = useContext(InstanceContext); @@ -18,7 +19,7 @@ export default function LeftNav({ className }: { className?: string }) { const userLoggedIn = useUserLoggedIn(); return (
@@ -46,8 +47,8 @@ export default function LeftNav({ className }: { className?: string }) {
-
+ diff --git a/dashboard/src/components/DashboardLayout/SelectedInstanceInfo.tsx b/dashboard/src/components/DashboardLayout/SelectedInstanceInfo.tsx index 7de7e0ce..250a8b30 100644 --- a/dashboard/src/components/DashboardLayout/SelectedInstanceInfo.tsx +++ b/dashboard/src/components/DashboardLayout/SelectedInstanceInfo.tsx @@ -44,7 +44,7 @@ export const SelectedInstanceInfo = ({ const uuid = selectedInstance?.uuid; if (!selectedInstance || !uuid) { return ( -
+
SELECTED INSTANCE
@@ -64,7 +64,7 @@ export const SelectedInstanceInfo = ({ return ( diff --git a/dashboard/src/components/UserMenu.tsx b/dashboard/src/components/UserMenu.tsx index 1bb39526..958fca2e 100644 --- a/dashboard/src/components/UserMenu.tsx +++ b/dashboard/src/components/UserMenu.tsx @@ -120,7 +120,7 @@ const UserMenu = () => { icon={faCog} onClick={() => { localStorage.setItem('lastVisitedRoute', location.pathname); - setPathname('/settings/general'); + setPathname('/settings/users'); }} />
diff --git a/dashboard/src/pages/settings.tsx b/dashboard/src/pages/settings.tsx index 9d03dcc7..77661639 100644 --- a/dashboard/src/pages/settings.tsx +++ b/dashboard/src/pages/settings.tsx @@ -1,7 +1,6 @@ import { Tab } from '@headlessui/react'; import { useContext, useState } from 'react'; import { useUserInfo } from 'data/UserInfo'; -import CoreSettings from 'pages/settings/CoreSettings'; import UserSettings from 'pages/settings/UserSettings'; import { SettingsContext } from 'data/SettingsContext'; import { useDocumentTitle } from 'usehooks-ts'; @@ -11,10 +10,6 @@ const SettingsPage = () => { const { tabIndex, setTabIndex, selectUser } = useContext(SettingsContext); const tabList = [ - { - title: 'General', - content: , - }, { title: 'Users', content: , diff --git a/dashboard/src/pages/settings/GenericSettings.tsx b/dashboard/src/pages/settings/GenericSettings.tsx new file mode 100644 index 00000000..0b0b6031 --- /dev/null +++ b/dashboard/src/pages/settings/GenericSettings.tsx @@ -0,0 +1,49 @@ +import { useCoreInfo } from 'data/SystemInfo'; +import { useDocumentTitle } from 'usehooks-ts'; +import packageJson from '../../../package.json'; + +export const GenericSetting = () => { + useDocumentTitle('Lodestone Generic Settings - Lodestone'); + const { data: coreInfo } = useCoreInfo(); + + return ( + <> +
+
+

Version Info

+
+
+

+ +

+
+
+
+
+
+ +
+
+ {packageJson.version} +
+
+
+
+ +
+
+ {coreInfo ? coreInfo.version : 'unavailable'} +
+
+
+
+
+ + ); +}; + +export default GenericSetting; diff --git a/dashboard/src/pages/settings/GlobalSettings.tsx b/dashboard/src/pages/settings/GlobalSettings.tsx new file mode 100644 index 00000000..98df2894 --- /dev/null +++ b/dashboard/src/pages/settings/GlobalSettings.tsx @@ -0,0 +1,62 @@ + +import { cn } from 'utils/util'; +import { CommandHistoryContextProvider } from 'data/CommandHistoryContext'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { + faGears, + faJarWheat, +} from '@fortawesome/free-solid-svg-icons'; +import CoreSettings from './CoreSettings'; +import GenericSetting from './GenericSettings'; + +export const tabs = [ + { + title: 'Core Settings', + displayTitle: null, + path: 'core-settings', + width: 'max-w-4xl', + icon: , + content: , + }, + { + title: 'Verion Info', + displayTitle: null, + path: 'version', + width: 'max-w-4xl', + icon: , + content: , + } +]; + +const GlobalTabs = () => { + return ( + + {tabs.map((tab, index) => { + return ( +
+
+
+ {tab.displayTitle && ( +
+ {tab.displayTitle} +
+ )} + {tab.content} +
+
+
+ ) + })} +
+ ); +}; + +export default GlobalTabs;