fix(frontend): hide unconfigured navigation tabs
This commit is contained in:
parent
0ddc30c1e1
commit
0074e49792
2 changed files with 16 additions and 5 deletions
|
|
@ -1055,7 +1055,7 @@ function AppLayout(props: {
|
||||||
});
|
});
|
||||||
|
|
||||||
const platformTabs = createMemo(() => {
|
const platformTabs = createMemo(() => {
|
||||||
return [
|
const allPlatforms = [
|
||||||
{
|
{
|
||||||
id: 'proxmox' as const,
|
id: 'proxmox' as const,
|
||||||
label: 'Proxmox',
|
label: 'Proxmox',
|
||||||
|
|
@ -1067,6 +1067,7 @@ function AppLayout(props: {
|
||||||
icon: (
|
icon: (
|
||||||
<ProxmoxIcon class="w-4 h-4 shrink-0" />
|
<ProxmoxIcon class="w-4 h-4 shrink-0" />
|
||||||
),
|
),
|
||||||
|
alwaysShow: true, // Proxmox is the default, always show
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'docker' as const,
|
id: 'docker' as const,
|
||||||
|
|
@ -1079,6 +1080,7 @@ function AppLayout(props: {
|
||||||
icon: (
|
icon: (
|
||||||
<BoxesIcon class="w-4 h-4 shrink-0" />
|
<BoxesIcon class="w-4 h-4 shrink-0" />
|
||||||
),
|
),
|
||||||
|
alwaysShow: true, // Docker is commonly used, keep visible
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'kubernetes' as const,
|
id: 'kubernetes' as const,
|
||||||
|
|
@ -1086,11 +1088,12 @@ function AppLayout(props: {
|
||||||
route: '/kubernetes',
|
route: '/kubernetes',
|
||||||
settingsRoute: '/settings/agents',
|
settingsRoute: '/settings/agents',
|
||||||
tooltip: 'Monitor Kubernetes clusters and workloads',
|
tooltip: 'Monitor Kubernetes clusters and workloads',
|
||||||
enabled: hasKubernetesClusters() || !!seenPlatforms()['kubernetes'],
|
enabled: hasKubernetesClusters(),
|
||||||
live: hasKubernetesClusters(),
|
live: hasKubernetesClusters(),
|
||||||
icon: (
|
icon: (
|
||||||
<NetworkIcon class="w-4 h-4 shrink-0" />
|
<NetworkIcon class="w-4 h-4 shrink-0" />
|
||||||
),
|
),
|
||||||
|
alwaysShow: false, // Only show when clusters exist
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'hosts' as const,
|
id: 'hosts' as const,
|
||||||
|
|
@ -1103,8 +1106,12 @@ function AppLayout(props: {
|
||||||
icon: (
|
icon: (
|
||||||
<MonitorIcon class="w-4 h-4 shrink-0" />
|
<MonitorIcon class="w-4 h-4 shrink-0" />
|
||||||
),
|
),
|
||||||
|
alwaysShow: true, // Hosts is commonly used, keep visible
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Filter out platforms that should be hidden when not configured
|
||||||
|
return allPlatforms.filter(p => p.alwaysShow || p.enabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
const utilityTabs = createMemo(() => {
|
const utilityTabs = createMemo(() => {
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,18 @@ export const ProxmoxSectionNav: Component<ProxmoxSectionNavProps> = (props) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { state } = useWebSocket();
|
const { state } = useWebSocket();
|
||||||
|
|
||||||
// Only show Mail Gateway tab if PMG instances are configured
|
// Only show tabs if the corresponding feature has data:
|
||||||
// Only show Ceph tab if Ceph clusters are detected (from agent or Proxmox API)
|
// - Mail Gateway: requires PMG instances
|
||||||
|
// - Ceph: requires Ceph clusters (from agent or Proxmox API)
|
||||||
|
// - Replication: requires replication jobs
|
||||||
const sections = createMemo(() => {
|
const sections = createMemo(() => {
|
||||||
const hasPMG = state.pmg && state.pmg.length > 0;
|
const hasPMG = state.pmg && state.pmg.length > 0;
|
||||||
const hasCeph = state.cephClusters && state.cephClusters.length > 0;
|
const hasCeph = state.cephClusters && state.cephClusters.length > 0;
|
||||||
|
const hasReplication = state.replicationJobs && state.replicationJobs.length > 0;
|
||||||
return allSections.filter((section) =>
|
return allSections.filter((section) =>
|
||||||
(section.id !== 'mail' || hasPMG) &&
|
(section.id !== 'mail' || hasPMG) &&
|
||||||
(section.id !== 'ceph' || hasCeph)
|
(section.id !== 'ceph' || hasCeph) &&
|
||||||
|
(section.id !== 'replication' || hasReplication)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue