diff options
author | Mathieu Suen <mathieu.suen@sonarsource.com> | 2022-07-08 11:23:32 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-07-11 20:13:11 +0000 |
commit | 6f6c31272190acb041d97a9fc8b6193c5f7d82da (patch) | |
tree | 57cf45da71315212de5a02a2c6fcad177833578e /server/sonar-web/src/main | |
parent | 12b488c80a45f27b5176557a9c7e1a24dcab83d4 (diff) | |
download | sonarqube-6f6c31272190acb041d97a9fc8b6193c5f7d82da.tar.gz sonarqube-6f6c31272190acb041d97a9fc8b6193c5f7d82da.zip |
SONAR-16598 Rename generic concept to education principles
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r-- | server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/app/theme.js | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/coding-rules/components/RuleTabViewer.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx | 2 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/components/IssueTabViewer.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx | 23 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/rules/educationPrinciples/DefenseInDepth.tsx (renamed from server/sonar-web/src/main/js/components/rules/genericConcepts/DefenseInDepth.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/rules/educationPrinciples/LeastTrustPrinciple.tsx (renamed from server/sonar-web/src/main/js/components/rules/genericConcepts/LeastTrustPrinciple.tsx) | 0 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/rules/style.css | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/types/types.ts | 2 |
10 files changed, 23 insertions, 20 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts index 054ca7cde59..0e1fe610143 100644 --- a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts +++ b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts @@ -245,7 +245,7 @@ export default class IssuesServiceMock { rule: mockRuleDetails({ key: parameters.key, name: 'Advanced rule', - genericConcepts: ['defense_in_depth'], + educationPrinciples: ['defense_in_depth'], descriptionSections: [ { key: RuleDescriptionSections.INTRODUCTION, content: '<h1>Into</h1>' }, { key: RuleDescriptionSections.ROOT_CAUSE, content: '<h1>Because</h1>' }, diff --git a/server/sonar-web/src/main/js/app/theme.js b/server/sonar-web/src/main/js/app/theme.js index d4119df1c66..b8f4ef1bbbb 100644 --- a/server/sonar-web/src/main/js/app/theme.js +++ b/server/sonar-web/src/main/js/app/theme.js @@ -58,7 +58,7 @@ module.exports = { globalNavBarBg: '#262626', - genericConceptBgColor: '#F4F6FF', + educationPrinciplesBgColor: '#F4F6FF', // table rowHoverHighlight: '#ecf6fe', diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleTabViewer.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleTabViewer.tsx index 3422bce50d5..cebd8c1d4d8 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleTabViewer.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleTabViewer.tsx @@ -108,10 +108,10 @@ export default class RuleViewerTabs extends React.PureComponent<Props, State> { { key: RuleTabKeys.MoreInfo, label: translate('coding_rules.description_section.title', RuleTabKeys.MoreInfo), - content: (ruleDetails.genericConcepts || + content: (ruleDetails.educationPrinciples || descriptionSectionsByKey[RuleDescriptionSections.RESOURCES]) && ( <MoreInfoRuleDescription - genericConcepts={ruleDetails.genericConcepts} + educationPrinciples={ruleDetails.educationPrinciples} sections={descriptionSectionsByKey[RuleDescriptionSections.RESOURCES]} /> ) diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx index 40e6a7092fb..8e0a0c3aaee 100644 --- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssueApp-it.tsx @@ -38,7 +38,7 @@ beforeEach(() => { handler = new IssuesServiceMock(); }); -it('should show generic concpet', async () => { +it('should show education principles', async () => { const user = userEvent.setup(); renderProjectIssuesApp('project/issues?issues=issue2&open=issue2&id=myproject'); await user.click(await screen.findByRole('button', { name: `issue.tabs.more_info` })); diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueTabViewer.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueTabViewer.tsx index cfd70022e55..005b6fdbe82 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueTabViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueTabViewer.tsx @@ -142,10 +142,10 @@ export default class IssueViewerTabs extends React.PureComponent<Props, State> { { key: IssueTabKeys.MoreInfo, label: translate('issue.tabs', IssueTabKeys.MoreInfo), - content: (ruleDetails.genericConcepts || + content: (ruleDetails.educationPrinciples || descriptionSectionsByKey[RuleDescriptionSections.RESOURCES]) && ( <MoreInfoRuleDescription - genericConcepts={ruleDetails.genericConcepts} + educationPrinciples={ruleDetails.educationPrinciples} sections={descriptionSectionsByKey[RuleDescriptionSections.RESOURCES]} /> ) diff --git a/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx b/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx index 7e51817a4f4..d083f47d3a4 100644 --- a/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx +++ b/server/sonar-web/src/main/js/components/rules/MoreInfoRuleDescription.tsx @@ -21,22 +21,25 @@ import * as React from 'react'; import { RuleDescriptionSection } from '../../apps/coding-rules/rule'; import { translate } from '../../helpers/l10n'; import { Dict } from '../../types/types'; -import DefenseInDepth from './genericConcepts/DefenseInDepth'; -import LeastTrustPrinciple from './genericConcepts/LeastTrustPrinciple'; +import DefenseInDepth from './educationPrinciples/DefenseInDepth'; +import LeastTrustPrinciple from './educationPrinciples/LeastTrustPrinciple'; import RuleDescription from './RuleDescription'; import './style.css'; interface Props { sections?: RuleDescriptionSection[]; - genericConcepts?: string[]; + educationPrinciples?: string[]; } -const GENERIC_CONCPET_MAP: Dict<React.ComponentType> = { +const EDUCATION_PRINCIPLES_MAP: Dict<React.ComponentType> = { defense_in_depth: DefenseInDepth, least_trust_principle: LeastTrustPrinciple }; -export default function MoreInfoRuleDescription({ sections = [], genericConcepts = [] }: Props) { +export default function MoreInfoRuleDescription({ + sections = [], + educationPrinciples = [] +}: Props) { return ( <> {sections.length > 0 && ( @@ -50,20 +53,20 @@ export default function MoreInfoRuleDescription({ sections = [], genericConcepts </> )} - {genericConcepts.length > 0 && ( + {educationPrinciples.length > 0 && ( <> <div className="big-padded-left big-padded-right rule-desc"> <h2 className="null-spacer-top"> - {translate('coding_rules.more_info.generic_concept.title')} + {translate('coding_rules.more_info.education_principles.title')} </h2> </div> - {genericConcepts.map(key => { - const Concept = GENERIC_CONCPET_MAP[key]; + {educationPrinciples.map(key => { + const Concept = EDUCATION_PRINCIPLES_MAP[key]; if (Concept === undefined) { return null; } return ( - <div key={key} className="generic-concept rule-desc"> + <div key={key} className="education-principles rule-desc"> <Concept /> </div> ); diff --git a/server/sonar-web/src/main/js/components/rules/genericConcepts/DefenseInDepth.tsx b/server/sonar-web/src/main/js/components/rules/educationPrinciples/DefenseInDepth.tsx index e338d15b045..e338d15b045 100644 --- a/server/sonar-web/src/main/js/components/rules/genericConcepts/DefenseInDepth.tsx +++ b/server/sonar-web/src/main/js/components/rules/educationPrinciples/DefenseInDepth.tsx diff --git a/server/sonar-web/src/main/js/components/rules/genericConcepts/LeastTrustPrinciple.tsx b/server/sonar-web/src/main/js/components/rules/educationPrinciples/LeastTrustPrinciple.tsx index 5c2f8fb132c..5c2f8fb132c 100644 --- a/server/sonar-web/src/main/js/components/rules/genericConcepts/LeastTrustPrinciple.tsx +++ b/server/sonar-web/src/main/js/components/rules/educationPrinciples/LeastTrustPrinciple.tsx diff --git a/server/sonar-web/src/main/js/components/rules/style.css b/server/sonar-web/src/main/js/components/rules/style.css index de8c16594e0..e0c36bff985 100644 --- a/server/sonar-web/src/main/js/components/rules/style.css +++ b/server/sonar-web/src/main/js/components/rules/style.css @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -.generic-concept { - background-color: var(--genericConceptBgColor); +.education-principles { + background-color: var(--educationPrinciplesBgColor); border-radius: 2px; display: inline-block; margin-left: 16px; diff --git a/server/sonar-web/src/main/js/types/types.ts b/server/sonar-web/src/main/js/types/types.ts index ba2717c72de..0e0b576c97f 100644 --- a/server/sonar-web/src/main/js/types/types.ts +++ b/server/sonar-web/src/main/js/types/types.ts @@ -589,7 +589,7 @@ export interface RuleDetails extends Rule { defaultRemFnBaseEffort?: string; defaultRemFnType?: string; descriptionSections?: RuleDescriptionSection[]; - genericConcepts?: string[]; + educationPrinciples?: string[]; effortToFixDescription?: string; htmlDesc?: string; htmlNote?: string; |