-
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
Add Read-Only Project View, Add Username to Projects Table #144
Conversation
Still need to clean up footer in component and conditionally render based on read_only state.
When re-rendering the project form, any project data passed to the component is written to the project_params in the store. This effectively nukes any input that has already been made in the creation of a new project, so make sure we save the draft off before showing the project view. Also add user ID to projects table and make it sortable.
rewrite_state (state, val) { | ||
// loop through and rewrite the state | ||
for (const stateItem in val) { | ||
Vue.set(state, stateItem, val[stateItem]) |
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.
In order to restore the state from the draft_project_params, we need to loop through every attribute in the draft params and set the corresponding state variable.
const project_loader = { | ||
project: response.data | ||
} | ||
this.$store.dispatch('project_params/saveProjectDraft') |
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.
When the new CreateProjectForm is rendered with project data, it re-writes the current project data in the store, so we need to first save off anything that has been entered before we destroy it, so we can load it back later!
data () { | ||
return { | ||
localDec: null, | ||
localDec: this.value, |
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.
Here we default the localDec value to the prop that was passed in - I was having an issue when I was re-rendering the component, the dec wasn't displaying even though the value was being passed. So set the default to the value passed in. (I had to do the same with the RightAscensionInput)
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.
Like the reuse of the form component, and how closing the inspection reloads from drafts. Lgtm
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.
beautiful! also thank you for the video, that's very helpful : )
This PR adds an "inspect" button to the projects table, which opens up a read-only view of the CreateProjectForm, pre-populated with the data that needs to be displayed.
RightAscensionInput/DeclinationInput/ProjectSitesSelector:
CreateProjectForm
UserProjectsTable
inspect-project
signal along with the project data for the so the parent SiteProjects component can pop up and render the modal.SiteProjects
project_params store module
draft_project_params
store variable to hold the draft of the project that's been entered into the project form prior to the user clicking "inspect," so that they may be re-loaded when the user closes the inspection tab. Unfortunately the CreateProjectForm is tightly coupled to the vuex store and whenever we render a new instance of that component, it overwrites the data in the project_params module of the store - so we need to keep a history of anything that was entered into the form, if the user had done that.Video!
Screen.Recording.2024-02-15.at.11.24.33.AM.mov