Skip to content

Edit Template

Flynn Duniho edited this page May 29, 2024 · 6 revisions

Using the "Edit Template" tab in admin mode.

AUDIENCE: This feature intended for use by researchers and advanced users only.

TABLE OF CONTENTS


IMPORTANT:

  • Only administrators can edit templates using ?admin=true.
  • Editing a template modifies the *.template.tomlfiles that are saved on the server.
  • When a template is being edited, Node and Edge editors are disabled.
  • If you're in the middle of editing a Node or Edge, the Template editors will be disabled.

To edit a template:

  1. Start Net.Create on the server
  2. Log onto Net.Create as an admin
  3. Select the "More..." tab
  4. Select the "Edit Template" tab

You can edit the current template in a variety of ways:

  • Edit Node Type
  • Edit Edge Type
  • Edit Current Template
  • Download Current Template
  • New Template
  • Import Template File

Locking Templates

See #200

While editing templates, you cannot edit nodes or edges. This is because changes to the Template can affect how Nodes and Edges behave and are displayed. Changes to the template can also result in changes to the dataset (e.g. one node type is remapped to another node type).

Conversely, when you are editing a node or edge, you are not allowed to edit templates.

There is a warning message displayed on the Node/Edge if this occurs.

Edit Node/Edge Types

Click on the "Edit Node Types" button to edit the node types defined in the current template. Click on the "Edit Edge Types" button to edit the edge types defined in the current template.

"Edit Node Types" and "Edit Edge Types" allows you to quickly edit just the node type or edge type instead of having to edit the whole current template (that's what "Edit Current Template" does). The basic functionality is the same as "Edit Current Template".

You can set:

  • label of the node/edge type -- This is what is displayed in the Node Editor.
  • color of the node/edge type
  • Add new option
  • Remove an existing option
  • Change the order in which the types appear.

When you are happy with the changes, click "Save". The template will be updated, the graph redrawn, and the changes written to the current template file on the server.

What happens when you change the label? The label field determines what is displayed in the popup menu for Type in the Node Editor or Edge Editor. If you change an existing label:

  • The updated label will appear in the Node Editor / Edge Editor type menu in place of the old label.
  • Any existing node / edge that is using the label is not converted. So if you open any existing node / edge that uses the old label in a Node Editor or Edge Editor, it will open with a blank type (since the old selection is no longer available for populating the menu). The node / edge will still the original label information (which you can see if you look at the label in the Node or Edge Table). You need to manually select and edit the Node and reselect the new label type to change the type.

New "color" setting for Edge Types

  • Colors for edge types was partially defined and implemented previously. With the template change, it was easy to add the feature. So now you can define a different line color for each edge type. Keep in mind the transparency settings will affect how the edge colors appear.

When editing node types or edge types, if you use the "Change To" field, Net.Create will automatically update your dataset for you: any nodes and edges using the original "Label" type will be updated to use the new "Change To" type. This change is executed as soon as you click "Save Changes". Your dataset file on disk will be updated immediately.

Default "No Type Selected" Type

A blank label will set the default "No Type Selected" type color. If this is missing, just add a new type with a blank label. Note that the order of the types is the order they will be displayed in the LEGEND/KEY, so move them up/down as you want.

Extra blank labels will be removed when the template is saved. Only the first blank is kept.

NOTES

  • If you inadvertently add a row and leave the "Label" field blank, the system will remove the row when it saves.
  • The system automatically adds a "blank default" type option so that Node Types and Edge Types can be set to an un-selected blank state. This is completely invisible to the user. [DEPRECATED as of 5/2023: The default type is now directly editable, see 'Default "No Type Selected" Type' above.

Edit Current Template

Clicking "Edit Current Template" will open the current template in the json-editor. You can then change any value in the template, and hit "Save" to save the changes.

IMPORTANT:

  • EXPERTS ONLY!!! Do not edit the whole template if you do not know what you're doing!!! You can inadvertently break the template and dataset with the wrong change.
  • The form provides some context and help for each field.

Missing Properties: Use "Object Properties"

The json-editor only displays properties that have been defined in the *.template.toml file. In some cases, if for instance you've imported/converted a JSON file or created a new TOML template file from scratch, you may find that you had inadvertently ommitted a property that you would like to change. These properties will not be available in the editor for modification.

In these cases, you CAN actually add the property by clicking on the "Object Properties" button next to the header section. For instance, if you find yourself wanting to set the searchColor but it was not included in the current template, and is therefore not visible, you would:

  1. Edit Current Template
  2. Click "Object Properties" next to the main "NetCreate Tempalte" heading
  3. Scroll down and check the "searchColor" property
  4. The parameter should immediately appear in the editor (you might have to scroll down to see it)

This should only allow you to add properties that have been previously defined in the schema.

Download Current Template

Clicking "Download Current Template" will allow you to download the currently loaded template to a file on your local hard disk via your browser. The file will have the same name as the template file on the server.

The downloaded file is in TOML format.

You can use this to save backups or as a starting point for defining new templates.

New Template

Clicking "New Template" will replace the currently loaded template with a new blank template cloned from the _default.template.toml file in build/app/assets/templates/_default.template.toml. If you save the file it will be saved with the name of the current dataset. E.g. if you had tacitus.json open, and clicked "New Template" then saved the changes, you would now have a tacitus.template.toml file.

The main use model here is if you are creating a new dataset, try some changes, and decide you don't like them and want to start fresh with a new template, you can do so without quitting and restarting the app and deleting the old template file.

Import Template

Click "Choose File" and then select a *.template.toml file to replace the current template file with a new TOML template file.

After you import the template, the editor will be shown. Review it to make sure it's what you want. Make any changes. Then click "Save" to save the template to the server and reload the dataset with the new template.

NOTE: If you don't click "Save", the imported template will not be applied to the current dataset. You can just click "Cancel" to leave your original template as-is.

This is probably the easiest way to create a new dataset and clone the template from another dataset without restarting the server.

Save/Cancel Buttons

All of the template editors will show a "Cancel" and "Save" buttons once you've started editing.

  • "Cancel" will exit the node type editing without saving the changes.
  • "Save" will save the template changes, apply them to the current dataset, and write the changes to the server.

Saves will overwrite the exisitng <projectname>.template.toml file. The previous version will be saved with a timestamp, so it should be relatively easy to revert if you need to. But we'll need to keep an eye on accumulating versions and perhaps figure out a solution for this.

Clone this wiki locally