mdenet / educationplatform

Eclipse Public License 2.0
2 stars 3 forks source link

Add support for multifile output #121

Closed agarciadom closed 8 months ago

agarciadom commented 9 months ago

I have a more in-depth example for the "Dev" side of the Annual Symposium tutorial, involving EGX. The EGX tool function returns a JSON with potentially multiple generated files, like this:

{
    "generatedFiles": [
        {
            "path": "../gradle/lib/src/main/java/org/mdenet/HelloWorld.java",
            "content": "package org.mdenet;\n\npublic class HelloWorld {\n}\n"
        }
    ]
}

The problem is that showing this correctly requires implementing the multiple-output support that got dropped during the refactoring from the Epsilon Playground to the MDENet EP.

This PR adds it back for any panel definition that uses multi as its language, like this one:

{
  "id": "multicode",
  "name": "code",
  "panelclass": "OutputPanel",
  "icon": "editor",
  "language": "multi"
}

The panel definition would need to be in the tools.json of the relevant tool server.

With this and the latest version of the Epsilon playground-micronaut project, I can reproduce our EGX example:

image

szschaler commented 9 months ago

Thanks, @agarciadom, that's really useful to bring back in! @barnettwilliam can you review and merge, please?

agarciadom commented 9 months ago

I just did a minor cleanup of the code, removing the unnecessary id parameter. Feel free to merge it :-). You may want to document this new option in the wiki, too:

https://github.com/mdenet/educationplatform/wiki/Adding-a-Tool#paneldef

barnettwilliam commented 8 months ago

Yes definitely, Added documentation located mdenet/educationplatform.wiki@5f386c9ead32558f94e384b4b2ec99eea80c64cd branch 121-support-for-multiple-files