Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/serverinfo-main.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/* extracted by css-entry-points-plugin */
@import './main-BGnaytV2.chunk.css';
@import './main-CTcIB92A.chunk.css';
22 changes: 11 additions & 11 deletions js/serverinfo-main.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/serverinfo-main.mjs.map

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions lib/Database/Advisor.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ private function evaluateRule(Rule $rule, Snapshot $snapshot, array $context): R
try {
$value = $this->evaluator->evaluate($rule->formula, $context);
} catch (ExpressionException $e) {
$this->logger->warning(
// Debug, not warning: a variable that is not a number on this server is
// ordinary — MariaDB reports concurrent_insert as AUTO where MySQL
// reports an integer — and the rule says so in its skip reason. At
// warning level it would land in the log on every page load and inflate
// the "Errors in the log" setup check.
$this->logger->debug(
'serverinfo: failed to evaluate formula for rule {id}: {msg}',
['id' => $rule->id, 'msg' => $e->getMessage(), 'app' => 'serverinfo'],
);
Expand All @@ -153,7 +158,9 @@ private function evaluateRule(Rule $rule, Snapshot $snapshot, array $context): R
$failed = $this->evaluator->evaluate($rule->test, $testCtx);
$failed = is_bool($failed) ? $failed : ($valueFloat !== 0.0);
} catch (ExpressionException $e) {
$this->logger->warning(
// Debug for the same reason as the formula above: reported to the admin
// as a skipped rule, not something to write to the log every time.
$this->logger->debug(
'serverinfo: failed to evaluate test for rule {id}: {msg}',
['id' => $rule->id, 'msg' => $e->getMessage(), 'app' => 'serverinfo'],
);
Expand Down
13 changes: 11 additions & 2 deletions src/components/DatabaseLiveCharts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,25 @@ watch(() => [props.active, document.hidden], () => {
}
}, { immediate: true })

document.addEventListener('visibilitychange', () => {
/**
* Pauses while the tab is in the background and resumes on return.
*
* Named rather than inline so that it can be taken off again: an anonymous
* handler here would outlive the component.
*/
function onVisibilityChange() {
if (document.hidden) {
stop()
} else if (props.active && timeoutId === null) {
poll()
}
})
}

document.addEventListener('visibilitychange', onVisibilityChange)

onUnmounted(() => {
stopped = true
document.removeEventListener('visibilitychange', onVisibilityChange)
stop()
})

Expand Down
14 changes: 12 additions & 2 deletions src/views/SettingsAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<script setup lang="ts">
import type { LiveData, PeriodicData, SettingsView } from '../types.ts'

import { ref, watch } from 'vue'
import { onUnmounted, ref, watch } from 'vue'
import SettingsNavigation from '../components/SettingsNavigation.vue'
import BackgroundJobsView from './BackgroundJobsView.vue'
import DatabaseView from './DatabaseView.vue'
Expand Down Expand Up @@ -54,8 +54,18 @@ watch(view, (current) => {
window.history.replaceState(null, '', `#${current}`)
})

window.addEventListener('hashchange', () => {
/**
* Keeps the page in step with the fragment when the browser changes it, for
* instance on back/forward. Named so it can be removed again.
*/
function onHashChange() {
view.value = viewFromHash()
}

window.addEventListener('hashchange', onHashChange)

onUnmounted(() => {
window.removeEventListener('hashchange', onHashChange)
})

const { data: staticData } = useStaticData()
Expand Down
Loading