Chapter 29. Adding a Field to a Desktop Panel

This recipe assumes that the necessary table is already used on the relevant panel and that a column already exists containing the data to present, see other recipes if this is not the case. This recipe can be run from anywhere on a machine with the necessary packages installed and suitable configuration of PostgreSQL (see configuration recipe).

(1) First create a local XSDDB to use

ttkm create

(2) Now reload the relevant model, we will use Hypatia in this example - the relevant ModelLibrary packages must be installed for this to work.

ttkm hypatia reload

If instead you are using a local working copy of the repository for the model (so that the changes can be committed, packaged and distributed) then change into an uptodate working copy of the ModelLibrary directory first).

cd -/hypatia/library/hypatia
ttkm reload

The remainder of the recipe assumes that we are within the ModelLibrary directory in the working copy of a repository.

Installed packages must be compatible with the current Theon version. To rebuild, from the working copy do as below before the reload. For this to work you will need the Theon library package installed. The content may need to be modified for this to work, depending on changes.

THEON_MODEL_XSLT_PATH=/usr/share/theon/self/xslt ttkm derive ddldata
ttkm reload

(3) Start the local UI server to alter XSDDB

ttkm self server ui

ABOVE DIDNT WORK - DUE TO CONFIG FILE NOT HAVING ""session_secure": False," - NEED TO INCLUDE THAT SOMEWHERE/SOMEHOW

(4) Point a locally running browser at http://localhost:8000/ui.html and follow these steps:

open the "Reflection" desktop
select the "Panel" panel and query for the relevant panel
in the "Fields" box add a row and enter the next Position number,
choose the base table or connector table from the drop-down, choose
the attribute/column to add from the drop-down, if relevant choose
the presenter from the drop-down, set any field specific options
(e.g. read only, width) and a name label.
Save Changes

(5) Stop the local UI server, by ^C.

(6) Launch a suitable ModelLibrary and LiveProfile to test the changes in the UI. This will depend on the database the desktops are built to run against and whether it is being tested against a remote live production service or a local development instance for example. Below is an example, here using the remote physical database infdb on a remote host also called infdb.

ttkm hypatia launch at /tmp upon testhyp using database=infdb host=infdb

Above will create a ModelLibrary in /tmp/hypatia from which to build the test environment from the modified desktops against a database connection defined in the LiveProfile testhyp.

(7) Now rebuild the UI data from the change to test

ttkm export at /tmp/hypatia
THEON_MODEL_XSLT_PATH=/usr/share/theon/ui/xslt ttkm derive at /tmp/hypatia ui
"session_secure": False,

(8) Start the local UI server on the new data set

ttkm server at /tmp/hypatia ui

Test the changes work by pointing local browser at http://localhost:8000/ui.html and navigating to the altered panel.

If everything is not ok then iterate back through steps (3) to (8), skipping (6), until works.

(9) Commit the schema changes and re-package.

ttkm export