]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8628 Display organizations on the Issues page
authorStas Vilchik <vilchiks@gmail.com>
Wed, 18 Jan 2017 12:39:48 +0000 (13:39 +0100)
committerStas Vilchik <stas-vilchik@users.noreply.github.com>
Tue, 24 Jan 2017 08:25:53 +0000 (09:25 +0100)
server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-list-component.hbs
server/sonar-web/src/main/js/apps/issues/workspace-list-view.js
server/sonar-web/src/main/js/store/organizations/utils.js [new file with mode: 0644]

index 43d94de426fc088448444171599ea4144b4a891c..ef3ed17285c27665a8eac0e4b0131d66c8a41a9c 100644 (file)
@@ -1,4 +1,9 @@
 <div class="component-name issues-workspace-list-component">
+  {{#notNull organization}}
+    <span class="component-name-parent">
+      {{organization.name}}
+    </span>
+  {{/notNull}}
   <a class="component-name-parent link-no-underline" href="{{dashboardUrl project}}">
     {{qualifierIcon "TRK"}}&nbsp;{{projectLongName}}
   </a>
@@ -8,6 +13,6 @@
     </a>
   {{/if}}
   <a class="component-name-file link-no-underline" href="{{dashboardUrl component}}">
-    {{qualifierIcon componentQualifier}}&nbsp;{{componentLongName}}
+    {{qualifierIcon componentQualifier}}&nbsp;{{collapsePath componentLongName}}
   </a>
 </div>
index 453e6a5c5f04e43be2b157edb80077f013b727e4..536c67b0510fe61f939f958e669e4e4b0107e15a 100644 (file)
@@ -23,6 +23,7 @@ import IssueView from './workspace-list-item-view';
 import EmptyView from './workspace-list-empty-view';
 import Template from './templates/issues-workspace-list.hbs';
 import ComponentTemplate from './templates/issues-workspace-list-component.hbs';
+import { getOrganization, areThereCustomOrganizations } from '../../store/organizations/utils';
 
 const COMPONENT_HEIGHT = 29;
 const BOTTOM_OFFSET = 60;
@@ -113,7 +114,12 @@ export default WorkspaceListView.extend({
         }
       }
       if (putComponent) {
-        $container.append(this.componentTemplate(model.toJSON()));
+        const organization = areThereCustomOrganizations() ?
+            getOrganization(model.get('projectOrganization')) : null;
+        $container.append(this.componentTemplate({
+          ...model.toJSON(),
+          organization
+        }));
       }
     }
     $container.append(childView.el);
@@ -124,4 +130,3 @@ export default WorkspaceListView.extend({
     this.$('.issues-workspace-list-component').remove();
   }
 });
-
diff --git a/server/sonar-web/src/main/js/store/organizations/utils.js b/server/sonar-web/src/main/js/store/organizations/utils.js
new file mode 100644 (file)
index 0000000..b9696df
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+// @flow
+import getStore from '../../app/utils/getStore';
+import { getOrganizationByKey, areThereCustomOrganizations as customOrganizations } from '../rootReducer';
+
+export const getOrganization = (key: string) => {
+  const store = getStore();
+  const state = store.getState();
+  return getOrganizationByKey(state, key);
+};
+
+export const areThereCustomOrganizations = () => {
+  const store = getStore();
+  const state = store.getState();
+  return customOrganizations(state);
+};