From: Stas Vilchik Date: Wed, 22 Apr 2015 12:13:55 +0000 (+0200) Subject: SONAR-6440 The "Quality Gates" page should start by a short description message expla... X-Git-Tag: 5.2-RC1~2156 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=33ea3a14b5e06fe7c13edf53ddc5ff6245d1fc34;p=sonarqube.git SONAR-6440 The "Quality Gates" page should start by a short description message explaining the concept of Quality Gates --- 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 5aff2a4f4ce..38705f870b2 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/app.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/app.coffee @@ -29,14 +29,12 @@ requirejs [ 'quality-gate/views/quality-gate-edit-view', 'quality-gate/router', 'quality-gate/layout' -], ( - QualityGates, +], (QualityGates, QualityGateSidebarListItemView, QualityGateActionsView, QualityGateEditView, QualityGateRouter, - QualityGateLayout -) -> + QualityGateLayout) -> # Create a Quality Gate Application App = new Marionette.Application @@ -46,10 +44,7 @@ requirejs [ App.openFirstQualityGate = -> - if @qualityGates.length > 0 - @router.navigate "show/#{@qualityGates.models[0].get('id')}", trigger: true - else - App.layout.detailsRegion.reset() + App.layout.detailsRegion.reset() App.deleteQualityGate = (id) -> @@ -93,7 +88,12 @@ requirejs [ # Start router App.addInitializer -> @router = new QualityGateRouter app: @ - Backbone.history.start() + + QUALITY_GATES = '/quality_gates' + path = window.location.pathname + pos = path.indexOf QUALITY_GATES + root = path.substr(0, pos + QUALITY_GATES.length) + Backbone.history.start pushState: true, root: root # Open first quality gate when come to the page @@ -106,9 +106,9 @@ requirejs [ appXHR = jQuery.ajax url: "#{baseUrl}/api/qualitygates/app" .done (r) => - App.canEdit = r.edit - App.periods = r.periods - App.metrics = r.metrics + App.canEdit = r.edit + App.periods = r.periods + App.metrics = r.metrics qualityGatesXHR = App.qualityGates.fetch() @@ -116,6 +116,7 @@ requirejs [ l10nXHR = window.requestMessages() jQuery.when(qualityGatesXHR, appXHR, l10nXHR) - .done -> - # Start the application - App.start() + .done -> + # Start the application + App.start() + 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 9f8f30fa713..d63a1fbc713 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/router.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/router.coffee @@ -31,6 +31,7 @@ define [ class QualityGateRouter extends Backbone.Router routes: + '': 'index' 'show/:id': 'show' @@ -38,6 +39,9 @@ define [ @app = options.app + index: -> + + show: (id) -> qualityGate = @app.qualityGates.get id if qualityGate diff --git a/server/sonar-web/src/main/hbs/quality-gates/_quality-gate-intro.hbs b/server/sonar-web/src/main/hbs/quality-gates/_quality-gate-intro.hbs new file mode 100644 index 00000000000..8d627a11530 --- /dev/null +++ b/server/sonar-web/src/main/hbs/quality-gates/_quality-gate-intro.hbs @@ -0,0 +1,7 @@ +
+

Quality Gates are collections of simple boolean thresholds set on project measures. A project + must pass each of the thresholds in order to pass the Quality Gate as a whole.

+ +

It is possible to set a default Quality Gate, which will be applied to all projects not explicitly assigned to some + other gate.

+
diff --git a/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs b/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs index e156acf6e18..caac49159fd 100644 --- a/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs +++ b/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs @@ -4,6 +4,6 @@
-
-
+
 
+
{{> '_quality-gate-intro'}}
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb b/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb index 6754a315d62..442ebdce8b5 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb @@ -44,6 +44,7 @@ ActionController::Routing::Routes.draw do |map| map.connect 'rules_configuration/:action/:language/:name/:plugin.:format', :controller => 'rules_configuration' map.connect 'api_documentation/*other', :controller => 'api_documentation', :action => 'index' + map.connect 'quality_gates/*other', :controller => 'quality_gates', :action => 'index' # Install the default route as the lowest priority. map.connect ':controller/:action/:id', :requirements => { :id => /.*/ } diff --git a/server/sonar-web/src/test/js/quality-gates-spec.js b/server/sonar-web/src/test/js/quality-gates-spec.js index dc3c644d008..b892b5527a3 100644 --- a/server/sonar-web/src/test/js/quality-gates-spec.js +++ b/server/sonar-web/src/test/js/quality-gates-spec.js @@ -28,7 +28,7 @@ lib.configureCasper(); casper.test.begin('Quality Gates', function suite (test) { casper - .start(lib.buildUrl('quality-gates'), function () { + .start(lib.buildUrl('quality_gates#show/1'), function () { lib.setDefaultViewport(); diff --git a/server/sonar-web/src/test/views/quality-gates.jade b/server/sonar-web/src/test/views/quality-gates.jade deleted file mode 100644 index c7cbf2c021a..00000000000 --- a/server/sonar-web/src/test/views/quality-gates.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layouts/main - -block body - #content - .search-navigator#quality-gates diff --git a/server/sonar-web/src/test/views/quality_gates.jade b/server/sonar-web/src/test/views/quality_gates.jade new file mode 100644 index 00000000000..c7cbf2c021a --- /dev/null +++ b/server/sonar-web/src/test/views/quality_gates.jade @@ -0,0 +1,5 @@ +extends layouts/main + +block body + #content + .search-navigator#quality-gates