mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-14 18:56:52 +00:00
attribute post-install helpers to their feature and dedupe files
This commit is contained in:
@@ -83,6 +83,11 @@ function undoKey(change: { revert: string; exactness: string }): string {
|
||||
}
|
||||
|
||||
const FN_LABEL: Record<string, string> = {
|
||||
// Internal helpers of a post-install feature show its menu name, not their
|
||||
// raw name — and never the source ("auto"/"customizable").
|
||||
_update_existing_log2ram_auto: "Install and configure Log2RAM",
|
||||
_update_existing_log2ram_custom: "Install and configure Log2RAM",
|
||||
update_snapshot_schedule: "Install ZFS auto-snapshot",
|
||||
apply_amd_fixes: "Apply AMD CPU fixes",
|
||||
apply_network_optimizations: "Apply network optimizations",
|
||||
apt_upgrade: "Update and upgrade system",
|
||||
@@ -144,7 +149,9 @@ function blockOf(c: { class: string; source: string }): "installs" | "postInstal
|
||||
// A post-install function shows its menu name; anything else shows the script
|
||||
// that made the change.
|
||||
function groupLabel(fn: string, source: string): string {
|
||||
return FN_LABEL[fn] || source || fn || "—"
|
||||
// A post-install change shows its feature's menu name; if the function is
|
||||
// not a known optimization, its own name — never the bare source.
|
||||
return FN_LABEL[fn] || fn || source || "—"
|
||||
}
|
||||
|
||||
const CLASS_STYLE: Record<string, { chip: string; Icon: typeof Settings2 }> = {
|
||||
@@ -406,7 +413,7 @@ export function AuditChanges() {
|
||||
// The same script can appear in more than one section (it changed
|
||||
// config and also installed a package), so the accordion key is scoped
|
||||
// by section — otherwise opening one card opens its twin elsewhere.
|
||||
const rawKey = b === "postInstall" ? (c.function || c.source || "—") : (c.source || c.function || "—")
|
||||
const rawKey = b === "postInstall" ? groupLabel(c.function, c.source) : (c.source || c.function || "—")
|
||||
const key = `${b}:${rawKey}`
|
||||
const label = b === "postInstall"
|
||||
? groupLabel(c.function, c.source)
|
||||
|
||||
@@ -219,23 +219,31 @@ def ingest(limit: int = 5000) -> int:
|
||||
conn.execute("BEGIN IMMEDIATE")
|
||||
for r in rows:
|
||||
if r[2] == CLASS_INSTALLATION:
|
||||
# A package is one entry however often, or by whichever helper,
|
||||
# it is installed.
|
||||
found = conn.execute(
|
||||
"SELECT id FROM changes WHERE class = ? AND target = ?",
|
||||
(CLASS_INSTALLATION, r[7])).fetchone()
|
||||
elif r[2] == CLASS_CONFIGURATION:
|
||||
# A file is one entry no matter which function touched it — a
|
||||
# feature and its re-apply helper both land here — so it always
|
||||
# reads as origin -> current, not once per code path.
|
||||
found = conn.execute(
|
||||
"SELECT id FROM changes WHERE class = ? AND target = ?",
|
||||
(CLASS_CONFIGURATION, r[7])).fetchone()
|
||||
else:
|
||||
found = conn.execute(
|
||||
"SELECT id FROM changes WHERE function = ? AND target = ? "
|
||||
"AND operation = ?", (r[5], r[7], r[3])).fetchone()
|
||||
if found:
|
||||
# Everything but the identity and the original before_ref moves
|
||||
# to the latest application.
|
||||
# Only what reflects the current state moves forward; the
|
||||
# original attribution, operation, capture and before_ref stay,
|
||||
# so the entry keeps reading as how the host came versus now.
|
||||
conn.execute(
|
||||
"UPDATE changes SET recorded_at = ?, ingested_at = ?, class = ?, "
|
||||
"source = ?, function_version = ?, after_ref = ?, capture = ?, "
|
||||
"revert = ?, exactness = ?, result = ?, detail = ?, origin = ? "
|
||||
"WHERE id = ?",
|
||||
(r[0], r[1], r[2], r[4], r[6], r[9], r[10], r[11], r[12],
|
||||
r[13], r[14], r[15], found[0]))
|
||||
"UPDATE changes SET recorded_at = ?, ingested_at = ?, "
|
||||
"source = ?, function_version = ?, after_ref = ?, "
|
||||
"result = ?, detail = ?, origin = ? WHERE id = ?",
|
||||
(r[0], r[1], r[4], r[6], r[9], r[13], r[14], r[15], found[0]))
|
||||
else:
|
||||
conn.execute(
|
||||
"INSERT OR IGNORE INTO changes (recorded_at, ingested_at, class, "
|
||||
|
||||
Reference in New Issue
Block a user