Simplify agent installation UI - remove Force Docker/K8s/Proxmox checkboxes
- Remove confusing Force Docker, Force Kubernetes, Force Proxmox checkboxes - Auto-detection handles these platforms; checkboxes were redundant - Keep Skip TLS verification checkbox (commonly needed for self-signed certs) - Add Troubleshooting section with --enable-* and --disable-* flags for edge cases - Update tests to reflect simplified UI
This commit is contained in:
parent
ee83cc3f54
commit
605d1680da
2 changed files with 29 additions and 100 deletions
|
|
@ -107,9 +107,6 @@ export const UnifiedAgents: Component = () => {
|
||||||
const [lookupResult, setLookupResult] = createSignal<HostLookupResponse | null>(null);
|
const [lookupResult, setLookupResult] = createSignal<HostLookupResponse | null>(null);
|
||||||
const [lookupError, setLookupError] = createSignal<string | null>(null);
|
const [lookupError, setLookupError] = createSignal<string | null>(null);
|
||||||
const [lookupLoading, setLookupLoading] = createSignal(false);
|
const [lookupLoading, setLookupLoading] = createSignal(false);
|
||||||
const [enableDocker, setEnableDocker] = createSignal(false); // Default to false - user must opt-in for Docker monitoring
|
|
||||||
const [enableKubernetes, setEnableKubernetes] = createSignal(false); // Default to false - user must opt-in for Kubernetes monitoring
|
|
||||||
const [enableProxmox, setEnableProxmox] = createSignal(false); // For Proxmox VE/PBS nodes - creates API token and auto-registers
|
|
||||||
const [insecureMode, setInsecureMode] = createSignal(false); // For self-signed certificates (issue #806)
|
const [insecureMode, setInsecureMode] = createSignal(false); // For self-signed certificates (issue #806)
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
|
@ -237,9 +234,6 @@ export const UnifiedAgents: Component = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDockerFlag = () => enableDocker() ? ' --enable-docker' : '';
|
|
||||||
const getKubernetesFlag = () => enableKubernetes() ? ' --enable-kubernetes' : '';
|
|
||||||
const getProxmoxFlag = () => enableProxmox() ? ' --enable-proxmox' : '';
|
|
||||||
const getInsecureFlag = () => insecureMode() ? ' --insecure' : '';
|
const getInsecureFlag = () => insecureMode() ? ' --insecure' : '';
|
||||||
const getCurlInsecureFlag = () => insecureMode() ? '-k' : '';
|
const getCurlInsecureFlag = () => insecureMode() ? '-k' : '';
|
||||||
|
|
||||||
|
|
@ -499,56 +493,23 @@ export const UnifiedAgents: Component = () => {
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<h4 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Installation commands</h4>
|
<h4 class="text-sm font-semibold text-gray-900 dark:text-gray-100">Installation commands</h4>
|
||||||
<p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">The installer auto-detects Docker, Kubernetes, and Proxmox. Use these to force enable/disable:</p>
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-0.5">The installer auto-detects Docker, Kubernetes, and Proxmox on the target machine.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-4 flex-wrap">
|
<Show when={insecureMode()}>
|
||||||
<label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300 cursor-pointer" title="Force enable Docker monitoring (auto-detected if Docker/Podman is available)">
|
<div class="rounded-lg border border-amber-200 bg-amber-50 px-4 py-2 text-sm text-amber-800 dark:border-amber-700 dark:bg-amber-900/20 dark:text-amber-200">
|
||||||
<input
|
<span class="font-medium">TLS verification disabled</span> — commands will skip certificate checks (for self-signed certs).
|
||||||
type="checkbox"
|
|
||||||
checked={enableDocker()}
|
|
||||||
onChange={(e) => setEnableDocker(e.currentTarget.checked)}
|
|
||||||
class="rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"
|
|
||||||
/>
|
|
||||||
Force Docker
|
|
||||||
</label>
|
|
||||||
<label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300 cursor-pointer" title="Force enable Kubernetes monitoring (auto-detected if kubectl/kubeconfig is available)">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={enableKubernetes()}
|
|
||||||
onChange={(e) => setEnableKubernetes(e.currentTarget.checked)}
|
|
||||||
class="rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"
|
|
||||||
/>
|
|
||||||
Force Kubernetes
|
|
||||||
</label>
|
|
||||||
<label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300 cursor-pointer" title="Force enable Proxmox integration (auto-detected on PVE/PBS hosts)">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={enableProxmox()}
|
|
||||||
onChange={(e) => setEnableProxmox(e.currentTarget.checked)}
|
|
||||||
class="rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"
|
|
||||||
/>
|
|
||||||
Force Proxmox
|
|
||||||
</label>
|
|
||||||
<label class="flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300 cursor-pointer" title="Skip TLS certificate verification (for self-signed certificates)">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={insecureMode()}
|
|
||||||
onChange={(e) => setInsecureMode(e.currentTarget.checked)}
|
|
||||||
class="rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"
|
|
||||||
/>
|
|
||||||
Skip TLS verify
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<Show when={enableProxmox()}>
|
|
||||||
<div class="rounded-lg border border-blue-200 bg-blue-50 px-4 py-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-200">
|
|
||||||
<p class="font-medium">Proxmox force-enable</p>
|
|
||||||
<p class="text-xs mt-1 text-blue-700 dark:text-blue-300">
|
|
||||||
The agent will create a <code class="bg-blue-100 dark:bg-blue-900/40 px-1 rounded">pulse-monitor</code> user and API token on the Proxmox node,
|
|
||||||
then register it with Pulse automatically. Includes temperature monitoring.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
<label class="inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300 cursor-pointer" title="Skip TLS certificate verification (for self-signed certificates)">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={insecureMode()}
|
||||||
|
onChange={(e) => setInsecureMode(e.currentTarget.checked)}
|
||||||
|
class="rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700"
|
||||||
|
/>
|
||||||
|
Skip TLS certificate verification (self-signed certs)
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
|
|
@ -568,29 +529,8 @@ export const UnifiedAgents: Component = () => {
|
||||||
if (insecureMode() && cmd.includes('curl -fsSL')) {
|
if (insecureMode() && cmd.includes('curl -fsSL')) {
|
||||||
cmd = cmd.replace('curl -fsSL', 'curl -kfsSL');
|
cmd = cmd.replace('curl -fsSL', 'curl -kfsSL');
|
||||||
}
|
}
|
||||||
// For bash scripts (not PowerShell), append flags directly
|
// For bash scripts (not PowerShell), append insecure flag
|
||||||
const isBashScript = !cmd.includes('$env:') && !cmd.includes('irm');
|
const isBashScript = !cmd.includes('$env:') && !cmd.includes('irm');
|
||||||
// Append docker flag if enabled
|
|
||||||
if (enableDocker()) {
|
|
||||||
if (cmd.includes('$env:PULSE_URL')) {
|
|
||||||
cmd = `$env:PULSE_ENABLE_DOCKER="true"; ` + cmd;
|
|
||||||
} else if (isBashScript) {
|
|
||||||
cmd += getDockerFlag();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Append kubernetes flag if enabled
|
|
||||||
if (enableKubernetes()) {
|
|
||||||
if (cmd.includes('$env:PULSE_URL')) {
|
|
||||||
cmd = `$env:PULSE_ENABLE_KUBERNETES="true"; ` + cmd;
|
|
||||||
} else if (isBashScript) {
|
|
||||||
cmd += getKubernetesFlag();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Append proxmox flag if enabled (Linux only - Proxmox doesn't run on Windows/macOS)
|
|
||||||
if (enableProxmox() && isBashScript) {
|
|
||||||
cmd += getProxmoxFlag();
|
|
||||||
}
|
|
||||||
// Append insecure flag for agent if enabled
|
|
||||||
if (insecureMode() && isBashScript) {
|
if (insecureMode() && isBashScript) {
|
||||||
cmd += getInsecureFlag();
|
cmd += getInsecureFlag();
|
||||||
}
|
}
|
||||||
|
|
@ -706,31 +646,20 @@ export const UnifiedAgents: Component = () => {
|
||||||
</div>
|
</div>
|
||||||
<details class="rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-700 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300">
|
<details class="rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-700 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300">
|
||||||
<summary class="cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100">
|
<summary class="cursor-pointer text-sm font-medium text-gray-900 dark:text-gray-100">
|
||||||
Advanced options (uninstall & manual install)
|
Troubleshooting
|
||||||
</summary>
|
</summary>
|
||||||
<div class="mt-3 space-y-4">
|
<div class="mt-3 space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<p class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400">Uninstall</p>
|
<p class="text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400">Auto-detection not working?</p>
|
||||||
<div class="mt-2 flex items-center gap-2">
|
<p class="mt-1 text-xs text-gray-600 dark:text-gray-400">
|
||||||
<code class="flex-1 break-all rounded bg-gray-900 px-3 py-2 font-mono text-xs text-red-400 dark:bg-gray-950">
|
If Docker, Kubernetes, or Proxmox isn't detected automatically, add these flags to the install command:
|
||||||
{getUninstallCommand()}
|
|
||||||
</code>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={async () => {
|
|
||||||
const success = await copyToClipboard(getUninstallCommand());
|
|
||||||
if (typeof window !== 'undefined' && window.showToast) {
|
|
||||||
window.showToast(success ? 'success' : 'error', success ? 'Copied to clipboard' : 'Failed to copy to clipboard');
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
class="rounded-lg bg-red-50 px-3 py-1.5 text-xs font-medium text-red-700 transition-colors hover:bg-red-100 dark:bg-red-900/30 dark:text-red-300 dark:hover:bg-red-900/50"
|
|
||||||
>
|
|
||||||
Copy
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
|
||||||
Stops the agent, removes the binary, the systemd unit, and related files.
|
|
||||||
</p>
|
</p>
|
||||||
|
<ul class="mt-2 text-xs text-gray-600 dark:text-gray-400 list-disc list-inside space-y-1">
|
||||||
|
<li><code class="bg-gray-200 dark:bg-gray-700 px-1 rounded">--enable-docker</code> — Force enable Docker/Podman monitoring</li>
|
||||||
|
<li><code class="bg-gray-200 dark:bg-gray-700 px-1 rounded">--enable-kubernetes</code> — Force enable Kubernetes monitoring</li>
|
||||||
|
<li><code class="bg-gray-200 dark:bg-gray-700 px-1 rounded">--enable-proxmox</code> — Force enable Proxmox integration (creates API token)</li>
|
||||||
|
<li><code class="bg-gray-200 dark:bg-gray-700 px-1 rounded">--disable-docker</code> — Skip Docker even if detected</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ describe('UnifiedAgents platform commands', () => {
|
||||||
expect(screen.getByText('Install on Windows')).toBeInTheDocument();
|
expect(screen.getByText('Install on Windows')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('includes docker flag when docker monitoring is enabled', async () => {
|
it('includes insecure flag when TLS skip is enabled', async () => {
|
||||||
createTokenMock.mockResolvedValue({
|
createTokenMock.mockResolvedValue({
|
||||||
token: 'test-token',
|
token: 'test-token',
|
||||||
record: {
|
record: {
|
||||||
|
|
@ -382,18 +382,18 @@ describe('UnifiedAgents platform commands', () => {
|
||||||
await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
|
await waitFor(() => expect(createTokenMock).toHaveBeenCalled(), { interval: 0 });
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByText('Force Docker')).toBeInTheDocument();
|
expect(screen.getByText(/Skip TLS certificate verification/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Docker is disabled by default (force off)
|
// TLS skip is disabled by default
|
||||||
const checkbox = screen.getByRole('checkbox', { name: /Force Docker/i });
|
const checkbox = screen.getByRole('checkbox', { name: /Skip TLS certificate verification/i });
|
||||||
expect(checkbox).not.toBeChecked();
|
expect(checkbox).not.toBeChecked();
|
||||||
|
|
||||||
// Enable it
|
// Enable it
|
||||||
fireEvent.click(checkbox);
|
fireEvent.click(checkbox);
|
||||||
expect(checkbox).toBeChecked();
|
expect(checkbox).toBeChecked();
|
||||||
|
|
||||||
// Find a copy button and check that the command includes the docker flag
|
// Find a copy button and check that the command includes the insecure flag
|
||||||
const copyButtons = screen.getAllByRole('button', { name: /Copy command/i });
|
const copyButtons = screen.getAllByRole('button', { name: /Copy command/i });
|
||||||
expect(copyButtons.length).toBeGreaterThan(0);
|
expect(copyButtons.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue