Skip to content

Commit 8190224

Browse files
committed
fix: improve Project Defaults
fix lint (don't use async) rename button rename page path
1 parent 32e038e commit 8190224

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/helpers/projectHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export function getProjectNavLinks(project, projectId, renderFAQs) {
285285
const searchParams = new URLSearchParams(window.location.search)
286286

287287
if (searchParams.get('beta') === 'true' && hasPermission(PERMISSIONS.VIEW_PROJECT_DEFAULTS)) {
288-
navLinks.push({ label: 'Project Defaults', to: `/projects/${projectId}/projectDefaults`, Icon: AccountSecurityIcon, iconClassName: 'stroke' })
288+
navLinks.push({ label: 'Project Defaults', to: `/projects/${projectId}/settings`, Icon: AccountSecurityIcon, iconClassName: 'stroke' })
289289
}
290290

291291
return navLinks

src/projects/detail/components/EditProjectDefaultsForm/EditProjectDefaultsForm.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,31 @@ class EditProjectDefaultsForm extends React.Component {
4444
}
4545
}
4646

47-
async handleSubmit() {
47+
handleSubmit() {
4848
const {updateProject} = this.props
4949
const {id, terms} = this.props.project
5050
const newHasNda = !this.state.hasNda
5151
if (newHasNda) {
52-
await updateProject(id, {
52+
updateProject(id, {
5353
terms: [...new Set([...terms, DEFAULT_NDA_UUID])]
54-
}, true)
54+
}, true).then(() => {
55+
this.setState({
56+
hasNda: this.props.project.terms.indexOf(DEFAULT_NDA_UUID) >= 0
57+
})
58+
})
5559
} else {
5660
const newTerms = [...terms]
5761
if (newTerms.indexOf(DEFAULT_NDA_UUID) >= 0) {
5862
newTerms.splice(newTerms.indexOf(DEFAULT_NDA_UUID), 1)
59-
await updateProject(id, {
63+
updateProject(id, {
6064
terms: newTerms
61-
}, true)
65+
}, true).then(() => {
66+
this.setState({
67+
hasNda: this.props.project.terms.indexOf(DEFAULT_NDA_UUID) >= 0
68+
})
69+
})
6270
}
6371
}
64-
this.setState({
65-
hasNda: this.props.project.terms.indexOf(DEFAULT_NDA_UUID) >= 0
66-
})
6772
}
6873

6974
render() {
@@ -109,7 +114,7 @@ class EditProjectDefaultsForm extends React.Component {
109114
type="submit"
110115
disabled={!this.state.enableButton}
111116
>
112-
Submit
117+
Save
113118
</button>
114119
</div>
115120
</Formsy.Form>

src/projects/routes.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const ProjectDetailWithAuth = requiresAuthentication(() =>
5959
<Route path="/projects/:projectId/assets" render={() => <ProjectDetail component={AssetsLibrary} />} />
6060
<Route path="/projects/:projectId/discussions/:discussionId?" render={() => <ProjectDetail component={ProjectMessages} />} />
6161
<Route path="/projects/:projectId/faqs" render={() => <ProjectDetail component={ProjectFAQContainer} />} />
62-
<Route path="/projects/:projectId/projectDefaults" render={() => <ProjectDetail component={ProjectDefaultsContainer} />} />
62+
<Route path="/projects/:projectId/settings" render={() => <ProjectDetail component={ProjectDefaultsContainer} />} />
6363
<Route render={() => <CoderBot code={404}/>} />
6464
</Switch>)
6565
)

0 commit comments

Comments
 (0)