Configuring solutions

Explanation on configuring solutions.

Introduction

A web application on the Packhunt platform is called a solution. You can create multiple solutions within any organisation that you belong to.

A solution can have different web pages defined using one or more frames. Frames are generic containers with various types of content inside them.

As an example, the diagram below shows a solution with a page defined using a single frame. This frame contains three entities: a Grasshopper model, a control panel with some sliders, and a viewer for showing 3D geometry. These entities are then connected to create a simple configurator. The data from the control panel (the slider values) is passed to the model, and the data from the model (the geometry) is passed to the viewer.

Solutions

The configuration file defines a set of objects with properties. The top-level object is the Solution. This object then contains various lower-level objects.

As an example, the diagram below shows the structure of the configuration. The home frame contains the control panel, the model, and the viewer. Two other frames are also defined that are empty.

Here is the configuration code for this example. (Note that some content has been omitted.)

kind: Solution
version: v0
router:
  kind: Router
  routes:
    - frame: home
    - frame: frame-1
    - frame: frame-2
frames:
  # ====== HOME FRAME ======
  home:
    kind: Frame
    layout:
      kind: ColumnLayout
      widths: [auto, 300px]
      areas: [viewer, params]
    contents:
      model:
        kind: Model
        modelFile: trimbox.gh
        # more
      viewer:
        kind: Viewer
        # more
      params:
        kind: ControlPanel
        controls: {}
        # more
  # ====== FRAME 1 ======
  frame-1:
    kind: Frame
    # more
  # ====== FRAME 2 ======
  frame-2:
    kind: Frame
    # more

The Solution has a router and a set of frames.

  • Frames are general types of containers that have a layout and contents.
  • The router maps links to web pages defined using some combination of nested frames.

A web page can contain just a single frame. But for many web pages, frames are embedded within one another creating a more complex hierarchical structure. Different links then get mapped to different combinations of frames.

In the configuration, the frames are defined as a dictionary. Each entry in the dictionary consists of a key-value pair, where the key is the name of the frame and the value is a Frame object. In the example above, this dictionary has three frames with keys: home, frame-1, and frame-2. These are all top-level frames, representing three separate web pages.

The following sections contain more information about frames and routers.