]> source.dussan.org Git - sonarqube.git/commitdiff
improve display of component paths on issues page
authorStas Vilchik <vilchiks@gmail.com>
Thu, 2 Feb 2017 09:36:40 +0000 (10:36 +0100)
committerStas Vilchik <stas-vilchik@users.noreply.github.com>
Thu, 2 Feb 2017 12:32:25 +0000 (13:32 +0100)
server/sonar-web/src/main/js/apps/issues/controller.js
server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-header.hbs
server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-list-component.hbs
server/sonar-web/src/main/js/apps/issues/workspace-header-view.js
server/sonar-web/src/main/js/apps/issues/workspace-list-view.js

index 9586f4130a70d8a44e3783adb539aef3ccd620f6..bdb0455f4568afac7bbc310934ed9f46a1c54a40 100644 (file)
@@ -171,7 +171,8 @@ export default Controller.extend({
       subProject: issue.get('subProject'),
       subProjectName: issue.get('subProjectLongName'),
       project: issue.get('project'),
-      projectName: issue.get('projectLongName')
+      projectName: issue.get('projectLongName'),
+      projectOrganization: issue.get('projectOrganization')
     };
   },
 
index b95572f16539ece90446a2aaa025d5045c22001c..6a28b925ad80a4e372db7b8c13b5966f225ffba6 100644 (file)
@@ -6,25 +6,27 @@
         <a class="js-back">{{t "issues.return_to_list"}}</a>&nbsp;&nbsp;&nbsp;
       </div>
 
