Skip to content

Conversation

@CarolineDenis
Copy link
Contributor

@CarolineDenis CarolineDenis commented Jun 16, 2025

Fixes #2931
Fixes #4832
Fixes #6210

Adds an initial set up page for configuring your database much like the Spwizard for Specify 6.

image

TODO:

  • Title colors are white-on-white.
  • Make certain fields required (at least for user)
  • Error on backend doesn't stop you from progressing onto the next step.
  • Defaults for fields (So certain tree ranks can be true by default)
  • Progress indicator?
  • Backend should tell frontend which step to go to next. Needed to conditionally skip geography tree setup pages.
  • Setup can be finished before schema is finished being created. Need to have some sort of waiting page, or speed improvement? Thinking I can change the setup so you fill out the forms first, then at the very end the database is created.
  • Use new default files Feat (setup tool): Create default files for the new setup tool #7444
  • Create trees
  • Add documentation links
  • Only use localized strings
  • Add better error handling. User should be notified and sent back to the forms if anything goes wrong.
  • Check if worker is set up before continuing.
  • specifyuser_spprincipal table needs to exist before the setup process works on a new sp7 database. It also looks like the admin user isn't actually a proper admin.

Future TODO:

  • Password confirmation input doesn't work if you input the password into it first, then fill out the normal password field.
  • Notification polling seems to be causing errors on the backend when lingering on the setup page. Will investigate.
  • Need schema for API
  • Save form to localStorage. Also change the Save & Continue text maybe.
  • Normalize all keys (recursively) on backend api requests
  • Institution should have a value for all treedef fields once all trees are created. There should be api.finalize_institution or something similar.
  • There should be a functioning progress bar during the setup.
  • Speed up schema config localization setup. This is the biggest bottleneck in the setup process and it can be sped up significantly.
  • Fix two geography tree forms showing up on the overview sidebar.
  • Add documentation links and descriptions to all resources
  • Move over default tree creation functions to tree folder

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add pr to documentation list
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR

Testing instructions

  • Use a blank DB to test this PR.
  • Try to create dbs with different disciplines. At least a paleo/geo discipline and a non-paleo/geo discipline.
  • Fill out the setup forms
    • Make sure the forms look good in light mode and dark mode (It uses your system settings.)
    • You can only progress to the next form if you filled out all required fields.
    • Make sure your choices are shown in the Overview sidebar.
    • Make sure you can submit at the end.
  • Make sure you can log into the database.
  • NOTE: The dialog about the DB schema is expected behavior in this PR
  • Make sure the schema config defaults were applied correctly.
  • Make sure default picklists were created correctly.
  • Make sure prep types were created correctly.
  • Make sure all tree viewer pages load.
  • Local testing:
    • Use an empty DB again (restore it or use a different one).
    • Stop the specify worker and try to start the setup. You should get a clear error on the frontend.
    • Make sure API endpoints work. Look at the stetup_tool section in http://localhost/documentation/api/operations/all/ for more information. You should be able to manually set up a blank database by creating these resources in order.
      • setup_tool/institution/create
      • setup_tool/division/create
      • setup_tool/discipline/create
      • setup_tool/collection/create
      • setup_tool/specifyuser/create

@grantfitzsimmons
Copy link
Member

Any specifyuser can be set as an institution admin by inserting the following, replacing the specifyuser_id with the ID of the newly created user:

INSERT INTO spuserpolicy (id, resource, action, collection_id, specifyuser_id) VALUES (1, '%', '%', null, 1);

@CarolineDenis
Copy link
Contributor Author

CarolineDenis commented Jul 9, 2025

NOTES:

@alesan99
Copy link
Contributor

@grantfitzsimmons @CarolineDenis This pr should be ready to test again 👍
I temporarily commented out some problem code with the specifyuser_spprincipal table to allow for testing. I will undo this once the table is added to main.

As for the progress bar, I want to see if I can speed up schema config creation more in a separate PR. That should make it easier to estimate how long the set up process takes.

@CarolineDenis
Copy link
Contributor Author

Small UI notes:
Could we center the subsections?
Screenshot 2025-12-03 at 10 48 27 AM
Screenshot 2025-12-03 at 10 47 47 AM

There are some issues with the bottom of the page
Screenshot 2025-12-03 at 10 46 32 AM

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.

Testing instructions

  • Use a blank DB to test this PR.

New DB was created!

  • Fill out the setup forms
    • Make sure the forms look good in light mode and dark mode (It uses your system settings.)
    • You can only progress to the next form if you filled out all required fields.
    • Make sure your choices are shown in the Overview sidebar.
    • Make sure you can submit at the end.

Some database restrictions (e.g. max field length) are not accounted for, say for instance when you enter more text than is able to fit in a field (e.g. institution.Name)
Image

  • Make sure you can log into the database.

There is still a reported schema mismatch (it expects 6.8.03, returning 7)
Image

  • Make sure the schema config defaults were applied correctly.
  • Make sure default picklists were created correctly.
  • Make sure prep types were created correctly.
  • Make sure all tree viewer pages load.

When creating a 'Herbarium' collection, my Taxon tree looks like this:

Image Image

See Geography as well:

Image

Same story for Storage...

  • Local testing:
    • Use an empty DB again (restore it or use a different one).
    • Stop the specify worker and try to start the setup. You should get a clear error on the frontend.
Image

It just pauses on loading Institution?

- [X] Make sure API endpoints work. Look at the stetup_tool section in http://localhost/documentation/api/operations/all/ for more information. You should be able to manually set up a blank database by creating these resources in order.
    - [X] `setup_tool/institution/create`
    - [X] `setup_tool/division/create`
    - [X] `setup_tool/discipline/create`
    - [X] `setup_tool/collection/create`
    - [X] `setup_tool/specifyuser/create`

@github-project-automation github-project-automation bot moved this from 📋Back Log to Dev Attention Needed in General Tester Board Dec 5, 2025
@alesan99
Copy link
Contributor

alesan99 commented Dec 12, 2025

@grantfitzsimmons thanks for the review!

Some database restrictions (e.g. max field length) are not accounted for, say for instance when you enter more text than is able to fit in a field (e.g. institution.Name)

Fixed for institution name and password 👍
It was off by one (256 rather than varchar(255)), so the rest should be good.

  • Make sure all tree viewer pages load.

Once the tree PR is merged I can create a PR to properly create the trees.
I can make an issue detailing what I should add.

EDIT: #7593 <- to be addressed once the tree creation PR is merged

It just pauses on loading Institution?

Hm I'm getting an error (it's not descriptive, though). I might need to look at your set up to see if the check isn't working or if the error isn't being reported.

image

EDIT: Hopefully addressed by my new changes

Fix key not being lowercase
Triggered by a895d0c on branch refs/heads/issue-2931-1
Triggered by 92dcf63 on branch refs/heads/issue-2931-1
Triggered by 72763a3 on branch refs/heads/issue-2931-1
'insert into specifyuser_spprincipal(specifyuserid, spprincipalid) values (%s, %s)',
[user.id, gp.id]
)
# TODO: UNCOMMENT THIS. Commented specifically for testing PR https://github.com/specify/specify7/pull/6671
Copy link
Contributor

Choose a reason for hiding this comment

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

Note

WHERE Name = 'Administrator'
)
""", [self.id])
# TODO: UNCOMMENT THIS. Commented specifically for testing PR https://github.com/specify/specify7/pull/6671
Copy link
Contributor

Choose a reason for hiding this comment

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

Note

# Create picklists
create_default_picklists(new_collection, discipline.type)
# Create Collection Object Type
# TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

Note

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Dev Attention Needed

5 participants