diff --git a/src/assets/icons/ui-rocket-white.svg b/src/assets/icons/ui-rocket-white.svg new file mode 100644 index 000000000..a2b49045e --- /dev/null +++ b/src/assets/icons/ui-rocket-white.svg @@ -0,0 +1,10 @@ + + + + ui-rocket + Created with Sketch. + + + + + \ No newline at end of file diff --git a/src/assets/icons/v.2.5/project-types/tc-internal-2.svg b/src/assets/icons/v.2.5/project-types/tc-internal-2.svg new file mode 100644 index 000000000..1b8fbee76 --- /dev/null +++ b/src/assets/icons/v.2.5/project-types/tc-internal-2.svg @@ -0,0 +1,24 @@ + + + + +Created by potrace 1.16, written by Peter Selinger 2001-2019 + + + + + + diff --git a/src/components/ProjectTypeIcon.jsx b/src/components/ProjectTypeIcon.jsx index f5bc1f379..d433e74b7 100644 --- a/src/components/ProjectTypeIcon.jsx +++ b/src/components/ProjectTypeIcon.jsx @@ -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" @@ -60,6 +62,7 @@ const ProjectTypeIcon = ({ type }) => { case 'salesforce-implementation': return case 'solutions': return case 'user-sentiment-analysis': return + case 'tc-internal': return default: // this will be default icon return diff --git a/src/config/constants.js b/src/config/constants.js index c0ef9385a..1dcd7e752 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -1000,4 +1000,8 @@ export const CONTENTFUL_SPACE_ID = process.env.CONTENTFUL_SPACE_ID */ export const CONTENTFUL_NODE_TYPES = { HYPERLINK : 'hyperlink', -} \ No newline at end of file +} +export const INTERNAL_PROJECT_URLS=[ + 'tc_internal', + 'tc-internal' +] \ No newline at end of file diff --git a/src/projects/create/components/ProjectWizard.jsx b/src/projects/create/components/ProjectWizard.jsx index b55d62fe2..0ca419fdc 100644 --- a/src/projects/create/components/ProjectWizard.jsx +++ b/src/projects/create/components/ProjectWizard.jsx @@ -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, @@ -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 @@ -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'] = {} @@ -566,6 +575,7 @@ class ProjectWizard extends Component { onProjectTypeChange={ this.updateProjectType } projectTemplates={ projectTemplates } projectTypes={ projectTypes } + userRoles={ userRoles } /> { const cards = [] + const managerRoles = _.filter(MANAGER_ROLES, mgrRole => { + return _.find(userRoles, role => role === mgrRole) + }) + const isValidRole = managerRoles && managerRoles.length > 0 projectTypes.forEach((projectType) => { @@ -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 = cards.push(