chore: clean up repository and remove test files

- Remove all temporary test files and documentation
- Delete testing-tools directory with old screenshots and scripts
- Remove stray package.json files from root
- Update .gitignore to prevent test files from being committed
- Keep repository clean and focused on production code
This commit is contained in:
Pulse Monitor
2025-08-12 11:25:32 +00:00
parent a91bd42b74
commit c6716cd0c2
20 changed files with 10 additions and 2099 deletions
+10
View File
@@ -61,3 +61,13 @@ scripts/backend-watch.sh
temp/
RELEASE_CHECKLIST.md
DOCKER_PUSH_INSTRUCTIONS.md
# Testing and temporary files
testing-tools/
manual-test*.md
verify-*.md
test-*.md
package.json
package-lock.json
*.test.js
*.test.md
-33
View File
@@ -1,33 +0,0 @@
# Manual Test Steps for PBS Form Fix
## Test Procedure
1. Open http://192.168.0.123:7655 in browser
2. Navigate to Settings → Nodes tab
3. Click "Add PVE Node"
- Enter name: test-pve
- Enter host: https://192.168.1.100:8006
- Enter token: root@pam!pvetoken
- Click Cancel (don't save)
4. Click "Add PBS Node"
- CHECK: Form should be completely empty (no PVE data)
- If form has any PVE data = FAIL
5. Add a real PBS node:
- Name: test-pbs
- Host: https://192.168.1.200:8007
- Token: root@pam!pbstoken
- Token value: xxxxx
- Click Add Node
6. Edit the PBS node (click edit icon)
- CHECK: Form should show PBS data (test-pbs, https://192.168.1.200:8007, etc)
- If form is empty or shows wrong data = FAIL
7. Cancel and add a PVE node
8. Edit the PVE node
- CHECK: Form should show PVE data, not PBS data
- If form shows PBS data = FAIL
## Expected Results
- [ ] PBS form never shows PVE data
- [ ] PVE form never shows PBS data
- [ ] Editing PBS node shows PBS data
- [ ] Editing PVE node shows PVE data
-1001
View File
File diff suppressed because it is too large Load Diff
-5
View File
@@ -1,5 +0,0 @@
{
"dependencies": {
"puppeteer": "^24.16.1"
}
}
-91
View File
@@ -1,91 +0,0 @@
# Final Pre-Release Verification Report
## Date: 2025-08-12
## Changes Implemented in This Session
### 1. ✅ **Email Notification Fix (Issue #299)**
- Fixed email sending failures by using STARTTLS for port 587
- Fixed password preservation when saving email config
- Fixed SMTP server field displaying placeholder instead of actual value
- Added password preservation logic in test email endpoint
### 2. ✅ **Threshold Edit UI Fix (Issue #295)**
- Fixed Save/Cancel buttons disappearing during 5-second WebSocket refresh
- Lifted editing state to parent component to preserve across re-renders
- Buttons now remain visible during entire edit session
### 3. ✅ **PBS Edit Form Fix (Issue #296 follow-up)**
- Fixed PBS node edit forms not loading authentication data
- Properly preserves full token format (user@realm!token-name)
- Correctly detects token vs password authentication
### 4. ✅ **Password Security Enhancement**
- Removed password logging from email notification code
- Added guidelines to CLAUDE.md about avoiding sensitive data in logs
### 5. ✅ **Registration Token Feature Verification**
- Confirmed full UI functionality in Settings → Security → Registration Tokens
- Verified API endpoints are working correctly
- Feature is production-ready
## Test Results Summary
| Component | Status | Notes |
|-----------|--------|-------|
| TypeScript Compilation | ✅ PASS | No errors, clean build |
| Go Compilation | ✅ PASS | No errors, clean build |
| Frontend Build | ✅ PASS | 339KB JS bundle, 3.2s build time |
| Backend Service | ✅ PASS | Running stable, 26MB memory usage |
| WebSocket Connectivity | ✅ PASS | Multiple active connections |
| Email Notifications | ✅ PASS | Config loads correctly, STARTTLS working |
| PBS Node Editing | ✅ PASS | Token auth data loads correctly |
| PVE Node Editing | ✅ PASS | Cluster detection working |
| Threshold UI | ✅ PASS | Buttons persist during refresh |
| Registration Tokens | ✅ PASS | Full UI and API functionality |
| API Health | ✅ PASS | All endpoints responding |
| Error Logs | ✅ PASS | No errors in recent logs |
## Current System State
- **Nodes Connected**: 3 (2 PVE in cluster, 1 standalone PVE)
- **PBS Instances**: 1 (pbs-docker)
- **Total Backups**: 197
- **WebSocket Clients**: Active and updating
- **Memory Usage**: 26MB (excellent)
- **Uptime**: Stable
## Security Verification
- ✅ Passwords not exposed in logs
- ✅ Credentials encrypted at rest
- ✅ Token authentication working
- ✅ No sensitive data in API responses
## Known Minor Issues (Non-Breaking)
1. Frontend occasionally calls `/api/notifications/email/providers` instead of `/api/notifications/email-providers` (404 but doesn't break functionality)
## Release Readiness
### ✅ **READY FOR RELEASE**
All critical functionality is working correctly:
- No compilation errors
- No runtime errors
- All recent fixes verified working
- Security enhancements in place
- Performance is excellent
- System is stable
### Recommended Version
Based on changes, this should be a patch release:
- Current version: v4.2.0
- Recommended: **v4.2.1**
### Changelog Summary
- Fixed email notifications failing with STARTTLS
- Fixed threshold edit UI buttons disappearing
- Fixed PBS node edit forms not loading auth data
- Enhanced password security in logs
- Verified registration token functionality
-6
View File
@@ -1,6 +0,0 @@
{
"name": "testing-tools",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

-84
View File
@@ -1,84 +0,0 @@
const { chromium } = require('playwright');
async function quickCheck() {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
try {
console.log('Loading Pulse...');
await page.goto('http://192.168.0.212:7655');
await page.waitForTimeout(2000);
console.log('Clicking Settings...');
await page.click('text=Settings');
await page.waitForTimeout(1000);
console.log('Looking for System tab...');
// Try different selectors for System tab
const tabSelectors = [
'button:has-text("System")',
'div[role="tab"]:has-text("System")',
'[data-tab="system"]',
'text=System'
];
let clicked = false;
for (const selector of tabSelectors) {
try {
const element = page.locator(selector).first();
if (await element.count() > 0) {
console.log(`Found System tab with selector: ${selector}`);
await element.click();
clicked = true;
break;
}
} catch (e) {
// Continue trying
}
}
if (!clicked) {
console.log('Could not find System tab!');
// Get all button texts
const buttons = await page.locator('button').allTextContents();
console.log('Available buttons:', buttons);
}
await page.waitForTimeout(2000);
// Take screenshot
await page.screenshot({ path: 'system-tab.png', fullPage: true });
// Get all text
const text = await page.textContent('body');
// Check for expected content
const checks = [
'Performance',
'Polling Interval',
'Backend Port',
'Updates',
'Current Version',
'Check for Updates'
];
console.log('\nContent checks:');
for (const check of checks) {
if (text.includes(check)) {
console.log(`✅ Found: "${check}"`);
} else {
console.log(`❌ Missing: "${check}"`);
}
}
// Get all headings
const headings = await page.locator('h3, h4').allTextContents();
console.log('\nHeadings found:', headings);
} finally {
await browser.close();
}
}
quickCheck().catch(console.error);
@@ -1,142 +0,0 @@
# Registration Token Feature - Complete Test Report
## Test Date: 2025-08-12
## Executive Summary
✅ **The Registration Token feature is FULLY FUNCTIONAL** with both UI and API components working correctly.
## Components Tested
### 1. User Interface ✅
- **Location**: Settings → Security → Registration Tokens
- **Component**: `/frontend-modern/src/components/Settings/RegistrationTokens.tsx`
- **Features**:
- Generate new tokens
- List active tokens
- Revoke tokens
- Set validity period
- Set max uses
- Add descriptions
### 2. API Endpoints ✅
#### Token Management
- `POST /api/tokens/generate` - Generate new registration token
- `GET /api/tokens/list` - List all active tokens
- `DELETE /api/tokens/revoke?token=TOKEN` - Revoke a token
#### Registration
- `POST /api/auto-register` - Register node with optional token
- `GET /api/setup-script` - Generate setup script with token support
### 3. Token Generation ✅
**Request:**
```json
{
"validityMinutes": 30,
"maxUses": 5,
"allowedTypes": ["pve", "pbs"],
"description": "Test token"
}
```
**Response:**
```json
{
"token": "PULSE-REG-99de354400848de0",
"expires": "2025-08-12T10:55:00Z",
"maxUses": 5,
"usedCount": 0,
"description": "Test token for verification"
}
```
### 4. Token Validation ✅
- Tokens are validated when provided via `X-Registration-Token` header
- Invalid tokens are rejected (when security is enabled)
- Token usage tracking implemented
### 5. Security Modes ✅
#### Homelab Mode (Default)
- Registration tokens are **optional**
- Nodes can register without tokens
- Suitable for trusted networks
#### Secure Mode
- Enable with: `REQUIRE_REGISTRATION_TOKEN=true`
- All registrations require valid token
- Tokens expire after set time
- Usage limits enforced
## Test Results
| Feature | Status | Notes |
|---------|--------|-------|
| Token Generation | ✅ Working | Generates unique PULSE-REG-* tokens |
| Token Listing | ✅ Working | Shows all active tokens with metadata |
| Token Revocation | ✅ Working | Successfully removes tokens |
| Auto-Registration | ✅ Working | Accepts nodes with/without tokens |
| Token Validation | ✅ Working | Validates when provided |
| Setup Scripts | ✅ Working | Include token support |
| UI Components | ✅ Present | Full UI in Security tab |
## Security Configuration
### Environment Variables
- `REQUIRE_REGISTRATION_TOKEN=true` - Enforce token requirement
- `ALLOW_UNPROTECTED_AUTO_REGISTER=true` - Allow registration without tokens
- `REGISTRATION_TOKEN_DEFAULT_VALIDITY` - Default validity in seconds
- `REGISTRATION_TOKEN_DEFAULT_MAX_USES` - Default max uses per token
### Token Format
- Pattern: `PULSE-REG-[16 hex chars]`
- Example: `PULSE-REG-99de354400848de0`
## Usage Flow
### 1. Generate Token (Admin)
1. Go to Settings → Security → Registration Tokens
2. Click "Generate New Token"
3. Set validity period and max uses
4. Copy the generated token
### 2. Use Token (Node Setup)
```bash
# Option 1: Environment variable
PULSE_REG_TOKEN=PULSE-REG-xxxx ./setup.sh
# Option 2: In setup script
curl -X POST "$PULSE_URL/api/auto-register" \
-H "X-Registration-Token: PULSE-REG-xxxx" \
-d "$NODE_DATA"
```
### 3. Monitor Usage
- Check token usage count in UI
- Tokens auto-expire after validity period
- Revoke tokens manually when needed
## Comparison with Issue #302 Request
Issue #302 requests API key management in UI. The registration token feature already provides:
- ✅ UI-based token management
- ✅ Generate/revoke from UI
- ✅ No need to edit systemd configs
- ✅ Multiple tokens with different permissions
- ✅ Security without complexity
The main difference:
- Registration tokens: For node registration only
- API keys: For general API access (still in systemd)
## Recommendations
1. **Documentation**: Add user guide for registration tokens
2. **API Keys**: Consider extending this UI for general API keys (#302)
3. **Audit Log**: Add token usage audit trail
4. **Notifications**: Alert when tokens are near expiry
## Conclusion
The Registration Token feature is **production-ready** and provides excellent security options for both homelab and enterprise environments. The UI is intuitive, the API is complete, and the security model is flexible.
@@ -1,94 +0,0 @@
# Registration Token Feature Test Results
## Test Date: 2025-08-12
## Feature Overview
The registration token feature provides secure auto-registration of Proxmox nodes with Pulse monitoring.
## Test Results
### ✅ **1. Auto-Registration Endpoint**
- **Status**: Working
- **Endpoint**: `/api/auto-register`
- **Behavior**: Accepts node registration requests
- **Response**: Successfully registers nodes and returns node ID
### ✅ **2. Setup Script Generation**
- **Status**: Working
- **Endpoint**: `/api/setup-script`
- **Features**:
- Generates bash scripts for PVE/PBS setup
- Includes registration token support
- Handles token cleanup for existing installations
- Supports both token and non-token modes
### ✅ **3. Token Support in Scripts**
- **Status**: Working
- **Implementation**:
- Scripts check for `PULSE_REG_TOKEN` environment variable
- Adds `X-Registration-Token` header when token is present
- Falls back to non-token mode if not provided
### ✅ **4. Homelab Mode (Default)**
- **Status**: Working
- **Behavior**:
- Registration tokens are **optional** by default
- Nodes can auto-register without any token
- Suitable for trusted home networks
### ⚠️ **5. Secure Mode**
- **Status**: Not tested (requires env var)
- **Enable with**: `REQUIRE_REGISTRATION_TOKEN=true`
- **Behavior**: Would require valid token for all registrations
## API Behavior
### Successful Registration
```json
{
"message": "Node https://delly.lan:8006 auto-registered successfully",
"nodeId": "https://delly.lan:8006",
"status": "success"
}
```
### Registration Data Format
```json
{
"type": "pve",
"host": "https://node.local:8006",
"name": "Node Name",
"username": "pulse-monitor@pam",
"tokenId": "token-id",
"tokenValue": "token-secret",
"hasToken": true
}
```
## Security Considerations
1. **Default Mode**: Open registration (homelab-friendly)
2. **Secure Mode**: Set `REQUIRE_REGISTRATION_TOKEN=true` in environment
3. **Token Management**: Currently no UI for token management (planned enhancement)
4. **API Token**: Can also use global API token as fallback
## Usage Instructions
### For Users
1. Generate setup script from Settings → Nodes → Add Node → Setup Script
2. Run script on Proxmox node
3. Node auto-registers with Pulse
### For Secure Environments
1. Set `REQUIRE_REGISTRATION_TOKEN=true` in Pulse service
2. Generate registration tokens (future UI feature)
3. Provide token when running setup script
## Recommendations
1. Feature is functional for homelab use
2. Token management UI would be beneficial (relates to issue #302)
3. Consider adding token generation/management endpoints
4. Documentation should clarify security modes
## Conclusion
The registration token feature is **working correctly** in its current implementation. It provides a good balance between security and ease-of-use for homelab environments while supporting enhanced security when needed.
-96
View File
@@ -1,96 +0,0 @@
# PBS Edit Form Test Instructions
## Test Date: 2025-08-12
## Test Objective
Verify that PBS node edit forms correctly load and save configuration data, especially token authentication details.
## Current PBS Node Data
Based on API response, we have a PBS node with:
- **ID**: pbs-0
- **Name**: pbs-docker
- **Host**: https://192.168.0.8:8007
- **Auth Type**: Token (hasToken: true, hasPassword: false)
- **Token Name**: pulse-monitor@pbs!pulse-192-168-0-123-1754983958
- **Monitoring Settings**: All enabled except monitorGarbageJobs
## Test Steps
### 1. Open Edit Modal
1. Navigate to http://localhost:7655
2. Go to Settings → Nodes tab
3. Find the PBS node "pbs-docker"
4. Click the Edit button (pencil icon)
### 2. Verify Form Population
Check that the following fields are correctly populated:
#### Basic Fields
- [ ] **Name**: Should show "pbs-docker"
- [ ] **Host URL**: Should show "https://192.168.0.8:8007"
- [ ] **Verify SSL**: Should be unchecked (based on verifySSL: false)
#### Authentication Fields
- [ ] **Auth Type**: Token option should be selected
- [ ] **Token ID field**: Should show FULL token format "pulse-monitor@pbs!pulse-192-168-0-123-1754983958"
- [ ] **Token Value field**: Should be empty (password fields never show existing values)
#### Monitoring Options
- [ ] **Monitor Datastores**: Should be checked ✓
- [ ] **Monitor Sync Jobs**: Should be checked ✓
- [ ] **Monitor Verify Jobs**: Should be checked ✓
- [ ] **Monitor Prune Jobs**: Should be checked ✓
- [ ] **Monitor Garbage Collection Jobs**: Should be unchecked ✗
### 3. Test Saving Without Changes
1. Click "Save" without making any changes
2. Verify the node continues to work
3. Check that monitoring continues normally
### 4. Test Minor Edit
1. Open edit modal again
2. Change the name to "PBS Docker Updated"
3. Click Save
4. Verify the name updates in the list
5. Verify monitoring continues working
### 5. Test Token Auth Preservation
1. Open edit modal again
2. Verify Token ID still shows full format
3. Add a space at the end of Token ID, then remove it
4. Click Save
5. Verify node still connects properly
## Expected Behavior
### Correct Token Handling
- When editing a PBS node with token auth, the Token ID field should display the FULL token format including username
- Format: `username@realm!token-name`
- Example: `pulse-monitor@pbs!pulse-192-168-0-123-1754983958`
### What NOT to expect
- Token Value will never be shown (security feature)
- Password fields are always empty when editing
## Known Issues Fixed
- PBS edit form now correctly loads the full token ID
- Token authentication type is properly detected
- Monitoring settings are correctly populated
## API Verification
Run this command to verify the node data:
```bash
curl -s "http://localhost:7655/api/config/nodes" | jq '.[] | select(.type == "pbs")'
```
Expected fields:
- `tokenName`: Full format with username
- `hasToken`: true
- `hasPassword`: false
## Success Criteria
- [ ] All form fields populate correctly when editing
- [ ] Saving without changes doesn't break the node
- [ ] Token ID shows full format including username
- [ ] Monitoring settings are preserved correctly
- [ ] Node continues to function after editing
-111
View File
@@ -1,111 +0,0 @@
#!/bin/bash
# Test PBS edit form data loading
echo "PBS Edit Form Test Script"
echo "========================="
# API endpoint and token
API_URL="http://localhost:7655/api"
API_TOKEN="test-token-123"
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "\n${YELLOW}Step 1: Fetching current PBS nodes...${NC}"
RESPONSE=$(curl -s -H "X-API-Token: $API_TOKEN" "$API_URL/config/nodes")
# Check if we have PBS nodes (response is an array)
PBS_COUNT=$(echo "$RESPONSE" | jq '[.[] | select(.type == "pbs")] | length')
echo "Found $PBS_COUNT PBS instances"
if [ "$PBS_COUNT" -eq 0 ]; then
echo -e "${YELLOW}No PBS nodes found. Creating a test PBS node...${NC}"
# Create a test PBS node
PBS_DATA='{
"node": {
"type": "pbs",
"name": "Test PBS",
"host": "192.168.0.8:8007",
"tokenName": "testuser@pbs!test-token",
"tokenValue": "test-token-value",
"verifySSL": false,
"monitorDatastores": true,
"monitorSyncJobs": true,
"monitorVerifyJobs": true,
"monitorPruneJobs": true,
"monitorGarbageJobs": false
}
}'
CREATE_RESPONSE=$(curl -s -X POST \
-H "Content-Type: application/json" \
-H "X-API-Token: $API_TOKEN" \
-d "$PBS_DATA" \
"$API_URL/config/nodes")
echo "PBS node created: $CREATE_RESPONSE"
# Fetch nodes again
RESPONSE=$(curl -s -H "X-API-Token: $API_TOKEN" "$API_URL/config/nodes")
fi
# Get first PBS node details (filter from array)
PBS_NODE=$(echo "$RESPONSE" | jq '[.[] | select(.type == "pbs")] | .[0]')
if [ "$PBS_NODE" != "null" ]; then
echo -e "\n${GREEN}PBS Node Data:${NC}"
echo "$PBS_NODE" | jq '.'
# Check critical fields
echo -e "\n${YELLOW}Checking PBS node fields:${NC}"
# Check if tokenName contains username
TOKEN_NAME=$(echo "$PBS_NODE" | jq -r '.tokenName // empty')
HAS_TOKEN=$(echo "$PBS_NODE" | jq -r '.hasToken // false')
HAS_PASSWORD=$(echo "$PBS_NODE" | jq -r '.hasPassword // false')
echo "- tokenName: $TOKEN_NAME"
echo "- hasToken: $HAS_TOKEN"
echo "- hasPassword: $HAS_PASSWORD"
if [[ "$TOKEN_NAME" == *"!"* ]]; then
echo -e "${GREEN}✓ Token name contains username separator (!)${NC}"
USERNAME=$(echo "$TOKEN_NAME" | cut -d'!' -f1)
TOKEN_PART=$(echo "$TOKEN_NAME" | cut -d'!' -f2)
echo " - Extracted username: $USERNAME"
echo " - Token part: $TOKEN_PART"
else
echo -e "${YELLOW}Note: Token name doesn't contain separator, might be using password auth${NC}"
fi
# Check auth type detection
if [ "$HAS_TOKEN" == "true" ]; then
echo -e "${GREEN}✓ Node is using token authentication${NC}"
elif [ "$HAS_PASSWORD" == "true" ]; then
echo -e "${GREEN}✓ Node is using password authentication${NC}"
else
echo -e "${RED}✗ No authentication method detected${NC}"
fi
# Check monitoring settings
echo -e "\n${YELLOW}PBS Monitoring Settings:${NC}"
echo "- monitorDatastores: $(echo "$PBS_NODE" | jq -r '.monitorDatastores')"
echo "- monitorSyncJobs: $(echo "$PBS_NODE" | jq -r '.monitorSyncJobs')"
echo "- monitorVerifyJobs: $(echo "$PBS_NODE" | jq -r '.monitorVerifyJobs')"
echo "- monitorPruneJobs: $(echo "$PBS_NODE" | jq -r '.monitorPruneJobs')"
echo "- monitorGarbageJobs: $(echo "$PBS_NODE" | jq -r '.monitorGarbageJobs')"
else
echo -e "${RED}No PBS nodes found in the system${NC}"
fi
echo -e "\n${YELLOW}Test Complete!${NC}"
echo "To verify in UI:"
echo "1. Open http://localhost:7655"
echo "2. Go to Settings → Nodes"
echo "3. Click edit on a PBS node"
echo "4. Check that all fields are populated correctly"
-111
View File
@@ -1,111 +0,0 @@
#!/bin/bash
echo "=== Testing Registration Token Feature ==="
echo ""
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
PULSE_URL="http://localhost:7655"
# Test 1: Try auto-register without token (should work by default in homelab mode)
echo "Test 1: Auto-register without token (homelab mode)..."
TEST_NODE='{
"type": "pve",
"host": "test-node.local:8006",
"name": "Test Node",
"username": "root@pam",
"password": "test-password"
}'
RESPONSE=$(curl -s -X POST "$PULSE_URL/api/auto-register" \
-H "Content-Type: application/json" \
-d "$TEST_NODE" 2>&1)
if echo "$RESPONSE" | grep -q "success"; then
echo -e "${GREEN} ✓ Auto-registration without token succeeded (homelab mode)${NC}"
else
echo -e "${YELLOW} ⚠ Auto-registration response: $RESPONSE${NC}"
fi
# Test 2: Check if we can enable token requirement
echo ""
echo "Test 2: Checking registration token configuration..."
# Check if token requirement is enabled
if [ -n "$REQUIRE_REGISTRATION_TOKEN" ]; then
echo -e "${YELLOW} Registration tokens are required (REQUIRE_REGISTRATION_TOKEN=$REQUIRE_REGISTRATION_TOKEN)${NC}"
else
echo -e "${GREEN} Registration tokens are optional (default homelab mode)${NC}"
fi
# Test 3: Generate a setup script with token
echo ""
echo "Test 3: Generating setup script..."
SETUP_RESPONSE=$(curl -s "$PULSE_URL/api/setup-script?node=test&token=test-token-123")
if echo "$SETUP_RESPONSE" | grep -q "PULSE_URL"; then
echo -e "${GREEN} ✓ Setup script generated successfully${NC}"
# Check if token is included
if echo "$SETUP_RESPONSE" | grep -q "REG_TOKEN"; then
echo -e "${GREEN} ✓ Registration token included in script${NC}"
else
echo -e "${YELLOW} ⚠ No registration token in script${NC}"
fi
else
echo -e "${RED} ✗ Failed to generate setup script${NC}"
fi
# Test 4: Test with invalid token when tokens are required
echo ""
echo "Test 4: Testing token validation..."
# This would only fail if REQUIRE_REGISTRATION_TOKEN=true
INVALID_RESPONSE=$(curl -s -X POST "$PULSE_URL/api/auto-register" \
-H "Content-Type: application/json" \
-H "X-Registration-Token: invalid-token" \
-d "$TEST_NODE" 2>&1)
if echo "$INVALID_RESPONSE" | grep -q "Unauthorized\|Invalid token"; then
echo -e "${GREEN} ✓ Invalid token rejected${NC}"
else
echo -e "${YELLOW} ⚠ Token validation may not be active${NC}"
fi
# Test 5: Check registration endpoints
echo ""
echo "Test 5: Checking registration endpoints..."
# Check if setup script endpoint works
SETUP_CHECK=$(curl -s -o /dev/null -w "%{http_code}" "$PULSE_URL/api/setup-script")
if [ "$SETUP_CHECK" = "200" ]; then
echo -e "${GREEN} ✓ Setup script endpoint available (/api/setup-script)${NC}"
else
echo -e "${RED} ✗ Setup script endpoint returned: $SETUP_CHECK${NC}"
fi
# Check if auto-register endpoint works
REGISTER_CHECK=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$PULSE_URL/api/auto-register" \
-H "Content-Type: application/json" \
-d '{}')
if [ "$REGISTER_CHECK" = "400" ] || [ "$REGISTER_CHECK" = "401" ] || [ "$REGISTER_CHECK" = "200" ]; then
echo -e "${GREEN} ✓ Auto-register endpoint available (/api/auto-register)${NC}"
else
echo -e "${RED} ✗ Auto-register endpoint returned: $REGISTER_CHECK${NC}"
fi
echo ""
echo "=== Summary ==="
echo "The registration token feature allows:"
echo "1. Secure node auto-registration with tokens"
echo "2. Optional token requirement (via REQUIRE_REGISTRATION_TOKEN env var)"
echo "3. Setup scripts with embedded tokens"
echo "4. Default homelab mode (no token required)"
echo ""
echo "To enable token requirement, set:"
echo " REQUIRE_REGISTRATION_TOKEN=true"
echo "in the Pulse service environment"
-79
View File
@@ -1,79 +0,0 @@
# Manual Test Plan: Threshold Edit UI Refresh Fix
## Test Objective
Verify that the Save/Cancel buttons remain visible during threshold editing when the UI refreshes every 5 seconds.
## Prerequisites
1. Pulse v4.2.0+ with the fix applied
2. At least one node configured
3. Browser with developer tools
## Test Steps
### Setup
1. Open Pulse in browser (http://localhost:7655)
2. Navigate to Alerts page
3. Click on "Thresholds" tab
### Test Case 1: Create Override and Test Edit Persistence
1. Add a custom threshold override:
- Click "Add Override"
- Select a node or VM
- Set custom thresholds
- Save
2. Start editing the override:
- Click "Edit" button next to the override
- **Expected**: Save and Cancel buttons appear
- **Expected**: Threshold sliders become editable
3. Wait for UI refresh (15 seconds total - 3 refresh cycles):
- Watch the UI (you may see slight data updates)
- **Expected**: Save and Cancel buttons REMAIN VISIBLE
- **Expected**: Edit mode is maintained
- **Expected**: Any changes to sliders are preserved
4. Make a change and save:
- Adjust one of the threshold sliders
- Click "Save"
- **Expected**: Changes are saved
- **Expected**: Returns to view mode with Edit button
### Test Case 2: Cancel During Refresh
1. Click "Edit" on an override
2. Wait 7-8 seconds (through at least one refresh)
3. Click "Cancel"
- **Expected**: Returns to view mode
- **Expected**: No changes are saved
### Test Case 3: Multiple Overrides
1. Create 2-3 overrides
2. Edit one override
3. Wait for refresh
- **Expected**: Only the one being edited shows Save/Cancel
- **Expected**: Other overrides still show Edit button
## Verification in Browser Console
Open browser dev tools and run:
```javascript
// Check if edit state is preserved
setInterval(() => {
const saveBtn = document.querySelector('button:has-text("Save")');
const editBtn = document.querySelector('button:has-text("Edit")');
console.log('Save visible:', !!saveBtn, 'Edit visible:', !!editBtn);
}, 1000);
```
## Expected Results
- ✅ Edit state persists across all UI refresh cycles
- ✅ Save/Cancel buttons remain visible during entire edit session
- ✅ Threshold values being edited are not reset during refresh
- ✅ Only the override being edited maintains edit state
## Known Issues (Before Fix)
- ❌ Save/Cancel buttons disappeared after 5-second refresh
- ❌ Users lost ability to save changes
- ❌ Had to be very quick to save before refresh
## Fix Implementation
The fix tracks editing state at the parent component level (ThresholdsTab) instead of locally in each OverrideItem, preventing state loss during re-renders.
-107
View File
@@ -1,107 +0,0 @@
const { chromium } = require('playwright');
const BASE_URL = 'http://192.168.0.123:7655';
async function verifyPBSDisplay() {
console.log('\n' + '='.repeat(60));
console.log('PBS Authentication Display Verification');
console.log('='.repeat(60) + '\n');
console.log('This test assumes you have already added PBS nodes manually.\n');
const browser = await chromium.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newContext({ ignoreHTTPSErrors: true })
.then(ctx => ctx.newPage());
try {
// Navigate to Pulse
console.log('📍 Navigating to Pulse...');
await page.goto(BASE_URL);
await page.waitForTimeout(2000);
// Go to Settings
console.log('⚙️ Opening Settings...');
await page.locator('text=Settings').first().click();
await page.waitForTimeout(1500);
// Click on PBS Nodes tab
console.log('📂 Opening PBS Nodes tab...\n');
await page.locator('button:text("PBS Nodes")').click();
await page.waitForTimeout(1000);
// Take screenshot
await page.screenshot({ path: 'pbs-display-check.png', fullPage: true });
console.log('📸 Screenshot saved to pbs-display-check.png\n');
// Find all PBS node cards
const pbsCards = await page.locator('.bg-white, .dark\\:bg-gray-800').all();
console.log(`Found ${pbsCards.length} node cards\n`);
for (let i = 0; i < pbsCards.length; i++) {
const card = pbsCards[i];
// Try to get the node name
const nameElement = card.locator('h4, .font-medium').first();
const nodeName = await nameElement.textContent().catch(() => 'Unknown');
// Look for auth display (User: or Token:)
const authSpan = card.locator('span.text-xs').first();
const authDisplay = await authSpan.textContent().catch(() => 'Not found');
console.log(`Node ${i + 1}: ${nodeName}`);
console.log(` Auth display: ${authDisplay}`);
// Check edit mode
const editButton = card.locator('button[title="Edit node"]');
if (await editButton.isVisible()) {
console.log(' Testing edit mode...');
await editButton.click();
await page.waitForTimeout(1000);
// Check which auth type is selected
const tokenRadioChecked = await page.locator('input[value="token"]').isChecked();
const passRadioChecked = await page.locator('input[value="password"]').isChecked();
if (tokenRadioChecked) {
console.log(' ✅ Edit mode shows: Token authentication');
if (authDisplay.includes('Token:')) {
console.log(' ✅ Display matches auth type');
} else {
console.log(' ❌ Display does NOT match auth type (shows ' + authDisplay + ')');
}
} else if (passRadioChecked) {
console.log(' ✅ Edit mode shows: Password authentication');
if (authDisplay.includes('User:')) {
console.log(' ✅ Display matches auth type');
} else {
console.log(' ❌ Display does NOT match auth type (shows ' + authDisplay + ')');
}
} else {
console.log(' ⚠️ Cannot determine auth type in edit mode');
}
// Cancel edit
await page.locator('button:has-text("Cancel")').click();
await page.waitForTimeout(1000);
}
console.log('');
}
console.log('='.repeat(60));
console.log('Verification Complete');
console.log('='.repeat(60));
} catch (error) {
console.error('Error:', error.message);
await page.screenshot({ path: 'pbs-display-error.png' });
} finally {
await browser.close();
}
}
verifyPBSDisplay().catch(console.error);
-99
View File
@@ -1,99 +0,0 @@
#!/bin/bash
echo "=== Testing Threshold Edit UI Refresh Fix ==="
echo ""
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# 1. Check current alert config
echo "1. Checking current alert configuration..."
OVERRIDES=$(curl -s http://localhost:7655/api/alerts/config | jq '.overrides')
if [ "$OVERRIDES" = "{}" ]; then
echo -e "${YELLOW} No overrides configured yet${NC}"
else
echo -e "${GREEN} Found existing overrides${NC}"
fi
# 2. Get a node to test with
echo ""
echo "2. Getting available nodes..."
NODE_ID=$(curl -s http://localhost:7655/api/state | jq -r '.nodes[0].id' 2>/dev/null)
NODE_NAME=$(curl -s http://localhost:7655/api/state | jq -r '.nodes[0].name' 2>/dev/null)
if [ -z "$NODE_ID" ] || [ "$NODE_ID" = "null" ]; then
echo -e "${RED} No nodes available for testing${NC}"
exit 1
fi
echo -e "${GREEN} Found node: $NODE_NAME (ID: $NODE_ID)${NC}"
# 3. Create a test override
echo ""
echo "3. Creating test threshold override for $NODE_NAME..."
TEST_CONFIG="{
\"overrides\": {
\"$NODE_ID\": {
\"cpu\": { \"trigger\": 75, \"clear\": 70 },
\"memory\": { \"trigger\": 80, \"clear\": 75 }
}
}
}"
# Save the override
curl -s -X PUT http://localhost:7655/api/alerts/config \
-H "Content-Type: application/json" \
-d "$TEST_CONFIG" > /dev/null
# Verify it was saved
SAVED_OVERRIDE=$(curl -s http://localhost:7655/api/alerts/config | jq ".overrides[\"$NODE_ID\"]")
if [ "$SAVED_OVERRIDE" != "null" ]; then
echo -e "${GREEN} ✓ Override created successfully${NC}"
else
echo -e "${RED} ✗ Failed to create override${NC}"
exit 1
fi
# 4. Test instructions
echo ""
echo "4. Manual UI Test Instructions:"
echo " ================================"
echo -e "${YELLOW}"
echo " a) Open Pulse in your browser: http://localhost:7655"
echo " b) Navigate to Alerts → Thresholds tab"
echo " c) Find the override for '$NODE_NAME'"
echo " d) Click 'Edit' button"
echo " e) Wait 15 seconds (3 refresh cycles)"
echo " f) Verify Save/Cancel buttons are STILL VISIBLE"
echo ""
echo " Expected: Buttons remain visible during all refreshes"
echo " Old Bug: Buttons would disappear after 5 seconds"
echo -e "${NC}"
# 5. Verification check
echo "5. Code verification:"
echo " Checking if fix is implemented in code..."
# Check for the editingOverrideId state management
if grep -q "editingOverrideId" /opt/pulse/frontend-modern/src/pages/Alerts.tsx; then
echo -e "${GREEN} ✓ Fix is present in code (editingOverrideId state management found)${NC}"
else
echo -e "${RED} ✗ Fix may not be implemented${NC}"
fi
# Check for proper prop passing
if grep -q "isEditing={editingOverrideId()" /opt/pulse/frontend-modern/src/pages/Alerts.tsx; then
echo -e "${GREEN} ✓ Edit state properly passed to components${NC}"
else
echo -e "${YELLOW} ⚠ Could not verify prop passing${NC}"
fi
echo ""
echo "=== Test Setup Complete ==="
echo -e "${GREEN}Override created for $NODE_NAME - Please test manually in browser${NC}"
echo ""
echo "To clean up test data later, run:"
echo "curl -X PUT http://localhost:7655/api/alerts/config -H 'Content-Type: application/json' -d '{\"overrides\":{}}'"
-40
View File
@@ -1,40 +0,0 @@
# PBS Form Fix Verification
## What was broken
1. When editing a PBS node, the form wouldn't populate with PBS data
2. PBS forms could show PVE data if a PVE node was edited first
## What we fixed
In `/opt/pulse/frontend-modern/src/components/Settings/Settings.tsx`:
- Lines 886 and 1063: Added `setCurrentNodeType(node.type as 'pve' | 'pbs');`
- This ensures when editing any node, we set the correct type
## How to verify the fix works
### Test #1: PBS form after PVE
1. Go to Settings → Nodes
2. Click "Add PVE Node"
3. Fill in some data
4. Press Escape to cancel
5. Click "Add PBS Node"
6. **VERIFY**: PBS form should be completely empty
### Test #2: Edit PBS node
1. Add a PBS node with test data
2. Click the edit icon on that PBS node
3. **VERIFY**: Form should show the PBS node's data
### Test #3: Edit PVE after PBS
1. Add a PVE node
2. Add a PBS node
3. Edit the PBS node
4. Cancel
5. Edit the PVE node
6. **VERIFY**: PVE form shows PVE data, not PBS data
## Current Status
- [x] Fix implemented in source code
- [x] Frontend rebuilt with fix
- [x] Backend restarted
- [ ] Manual testing completed
- [ ] User confirmed it works