Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/assets/icons/ui-rocket-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/assets/icons/v.2.5/project-types/tc-internal-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/components/ProjectTypeIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import IconSalesforceImplementation from '../assets/icons/v.2.5/project-types/sa
import IconSolutions from '../assets/icons/v.2.5/project-types/solutions.svg'
import IconUserSentimentAnalysis from '../assets/icons/v.2.5/project-types/user-sentiment-analysis.svg'
import IconDefault from '../assets/icons/v.2.5/project-types/default.svg'
import IconTcInternal from '../assets/icons/v.2.5/project-types/tc-internal-2.svg'
//import IconTcInternal from '../assets/icons/ui-rocket-white.svg'

const ProjectTypeIcon = ({ type }) => {
// if type is defined as a relative path to the icon, convert it to icon "id"
Expand Down Expand Up @@ -60,6 +62,7 @@ const ProjectTypeIcon = ({ type }) => {
case 'salesforce-implementation': return <IconSalesforceImplementation />
case 'solutions': return <IconSolutions />
case 'user-sentiment-analysis': return <IconUserSentimentAnalysis />
case 'tc-internal': return <IconTcInternal />
default:
// this will be default icon
return <IconDefault />
Expand Down
6 changes: 5 additions & 1 deletion src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -1000,4 +1000,8 @@ export const CONTENTFUL_SPACE_ID = process.env.CONTENTFUL_SPACE_ID
*/
export const CONTENTFUL_NODE_TYPES = {
HYPERLINK : 'hyperlink',
}
}
export const INTERNAL_PROJECT_URLS=[
'tc_internal',
'tc-internal'
]
14 changes: 12 additions & 2 deletions src/projects/create/components/ProjectWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
SPECIAL_QUERY_PARAMS,
PROJECT_REF_CODE_MAX_LENGTH,
PROJECT_ATTACHMENTS_FOLDER,
MANAGER_ROLES,
INTERNAL_PROJECT_URLS
} from '../../../config/constants'
import {
buildProjectUpdateQueryByQueryParamSelectCondition,
Expand Down Expand Up @@ -212,7 +214,7 @@ class ProjectWizard extends Component {
* @return {number} step where wizard should move after parsing the URL param
*/
loadProjectFromURL(urlParams, updateQuery) {
const { projectTemplates, projectTypes } = this.props
const { projectTemplates, projectTypes, userRoles } = this.props
const urlAlias = urlParams && urlParams.project
const statusParam = urlParams && urlParams.status

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

// if we have some project template key in the URL and we can find the project template
// show details step
if (projectTemplate) {
if (isValidRole && projectTemplate) {
updateQuery['type'] = { $set : projectTemplate.category }
updateQuery['templateId'] = { $set : projectTemplate.id }
updateQuery['details'] = {}
Expand Down Expand Up @@ -566,6 +575,7 @@ class ProjectWizard extends Component {
onProjectTypeChange={ this.updateProjectType }
projectTemplates={ projectTemplates }
projectTypes={ projectTypes }
userRoles={ userRoles }
/>
<SelectProjectTemplate
onProjectTemplateChange={ this.updateProjectTemplate }
Expand Down
12 changes: 11 additions & 1 deletion src/projects/create/components/SelectProjectType.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import React from 'react'
import PT from 'prop-types'
import _ from 'lodash'

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

import { DOMAIN } from '../../../config/constants'
import { DOMAIN, MANAGER_ROLES } from '../../../config/constants'

import './SelectProjectType.scss'

const SelectProjectType = ({
onProjectTypeChange,
projectTypes,
projectTemplates,
userRoles,
}) => {
const cards = []
const managerRoles = _.filter(MANAGER_ROLES, mgrRole => {
return _.find(userRoles, role => role === mgrRole)
})
const isValidRole = managerRoles && managerRoles.length > 0

projectTypes.forEach((projectType) => {

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

// don't render internal projects to customer user roles
if (projectType.metadata && projectType.metadata.isInternal
&& projectType.metadata.isInternal === true && !isValidRole) return

const icon = <ProjectTypeIcon type={projectType.icon} />

cards.push(
Expand Down