Require confirmation and block deleting library actions still referenced by node groups.

This commit is contained in:
2026-07-20 21:00:24 +02:00
parent d188ca41b8
commit be255341e5
5 changed files with 217 additions and 0 deletions
@@ -128,6 +128,23 @@ func GroupsForNode(store NodeActionGroupStore, nodeID string) []NodeActionGroup
return result
}
// LibraryActionInUse reports whether any group item still references actionID as a library source.
// Local clones (source local) do not count even if they previously came from that action.
func LibraryActionInUse(store NodeActionGroupStore, actionID string) bool {
actionID = strings.TrimSpace(actionID)
if actionID == "" {
return false
}
for _, group := range store.Groups {
for _, item := range group.Items {
if item.Source == ActionItemSourceLibrary && item.LibraryActionID == actionID {
return true
}
}
}
return false
}
// UpdateGroupLastRunAt sets LastRunAt and UpdatedAt for a group and saves.
func UpdateGroupLastRunAt(dir string, groupID string, at time.Time) error {
store, err := LoadNodeActionGroupsOrEmpty(dir)