]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9566 Remove organization name from component path when in issues page at org...
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 20 Jul 2017 14:53:00 +0000 (16:53 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 25 Jul 2017 07:20:30 +0000 (09:20 +0200)
server/sonar-web/src/main/js/apps/issues/components/App.js
server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.js
server/sonar-web/src/main/js/apps/issues/components/IssuesList.js
server/sonar-web/src/main/js/apps/issues/components/ListItem.js
server/sonar-web/src/main/js/apps/issues/sidebar/ProjectFacet.js
server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigation.js
tests/src/test/java/org/sonarqube/pageobjects/issues/IssuesPage.java
tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java

index 43dfe6ecba7d61c163325a9bea0ec65baf2043e0..3f5dc5a0290dd351cebd1d85b14e0b66155b6849 100644 (file)
@@ -748,7 +748,7 @@ export default class App extends React.PureComponent {
   }
 
   renderList() {
-    const { component, currentUser } = this.props;
+    const { component, currentUser, organization } = this.props;
     const { issues, openIssue, paging } = this.state;
     const selectedIndex = this.getSelectedIndex();
     const selectedIssue = selectedIndex != null ? issues[selectedIndex] : null;
@@ -768,6 +768,7 @@ export default class App extends React.PureComponent {
             onIssueChange={this.handleIssueChange}
             onIssueCheck={currentUser.isLoggedIn ? this.handleIssueCheck : undefined}
             onIssueClick={this.openIssue}
+            organization={organization}
             selectedIssue={selectedIssue}
           />}
 
@@ -819,7 +820,11 @@ export default class App extends React.PureComponent {
                 {this.renderBulkChange(openIssue)}
                 {openIssue != null
                   ? <div className="pull-left width-60">
-                      <ComponentBreadcrumbs component={component} issue={openIssue} />
+                      <ComponentBreadcrumbs
+                        component={component}
+                        issue={openIssue}
+                        organization={this.props.organization}
+                      />
                     </div>
                   : <PageActions
                       loading={this.state.loading}
index fafa016098ab4931f751962f588b3945b7cff63d..e4103100db06e0cafc45bc75e7d851befaa30bcf 100644 (file)
@@ -27,16 +27,18 @@ import type { Component } from '../utils';
 
 type Props = {
   component?: Component,
-  issue: Object
+  issue: Object,
+  organization?: { key: string }
 };
 
 export default class ComponentBreadcrumbs extends React.PureComponent {
   props: Props;
 
   render() {
-    const { component, issue } = this.props;
+    const { component, issue, organization } = this.props;
 
-    const displayOrganization = component == null || ['VW', 'SVW'].includes(component.qualifier);
+    const displayOrganization =
+      !organization && (component == null || ['VW', 'SVW'].includes(component.qualifier));
     const displayProject =
       component == null || !['TRK', 'BRC', 'DIR'].includes(component.qualifier);
     const displaySubProject = component == null || !['BRC', 'DIR'].includes(component.qualifier);
index a3a6097152be1e3567d4f7a47ce326d88b299887..b0e56815484b0d1947b9c28ab15e63eda5c06ad4 100644 (file)
@@ -31,6 +31,7 @@ type Props = {|
   onIssueChange: Issue => void,
   onIssueCheck?: string => void,
   onIssueClick: string => void,
+  organization?: { key: string },
   selectedIssue: ?Issue
 |};
 
@@ -52,6 +53,7 @@ export default class IssuesList extends React.PureComponent {
             onCheck={this.props.onIssueCheck}
             onClick={this.props.onIssueClick}
             onFilterChange={this.props.onFilterChange}
+            organization={this.props.organization}
             previousIssue={index > 0 ? issues[index - 1] : null}
             selected={selectedIssue != null && selectedIssue.key === issue.key}
           />
index 7d46d74eab76da661ff9d45377be604a47f16cfd..050a34093b28b81129f1e669e8f20fb11ba9ff85 100644 (file)
@@ -32,6 +32,7 @@ type Props = {|
   onCheck?: string => void,
   onClick: string => void,
   onFilterChange: (changes: {}) => void,
+  organization?: { key: string },
   previousIssue: ?Object,
   selected: boolean
 |};
@@ -89,7 +90,11 @@ export default class ListItem extends React.PureComponent {
       <div className="issues-workspace-list-item">
         {displayComponent &&
           <div className="issues-workspace-list-component">
-            <ComponentBreadcrumbs component={component} issue={this.props.issue} />
+            <ComponentBreadcrumbs
+              component={component}
+              issue={this.props.issue}
+              organization={this.props.organization}
+            />
           </div>}
         <Issue
           checked={this.props.checked}
index 843f659a275ea23bf249ef5d28f8008b1e9e601d..8d4c9269e1e1fcf1f57d4851c0554548bc932eab 100644 (file)
@@ -104,11 +104,15 @@ export default class ProjectFacet extends React.PureComponent {
   }
 
   renderName(project: string): React.Element<*> | string {
-    const { referencedComponents } = this.props;
+    const { organization, referencedComponents } = this.props;
     return referencedComponents[project]
       ? <span>
           <QualifierIcon className="little-spacer-right" qualifier="TRK" />
-          <Organization link={false} organizationKey={referencedComponents[project].organization} />
+          {!organization &&
+            <Organization
+              link={false}
+              organizationKey={referencedComponents[project].organization}
+            />}
           {referencedComponents[project].name}
         </span>
       : <span>
index ab54c5330143ceeab59f5225f7274b630673b165..0d8939752c6c4f00c93f4643932a70f60c8736d8 100644 (file)
@@ -39,7 +39,7 @@ const ADMIN_PATHS = [
 
 export default class OrganizationNavigation extends React.PureComponent {
   props: {
-    currentUser: { isLoggedIn: boolean, showOnboardingTutorial: true },
+    currentUser: { isLoggedIn: boolean },
     location: { pathname: string },
     organization: Organization
   };
index 572b69b84549c96c9dc6f96076ce8c769a45b498..0918af6b0ae1a07250fc47e4941f1ef33e43bef6 100644 (file)
@@ -66,6 +66,11 @@ public class IssuesPage {
     return this;
   }
 
+  public IssuesPage componentsShouldNotContain(String path) {
+    this.getIssuesPathComponents().forEach(element -> element.shouldNotHave(text(path)));
+    return this;
+  }
+
   public IssuesPage bulkChangeOpen() {
     $("#issues-bulk-change").shouldBe(visible).click();
     $("#bulk-change-form").shouldBe(visible);
index f6f5a1dcaebd2f4cc294e252ac6e9b748556bb51..979467ee6935fa5347400e906a7b664471bcd27f 100644 (file)
@@ -73,10 +73,11 @@ public class OrganizationIssuesPageTest {
 
     nav.openIssues(org1.getKey())
       .issuesCount(2)
-      .componentsShouldContain(org1.getName());
+      .componentsShouldNotContain(org1.getName());
 
     nav.openIssues()
-      .issuesCount(4);
+      .issuesCount(4)
+      .componentsShouldContain("Org ");
   }
 
   private String provisionProject(Organizations.Organization organization) {