aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties3
-rw-r--r--sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee29
-rw-r--r--sonar-server/src/main/coffee/component-viewer/header.coffee31
-rw-r--r--sonar-server/src/main/coffee/component-viewer/main.coffee3
-rw-r--r--sonar-server/src/main/coffee/component-viewer/popup.coffee16
-rw-r--r--sonar-server/src/main/hbs/component-viewer/extensions-popup.hbs11
-rw-r--r--sonar-server/src/main/hbs/component-viewer/header.hbs26
-rw-r--r--sonar-server/src/main/less/component-viewer.less22
-rw-r--r--sonar-server/src/main/less/icons.less4
-rw-r--r--sonar-server/src/main/less/style.less7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb2
-rwxr-xr-xsonar-server/src/main/webapp/fonts/sonar.woffbin17672 -> 17916 bytes
12 files changed, 132 insertions, 22 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 28c894bae36..89586294b3c 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2657,8 +2657,9 @@ component_viewer.add_manual_issue=Add Manual Issue
component_viewer.line_actions=Line Actions
component_viewer.no_issues=No Issues
component_viewer.no_coverage=No Coverage
-component_viewer.time_changes=Time Changes
+component_viewer.time_changes=Time Change
component_viewer.added=Added
+component_viewer.extensions=Extensions
component_viewer.workspace=Workspace
component_viewer.workspace.tooltip=Keeps track of history of navigation
diff --git a/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee b/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee
new file mode 100644
index 00000000000..fbe48909ee2
--- /dev/null
+++ b/sonar-server/src/main/coffee/component-viewer/extensions-popup.coffee
@@ -0,0 +1,29 @@
+define [
+ 'backbone.marionette'
+ 'templates/component-viewer'
+ 'component-viewer/popup'
+], (
+ Marionette
+ Templates
+ Popup
+) ->
+
+ $ = jQuery
+
+
+ class extends Popup
+ template: Templates['extensions-popup']
+
+
+ events:
+ 'click .js-extension': 'showExtension'
+
+
+ showExtension: (e) ->
+ key = $(e.currentTarget).data 'key'
+ @trigger 'extension', key
+
+
+ serializeData: ->
+ _.extend super,
+ extensions: @options.main.state.get 'extensions'
diff --git a/sonar-server/src/main/coffee/component-viewer/header.coffee b/sonar-server/src/main/coffee/component-viewer/header.coffee
index 47483ea3a14..729ee508649 100644
--- a/sonar-server/src/main/coffee/component-viewer/header.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/header.coffee
@@ -8,6 +8,7 @@ define [
'component-viewer/header/duplications-header'
'component-viewer/header/scm-header'
'component-viewer/header/tests-header'
+ 'component-viewer/extensions-popup'
'common/handlebars-extensions'
], (
@@ -20,11 +21,13 @@ define [
DuplicationsHeaderView
SCMHeaderView
TestsHeaderView
+ ExtensionsPopup
) ->
$ = jQuery
API_FAVORITE = "#{baseUrl}/api/favourites"
+ API_EXTENSION = "#{baseUrl}/resource/extension"
BARS = [
{ scope: 'basic', view: BasicHeaderView }
{ scope: 'issues', view: IssuesHeaderView }
@@ -52,9 +55,9 @@ define [
events:
'click .js-favorite': 'toggleFavorite'
-
+ 'click .js-extensions': 'showExtensionsPopup'
+ 'click .js-extension-close': 'closeExtension'
'click @ui.expandLinks': 'showExpandedBar'
-
'click .js-toggle-issues': 'toggleIssues'
'click .js-toggle-coverage': 'toggleCoverage'
'click .js-toggle-duplications': 'toggleDuplications'
@@ -97,6 +100,28 @@ define [
@render()
+ showExtensionsPopup: (e) ->
+ e.stopPropagation()
+ $('body').click()
+ popup = new ExtensionsPopup
+ triggerEl: $(e.currentTarget)
+ main: @options.main
+ bottomRight: true
+ popup.render()
+ popup.on 'extension', (key) => @showExtension key
+
+
+ showExtension: (key) ->
+ @ui.expandedBar.html('<i class="spinner spinner-margin"></i>').addClass 'active'
+ @ui.expandLinks.removeClass 'active'
+ $.get API_EXTENSION, id: @options.main.component.get('key'), tab: key, (r) =>
+ @ui.expandedBar.html r
+
+
+ closeExtension: ->
+ @ui.expandedBar.html('').removeClass 'active'
+
+
showBarSpinner: ->
@ui.spinnerBar.addClass 'active'
@@ -113,7 +138,7 @@ define [
enableBar: (scope) ->
- @ui.expandedBar.addClass 'active'
+ @ui.expandedBar.html('<i class="spinner spinner-margin"></i>').addClass 'active'
requests = []
unless @state.get 'hasMeasures'
requests.push @options.main.requestMeasures @options.main.key
diff --git a/sonar-server/src/main/coffee/component-viewer/main.coffee b/sonar-server/src/main/coffee/component-viewer/main.coffee
index 45764200a45..7b38f0fb8a1 100644
--- a/sonar-server/src/main/coffee/component-viewer/main.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/main.coffee
@@ -123,7 +123,8 @@ define [
requestComponent: (key, clear = false, full = true) ->
- STATE_FIELDS = ['canBulkChange', 'canMarkAsFavourite', 'canCreateManualIssue', 'tabs', 'manual_rules']
+ STATE_FIELDS = ['canBulkChange', 'canMarkAsFavourite', 'canCreateManualIssue',
+ 'tabs', 'manual_rules', 'extensions']
COMPONENT_FIELDS = ['key', 'name', 'path', 'q', 'project', 'projectName', 'subProject', 'subProjectName',
'measures', 'fav']
diff --git a/sonar-server/src/main/coffee/component-viewer/popup.coffee b/sonar-server/src/main/coffee/component-viewer/popup.coffee
index ed750cc8fe5..939180e37be 100644
--- a/sonar-server/src/main/coffee/component-viewer/popup.coffee
+++ b/sonar-server/src/main/coffee/component-viewer/popup.coffee
@@ -14,15 +14,21 @@ define [
onRender: ->
@$el.detach().appendTo $('body')
- unless @options.bottom
- @$el.css
- top: @options.triggerEl.offset().top
- left: @options.triggerEl.offset().left + @options.triggerEl.outerWidth()
- else
+ if @options.bottom
@$el.addClass 'component-viewer-popup-bottom'
@$el.css
top: @options.triggerEl.offset().top + @options.triggerEl.outerHeight()
left: @options.triggerEl.offset().left
+ else if @options.bottomRight
+ @$el.addClass 'component-viewer-popup-bottom-right'
+ @$el.css
+ top: @options.triggerEl.offset().top + @options.triggerEl.outerHeight()
+ right: $(window).width() - @options.triggerEl.offset().left - @options.triggerEl.outerWidth()
+ else
+ @$el.css
+ top: @options.triggerEl.offset().top
+ left: @options.triggerEl.offset().left + @options.triggerEl.outerWidth()
+
$('body').on 'click.coverage-popup', =>
$('body').off 'click.coverage-popup'
diff --git a/sonar-server/src/main/hbs/component-viewer/extensions-popup.hbs b/sonar-server/src/main/hbs/component-viewer/extensions-popup.hbs
new file mode 100644
index 00000000000..e7ebf3b7c9a
--- /dev/null
+++ b/sonar-server/src/main/hbs/component-viewer/extensions-popup.hbs
@@ -0,0 +1,11 @@
+<div class="component-viewer-popup-container">
+ <div class="component-viewer-popup-title">{{t 'component_viewer.extensions'}}</div>
+
+ <div class="component-viewer-popup-section fluid">
+ {{#each extensions}}
+ <a href="#" class="js-extension link-action" data-key="{{this.[0]}}">{{this.[1]}}</a>
+ {{/each}}
+ </div>
+</div>
+
+<div class="component-viewer-popup-arrow"></div> \ No newline at end of file
diff --git a/sonar-server/src/main/hbs/component-viewer/header.hbs b/sonar-server/src/main/hbs/component-viewer/header.hbs
index 2810306f7b7..c1eaf500d2e 100644
--- a/sonar-server/src/main/hbs/component-viewer/header.hbs
+++ b/sonar-server/src/main/hbs/component-viewer/header.hbs
@@ -2,26 +2,34 @@
<div class="component-viewer-header-component">
{{#if component.projectName}}
<div class="component-viewer-header-component-project">
- {{qualifierIcon 'TRK'}} <a href="{{dashboardUrl component.project}}">{{component.projectName}}</a>
+ {{qualifierIcon 'TRK'}}
+ <a class="link-action" href="{{dashboardUrl component.project}}">{{component.projectName}}</a>
{{#if component.subProjectName}}
- / <a href="{{dashboardUrl component.subProject}}">{{component.subProjectName}}</a>
+ / <a class="link-action" href="{{dashboardUrl component.subProject}}">{{component.subProjectName}}</a>
{{/if}}
</div>
{{/if}}
<div class="component-viewer-header-component-name">
{{qualifierIcon component.q}} {{component.path}}
+
+ {{#if state.canMarkAsFavourite}}
+ <a class="js-favorite component-viewer-header-favorite"
+ title="{{#if component.fav}}{{t 'click_to_remove_from_favorites'}}{{else}}{{t 'click_to_add_to_favorites'}}{{/if}}">
+ <i class="{{#if component.fav}}icon-favorite{{else}}icon-not-favorite{{/if}}"></i>
+ </a>
+ {{/if}}
</div>
</div>
<div class="component-viewer-header-links">
<a><i class="icon-link"></i></a>
- {{#if state.canMarkAsFavourite}}
- <a class="js-favorite"
- title="{{#if component.fav}}{{t 'click_to_remove_from_favorites'}}{{else}}{{t 'click_to_add_to_favorites'}}{{/if}}">
- <i class="{{#if component.fav}}icon-favorite{{else}}icon-not-favorite{{/if}}"></i>
+ {{#ifNotEmpty state.extensions}}
+ <a class="js-extensions">
+ <i class="icon-extension"></i>
+ <i class="icon-dropdown"></i>
</a>
- {{/if}}
+ {{/ifNotEmpty}}
</div>
<div class="component-viewer-header-measures">
@@ -128,6 +136,4 @@
</div>
</div>
-<div class="component-viewer-header-expanded-bar">
- <i class="spinner spinner-margin"></i>
-</div> \ No newline at end of file
+<div class="component-viewer-header-expanded-bar"></div> \ No newline at end of file
diff --git a/sonar-server/src/main/less/component-viewer.less b/sonar-server/src/main/less/component-viewer.less
index 027e70f7b22..b90034eba1b 100644
--- a/sonar-server/src/main/less/component-viewer.less
+++ b/sonar-server/src/main/less/component-viewer.less
@@ -338,6 +338,12 @@
font-weight: 600;
}
+.component-viewer-header-favorite {
+ position: relative;
+ top: -2px;
+ margin-left: 4px;
+}
+
.component-viewer-header-measures {
float: right;
}
@@ -616,6 +622,17 @@
}
}
+.component-viewer-popup-bottom-right {
+ .component-viewer-popup-bottom;
+ margin-left: 0;
+ margin-right: -8px;
+
+ .component-viewer-popup-arrow {
+ left: auto;
+ right: 15px;
+ }
+}
+
.component-viewer-popup-container {
max-width: 560px;
max-height: 300px;
@@ -633,6 +650,11 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+
+ &.fluid {
+ width: auto;
+ max-width: 450px;
+ }
}
.component-viewer-popup-section + .component-viewer-popup-section,
diff --git a/sonar-server/src/main/less/icons.less b/sonar-server/src/main/less/icons.less
index b10dac3e8c0..cb6edff97ab 100644
--- a/sonar-server/src/main/less/icons.less
+++ b/sonar-server/src/main/less/icons.less
@@ -469,6 +469,10 @@ a[class^="icon-"], a[class*=" icon-"] {
content: "\f101";
font-size: @iconSmallFontSize;
}
+.icon-extension:before {
+ content: "\f069";
+ font-size: @iconFontSize;
+}
/*
diff --git a/sonar-server/src/main/less/style.less b/sonar-server/src/main/less/style.less
index 4581fd64b16..a46bba2c481 100644
--- a/sonar-server/src/main/less/style.less
+++ b/sonar-server/src/main/less/style.less
@@ -1016,8 +1016,6 @@ th.operations, td.operations {
}
.tab_header {
- border-bottom: 1px solid #DDD;
- background-color: #EFEFEF;
padding: 5px 10px;
}
@@ -1036,6 +1034,11 @@ th.operations, td.operations {
font-weight: bold;
}
+.extension-close {
+ position: absolute;
+ top: 5px; right: 10px;
+}
+
.source_options {
margin-top: 5px;
padding-top: 5px;
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb
index cfee6afffcc..24b6e292fa8 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb
@@ -7,3 +7,5 @@
<% elsif @extension.getTarget() # ruby on rails page %>
<%= render :inline => @extension.getTarget().getTemplate() -%>
<% end %>
+
+<a href="#" class="js-extension-close extension-close link-action"><%= message('close') -%></a> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/fonts/sonar.woff b/sonar-server/src/main/webapp/fonts/sonar.woff
index fc866e5cb88..dd7b9863305 100755
--- a/sonar-server/src/main/webapp/fonts/sonar.woff
+++ b/sonar-server/src/main/webapp/fonts/sonar.woff
Binary files differ