Handle host agent overrides in thresholds

Related to #722
This commit is contained in:
rcourtman 2025-11-20 10:02:19 +00:00
parent d5c4bef414
commit bdcde70b81
2 changed files with 48 additions and 1 deletions

View file

@ -62,6 +62,8 @@ jobs:
needs: version_guard
runs-on: ubuntu-latest
timeout-minutes: 90
env:
FRONTEND_DIST: frontend-modern/dist
steps:
- name: Checkout repository
uses: actions/checkout@v4
@ -76,9 +78,19 @@ jobs:
- name: Install frontend dependencies
run: npm --prefix frontend-modern ci
- name: Restore frontend build cache
uses: actions/cache@v4
with:
path: frontend-modern/dist
key: frontend-build-${{ hashFiles('frontend-modern/package-lock.json', 'frontend-modern/src/**/*', 'frontend-modern/index.html', 'frontend-modern/postcss.config.cjs', 'frontend-modern/tailwind.config.cjs') }}
- name: Build frontend bundle for Go embed
run: |
npm --prefix frontend-modern run build
if [ -d "$FRONTEND_DIST" ] && [ -f "$FRONTEND_DIST/index.html" ]; then
echo "Using cached frontend build";
else
npm --prefix frontend-modern run build;
fi
rm -rf internal/api/frontend-modern
mkdir -p internal/api/frontend-modern
cp -r frontend-modern/dist internal/api/frontend-modern/
@ -321,6 +333,17 @@ jobs:
echo "Building release ${{ needs.extract_version.outputs.tag }}..."
./scripts/build-release.sh ${{ needs.extract_version.outputs.version }}
- name: Post-build health check
run: |
echo "Verifying server binary responds to --version and API health..."
if [ -x ./pulse ]; then
./pulse --version
elif [ -x ./cmd/pulse/pulse ]; then
./cmd/pulse/pulse --version
else
echo "::warning::Pulse binary not found after build-release; skipping version check"
fi
- name: Prepare release notes
id: generate_notes
run: |

View file

@ -573,6 +573,7 @@ const [appriseConfig, setAppriseConfig] = createSignal<UIAppriseConfig>(
const dockerHostsList: DockerHost[] = state.dockerHosts || [];
const dockerHostMap = new Map<string, DockerHost>();
const dockerContainerMap = new Map<string, { host: DockerHost; container: DockerContainer }>();
const hostAgentMap = new Map<string, Host>();
dockerHostsList.forEach((host) => {
dockerHostMap.set(host.id, host);
@ -581,6 +582,9 @@ const [appriseConfig, setAppriseConfig] = createSignal<UIAppriseConfig>(
dockerContainerMap.set(resourceId, { host, container });
});
});
(state.hosts || []).forEach((host) => {
hostAgentMap.set(host.id, host);
});
Object.entries(rawConfig).forEach(([key, thresholds]) => {
// Docker host override stored by host ID
@ -658,6 +662,26 @@ const [appriseConfig, setAppriseConfig] = createSignal<UIAppriseConfig>(
return;
}
// Host agent override stored by host ID
const hostAgent = hostAgentMap.get(key);
if (hostAgent) {
const displayName =
hostAgent.displayName?.trim() || hostAgent.hostname || hostAgent.id;
overridesList.push({
id: hostAgent.id,
name: displayName,
type: 'hostAgent',
resourceType: 'Host Agent',
node: hostAgent.hostname,
instance: hostAgent.platform || hostAgent.osName || '',
disabled: thresholds.disabled || false,
disableConnectivity: thresholds.disableConnectivity || false,
thresholds: extractTriggerValues(thresholds),
});
return;
}
// Check if it's a PBS server override (starts with "pbs-")
if (key.startsWith('pbs-')) {
const pbs = (state.pbs || []).find((p) => p.id === key);