archi icon indicating copy to clipboard operation
archi copied to clipboard

[feature request] filter orphans

Open MatthijsE opened this issue 1 year ago • 2 comments

Hi,

First: Thank you for your time giving us this great tool.

I would like to suggest the following feature: A filter option to filter orphan elements. I consider a element an orphan when it is not used in a view. These are already visible in the model by it's italic font, but filtering would make maintaining the model a lot easier. If it is not to much of a trouble, I would like to request also a filter option for elements that have no relations to other elements.

Thank you for taking this into consideration.

Matthijs

MatthijsE avatar Jul 15 '24 07:07 MatthijsE

filtering would make maintaining the model a lot easier.

If the aim is to maintain the model by removing "orphan" elements or elements that have no relations to other elements then the following jArchi script is even easier than filtering and manually deleting them.

// jArchi script to delete orphan elements (not in a view) or elements that have no incoming or outgoing relations
$("element").forEach(element => {
    if($(element).viewRefs().isEmpty() || $(element).rels().isEmpty()) {
        element.delete();
        console.log("Deleted: " + element);
    }
});

Phillipus avatar Jul 15 '24 08:07 Phillipus

All elements unused in a view are listed in Validator warnings image

lvmm avatar Jul 20 '24 12:07 lvmm