Skip to content

Conversation

benloh
Copy link
Collaborator

@benloh benloh commented Feb 1, 2022

Merge after #198!

Branch: dev-bl/typeedit

This hacks the json-editor interface so that we can add some additional functionality around:

  • Renaming an existing node/edge type option label
  • Deleting a type option label
  • Deleting a type option label and remapping the deleted label to another label -- you would use this to combine two labels into one.

In addition to updating the template, the editor will now also update the existing dataset's type options if necessary.


To Test

We recommend making a backup of your dataset and template because these tests will change both template and dataset content.

  1. git fetch && git checkout dev-bl/typeedit
  2. npm run dev
  3. Go to http://localhost:3000

Test Rename

To rename a label, you just type the new name in the "Change To" field. The nice thing about this UI is that the original label is still visible if you're making decisions about naming while reviewing the whole list.

  1. Select "More..." and "Edit Template"
  2. Click on "Edit Node Types"
  3. Rename "Person" to "People"
  4. Click "Save Changes"
  5. Any nodes marked as Person should still be the same color (light blue by default)
  6. Open a known Person node and make sure its type has been changed to "People"
  7. In the terminal, ctrl-c quit NetCreate and start it again.
  8. The fresh reload of the data should still show the changes: Node types have changed to "People" and the color remains the same.

Test Delete

You can simply remove a type option by deleting it. However, deleting a type option will make it an unknown type -- this means that any node that is set to that type will be displayed as black because it will have an unknown type. We expect that most of the time when you want to delete a label, you would also want to remap it (see the next section "Test Delete and Remap").

  1. Select "More..." and "Edit Template"
  2. Click on "Edit Node Types"
  3. Check the "Delete" next to "Place" or some other type that you have on screen.
  4. Click "Save Changes"
  5. Any node that was a "Place" node should now display as black, since "Place" is no longer a type the system recognizes.

Test Delete and Remap

Instead of simply deleting a type option, you can tell the system to change any node with the deleted type to a new type.

  1. Select "More..." and "Edit Template"
  2. Click on "Edit Node Types"
  3. Check the "Delete" next to "Group" or some other type that you have on screen.
  4. In the "Change To" field, enter an existing name to map to, e.g. "People"
  5. Click "Save Changes"
  6. Any node that was a "Group" node should now display as a blue "People" node. The "Group" type is now deleted.

Test Adding

You can add new options.

  1. Select "More..." and "Edit Template"
  2. Click on "Edit Node Types"
  3. Check the "Add row".
  4. In the "Label" field, enter "Race"
  5. Leave the "Change To" field blank.
  6. Select a color
  7. Click "Save Changes"
  8. Set a node to the new type.
  9. You should see the new type listed in the type menu, and once it's set you should see the new color.

Technically we should probably hide the "Change To" field when adding a new field, but having it actually adds another handy feature. Read on...

Remap Inadvertent "Feature"

Another handy power user feature for managing type options is you can use the "Add Row" feature to both add a type AND rename it at the same time. This is handy if you find that you have a node with a stray type that hasn't been added. For example, let's say you found three black nodes set to a type "Race", but you do not currently have "Race" as a type option. And you don't want the type option to be "Race", you want it to be "Ethnicity". You can Add it and change it in one action:

  1. Select "More..." and "Edit Template"
  2. Click on "Edit Node Types"
  3. Check the "Add row".
  4. In the "Label" field, enter "Race"
  5. In the "Change To" field, enter "Ethnicity"
  6. Set the color to Purple.
  7. Click "Save Changes"
  8. Any node that was a "Race" node should now display as a purple "Ethnicity" node.

Under the hood what happens is:

  1. We create a new type option for any "Label" we find in the list.
  2. Then if there is something in the "Change To" field, we will search for nodes with the "Label" type and change them to the "Change To" type.

The UI is a little quirky, especially for someone who is not used to managing lists of items in this way. But the nice thing is we don't need to build a custom UI with a ton of actions to take for every single label.


Wiki

Edit Template

Locking Templates

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 Types / Edit Edge Types

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.

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.

benloh added 30 commits January 19, 2022 10:47
…nsparencies were being ignored/not properly restored.
…template. Otherwise, fall back to _default.template.toml.
…e any errant `id` field in JSON templates.
@benloh
Copy link
Collaborator Author

benloh commented Feb 8, 2022

Nodes and Edges will now display a warning message if the template is current open for editing.
screenshot_981

@benloh
Copy link
Collaborator Author

benloh commented Feb 8, 2022

