Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic tree creation functionality #5080

Open
wants to merge 49 commits into
base: production
Choose a base branch
from
Open

Add basic tree creation functionality #5080

wants to merge 49 commits into from

Conversation

Areyes42
Copy link

@Areyes42 Areyes42 commented Jul 8, 2024

Fixes #5268, as part of #4833

This PR implements Version 1 of the Tree Creation Process outlined in 4833. You should be able to create trees via the new add button in the Tree View. 🎉

image

This PR creates a tree with ranks, but without any items or anything--testing adding to the new tree/etc isn't apart of testing since it doesn't come with a root node by default!

Checklist

  • Self-review the PR after opening it to make sure the changes look good
    and self-explanatory (or properly documented)
  • Add automated tests
  • Add relevant issue to release milestone

Testing instructions

  • Log in as an admin.
  • Go to the Storage and Geography tree views and make sure that the Add button is not present on either tree.
    • Add button will appear after the edit button next to the tree's name.
  • Go to the Taxon tree view and see that the Add button is there.
  • After clicking on the Add button, ensure that a dialog with a list of default trees appear. Make sure you can select each one.
    • The list should include Botany, Entomology, Herpetology, Ichthyology, Invertebrate Paleontology, Invertebrate Zoology, Mammalogy, Ornithology, Paleobotany, Vascular Plants, and Vertebrate Paleontology
  • After selecting a record, make sure that you cannot add any TreeDefItems, but can still edit and delete existing ones.
    • Check this on multiple subview types--subform, grid, and button. Button is the default, and the XML for a diff form is below.
  • Upon saving, make sure that the new tree is in the tree dropdown.

Permissions

  • Log in as a non-admin.
  • Go to the Taxon tree view and make sure that the Add button is not there.

Here is the taxon tree definition form used in development, from #5073 (thanks Jason!)--it'll be added as the default form in v7.9.8, but this PR should work with any form. You'll need to click 'Show all tables' in App Resources--also make sure that you're adding it to Taxon Tree Definition, and not Taxon Tree Definition Item.

<viewdef name="TaxonTreeDef" class="edu.ku.brc.specify.datamodel.TaxonTreeDef" type="form" gettable="edu.ku.brc.af.ui.forms.DataGetterForObj" settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
	<desc>The TaxonTreeDef Table</desc>
	<enableRules/>
	<columnDef>p,2px,p,2px,p,2px,p,2px,p,2px,p,p:g</columnDef>
	<rowDef auto="true" cell="p" sep="2px"/>
	<rows>
		<row>
			<cell type="label" labelfor="name"/>
			<cell type="field" id="name" name="name" uitype="text"/>
		</row>
		<row>
			<cell type="label" labelfor="fullNameDir"/>
			<!--   The FullNameDirection picklist can be explicitly specified here, but is inferred because the PickList is assigned at the Schema Config for the field -->
			<cell type="field" id="fullNameDir" name="fullNameDirection" default="1" uitype="combobox"/>
		</row>
		<row>
			<cell type="label" labelfor="remarks"/>
			<cell type="field" id="remarks" name="remarks" uitype="textareabrief" rows="2" colspan="6"/>
		</row>
		<row>
                         <!--    Not specifying viewname: Specify is using the view called TaxonTreeDefItem (default for the table)   -->
			<cell type="subview" id="items" name="treeDefItems" colspan="8" defaulttype="table" initialize="sortField=rankId"/>
		</row>
	</rows>
</viewdef>

