Fix per-resource settings: tags saving, is_public bug, global setting inheritance
Bug fixes: - tags field was missing from INSERT/UPDATE SQL — tags never persisted - is_public: `0 !== false` is true in JS, so private resources (is_public=0) were silently flipped to public on every edit; fixed with explicit 0/false check Global setting inheritance: - One-time DB migration nulls out check_interval and timeout on all existing resources so they inherit from global monitoring settings going forward - Scheduler reads global check_interval and timeout from DB each cycle and uses them as the fallback when per-resource values are null - Create and edit modals: empty field = use global; placeholder shows the current global value so it's clear what will be used Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
3a3d32ecac
commit
59078362da
4 files changed
+49
-18
No files matched your search
@@ -333,4 +333,14 @@ db.exec(`
|
||||
CREATE INDEX IF NOT EXISTS idx_resources_heartbeat_token ON resources(heartbeat_token);
|
||||
`);
|
||||
|
||||
// One-time migration: null out per-resource check_interval and timeout so all resources
|
||||
// inherit from the global monitoring settings. Runs once, tracked by a settings flag.
|
||||
try {
|
||||
const alreadyMigrated = db.prepare("SELECT value FROM settings WHERE key = 'migrated_global_defaults_v1'").get();
|
||||
if (!alreadyMigrated) {
|
||||
db.prepare("UPDATE resources SET check_interval = NULL, timeout = NULL").run();
|
||||
db.prepare("INSERT OR IGNORE INTO settings (key, value) VALUES ('migrated_global_defaults_v1', 'true')").run();
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
module.exports = db;
|
||||
Reference in new issue
Block a user