@jdanish @kalanicraig One more question about Node Type and Edge Type Option editing: Currently the fancy tools that handle dataset remapping when editing types (e.g. using "Change To" map from an old type to a new type), are only available in the Node Type Option and Edge Type Option editors. They are NOT available in the main "Edit Current Template" view. That view just provides a flat list of options to edit without the data conversion tools.

While it is possible, it will be messy to add the conversion tools to the "Edit Current Template" tool. Also it makes the workflow very convoluted. So here are some assumptions I'm making:

  1. Assume that it's OK that the "Edit Current Template" is focused on the raw template editing and does not provide the data conversion tools.
  2. We could add instructional text to the "Edit Current Template" view informing users to use to use the "Node Type Option" and "Edge Type Option" editors if they need to convert data.
  3. Or, we could remove the Node Type Option and Edge Type Option from the Edit Current Template view altogether (though I don't like this solution as much as it can be more confusing to have it missing).

Any thoughts? Ideas?

@jdanish
Copy link
Collaborator

jdanish commented Feb 8, 2022 via email

@benloh
Copy link
Collaborator Author

benloh commented Feb 9, 2022

Standalone mode should work now. In addition, the "Edit Node" and "Edit Edge" buttons are now hidden in standalone mode.

…ge Types" rather than "Edit Current Template" for type options.
@benloh
Copy link
Collaborator Author

benloh commented Feb 9, 2022

Looks like nc-multiplex works fine.

@benloh benloh changed the title WIP Node/Edge Option Type Editor Node/Edge Option Type Editor Feb 9, 2022
@benloh benloh mentioned this pull request Feb 9, 2022
@benloh
Copy link
Collaborator Author

benloh commented Feb 9, 2022

@jdanish @kalanicraig Alright, I think the Node/Edge Type Option editors is now completed: locking template editing across the network now works, along with standalone mode fixes, and a confirmation that nc-multiplex still works.

Once you confirm the last few fixes starting with "New Feature: Network Locking" above, we can merge this into dev.

The next step will be to work on importing data.

@jdanish
Copy link
Collaborator

jdanish commented Feb 9, 2022

I noticed that the "NOTE: We recommend using the "Edit Node Types" feature to edit Node Types. It provides additional dataset migration tools." warning appears in both the edit not type editor, and the edit template editor. The first is a bit confusing since you are already there. Is that something that can be turned on only when it is part of the full editor? Same with edges. Otherwise, my minimal testing all looks good. Kalani can speak to more extensive testing / when it is ready, though.

@benloh
Copy link
Collaborator Author

benloh commented Feb 11, 2022

I think I have to remove the "NOTE: We recommend..." manually. It should be doable.

Also there's still an issue with Template edits propagating across the network: #204

@jdanish
Copy link
Collaborator

jdanish commented Feb 11, 2022

Also the key updating (I think I filed an issue?).

@benloh
Copy link
Collaborator Author

benloh commented Feb 11, 2022

Also the key updating (I think I filed an issue?).

Weird. I didn't get a notification. It's #206.

BTW, if you add a "Project" and select "Version 1.4" it should show up in the main work board I'm using: https://github.com/netcreateorg/netcreate-2018/projects/3

@benloh
Copy link
Collaborator Author

benloh commented Feb 14, 2022

@jdanish Three fixes:

  1. Template updates now properly propagate across the network (before Template updates only updated things on the local computer, remote computers were not updating).
  2. After selecting "Add Row" in either "Edit Node Types" or "Edit Edge Types", you now enter the new value in the "Change To" field. This makes behavior more consistent across the board: The "Label" field is always static, any text changes always go in "Change To".
  3. Fixed a minor bug where source and targets were not being properly converted.

This should complete all the features needed for this merge request.
The network data update changes are pretty fundamental, so it's worth doing a little more extended testing with this to make sure things still work as expected.

@jdanish
Copy link
Collaborator

jdanish commented Feb 14, 2022

Awesome. One thing I noticed by accident (I can file an issue if you need): If you go to edit a template, then navigate away in some way (e.g., reloading the page), then the network remains locked and there is no way to unlock it without a restart. Can we use the navigate away to trigger the unlock in one manner?

@benloh
Copy link
Collaborator Author

benloh commented Mar 9, 2022

Issue created in #219.
Merging.

@benloh benloh merged commit ab8ccbf into dev Mar 9, 2022
@benloh benloh deleted the dev-bl/typeedit branch May 28, 2023 00:11
benloh added a commit that referenced this pull request Sep 5, 2024
hotfix-comment-zindex: Keep comments visible on top of comment status…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants