Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic support for a multi-tier tree structure of the Templates package #422

Open
AntoineGautier opened this issue Jan 7, 2025 · 0 comments
Assignees
Labels
enhancement Top Priority Top of the Priority List

Comments

@AntoineGautier
Copy link
Collaborator

AntoineGautier commented Jan 7, 2025

The current version of ctrl-flow lacks support for a multi-tier tree structure such as:

System 
└── Subsystem
    └── ...
	└── Template

Building the app with MBL commit 2bfde98b1c in which the following classes are annotated with __ctrlFlow_template yields the following screen in the UI.

Buildings/Templates/Plants (* package.mo)
├── Controls (* package.mo)
│   └── HeatPumps (* package.mo)
│	└── AirToWater.mo (*)
└── HeatPumps (* package.mo)
    └── AirToWater.mo (*)
Picture1

The logic behind the current implementation is to simply display a flat list of all system types, where a new system type is created for each package.mo file annotated with __ctrlFlow_template. Each system type is populated by the set of templates found below, based on their path, regardless of the nesting level, and regardless of potential duplicates.

The order of the system types does not match the one in package.order (or in the package definition file for single-file packages). See the joint issue: lbl-srg/modelica-json#262

This is in stark contrast with the original requirement specification which stated:

  • A file explorer with a tree view should reveal the package structure in a left panel.
  • Only the classes defined in the package file, or enumerated in the package.order file shall be displayed. And they shall be displayed in the same order as the one specified by those two files.

To provide basic support for nested packages, duplicates will be removed by using the immediate parent package for the system type. From here, we can generate a list of system types, but we still lack support for:

  • subtypes,
  • ordering the templates according to the package.order file.

To help the future development of a tree view that allows for multiple levels of hierarchy, a generic tree-like type will already be introduced to store the templates, e.g.:

type TemplateNode = {
    description: string;
    className: string;
    json: Object;
    contents?: Array<TemplateNode>;
};

The work on this issue will also improve the routing logic based on the description from https://github.com/lbl-srg/modelica-buildings-templates/blob/master/docs/guide.md?plain=1#L568-L575.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Top Priority Top of the Priority List
Projects
None yet
Development

No branches or pull requests

1 participant