diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-gates')
23 files changed, 64 insertions, 38 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js b/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js index 156c7d88104..44013fbc930 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/actions-view.js @@ -1,7 +1,8 @@ define([ + 'backbone.marionette', './create-view', './templates' -], function (CreateView) { +], function (Marionette, CreateView) { return Marionette.ItemView.extend({ template: Templates['quality-gate-actions'], diff --git a/server/sonar-web/src/main/js/apps/quality-gates/app.js b/server/sonar-web/src/main/js/apps/quality-gates/app.js index 6f939c9aa24..1c8f38fea0d 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/app.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/app.js @@ -1,11 +1,13 @@ define([ + 'backbone', + 'backbone.marionette', './gates', './gates-view', './actions-view', './router', './layout', './controller' -], function (Gates, GatesView, ActionsView, Router, Layout, Controller) { +], function (Backbone, Marionette, Gates, GatesView, ActionsView, Router, Layout, Controller) { var $ = jQuery, App = new Marionette.Application(); @@ -52,7 +54,7 @@ define([ }); App.on('start', function (options) { - $.when(window.requestMessages(), appXHR).done(function () { + $.when(appXHR).done(function () { init.call(App, options); }); }); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/condition.js b/server/sonar-web/src/main/js/apps/quality-gates/condition.js index 9ca451ee5a0..bb14f8226c0 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/condition.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/condition.js @@ -1,4 +1,6 @@ -define(function () { +define([ + 'backbone' +], function (Backbone) { return Backbone.Model.extend({ @@ -7,7 +9,7 @@ define(function () { }, url: function () { - return baseUrl + '/api/qualitygates'; + return window.baseUrl + '/api/qualitygates'; }, createUrl: function () { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/conditions.js b/server/sonar-web/src/main/js/apps/quality-gates/conditions.js index 49cbb23f069..08d1cb52133 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/conditions.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/conditions.js @@ -1,6 +1,7 @@ define([ + 'backbone', './condition' -], function (Condition) { +], function (Backbone, Condition) { return Backbone.Collection.extend({ model: Condition, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/controller.js b/server/sonar-web/src/main/js/apps/quality-gates/controller.js index 890adc1ad8b..90b1c4b0d9f 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/controller.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/controller.js @@ -1,8 +1,9 @@ define([ + 'backbone.marionette', './gate', './details-view', './header-view' -], function (Gate, DetailsView, HeaderView) { +], function (Marionette, Gate, DetailsView, HeaderView) { return Marionette.Controller.extend({ diff --git a/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js b/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js index fdd6c974cf8..012683d9ee8 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/copy-view.js @@ -7,7 +7,7 @@ define([ prepareRequest: function () { var that = this; - var url = baseUrl + '/api/qualitygates/copy', + var url = window.baseUrl + '/api/qualitygates/copy', name = this.$('#quality-gate-form-name').val(), options = { url: url, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/create-view.js b/server/sonar-web/src/main/js/apps/quality-gates/create-view.js index f58863ba315..acb0cc5e5e3 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/create-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/create-view.js @@ -7,7 +7,7 @@ define([ prepareRequest: function () { var that = this; - var url = baseUrl + '/api/qualitygates/create', + var url = window.baseUrl + '/api/qualitygates/create', name = this.$('#quality-gate-form-name').val(), options = { url: url, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/details-view.js b/server/sonar-web/src/main/js/apps/quality-gates/details-view.js index 9af1b38e65e..6451104db2c 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/details-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/details-view.js @@ -1,9 +1,10 @@ define([ + 'backbone.marionette', './conditions', './gate-conditions-view', './gate-projects-view', './templates' -], function (Conditions, DetailConditionsView, ProjectsView) { +], function (Marionette, Conditions, DetailConditionsView, ProjectsView) { return Marionette.LayoutView.extend({ template: Templates['quality-gate-detail'], diff --git a/server/sonar-web/src/main/js/apps/quality-gates/form-view.js b/server/sonar-web/src/main/js/apps/quality-gates/form-view.js index 9b61f400bf3..6d696825899 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/form-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/form-view.js @@ -1,8 +1,9 @@ define([ + 'backbone', 'components/common/modal-form', './gate', './templates' -], function (ModalForm, Gate) { +], function (Backbone, ModalForm, Gate) { return ModalForm.extend({ template: Templates['quality-gate-form'], diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js index 0dfbea0ab17..7d9bbc741eb 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js @@ -1,7 +1,8 @@ define([ + 'backbone.marionette', './gate-conditions-delete-view', './templates' -], function (DeleteConditionView) { +], function (Marionette, DeleteConditionView) { return Marionette.ItemView.extend({ tagName: 'tr', @@ -90,7 +91,7 @@ define([ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { canEdit: this.options.canEdit, periods: this.options.periods, - periodText: period ? period.text : t('value'), + periodText: period ? period.text : window.t('value'), metric: this.getMetric(), isDiffMetric: this.isDiffMetric() }); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js index c8ed23a2883..eaf001b0658 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-delete-view.js @@ -1,7 +1,8 @@ define([ + 'backbone.marionette', 'components/common/modal-form', './templates' -], function (ModalForm) { +], function (Marionette, ModalForm) { return ModalForm.extend({ template: Templates['quality-gates-condition-delete'], diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js index 03390ac7a89..5bab8c1ff29 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-empty-view.js @@ -1,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { return Marionette.ItemView.extend({ tagName: 'tr', diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js index b0c0857cc95..5eb29360449 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js @@ -1,9 +1,10 @@ define([ + 'backbone.marionette', './condition', './gate-condition-view', './gate-conditions-empty-view', './templates' -], function (Condition, ConditionView, ConditionsEmptyView) { +], function (Marionette, Condition, ConditionView, ConditionsEmptyView) { return Marionette.CompositeView.extend({ template: Templates['quality-gate-detail-conditions'], @@ -34,7 +35,7 @@ define([ this.ui.metricSelect.select2({ allowClear: false, width: '250px', - placeholder: t('alerts.select_metric') + placeholder: window.t('alerts.select_metric') }); }, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js index c188c473be5..5337fad8c52 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js @@ -1,13 +1,15 @@ define([ + 'backbone.marionette', 'components/common/select-list', './templates' -], function () { +], function (Marionette) { return Marionette.ItemView.extend({ template: Templates['quality-gate-detail-projects'], onRender: function () { if (!this.model.isDefault()) { + //noinspection Eslint new window.SelectList({ el: this.$('#select-list-projects'), width: '100%', @@ -16,23 +18,23 @@ define([ format: function (item) { return item.name; }, - searchUrl: baseUrl + '/api/qualitygates/search?gateId=' + this.model.id, - selectUrl: baseUrl + '/api/qualitygates/select', - deselectUrl: baseUrl + '/api/qualitygates/deselect', + searchUrl: window.baseUrl + '/api/qualitygates/search?gateId=' + this.model.id, + selectUrl: window.baseUrl + '/api/qualitygates/select', + deselectUrl: window.baseUrl + '/api/qualitygates/deselect', extra: { gateId: this.model.id }, selectParameter: 'projectId', selectParameterValue: 'id', labels: { - selected: t('quality_gates.projects.with'), - deselected: t('quality_gates.projects.without'), - all: t('quality_gates.projects.all'), - noResults: t('quality_gates.projects.noResults') + selected: window.t('quality_gates.projects.with'), + deselected: window.t('quality_gates.projects.without'), + all: window.t('quality_gates.projects.all'), + noResults: window.t('quality_gates.projects.noResults') }, tooltips: { - select: t('quality_gates.projects.select_hint'), - deselect: t('quality_gates.projects.deselect_hint') + select: window.t('quality_gates.projects.select_hint'), + deselect: window.t('quality_gates.projects.deselect_hint') } }); } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js index 30036a3c313..c9fdb2ba12e 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate-view.js @@ -1,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { return Marionette.ItemView.extend({ tagName: 'a', diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gate.js b/server/sonar-web/src/main/js/apps/quality-gates/gate.js index 54b4e6ce13c..5bcda8336b1 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gate.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gate.js @@ -1,4 +1,6 @@ -define(function () { +define([ + 'backbone' +], function (Backbone) { return Backbone.Model.extend({ @@ -7,7 +9,7 @@ define(function () { }, url: function () { - return baseUrl + '/api/qualitygates'; + return window.baseUrl + '/api/qualitygates'; }, showUrl: function () { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js b/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js index cd36c381a39..2e58b9466f9 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gates-view.js @@ -1,7 +1,8 @@ define([ + 'backbone.marionette', './gate-view', './templates' -], function (ItemView) { +], function (Marionette, ItemView) { return Marionette.CompositeView.extend({ className: 'list-group', diff --git a/server/sonar-web/src/main/js/apps/quality-gates/gates.js b/server/sonar-web/src/main/js/apps/quality-gates/gates.js index d33b35bcfe5..55c6d681084 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/gates.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/gates.js @@ -1,12 +1,13 @@ define([ + 'backbone', './gate' -], function (Gate) { +], function (Backbone, Gate) { return Backbone.Collection.extend({ model: Gate, url: function () { - return baseUrl + '/api/qualitygates/list'; + return window.baseUrl + '/api/qualitygates/list'; }, parse: function (r) { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/header-view.js b/server/sonar-web/src/main/js/apps/quality-gates/header-view.js index b86b2c9ba62..dd6bea9ee74 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/header-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/header-view.js @@ -1,9 +1,10 @@ define([ + 'backbone.marionette', './rename-view', './copy-view', './delete-view', './templates' -], function (RenameView, CopyView, DeleteView) { +], function (Marionette, RenameView, CopyView, DeleteView) { return Marionette.ItemView.extend({ template: Templates['quality-gate-detail-header'], diff --git a/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js b/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js index c9588a3d48f..83d6b354d13 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/intro-view.js @@ -1,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { return Marionette.ItemView.extend({ template: Templates['quality-gates-intro'] diff --git a/server/sonar-web/src/main/js/apps/quality-gates/layout.js b/server/sonar-web/src/main/js/apps/quality-gates/layout.js index db02143caa6..bee18432f0c 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/layout.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/layout.js @@ -1,7 +1,9 @@ define([ + 'backbone.marionette', './intro-view', + '../../components/common/jquery-isolated-scroll', './templates' -], function (IntroView) { +], function (Marionette, IntroView) { return Marionette.LayoutView.extend({ template: Templates['quality-gates-layout'], diff --git a/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js b/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js index d9b5946653a..29db22d6fa4 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/rename-view.js @@ -7,7 +7,7 @@ define([ prepareRequest: function () { var that = this; - var url = baseUrl + '/api/qualitygates/rename', + var url = window.baseUrl + '/api/qualitygates/rename', name = this.$('#quality-gate-form-name').val(), options = { url: url, diff --git a/server/sonar-web/src/main/js/apps/quality-gates/router.js b/server/sonar-web/src/main/js/apps/quality-gates/router.js index 582c47361d5..35a41f33864 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/router.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/router.js @@ -1,4 +1,6 @@ -define(function () { +define([ + 'backbone' +], function (Backbone) { return Backbone.Router.extend({ routes: { |