Develop multi-models HTML report site plug-in

Started by vbo75, December 17, 2021, 16:15:19 PM

Previous topic - Next topic

vbo75

Hi,

I need to present more than one model in the HTML report site. I expect to develop a plug-in (based on the actual plug-in) to select models to include in a global HTML report site.

Do you have some advises to develop this kind of plug-in ?

Thanks a lot.

Phil Beauvoir

Hi,

the general advice I can give is to study the code in the existing HTML Report plug-in. But what are you aiming for? Do you want to modify the existing plug-in (it uses String Template, CSS and JS) or use a different framework for generating HTML?
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Jean-Baptiste Sarrodie

Hi,

Quote from: vbo75 on December 17, 2021, 16:15:19 PMI need to present more than one model in the HTML report site. I expect to develop a plug-in (based on the actual plug-in) to select models to include in a global HTML report site.

I guess the real question is: why do you want to develop a plugin for what could be easily do manually (or through script) outside?

I personnaly often try to avoid complexity (and believe me, writing an eclipse plugin is complexity). COuld you explain your end goal so that we could help you devise a simpler way of doing it?

FWIW, in my team we maintain several models, and we use a very simple website (only one PHP page) to host our HTML exports of models. We simply export them and put the content under a folder, and then the "magic page" provides a portal page that dynamically lists the model and its update date. Automation could be easy as Archi can be run headless on command line, but in our case we just do it manually when needed.

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

vbo75

Quote from: Phil Beauvoir on December 17, 2021, 16:31:14 PMHi,

the general advice I can give is to study the code in the existing HTML Report plug-in. But what are you aiming for? Do you want to modify the existing plug-in (it uses String Template, CSS and JS) or use a different framework for generating HTML?

Hi,

Yes, I started to study existing HTML Report plug-in and found a way to create a new one based on your source code. The plug-in show a window in order to select current models to add to the report.

Now, I'm studying the stringtemplate code used to generate HTML files. For most of the files, it's ok because for each model, you create a folder named with the model's id.

It's a little bit more complicated for the model's tree. I think that I have to add the selected IArchimateModel's list to the STmodel and create a loop in the modelreport.stg file to build the HTML tree for each model.

A better way should be to create the HTML piece for each model's tree separately and after to put together all pieces in one file but it is not the way stringtemplate works.

Do you have an another idea ?

Thanks a lot.

vbo75

Quote from: Jean-Baptiste Sarrodie on December 17, 2021, 19:18:05 PMHi,

I personnaly often try to avoid complexity (and believe me, writing an eclipse plugin is complexity). COuld you explain your end goal so that we could help you devise a simpler way of doing it?

FWIW, in my team we maintain several models, and we use a very simple website (only one PHP page) to host our HTML exports of models. We simply export them and put the content under a folder, and then the "magic page" provides a portal page that dynamically lists the model and its update date. Automation could be easy as Archi can be run headless on command line, but in our case we just do it manually when needed.

Regards,

JB

Hi,

Thanks for your advise. Your one-PHP-page is a good idea.
I should prefer a more built-in solution and also, as I developed on Eclipse few years ago, it's a way for me to get back on Java coding ;-)


vbo75

Hi and Happy new year,

I finished a primary version of the plug-in (cf. screenshots).

I've found a way to generate models tree in the modelreport.stg using a list of Hashmap. For each model selected, the map contains model name, model id, model content folders and views folder (I separated views folder and other model content folders as they aren't at the same level in the <ul> list). I'm also filtering model content folders in order to not add them to the map if they are empty (no elements and no subfolders).

All other features are ok.

Are you interesting in testing it ?

At this time, I create a simple html main page that shows "Starting page..." text. Maybe, it could be interesting to create a models list with some informations.

The other thing I want to do is create view's thumbnails pages for each folder in views (like lightbox plug-in) but I don't now how to generate thumbnail.

Thanks for your help.


vbo75

January 13, 2022, 14:41:24 PM #6 Last Edit: January 13, 2022, 15:03:36 PM by vbo75
Hi,

Thinking about thumbnails and bad image quality when downsizing PNG file, I thought it would be a good thing to improve image definition in using SVG. So I found a solution for zooming and panning SVG in a HTML frame even if the frame is resizing.

Now, I have to add html link on diagram elements but SVG doesn't use map but a href directly included into the SVG code (a <a> tag put arround the element description).
I tried to understand how SVG are generated in the Archi code source but I didn't find when each element description is added to the file stream.

Thanks for your help.

Phil Beauvoir

Quote from: vbo75 on January 13, 2022, 14:41:24 PMHi,

Thinking about thumbnails and bad image quality when downsizing PNG file, I thought it would be a good thing to improve image definition with SVG file. So I found a solution for zooming and panning SVG in a HTML frame

Sounds good. But can you click on the objects in the diagram as you can with the PNG images?
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

vbo75

January 13, 2022, 15:09:27 PM #8 Last Edit: January 13, 2022, 15:11:22 PM by vbo75
Quote from: Phil Beauvoir on January 13, 2022, 14:43:36 PMSounds good. But can you click on the objects in the diagram as you can with the PNG images?

Yes, it's possible to click on a diagram element, but I have to include a herf directly in the SVG code. So I need to understand how SVG file are generated in Archi code source to add the good html link when a diagram element is rendering  in SVG.

Jean-Baptiste Sarrodie

Hi,

Quote from: vbo75 on January 13, 2022, 15:09:27 PMYes, it's possible to click on a diagram element, but I have to include a herf directly in the SVG code. So I need to understand how SVG file are generated in Archi code source to add the good html link when a diagram element is rendering  in SVG.

Unfortunately, the SVG is created by a low level method which simulates the way diagrams are drawn on screen. This means we have no control on it as this is seen as a drawing backend which is not related to the elements and there attributes. So we are drawing figures using draw2d primitives which are then "converted" to SVG operations. To my knowledge, there no way to trap this and add hrefs.

Maybe another option could be to generate the SVG like now, but then add other transparent objects on top of it to contain the hrefs.

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate