-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create projects #154
Create projects #154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking solid @oliverroick! Thank you! Just a handful of misc. adjustments and bug fixes and I think we're good to merge.
const stateMsg = useSelector(selectCreateProjectState); | ||
|
||
const tzOptions = timeZonesNames.map((tz) => ({ value: tz, label: tz })); | ||
const mlModelOptions = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pull the ML model options from the DB here rather than hard-code them. Just skimming the code here but I think if we use the fetchModels
thunk and don't pass in any model _ids
, it should return all of them, and we can build a list of mlModelOptions
from that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to use the existing thunk because no project is selected on the create-project page. But I added a new thunk and state to store the model options.
}; | ||
state.loadingStates.createProject = ls; | ||
|
||
state.projects = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I successfully create a project and try to navigate to the app by clicking the "application" nav link, the app crashes, and it looks like it may be because there's a bug here and all of the previous projects
in state get accidentally overwritten with the newly created project. Your code here looks like it should work to me so I'm not totally sure what's going on...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a bug, projects
should be an array not an object. I fixed that but now I'm seeing another error TypeError: Cannot read property 'roles' of undefined
but I'm not sure what this is related to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not seeing that new error.
However, I'm noticing another related bug. It's a little odd and I'm not sure how consequential so I'm not sure how much time to dedicate towards a fix, but the gist is:
- for a super user to access the animl.camera/create-project form, they would either have to be signed in already or navigate to animl.camera/app and sign in to get their JWT with their creds. After being authenticated, the
ProjectAndViewNav.jsx
component looks to see if there are any projects in state, and if not, it fetches them. So at this point the user would presumably have some projects already in state. - if they they want to create a project, they'd have to manually type out that URL because there's no link to it, and when they navigate there it's a page refresh the projects get removed from state.
- once the user successfully creates a project, that gets added to the state, BUT if they then navigate back to the app using the "application" nav link, the state is preserved and the
ProjectAndViewNav.jsx
component sees that there are already projects in the state so it doesn't re-fetch them.
There are probably some fairly straightforward ways to fix this (maybe instead of housing the create-projects form on a separate page, we put it in a modal), but I am not overly concerned about this so I think let's call it good enough for now.
Contributes to #151
/create-project
NotFound
; we show this when the user is signed in and does not have the required permission to create projectsCreateProjectform
; it provides the form to create a new project