mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-04-05 16:26:15 +02:00
fix(EasySetup): Remove built-in System Benchmark from wizard
System Benchmark is a built-in feature that doesn't require installation, so it shouldn't appear in the Easy Setup Wizard where users select things to install. Users can access the benchmark through Settings > Benchmark. - Removed benchmark entry from ADDITIONAL_TOOLS array - Removed unused isBuiltInCapability helper and related dead code - Simplified renderCapabilityCard by removing built-in specific styling - Removed unused IconArrowRight import Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e8cc17a20d
commit
6d9417e23c
|
|
@ -10,7 +10,7 @@ import CategoryCard from '~/components/CategoryCard'
|
||||||
import TierSelectionModal from '~/components/TierSelectionModal'
|
import TierSelectionModal from '~/components/TierSelectionModal'
|
||||||
import LoadingSpinner from '~/components/LoadingSpinner'
|
import LoadingSpinner from '~/components/LoadingSpinner'
|
||||||
import Alert from '~/components/Alert'
|
import Alert from '~/components/Alert'
|
||||||
import { IconCheck, IconChevronDown, IconChevronUp, IconArrowRight } from '@tabler/icons-react'
|
import { IconCheck, IconChevronDown, IconChevronUp } from '@tabler/icons-react'
|
||||||
import StorageProjectionBar from '~/components/StorageProjectionBar'
|
import StorageProjectionBar from '~/components/StorageProjectionBar'
|
||||||
import { useNotifications } from '~/context/NotificationContext'
|
import { useNotifications } from '~/context/NotificationContext'
|
||||||
import useInternetStatus from '~/hooks/useInternetStatus'
|
import useInternetStatus from '~/hooks/useInternetStatus'
|
||||||
|
|
@ -98,19 +98,6 @@ const ADDITIONAL_TOOLS: Capability[] = [
|
||||||
services: ['nomad_cyberchef'],
|
services: ['nomad_cyberchef'],
|
||||||
icon: 'IconChefHat',
|
icon: 'IconChefHat',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'benchmark',
|
|
||||||
name: 'System Benchmark',
|
|
||||||
technicalName: 'Built-in',
|
|
||||||
description: 'Measure your server performance and compare with the NOMAD community',
|
|
||||||
features: [
|
|
||||||
'CPU, memory, and disk benchmarks',
|
|
||||||
'AI inference performance testing',
|
|
||||||
'NOMAD Score for easy comparison',
|
|
||||||
],
|
|
||||||
services: ['__builtin_benchmark'], // Special marker for built-in features
|
|
||||||
icon: 'IconChartBar',
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
type WizardStep = 1 | 2 | 3 | 4
|
type WizardStep = 1 | 2 | 3 | 4
|
||||||
|
|
@ -526,20 +513,13 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a capability is a built-in feature (not a Docker service)
|
|
||||||
const isBuiltInCapability = (capability: Capability) => {
|
|
||||||
return capability.services.some((service) => service.startsWith('__builtin_'))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if a capability is selected (all its services are in selectedServices)
|
// Check if a capability is selected (all its services are in selectedServices)
|
||||||
const isCapabilitySelected = (capability: Capability) => {
|
const isCapabilitySelected = (capability: Capability) => {
|
||||||
if (isBuiltInCapability(capability)) return false // Built-ins can't be selected
|
|
||||||
return capability.services.every((service) => selectedServices.includes(service))
|
return capability.services.every((service) => selectedServices.includes(service))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a capability is already installed (all its services are installed)
|
// Check if a capability is already installed (all its services are installed)
|
||||||
const isCapabilityInstalled = (capability: Capability) => {
|
const isCapabilityInstalled = (capability: Capability) => {
|
||||||
if (isBuiltInCapability(capability)) return true // Built-ins are always "installed"
|
|
||||||
return capability.services.every((service) =>
|
return capability.services.every((service) =>
|
||||||
installedServices.some((s) => s.service_name === service)
|
installedServices.some((s) => s.service_name === service)
|
||||||
)
|
)
|
||||||
|
|
@ -547,7 +527,6 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
|
|
||||||
// Check if a capability exists in the system (has at least one matching service)
|
// Check if a capability exists in the system (has at least one matching service)
|
||||||
const capabilityExists = (capability: Capability) => {
|
const capabilityExists = (capability: Capability) => {
|
||||||
if (isBuiltInCapability(capability)) return true // Built-ins always exist
|
|
||||||
return capability.services.some((service) =>
|
return capability.services.some((service) =>
|
||||||
allServices.some((s) => s.service_name === service)
|
allServices.some((s) => s.service_name === service)
|
||||||
)
|
)
|
||||||
|
|
@ -575,38 +554,23 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
const selected = isCapabilitySelected(capability)
|
const selected = isCapabilitySelected(capability)
|
||||||
const installed = isCapabilityInstalled(capability)
|
const installed = isCapabilityInstalled(capability)
|
||||||
const exists = capabilityExists(capability)
|
const exists = capabilityExists(capability)
|
||||||
const isBuiltIn = isBuiltInCapability(capability)
|
|
||||||
|
|
||||||
if (!exists) return null
|
if (!exists) return null
|
||||||
|
|
||||||
// Determine visual state: installed (locked), selected (user chose it), or default
|
// Determine visual state: installed (locked), selected (user chose it), or default
|
||||||
const isChecked = installed || selected
|
const isChecked = installed || selected
|
||||||
|
|
||||||
// Handle click - built-in features navigate to their page, others toggle selection
|
|
||||||
const handleClick = () => {
|
|
||||||
if (isBuiltIn) {
|
|
||||||
// Navigate to the appropriate settings page for built-in features
|
|
||||||
if (capability.id === 'benchmark') {
|
|
||||||
router.visit('/settings/benchmark')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
toggleCapability(capability)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={capability.id}
|
key={capability.id}
|
||||||
onClick={handleClick}
|
onClick={() => toggleCapability(capability)}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'p-6 rounded-lg border-2 transition-all',
|
'p-6 rounded-lg border-2 transition-all',
|
||||||
isBuiltIn
|
installed
|
||||||
? 'border-desert-stone bg-desert-stone-lighter/50 hover:border-desert-green hover:shadow-sm cursor-pointer'
|
? 'border-desert-green bg-desert-green/20 cursor-default'
|
||||||
: installed
|
: selected
|
||||||
? 'border-desert-green bg-desert-green/20 cursor-default'
|
? 'border-desert-green bg-desert-green shadow-md cursor-pointer'
|
||||||
: selected
|
: 'border-desert-stone-light bg-white hover:border-desert-green hover:shadow-sm cursor-pointer'
|
||||||
? 'border-desert-green bg-desert-green shadow-md cursor-pointer'
|
|
||||||
: 'border-desert-stone-light bg-white hover:border-desert-green hover:shadow-sm cursor-pointer'
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex items-start justify-between">
|
<div className="flex items-start justify-between">
|
||||||
|
|
@ -615,16 +579,12 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
<h3
|
<h3
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'text-xl font-bold',
|
'text-xl font-bold',
|
||||||
isBuiltIn ? 'text-gray-700' : installed ? 'text-gray-700' : selected ? 'text-white' : 'text-gray-900'
|
installed ? 'text-gray-700' : selected ? 'text-white' : 'text-gray-900'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{capability.name}
|
{capability.name}
|
||||||
</h3>
|
</h3>
|
||||||
{isBuiltIn ? (
|
{installed && (
|
||||||
<span className="text-xs bg-desert-stone text-white px-2 py-0.5 rounded-full">
|
|
||||||
Built-in
|
|
||||||
</span>
|
|
||||||
) : installed && (
|
|
||||||
<span className="text-xs bg-desert-green text-white px-2 py-0.5 rounded-full">
|
<span className="text-xs bg-desert-green text-white px-2 py-0.5 rounded-full">
|
||||||
Installed
|
Installed
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -633,15 +593,15 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
<p
|
<p
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'text-sm mt-0.5',
|
'text-sm mt-0.5',
|
||||||
isBuiltIn ? 'text-gray-500' : installed ? 'text-gray-500' : selected ? 'text-green-100' : 'text-gray-500'
|
installed ? 'text-gray-500' : selected ? 'text-green-100' : 'text-gray-500'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isBuiltIn ? 'Click to open' : `Powered by ${capability.technicalName}`}
|
Powered by {capability.technicalName}
|
||||||
</p>
|
</p>
|
||||||
<p
|
<p
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'text-sm mt-3',
|
'text-sm mt-3',
|
||||||
isBuiltIn ? 'text-gray-600' : installed ? 'text-gray-600' : selected ? 'text-white' : 'text-gray-600'
|
installed ? 'text-gray-600' : selected ? 'text-white' : 'text-gray-600'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{capability.description}
|
{capability.description}
|
||||||
|
|
@ -650,7 +610,7 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
<ul
|
<ul
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'mt-3 space-y-1',
|
'mt-3 space-y-1',
|
||||||
isBuiltIn ? 'text-gray-600' : installed ? 'text-gray-600' : selected ? 'text-white' : 'text-gray-600'
|
installed ? 'text-gray-600' : selected ? 'text-white' : 'text-gray-600'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{capability.features.map((feature, idx) => (
|
{capability.features.map((feature, idx) => (
|
||||||
|
|
@ -658,13 +618,11 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
<span
|
<span
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'mr-2',
|
'mr-2',
|
||||||
isBuiltIn
|
installed
|
||||||
? 'text-desert-stone'
|
? 'text-desert-green'
|
||||||
: installed
|
: selected
|
||||||
? 'text-desert-green'
|
? 'text-white'
|
||||||
: selected
|
: 'text-desert-green'
|
||||||
? 'text-white'
|
|
||||||
: 'text-desert-green'
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
•
|
•
|
||||||
|
|
@ -678,18 +636,14 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'ml-4 w-7 h-7 rounded-full border-2 flex items-center justify-center transition-all flex-shrink-0',
|
'ml-4 w-7 h-7 rounded-full border-2 flex items-center justify-center transition-all flex-shrink-0',
|
||||||
isBuiltIn
|
isChecked
|
||||||
? 'border-desert-stone bg-desert-stone'
|
? installed
|
||||||
: isChecked
|
? 'border-desert-green bg-desert-green'
|
||||||
? installed
|
: 'border-white bg-white'
|
||||||
? 'border-desert-green bg-desert-green'
|
: 'border-desert-stone'
|
||||||
: 'border-white bg-white'
|
|
||||||
: 'border-desert-stone'
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isBuiltIn ? (
|
{isChecked && (
|
||||||
<IconArrowRight size={16} className="text-white" />
|
|
||||||
) : isChecked && (
|
|
||||||
<IconCheck size={20} className={installed ? 'text-white' : 'text-desert-green'} />
|
<IconCheck size={20} className={installed ? 'text-white' : 'text-desert-green'} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user