-      {{#with state.component}}
-        <div class="component-name-parent">
-          {{qualifierIcon "TRK"}}&nbsp;<a href="{{dashboardUrl project}}" title="{{projectName}}">{{projectName}}</a>
-        </div>
-        {{#if subProject}}
-          <div class="component-name-parent">
-            {{qualifierIcon "TRK"}}&nbsp;<a href="{{dashboardUrl subProject}}"
-                                            title="{{subProjectName}}">{{subProjectName}}</a>
-          </div>
+      <div class="component-name-parent">
+        {{#if organization}}
+          <a href="{{link '/organizations/' organization.key}}">{{organization.name}}</a>
+          <span class="slash-separator"></span>
         {{/if}}
-        <div class="component-name-file">
-          {{qualifierIcon qualifier}}&nbsp;<a href="{{dashboardUrl key}}" title="{{name}}">{{fileFromPath name}}</a>
-        </div>
-      {{/with}}
+        {{#with state.component}}
+          {{#if project}}
+            <a href="{{dashboardUrl project}}" title="{{projectName}}">{{projectName}}</a>
+            <span class="slash-separator"></span>
+          {{/if}}
+          {{#if subProject}}
+            <a href="{{dashboardUrl subProject}}" title="{{subProjectName}}">{{subProjectName}}</a>
+            <span class="slash-separator"></span>
+          {{/if}}
+          <a href="{{dashboardUrl key}}" title="{{name}}">{{collapsePath name}}</a>
+        {{/with}}
+      </div>
 
     {{else}}
       {{#if state.canBulkChange}}
-        <a class="js-selection icon-checkbox {{#if allSelected}}icon-checkbox-checked{{/if}} {{#if
-            someSelected}}icon-checkbox-checked icon-checkbox-single{{/if}}"
+        <a class="js-selection icon-checkbox {{#if allSelected}}icon-checkbox-checked{{/if}} {{#if someSelected}}icon-checkbox-checked icon-checkbox-single{{/if}}"
            data-toggle="tooltip" title="{{t 'issues.toggle_selection_tooltip'}}"></a>
       {{else}}
         &nbsp;
index f1c12ffb4915723df72f095779d4c00fd94abfad..b0e305ecddbe95a0a95f41fa362c74fbecec8f48 100644 (file)
@@ -1,23 +1,25 @@
 <div class="component-name issues-workspace-list-component">
-  {{#notNull organization}}
+  {{#if organization}}
     <a class="link-no-underline" href="{{link '/organizations/' organization.key}}">
       {{organization.name}}
     </a>
     <span class="slash-separator"></span>
-  {{/notNull}}
+  {{/if}}
 
-  <a class="link-no-underline" href="{{dashboardUrl project}}">
-    {{projectLongName}}
-  </a>
+  {{#if project}}
+    <a class="link-no-underline" href="{{dashboardUrl project}}">
+      {{projectLongName}}
+    </a>
+    <span class="slash-separator"></span>
+  {{/if}}
 
   {{#if subProject}}
-    <span class="slash-separator"></span>
     <a class="link-no-underline" href="{{dashboardUrl subProject}}">
       {{subProjectLongName}}
     </a>
+    <span class="slash-separator"></span>
   {{/if}}
 
-  <span class="slash-separator"></span>
   <a class="link-no-underline" href="{{dashboardUrl component}}">
     {{collapsePath componentLongName}}
   </a>
index ae3d4e613d85365fa2092a6ffac49974109067ed..8eba12233063495b9457012d1cc026f6fdafa46e 100644 (file)
@@ -20,6 +20,7 @@
 import WorkspaceHeaderView from '../../components/navigator/workspace-header-view';
 import BulkChangeForm from './BulkChangeForm';
 import Template from './templates/issues-workspace-header.hbs';
+import { getOrganization, areThereCustomOrganizations } from '../../store/organizations/utils';
 
 export default WorkspaceHeaderView.extend({
   template: Template,
@@ -113,12 +114,28 @@ export default WorkspaceHeaderView.extend({
     const selectedCount = this.options.app.list.where({ selected: true }).length;
     const allSelected = issuesCount > 0 && issuesCount === selectedCount;
     const someSelected = !allSelected && selectedCount > 0;
-    return {
+    const data = {
       ...WorkspaceHeaderView.prototype.serializeData.apply(this, arguments),
       selectedCount,
       allSelected,
       someSelected
     };
+    const component = this.options.app.state.get('component');
+    if (component) {
+      const qualifier = this.options.app.state.get('contextComponentQualifier');
+      if (qualifier === 'VW' || qualifier === 'SVW') {
+        // do nothing
+      } else if (qualifier === 'TRK') {
+        data.state.component.project = null;
+      } else if (qualifier === 'BRC') {
+        data.state.component.project = null;
+        data.state.component.subProject = null;
+      } else {
+        const organization = areThereCustomOrganizations() ? getOrganization(component.projectOrganization) : null;
+        Object.assign(data, { organization });
+      }
+    }
+    return data;
   }
 });
 
index 536c67b0510fe61f939f958e669e4e4b0107e15a..d5b71e3250ae02644d767cbad82f342b077a6b9a 100644 (file)
@@ -101,7 +101,7 @@ export default WorkspaceListView.extend({
   },
 
   attachHtml (compositeView, childView, index) {
-    const $container = this.getChildViewContainer(compositeView);
+    const container = this.getChildViewContainer(compositeView);
     const model = this.collection.at(index);
     if (model != null) {
       const prev = index > 0 && this.collection.at(index - 1);
@@ -114,15 +114,27 @@ export default WorkspaceListView.extend({
         }
       }
       if (putComponent) {
-        const organization = areThereCustomOrganizations() ?
-            getOrganization(model.get('projectOrganization')) : null;
-        $container.append(this.componentTemplate({
-          ...model.toJSON(),
-          organization
-        }));
+        this.displayComponent(container, model);
       }
     }
-    $container.append(childView.el);
+    container.append(childView.el);
+  },
+
+  displayComponent (container, model) {
+    const data = { ...model.toJSON() };
+    /* eslint-disable no-console */
+    const qualifier = this.options.app.state.get('contextComponentQualifier');
+    if (qualifier === 'VW' || qualifier === 'SVW') {
+      Object.assign(data, { organization: undefined });
+    } else if (qualifier === 'TRK') {
+      Object.assign(data, { organization: undefined, project: undefined });
+    } else if (qualifier === 'BRC') {
+      Object.assign(data, { organization: undefined, project: undefined, subProject: undefined });
+    } else {
+      const organization = areThereCustomOrganizations() ? getOrganization(model.get('projectOrganization')) : null;
+      Object.assign(data, { organization });
+    }
+    container.append(this.componentTemplate(data));
   },
 
   destroyChildren () {