From: Stas Vilchik Date: Wed, 18 Feb 2015 14:08:54 +0000 (+0100) Subject: SONAR-5855 Update UI of quality gates page X-Git-Tag: 5.1-RC1~205 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8640ce8dee1ff1f515d8c8b8564e0c53e5d6b5ec;p=sonarqube.git SONAR-5855 Update UI of quality gates page --- diff --git a/server/sonar-web/src/main/coffee/quality-gate/app.coffee b/server/sonar-web/src/main/coffee/quality-gate/app.coffee index 28cf9daf416..1e376e3b2b5 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/app.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/app.coffee @@ -18,10 +18,6 @@ requirejs [ QualityGateLayout ) -> - # Add html class to mark the page as navigator page - jQuery('html').addClass('navigator-page quality-gates-page'); - - # Create a Quality Gate Application App = new Marionette.Application @@ -49,8 +45,8 @@ requirejs [ # Construct layout App.addInitializer -> @layout = new QualityGateLayout app: @ - jQuery('#content').append @layout.render().el - @layout.onResize() + jQuery('#quality-gates').append @layout.render().el + jQuery('#footer').addClass 'search-navigator-footer' # Construct actions bar @@ -101,8 +97,5 @@ requirejs [ jQuery.when(qualityGatesXHR, appXHR, l10nXHR) .done -> - # Remove the initial spinner - jQuery('#quality-gate-page-loader').remove() - # Start the application App.start() diff --git a/server/sonar-web/src/main/coffee/quality-gate/layout.coffee b/server/sonar-web/src/main/coffee/quality-gate/layout.coffee index 9a982cf1e02..4e58fa172e8 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/layout.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/layout.coffee @@ -2,45 +2,21 @@ define [ 'templates/quality-gates' ], -> + $ = jQuery + class AppLayout extends Marionette.Layout - className: 'navigator quality-gates-navigator' template: Templates['quality-gates-layout'] regions: - headerRegion: '.navigator-header' - actionsRegion: '.navigator-actions' - resultsRegion: '.navigator-results' - detailsRegion: '.navigator-details' - - - initialize: (options) -> - @listenTo options.app.qualityGates, 'all', @updateLayout - jQuery(window).on 'resize', => @onResize() - - - updateLayout: -> - empty = @options.app.qualityGates.length == 0 - @$(@headerRegion.el).toggle !empty - @$(@detailsRegion.el).toggle !empty - - - onResize: -> - footerEl = jQuery('#footer') - footerHeight = footerEl.outerHeight true - - resultsEl = jQuery('.navigator-results') - resultsHeight = jQuery(window).height() - resultsEl.offset().top - - parseInt(resultsEl.css('margin-bottom'), 10) - footerHeight - resultsEl.height resultsHeight - - detailsEl = jQuery('.navigator-details') - detailsWidth = jQuery(window).width() - detailsEl.offset().left - - parseInt(detailsEl.css('margin-right'), 10) - detailsHeight = jQuery(window).height() - detailsEl.offset().top - - parseInt(detailsEl.css('margin-bottom'), 10) - footerHeight - detailsEl.width(detailsWidth).height detailsHeight + headerRegion: '.search-navigator-workspace-header' + actionsRegion: '.search-navigator-filters' + resultsRegion: '.quality-gates-results' + detailsRegion: '.search-navigator-workspace-list' onRender: -> - @updateLayout() + $('.search-navigator').addClass 'sticky' + top = $('.search-navigator').offset().top + @$('.search-navigator-workspace-header').css top: top + @$('.search-navigator-side').css({ top: top }).isolatedScroll() diff --git a/server/sonar-web/src/main/coffee/quality-gate/router.coffee b/server/sonar-web/src/main/coffee/quality-gate/router.coffee index 9bb56410f9a..e185428a51b 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/router.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/router.coffee @@ -34,7 +34,5 @@ define [ @app.layout.detailsRegion.show qualityGateDetailView qualityGateDetailView.$el.hide() - qualityGateDetailHeaderView.showSpinner() qualityGate.fetch().done -> qualityGateDetailView.$el.show() - qualityGateDetailHeaderView.hideSpinner() diff --git a/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-detail-header-view.coffee b/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-detail-header-view.coffee index 3bcc07e9eaf..a90b5580f2a 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-detail-header-view.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-detail-header-view.coffee @@ -49,26 +49,21 @@ define [ yesLabel: t 'delete' noLabel: t 'cancel' yesHandler: => - @showSpinner() jQuery.ajax type: 'POST' url: "#{baseUrl}/api/qualitygates/destroy" data: id: @model.id - .always => @hideSpinner() .done => @options.app.deleteQualityGate @model.id always: => @ui.deleteButton.blur() changeDefault: (set) -> - @showSpinner() data = if set then { id: @model.id } else {} method = if set then 'set_as_default' else 'unset_default' jQuery.ajax type: 'POST' url: "#{baseUrl}/api/qualitygates/#{method}" data: data - .always => - @hideSpinner() .done => @options.app.unsetDefaults @model.id @model.set 'default', !@model.get('default') @@ -82,15 +77,5 @@ define [ @changeDefault false - showSpinner: -> - @$el.hide() - jQuery(@spinner).insertBefore @$el - - - hideSpinner: -> - @$el.prev().remove() - @$el.show() - - serializeData: -> _.extend super, canEdit: @options.app.canEdit diff --git a/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-item-view.coffee b/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-item-view.coffee index d2c618fa745..4f2e3eaa14c 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-item-view.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-item-view.coffee @@ -3,7 +3,7 @@ define [ ], -> class QualityGateSidebarListItemView extends Marionette.ItemView - tagName: 'li' + className: 'facet search-navigator-facet' template: Templates['quality-gate-sidebar-list-item'] diff --git a/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-view.coffee b/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-view.coffee index 063fd569a2c..7cdfbe4a14e 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-view.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-sidebar-list-view.coffee @@ -7,8 +7,7 @@ define [ ) -> class QualityGateSidebarListView extends Marionette.CollectionView - tagName: 'ol' - className: 'navigator-results-list' + className: 'search-navigator-facet-list' itemView: QualityGateSidebarListItemView emptyView: QualityGateSidebarListEmptyView diff --git a/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-condition.hbs b/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-condition.hbs index 79973fe9a38..9be26807f78 100644 --- a/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-condition.hbs +++ b/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-condition.hbs @@ -27,19 +27,19 @@ {{t 'quality_gates.operator' op}} {{/if}} - + {{#if canEdit}} - {{else}} {{warning}} {{/if}} - + {{#if canEdit}} - {{else}} {{error}} diff --git a/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-header.hbs b/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-header.hbs index e84a730d379..71f7e3b06de 100644 --- a/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-header.hbs +++ b/server/sonar-web/src/main/hbs/quality-gates/quality-gate-detail-header.hbs @@ -1,14 +1,16 @@ -

{{name}}

+

{{name}}

{{#if canEdit}} -