Skip to content

Commit b18063b

Browse files
committed
Added featured to support internal intake form
1 parent b374214 commit b18063b

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ workflows:
128128
- build-dev
129129
filters:
130130
branches:
131-
only: ['dev']
131+
only: ['dev', 'feature/new-project-catalog']
132132

133133
- deployTest01:
134134
context : org-global

src/config/constants.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,4 +1000,8 @@ export const CONTENTFUL_SPACE_ID = process.env.CONTENTFUL_SPACE_ID
10001000
*/
10011001
export const CONTENTFUL_NODE_TYPES = {
10021002
HYPERLINK : 'hyperlink',
1003-
}
1003+
}
1004+
export const INTERNAL_PROJECT_URLS=[
1005+
'tc_internal',
1006+
'tc-internal'
1007+
]

src/projects/create/components/ProjectWizard.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
SPECIAL_QUERY_PARAMS,
2222
PROJECT_REF_CODE_MAX_LENGTH,
2323
PROJECT_ATTACHMENTS_FOLDER,
24+
MANAGER_ROLES,
25+
INTERNAL_PROJECT_URLS
2426
} from '../../../config/constants'
2527
import {
2628
buildProjectUpdateQueryByQueryParamSelectCondition,
@@ -212,7 +214,7 @@ class ProjectWizard extends Component {
212214
* @return {number} step where wizard should move after parsing the URL param
213215
*/
214216
loadProjectFromURL(urlParams, updateQuery) {
215-
const { projectTemplates, projectTypes } = this.props
217+
const { projectTemplates, projectTypes, userRoles } = this.props
216218
const urlAlias = urlParams && urlParams.project
217219
const statusParam = urlParams && urlParams.status
218220

@@ -233,10 +235,17 @@ class ProjectWizard extends Component {
233235
} else {
234236
// if it is not a project type, it should be a project template
235237
const projectTemplate = getProjectTemplateByAlias(projectTemplates, urlAlias)
238+
const managerRoles = _.filter(MANAGER_ROLES, mgrRole => {
239+
return _.find(userRoles, role => role === mgrRole)
240+
})
241+
const isInternalURL = _.find(INTERNAL_PROJECT_URLS, url => url === urlAlias)
242+
let isValidRole = true
243+
if(isInternalURL)
244+
isValidRole = managerRoles && managerRoles.length > 0
236245

237246
// if we have some project template key in the URL and we can find the project template
238247
// show details step
239-
if (projectTemplate) {
248+
if (isValidRole && projectTemplate) {
240249
updateQuery['type'] = { $set : projectTemplate.category }
241250
updateQuery['templateId'] = { $set : projectTemplate.id }
242251
updateQuery['details'] = {}
@@ -566,6 +575,7 @@ class ProjectWizard extends Component {
566575
onProjectTypeChange={ this.updateProjectType }
567576
projectTemplates={ projectTemplates }
568577
projectTypes={ projectTypes }
578+
userRoles={ userRoles }
569579
/>
570580
<SelectProjectTemplate
571581
onProjectTemplateChange={ this.updateProjectTemplate }

src/projects/create/components/SelectProjectType.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
import React from 'react'
22
import PT from 'prop-types'
3+
import _ from 'lodash'
34

45
import SelectProjectTypeCard from './SelectProjectTypeCard'
56
import { getProjectTemplatesByCategory } from '../../../helpers/templates'
67
import ProjectTypeIcon from '../../../components/ProjectTypeIcon'
78
import IconArrowRight from '../../../assets/icons/arrows-16px-1_tail-right.svg'
89

9-
import { DOMAIN } from '../../../config/constants'
10+
import { DOMAIN, MANAGER_ROLES } from '../../../config/constants'
1011

1112
import './SelectProjectType.scss'
1213

1314
const SelectProjectType = ({
1415
onProjectTypeChange,
1516
projectTypes,
1617
projectTemplates,
18+
userRoles,
1719
}) => {
1820
const cards = []
21+
const managerRoles = _.filter(MANAGER_ROLES, mgrRole => {
22+
return _.find(userRoles, role => role === mgrRole)
23+
})
24+
const isValidRole = managerRoles && managerRoles.length > 0
1925

2026
projectTypes.forEach((projectType) => {
2127

@@ -25,6 +31,10 @@ const SelectProjectType = ({
2531
// don't render hidden items as well, hidden items can be reached via direct link though
2632
if (projectType.disabled || projectType.hidden || visibleProjectTemplates.length === 0) return
2733

34+
// don't render internal projects to customer user roles
35+
if (projectType.metadata && projectType.metadata.isInternal
36+
&& projectType.metadata.isInternal === true && !isValidRole) return
37+
2838
const icon = <ProjectTypeIcon type={projectType.icon} />
2939

3040
cards.push(

0 commit comments

Comments
 (0)