diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2017-02-02 10:36:40 +0100 |
---|---|---|
committer | Stas Vilchik <stas-vilchik@users.noreply.github.com> | 2017-02-02 13:32:25 +0100 |
commit | c7dab63b2544a48cae7daa17c81762883f71ca14 (patch) | |
tree | 84d9ec3451a38b9adf4761359c6368e058021179 /server/sonar-web/src/main/js/apps/issues | |
parent | b815ace63bf5ad05778734bcfab9a8191d164098 (diff) | |
download | sonarqube-c7dab63b2544a48cae7daa17c81762883f71ca14.tar.gz sonarqube-c7dab63b2544a48cae7daa17c81762883f71ca14.zip |
improve display of component paths on issues page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues')
5 files changed, 66 insertions, 32 deletions
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 @@ <a class="js-back">{{t "issues.return_to_list"}}</a> </div> - {{#with state.component}} - <div class="component-name-parent"> - {{qualifierIcon "TRK"}} <a href="{{dashboardUrl project}}" title="{{projectName}}">{{projectName}}</a> - </div> - {{#if subProject}} - <div class="component-name-parent"> - {{qualifierIcon "TRK"}} <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}} <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}} 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 @@ <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> 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 () { |