Mark removed/disabled packages as uninstalled
Packages that only exist in the DB but are no longer in NODE_CLASS_MAPPINGS or LOADED_MODULE_DIRS get status "uninstalled" and appear in a separate greyed-out section at the bottom of the dialog. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,7 @@ async function showStatsDialog() {
|
||||
const considerRemoving = custom.filter((p) => p.status === "consider_removing");
|
||||
const unusedNew = custom.filter((p) => p.status === "unused_new");
|
||||
const used = custom.filter((p) => p.status === "used");
|
||||
const uninstalled = custom.filter((p) => p.status === "uninstalled");
|
||||
|
||||
let html = `<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;">
|
||||
<h2 style="margin:0;color:#fff;font-size:18px;">Node Package Stats</h2>
|
||||
@@ -133,6 +134,11 @@ async function showStatsDialog() {
|
||||
html += buildTable(used, "used");
|
||||
}
|
||||
|
||||
if (uninstalled.length > 0) {
|
||||
html += sectionHeader("Uninstalled", "Previously tracked, no longer installed", "#555");
|
||||
html += buildTable(uninstalled, "uninstalled");
|
||||
}
|
||||
|
||||
dialog.innerHTML = html;
|
||||
overlay.appendChild(dialog);
|
||||
document.body.appendChild(overlay);
|
||||
@@ -168,6 +174,7 @@ const STATUS_COLORS = {
|
||||
consider_removing: { bg: "#2a2215", hover: "#3a2e20" },
|
||||
unused_new: { bg: "#1a1a25", hover: "#252530" },
|
||||
used: { bg: "#151a15", hover: "#202a20" },
|
||||
uninstalled: { bg: "#1a1a1a", hover: "#252525" },
|
||||
};
|
||||
|
||||
function buildTable(packages, status) {
|
||||
|
||||
@@ -130,10 +130,12 @@ class UsageTracker:
|
||||
}
|
||||
packages[pkg]["total_nodes"] = total
|
||||
|
||||
# For packages that came only from DB (e.g. uninstalled), fill total_nodes
|
||||
# Packages only in DB (not in mapper) are uninstalled/disabled
|
||||
installed_packages = set(node_counts.keys()) | mapper.get_all_packages()
|
||||
for pkg, entry in packages.items():
|
||||
if "total_nodes" not in entry:
|
||||
entry["total_nodes"] = entry["used_nodes"]
|
||||
entry["installed"] = pkg in installed_packages
|
||||
|
||||
# Classify packages by usage recency
|
||||
now = datetime.now(timezone.utc)
|
||||
@@ -142,7 +144,9 @@ class UsageTracker:
|
||||
tracking_start = self._get_first_prompt_time()
|
||||
|
||||
for entry in packages.values():
|
||||
if entry["total_executions"] > 0:
|
||||
if not entry["installed"]:
|
||||
entry["status"] = "uninstalled"
|
||||
elif entry["total_executions"] > 0:
|
||||
# Used packages: classify by last_seen recency
|
||||
if entry["last_seen"] < two_months_ago:
|
||||
entry["status"] = "safe_to_remove"
|
||||
|
||||
Reference in New Issue
Block a user