Hi, excuse my ignorance, but is KVision also suita...
# kvision
s
Hi, excuse my ignorance, but is KVision also suitable for building a self-contained HTML page that can be sent around as a single file and viewed locally by opening the local file in a browser? I'm basically meaning a HTML report exported from a Kotlin application.
r
In general there are two files - *.html and *.js. But you could probably put the content of the JS file into HTML to get a single file.
An example hello world in a single file
s
Yes, that looks quite promising. Is there an example KVision project to generate such self-contained reports? Maybe even with some charts or react components?
r
Not at the moment. But I can try to create a simple gradle task for that.
Any ideas how would you like to generate the report itself?
s
I'm not exactly sure what you mean... in the end, the report represents data from the Kotlin data classes that I have. So I'd like to use my data classes basically as the input, and then using KVision write out a self-contained HTML reporter with embedded JS that displays the data from the classes in various way, like tables, trees and charts.
I guess the important bit is that the report should be generated at runtime of my application, and not by running a Gradle task.
r
"Using data classes as the input" is a bit unclear. Data classes in terms of what? A plain source code (.kt file)? A Kotlin object in memory (where? in the backend? frontend?)? A serialized representation (json?).
Checking your earlier conversation on kobweb channel I see you would like to have an application that generates a report, which is also an application. But those apps are always separated, whatever tech stack you would use to build them. So in my opinion there must a bridge to send the data between them. Serialized json representation doesn't seem to be a bad solution for this purpose.
If you would like the report application to be a Kotlin app it is by all means possible. I would just replace your React solution with KVision (or other Kotlin/JS framework), but kept the json transformation and HTML patching (I assume this means puting json report data directly into a pre-built HTML file).
s
Yes, correct, the "bridge" is serialized YAML. The ORT reporter tool reads serialized result files into data classes in-memory, and writes out a HTML report for that data. I'd like to replace the current solution (which involves e,bedding JSON into a JavaScript / React app) with a pure Kotlin solution.
So it's not a typical server scenario with a frontend / backend. Hence I'm unlcear whether KVision would be a good fit.
I would just replace your React solution with KVision (or other Kotlin/JS framework), but kept the json transformation and HTML patching (I assume this means puting json report data directly into a pre-built HTML file).
Thank, I guess I'll just give it a try.