mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 03:20:11 +00:00
fix(frontend): fix TypeScript errors in Settings components
- ConfiguredNodeTables.tsx: remove unused hostAgent variable and findMatchingHostAgent function - NodeModal.tsx: remove unused createMemo import and fix undefined temperatureToggleDisabled reference by using inline prop check
This commit is contained in:
parent
098f645b34
commit
b030584248
2 changed files with 2 additions and 30 deletions
|
|
@ -89,33 +89,6 @@ const resolvePveStatusMeta = (
|
|||
}
|
||||
};
|
||||
|
||||
// Helper to find matching host agent for a node
|
||||
// First tries to match via linkedHostAgentId from stateNodes, then falls back to hostname matching
|
||||
const findMatchingHostAgent = (
|
||||
nodeName: string,
|
||||
hosts: Host[] | undefined,
|
||||
stateNodes?: Node[],
|
||||
): Host | undefined => {
|
||||
if (!hosts || hosts.length === 0) return undefined;
|
||||
|
||||
// First try: find via linked host agent ID (proper backend linking)
|
||||
if (stateNodes && stateNodes.length > 0) {
|
||||
const nodeNameLower = nodeName.toLowerCase().trim();
|
||||
const stateNode = stateNodes.find(
|
||||
(n) => n.name.toLowerCase().trim() === nodeNameLower || n.instance.toLowerCase().trim() === nodeNameLower,
|
||||
);
|
||||
if (stateNode?.linkedHostAgentId) {
|
||||
const linkedHost = hosts.find((h) => h.id === stateNode.linkedHostAgentId);
|
||||
if (linkedHost) {
|
||||
return linkedHost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: hostname matching
|
||||
const nodeNameLower = nodeName.toLowerCase().trim();
|
||||
return hosts.find((h) => h.hostname.toLowerCase().trim() === nodeNameLower);
|
||||
};
|
||||
|
||||
export const PveNodesTable: Component<PveNodesTableProps> = (props) => {
|
||||
return (
|
||||
|
|
@ -150,7 +123,6 @@ export const PveNodesTable: Component<PveNodesTableProps> = (props) => {
|
|||
const clusterName = createMemo(() =>
|
||||
'clusterName' in node && node.clusterName ? node.clusterName : 'Unknown',
|
||||
);
|
||||
const hostAgent = createMemo(() => findMatchingHostAgent(node.name, props.stateHosts, props.stateNodes));
|
||||
return (
|
||||
<tr class="even:bg-gray-50/60 dark:even:bg-gray-800/30 hover:bg-blue-50/40 dark:hover:bg-blue-900/20 transition-colors">
|
||||
<td class="align-top py-3 pl-4 pr-3">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, Show, For, createSignal, createEffect, createMemo } from 'solid-js';
|
||||
import { Component, Show, For, createSignal, createEffect } from 'solid-js';
|
||||
import { Portal } from 'solid-js/web';
|
||||
import type { NodeConfig } from '@/types/nodes';
|
||||
import type { SecurityStatus } from '@/types/config';
|
||||
|
|
@ -2003,7 +2003,7 @@ export const NodeModal: Component<NodeModalProps> = (props) => {
|
|||
onChange={(event) => {
|
||||
props.onToggleTemperatureMonitoring?.(event.currentTarget.checked);
|
||||
}}
|
||||
disabled={temperatureToggleDisabled()}
|
||||
disabled={props.savingTemperatureSetting || props.temperatureMonitoringLocked}
|
||||
ariaLabel={
|
||||
temperatureMonitoringEnabledValue()
|
||||
? 'Disable temperature monitoring'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue