From: Stas Vilchik Date: Thu, 2 Feb 2017 09:36:40 +0000 (+0100) Subject: improve display of component paths on issues page X-Git-Tag: 6.3-RC1~256 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c7dab63b2544a48cae7daa17c81762883f71ca14;p=sonarqube.git improve display of component paths on issues page --- diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js index 9586f4130a7..bdb0455f456 100644 --- a/server/sonar-web/src/main/js/apps/issues/controller.js +++ b/server/sonar-web/src/main/js/apps/issues/controller.js @@ -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') }; }, diff --git a/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-header.hbs b/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-header.hbs index b95572f1653..6a28b925ad8 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-header.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-header.hbs @@ -6,25 +6,27 @@ {{t "issues.return_to_list"}}    - {{#with state.component}} -
- {{qualifierIcon "TRK"}} {{projectName}} -
- {{#if subProject}} -
- {{qualifierIcon "TRK"}} {{subProjectName}} -
+
+ {{#if organization}} + {{organization.name}} + {{/if}} -
- {{qualifierIcon qualifier}} {{fileFromPath name}} -
- {{/with}} + {{#with state.component}} + {{#if project}} + {{projectName}} + + {{/if}} + {{#if subProject}} + {{subProjectName}} + + {{/if}} + {{collapsePath name}} + {{/with}} +
{{else}} {{#if state.canBulkChange}} - {{else}}   diff --git a/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-list-component.hbs b/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-list-component.hbs index f1c12ffb491..b0e305ecddb 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-list-component.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/issues-workspace-list-component.hbs @@ -1,23 +1,25 @@
- {{#notNull organization}} + {{#if organization}} {{organization.name}} - {{/notNull}} + {{/if}} - - {{projectLongName}} - + {{#if project}} + + {{projectLongName}} + + + {{/if}} {{#if subProject}} - {{subProjectLongName}} + {{/if}} - {{collapsePath componentLongName}} diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js index ae3d4e613d8..8eba1223306 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js @@ -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; } }); diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js index 536c67b0510..d5b71e3250a 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-view.js @@ -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 () {