From b18063b408ee7cbf72192e13033d654fb7a1fc0b Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Sat, 8 Aug 2020 14:01:58 +0530 Subject: [PATCH 1/4] Added featured to support internal intake form --- .circleci/config.yml | 2 +- src/config/constants.js | 6 +++++- src/projects/create/components/ProjectWizard.jsx | 14 ++++++++++++-- .../create/components/SelectProjectType.jsx | 12 +++++++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 105dcca28..237ecdfcf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,7 +128,7 @@ workflows: - build-dev filters: branches: - only: ['dev'] + only: ['dev', 'feature/new-project-catalog'] - deployTest01: context : org-global 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( From 925639a5d02e8b3455e9868cfe570ba5ab5da596 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Sat, 8 Aug 2020 21:22:05 +0530 Subject: [PATCH 2/4] made branch deployable --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 237ecdfcf..60d672a27 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,7 +128,7 @@ workflows: - build-dev filters: branches: - only: ['dev', 'feature/new-project-catalog'] + only: ['dev', 'feature/add_option_for_rendering_internal_intake_forms'] - deployTest01: context : org-global From 68dc35bef202116fdc1a5b30dab4f854b4b1a6aa Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Mon, 17 Aug 2020 11:32:08 +0530 Subject: [PATCH 3/4] Added new svg for internal-project intake --- src/assets/icons/ui-rocket-white.svg | 10 ++++++++ .../v.2.5/project-types/tc-internal-2.svg | 24 +++++++++++++++++++ src/components/ProjectTypeIcon.jsx | 3 +++ 3 files changed, 37 insertions(+) create mode 100644 src/assets/icons/ui-rocket-white.svg create mode 100644 src/assets/icons/v.2.5/project-types/tc-internal-2.svg 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 From 9647041100f0b997d6d0cd284536d4a637b0913c Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Mon, 17 Aug 2020 11:48:50 +0530 Subject: [PATCH 4/4] remove branch from deployable --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 60d672a27..105dcca28 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,7 +128,7 @@ workflows: - build-dev filters: branches: - only: ['dev', 'feature/add_option_for_rendering_internal_intake_forms'] + only: ['dev'] - deployTest01: context : org-global