Require confirmation and block deleting library actions still referenced by node groups.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user