@Areyes42 Areyes42 added 2 - Trees Issues that are related to the tree system and related functionalities. 2 - API Issues that are related to the APIs labels Jul 8, 2024
@Areyes42 Areyes42 added this to the 7.9.11 milestone Jul 8, 2024
@Areyes42 Areyes42 closed this Jul 8, 2024
@Areyes42 Areyes42 reopened this Jul 8, 2024
@CarolineDenis CarolineDenis modified the milestones: 7.9.11, 7.9.8 Sep 11, 2024
@combs-a combs-a marked this pull request as ready for review September 16, 2024 13:55
@combs-a combs-a requested review from a team September 16, 2024 13:56
@@ -252,7 +256,8 @@ export function IntegratedRecordSelector({
preHeaderButtons={collapsibleButton}
sortField={sortField}
viewName={viewName}
onAdd={(resources): void => {
onAdd={isTaxonTreeDefItemTable ? undefined :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering that the TaxonTreeDefItems have their own specific adding setup, we did this so that there wouldn't be any weirdness with ranks (if you add a rank via the TreeDef editor then the new rank will be the lowest rank + 10 automatically and you can't edit it unless forms have been changed)

We don't think our changes will affect anything else but let us know 👍

@combs-a combs-a requested a review from a team September 16, 2024 14:13
Copy link
Contributor

@alesan99 alesan99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing instructions

  • Log in as an admin.
  • Go to the Storage and Geography tree views and make sure that the Add button is not present on either tree.
    • Add button will appear after the edit button next to the tree's name.
  • Go to the Taxon tree view and see that the Add button is there.
  • After clicking on the Add button, ensure that a dialog with a list of default trees appear. Make sure you can select each one.
    • The list should include Botany, Entomology, Herpetology, Ichthyology, Invertebrate Paleontology, Invertebrate Zoology, Mammalogy, Ornithology, Paleobotany, Vascular Plants, and Vertebrate Paleontology
  • After selecting a record, make sure that you cannot add any TreeDefItems, but can still edit and delete existing ones.
    • Check this on multiple subview types--subform, grid, and button. Button is the default, and the XML for a diff form is below.
  • Upon saving, make sure that the new tree is in the tree dropdown.

Permissions

  • Log in as a non-admin.
  • Go to the Taxon tree view and make sure that the Add button is not there.

Its working pretty well so far! 👌👍👍
I encountered two issues:

  1. Creating two trees of the same type causes an error:
chrome_XDan9GxfIf.mp4
  1. While I can't add a Rank through this menu, I also can't successfuly delete one. I don't know if that's strictly related to this PR though.
chrome_XdQE0gEqkD.mp4

And as a side note, its not possible to delete an empty tree after creating it without deleting the ranks first, but that's probably a separate feature request.

chrome_KHw7gTqtgi.mp4

@alesan99 alesan99 requested a review from a team September 16, 2024 18:12
@combs-a
Copy link
Collaborator

combs-a commented Sep 16, 2024

@alesan99 Can you try to recreate the second issue? I wasn't able to :(

It also looks like the name of the tree is the same as an already existing tree, so that might be the issue?

Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing instructions

  • Log in as an admin.
  • Go to the Storage and Geography tree views and make sure that the Add button is not present on either tree.
    • Add button will appear after the edit button next to the tree's name.
  • Go to the Taxon tree view and see that the Add button is there.
  • After clicking on the Add button, ensure that a dialog with a list of default trees appear. Make sure you can select each one.
    • The list should include Botany, Entomology, Herpetology, Ichthyology, Invertebrate Paleontology, Invertebrate Zoology, Mammalogy, Ornithology, Paleobotany, Vascular Plants, and Vertebrate Paleontology
  • After selecting a record, make sure that you cannot add any TreeDefItems, but can still edit and delete existing ones.
    • Check this on multiple subview types--subform, grid, and button. Button is the default, and the XML for a diff form is below.
  • Upon saving, make sure that the new tree is in the tree dropdown.

Permissions

  • Log in as a non-admin.
  • Go to the Taxon tree view and make sure that the Add button is not there.

Some more insight into the second issue that @alesan99 discovered. When you first add a tree before it is saved and try to remove any of the ranks it works, if the tree has already been saved and you go back and try to delete the highest rank it works, but if the tree has been saved and you try to remove the lowest rank it causes an error.

Before saving the tree:

chrome_WdIZ09CVd1.mp4

After saving the tree:

chrome_abV21hmdfV.mp4

Areyes42 and others added 2 commits September 17, 2024 15:01
@CarolineDenis
Copy link
Contributor

CarolineDenis commented Sep 27, 2024

@Areyes42 @combs-a
Could you add also an empty tree with just a root node? You could call it Empty Tree

@combs-a
Copy link
Collaborator

combs-a commented Sep 30, 2024

@Areyes42 @combs-a Could you add also an empty tree with just a root node? You could call it Empty Tree

Would that be a good idea currently, with the issue of the tree automatically setting the root rank as the lowest instead of the highest?

Copy link
Member

@grantfitzsimmons grantfitzsimmons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we should obfuscate this button more than we have now. It's a bit too apparent considering how infrequent this action is going to be taken.

@combs-a
Copy link
Collaborator

combs-a commented Oct 22, 2024

It seems like we should obfuscate this button more than we have now. It's a bit too apparent considering how infrequent this action is going to be taken.

Where would you suggest it be?

@melton-jason melton-jason self-requested a review October 22, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - API Issues that are related to the APIs 2 - Trees Issues that are related to the tree system and related functionalities.
Projects
Status: Dev Attention Needed
Development

Successfully merging this pull request may close these issues.

Create New Tree Tool V1
7 participants