Archi Forum

Archi Plug-ins => jArchi => Topic started by: Hervé on February 05, 2019, 16:41:22 PM

Title: jArchi - generate views using graphlib
Post by: Hervé on February 05, 2019, 16:41:22 PM
Dear all,

I discovered few weeks ago the jArchi plugin (https://www.archimatetool.com/plugins (https://www.archimatetool.com/plugins)) and really believe it is a great tool as it simplifies automation, where a full Java plugin was necessary before.

I'd like to share with you a script I developed under jArchi  that automates the view creation. My use case is simple: when I copy Archi elements in a view, the elements are placed one next to the other but I miss an automatic placement that take in account the relationships between them (a kind of visualizer but in an Archimate view).

So I've written some scripts that allow to do this automatic placement, based on a graph created using the Dagre library, based on Graphlib and Lodash.

The main script is called generate_view.js and is not meant to be called directly by jArchi but receives all its required information through parameters. Four AJS scripts are provided as jArchi front-ends but many more could be easily written to fulfill specific needs:

To install them, copy the ZIP content to you scripts folder (%appdata%\Archi4\scripts on Windows) including the generate_view folder that contains all the required libraries, select a model or some concepts and run one of the provided scripts.

Of course, you must have the jArchi plugin to be able to run them.

At the moment, the scripts have got the following known limitations:

Please do not hesitate to provide comments and improvement requests.

Best regards
Hervé
Title: Re: jArchi - generate views using graphlib
Post by: Phil Beauvoir on February 05, 2019, 20:26:20 PM
Hi Hervé,

this is pretty cool. I tired it and it works. 8) Thanks for sharing.

This goes to show what can be achieved with the jArchi scripting plug-in and some ingenuity. I hope other folks can make use of it!

Phil
Title: Re: jArchi - generate views using graphlib
Post by: Hervé on February 05, 2019, 20:43:51 PM
Yes, quite limited, but it works enough for my needs ...

As you may remember, I get a copy of my CMDB (applications, servers, relationships between them, etc ...) into Achi through my ServiceNow Import plugin. But with 1104 applications, I cannot afford to create views manually.

Si my first need is to generate them automatically ...

jArchi is very powerful ... And I'm event thinking about migrating one or two plugins from Java to jArchi (like the ServiceNow Import plugin). They would be much more easy to maintain ...
Title: Re: jArchi - generate views using graphlib
Post by: ievgenii on July 30, 2019, 17:02:38 PM
Hi Hervé,

Thanks for the script - looks promising. I was just missing something similar in Archi because relations become messy on big models. Would be great to have auto-routing like on attached sample (which BizzDesing does)

Regards,
Ievgenii
Title: Re: jArchi - generate views using graphlib
Post by: Hervé on July 30, 2019, 19:23:21 PM
Hi,

Indeed ... If you develop such script, I'm very interested :-)

Best regards
Hervé
Title: Re: jArchi - generate views using graphlib
Post by: casacde on August 07, 2019, 07:08:39 AM
Hello Hervé,

many thanks for these incredibly useful scripts! Have just tested these and they work great!
I've been working with Archi for some time and slowly realize the incredible potential that lies in using Archi in conjunction with jArchi and (for example) Neo4j.
Thanks a lot!

Regards, Carsten
Title: Re: jArchi - generate views using graphlib
Post by: vegardv on September 19, 2019, 12:14:39 PM
This is *very* useful. Thank you for providing this.

I have created some scripts for generating models from our CMDB, and I needed a way to generate a view based on a newly created element. I created a naive patch (attached) to the main script so that I can pass an actual element in 'param.concepts'.

Have you considered registering this in a public repo (github, gitlab)?
Title: Re: jArchi - generate views using graphlib
Post by: Hervé on September 19, 2019, 20:48:25 PM
Hi,

My scripts are very limited and I was waiting for some improvements before publishing the to public repo. unfortunately, I lack time to work on them at the moment  :-[

Best regards
Hervé
Title: Re: jArchi - generate views using graphlib
Post by: Manj75 on June 10, 2021, 17:06:39 PM
Hi Herve,

I've just reconnected with using Archi and had forgotten about this very useful jArchi script.  I was wondering if there's been any newer version of this script or if it's planned for any active developed for improvements.

Regards, M
Title: Re: jArchi - generate views using graphlib
Post by: Hervé on June 10, 2021, 21:04:20 PM
Hi,

Unfortunately, the graphlib library still lacks important features to be very usefull :
    - It does not allow to create relationships with group elements, therefore when creating views with nested elements, the relationships with elements that contain other elements do not participate to the graph position.
    - The connections between the elements in the graph are straight lines (bendpoints are not created yet)
    - It is not possible to create relationships to or from relationships

Thats the key reasons why I stopped working on this javascript. But if you know a better libray, I can have a look :)

Best regards
Hervé