diff --git a/src/components/Tabs/Tabs.tsx b/src/components/Tabs/Tabs.tsx index 92a1852..2c8dea9 100644 --- a/src/components/Tabs/Tabs.tsx +++ b/src/components/Tabs/Tabs.tsx @@ -26,7 +26,6 @@ export const Tabs = ({ tabs, onTabClick }: TabsProps) => { id="tabs" name="tabs" className="block w-full focus:ring-primary-500 focus:border-primary-500 border-gray-300 rounded-md" - // defaultValue={tabs ? tabs.find((tab) => tab.current).name : undefined} > {tabs.map((tab) => ( diff --git a/src/modules/dashboard/Dashboard.tsx b/src/modules/dashboard/Dashboard.tsx index cb8f44f..83538df 100644 --- a/src/modules/dashboard/Dashboard.tsx +++ b/src/modules/dashboard/Dashboard.tsx @@ -1,8 +1,9 @@ /* eslint-disable react-hooks/exhaustive-deps */ import React, { useEffect } from 'react'; import { useApps } from 'src/services/apps'; -import { DASHBOARD_QUICK_ACCESS } from './consts'; +import { useAuth } from 'src/services/auth'; import { DashboardCard, DashboardUtility } from './components'; +import { DASHBOARD_QUICK_ACCESS } from './consts'; export const Dashboard: React.FC = () => { const host = window.location.hostname; @@ -10,6 +11,8 @@ export const Dashboard: React.FC = () => { splitedDomain.shift(); const { apps, loadApps } = useApps(); + const { currentUser, isAdmin } = useAuth(); + // Tell React to load the apps useEffect(() => { loadApps(); @@ -29,6 +32,7 @@ export const Dashboard: React.FC = () => {
{apps .filter((app) => ['dashboard', 'monitoring'].indexOf(app.slug) === -1) + .filter((app) => currentUser?.app_roles.filter((role) => role.name === app.slug) !== []) .map((app) => ( ))}