HADotNet.CommandCenter icon indicating copy to clipboard operation
HADotNet.CommandCenter copied to clipboard

Allow wildcard includes in config.json to parse additional page json files

Open siege9929 opened this issue 3 years ago • 3 comments

Describe the new functionality

Allow includes in the config.json file so that we can create one json file per page. It's often easier for me to manually create pages via copying sections and editing a few variables, especially when I have an interface that includes common elements on every page like a row of nav buttons. If the config file allowed wildcard includes, I could copy a page json file, edit a few things, and have a new page with predefined tiles.

Additionally, it could be nice to add an option for a layout section of tiles that spans multiple pages, so I only have to set them up and edit them one time, instead of once per page. Again this would be nice for a nav bar or a header.

What will it look like in the Admin area?

No change

What will it look like on the dashboard?

No change.

siege9929 avatar Oct 26 '22 16:10 siege9929

Hey there, looks like this is your first time submitting a bug or enhancement to HACC! Thanks for helping make HACC a better app! 🎉

github-actions[bot] avatar Oct 26 '22 16:10 github-actions[bot]

Would you be able to provide a sample (JSON markup or similar) of what this would look like?

qJake avatar Oct 26 '22 19:10 qJake

Sure! Something like this. In the main config.json, add a section to "pages" listing files or directories of files to include:

"pages": [
    {
        "files": [
            "./page1.json",
            "./data/page2.json"
        ],
        "directories": [
            "./page1/",
            "./data/page2/"
        ]
    },
    ... other pages below
]

Each of the files directly included or included in the directories would contain one or more sections that would normally be inside the "pages" section, so a file would look like this:

{
    "name": "default",
    "description": "Default Page",
    "isDefaultPage": true,
    "autoReturnSeconds": 0,
    "tiles": [
        {
            "name": "Tile",
            "sizeX": 2,
            "sizeY": 2,
            "type": "state"
        }
    ]
}

Spanning multiple pages is less important to me, but I suppose you could define a page section with a "span" key where you could list page names that it appears on.

siege9929 avatar Nov 24 '22 23:11 siege9929