]> source.dussan.org Git - sonarqube.git/commitdiff
improve code quality
authorStas Vilchik <vilchiks@gmail.com>
Tue, 8 Dec 2015 16:55:39 +0000 (17:55 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 9 Dec 2015 15:29:49 +0000 (16:29 +0100)
40 files changed:
server/sonar-web/.eslintrc
server/sonar-web/package.json
server/sonar-web/src/main/js/apps/account/change-password-view.js
server/sonar-web/src/main/js/apps/coding-rules/app.js
server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js
server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js
server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
server/sonar-web/src/main/js/apps/issues/facets/author-facet.js
server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js
server/sonar-web/src/main/js/apps/issues/facets/language-facet.js
server/sonar-web/src/main/js/apps/issues/facets/project-facet.js
server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js
server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js
server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js
server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js
server/sonar-web/src/main/js/apps/projects/form-view.js
server/sonar-web/src/main/js/apps/quality-gates/gate-condition-view.js
server/sonar-web/src/main/js/apps/quality-gates/gate-conditions-view.js
server/sonar-web/src/main/js/apps/quality-gates/gate-projects-view.js
server/sonar-web/src/main/js/apps/quality-profiles/helpers.js
server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
server/sonar-web/src/main/js/components/issue/views/assign-form-view.js
server/sonar-web/src/main/js/components/issue/views/plan-form-view.js
server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js
server/sonar-web/src/main/js/components/source-viewer/main.js
server/sonar-web/src/main/js/components/widgets/barchart.js
server/sonar-web/src/main/js/helpers/handlebars-helpers.js
server/sonar-web/src/main/js/main/nav/global/search-view.js
server/sonar-web/src/main/js/main/processes.js
server/sonar-web/src/main/js/widgets/old/tag-cloud.js

index 19e2098c50fec6394abb50484303317e4385ac7b..77cfb1f6eddbf639e5d274e0bfd11c96b0047a2a 100644 (file)
   },
 
   "globals": {
-    "define": true,
-    "require": true,
-    "numeral": true,
     "key": true,
     "d3": true,
-    "baseUrl": true,
-    "t": true,
-    "tp": true
+    "baseUrl": true
   },
 
   "parser": "babel-eslint",
 
   "plugins": [
     "react",
-    "mocha"
+    "mocha",
+    "import"
   ],
 
   "rules": {
     "react/prop-types": 0,
     "react/react-in-jsx-scope": 2,
     "react/self-closing-comp": 2,
-    "react/sort-comp": 1
+    "react/sort-comp": 1,
+
+    "import/no-unresolved": 2,
+    "import/named": 2,
+    "import/export": 2,
+    "import/no-duplicates": 2,
+    "import/imports-first": 2
   }
 }
index 38d0e42048614d5efca51e37c3e1b09bde209c50..04d8169b95ad706e608ef56c55de40af178694c8 100644 (file)
@@ -19,6 +19,7 @@
     "d3": "3.5.6",
     "del": "2.0.2",
     "eslint": "^1.10.3",
+    "eslint-plugin-import": "^0.11.0",
     "eslint-plugin-mocha": "^1.1.0",
     "eslint-plugin-react": "^3.11.3",
     "event-stream": "3.3.1",
index 6bd5d992b2189db3ec3c60da46e162a470f2fe77..4df1c081161ff5807a0c3cc513d25578daba8704 100644 (file)
@@ -10,7 +10,7 @@ export default ModalForm.extend({
     if (this.checkPasswords()) {
       this.sendRequest();
     } else {
-      this.showErrors([{ msg: t('user.password_doesnt_match_confirmation') }]);
+      this.showErrors([{ msg: window.t('user.password_doesnt_match_confirmation') }]);
     }
   },
 
index 610895115946ccfee9697cea029f2d0f75825052..feb040c35625e5b6f5273dd907e9ac409cabc28e 100644 (file)
@@ -63,7 +63,7 @@ var App = new Marionette.Application(),
 App.manualRepository = function () {
   return {
     key: 'manual',
-    name: t('coding_rules.manual_rule'),
+    name: window.t('coding_rules.manual_rule'),
     language: 'none'
   };
 };
index d816c21c2198182b1cc43954a27131e69626ef64..453aa8fd107f165346f661588f758b2b22ce610e 100644 (file)
@@ -15,14 +15,14 @@ export default ModalFormView.extend({
   showSuccessMessage: function (profile, succeeded) {
     var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }),
         profileName = profileBase != null ? profileBase.name : profile,
-        message = tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded);
+        message = window.tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded);
     this.ui.messagesContainer.append('<div class="alert alert-success">' + message + '</div>');
   },
 
   showWarnMessage: function (profile, succeeded, failed) {
     var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }),
         profileName = profileBase != null ? profileBase.name : profile,
-        message = tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed);
+        message = window.tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed);
     this.ui.messagesContainer.append('<div class="alert alert-warning">' + message + '</div>');
   },
 
index 2062e292b99ae4672b983a3972cd8f6ef42debe2..2ab853c763ace124db82cdb4b5bf68a37b7f7440 100644 (file)
@@ -26,7 +26,7 @@ export default BaseFacet.extend({
 
   forbid: function () {
     BaseFacet.prototype.forbid.apply(this, arguments);
-    this.$el.prop('title', t('coding_rules.filters.active_severity.inactive'));
+    this.$el.prop('title', window.t('coding_rules.filters.active_severity.inactive'));
   },
 
   allow: function () {
index 9b2e01ef70a73d01c5069e5e7b3b322f27050f00..bf3739cf70c834423050ec87aaadcccf0fc61257 100644 (file)
@@ -22,17 +22,17 @@ export default BaseFacet.extend({
 
   prepareSearch: function () {
     this.$('.js-custom-value').select2({
-      placeholder: t('search_verb'),
+      placeholder: window.t('search_verb'),
       minimumInputLength: 1,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       formatInputTooShort: function () {
-        return tp('select2.tooShort', 1);
+        return window.tp('select2.tooShort', 1);
       },
       width: '100%',
       ajax: this.prepareAjaxSearch()
index d72f47e4584999703a5dc1df315cdb5c2d119ef6..490498a13cbbb0768e4a3c0edbdf431dc5538738 100644 (file)
@@ -30,7 +30,7 @@ export default BaseFacet.extend({
 
   forbid: function () {
     BaseFacet.prototype.forbid.apply(this, arguments);
-    this.$el.prop('title', t('coding_rules.filters.inheritance.inactive'));
+    this.$el.prop('title', window.t('coding_rules.filters.inheritance.inactive'));
   },
 
   allow: function () {
@@ -42,7 +42,7 @@ export default BaseFacet.extend({
     var values = ['NONE', 'INHERITED', 'OVERRIDES'];
     return values.map(function (key) {
       return {
-        label: t('coding_rules.filters.inheritance', key.toLowerCase()),
+        label: window.t('coding_rules.filters.inheritance', key.toLowerCase()),
         val: key
       };
     });
index 23b0e41e0893cae63b3f499875c3b407fd121b8c..fa453552567e4d78e107ecd97493c7471993f22e 100644 (file)
@@ -7,7 +7,7 @@ export default BaseFacet.extend({
   getValues: function () {
     var values = this.model.getValues();
     var x = values.map(function (value) {
-      return _.extend(value, { label: t('rules.status', value.val.toLowerCase()) });
+      return _.extend(value, { label: window.t('rules.status', value.val.toLowerCase()) });
     });
     return x;
   },
index f8dee5b02cdbec58a74e553a2fdacf822b8498b0..87ae705c660d9a025503baf1785c5b256eab83c8 100644 (file)
@@ -130,8 +130,8 @@ export default Marionette.LayoutView.extend({
     var that = this,
         ruleType = this.model.has('templateKey') ? 'custom' : 'manual';
     confirmDialog({
-      title: t('delete'),
-      html: tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')),
+      title: window.t('delete'),
+      html: window.tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')),
       yesHandler: function () {
         var url = baseUrl + '/api/rules/delete',
             options = { key: that.model.id };
index ff0da3c7803f62bc9d1d9c97f247a8341d7206fa..b4712e1c15e1c47e09cb1b71c5cd387808a686e2 100644 (file)
@@ -153,7 +153,7 @@ export default ModalFormView.extend({
     }).fail(function (jqXHR) {
       if (jqXHR.status === 409) {
         that.existingRule = jqXHR.responseJSON.rule;
-        that.showErrors([], [{ msg: t('coding_rules.reactivate.help') }]);
+        that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]);
         that.ui.customRuleCreationCreate.addClass('hidden');
         that.ui.customRuleCreationReactivate.removeClass('hidden');
       } else {
@@ -175,7 +175,7 @@ export default ModalFormView.extend({
     var statuses = ['READY', 'BETA', 'DEPRECATED'].map(function (status) {
       return {
         id: status,
-        text: t('rules.status', status.toLowerCase())
+        text: window.t('rules.status', status.toLowerCase())
       };
     });
 
index 6e7002ba5879b8adafc1f8696713de4fdb191cbd..791334b4a0f4121e06b27c91d870d7f41e88a9da 100644 (file)
@@ -19,8 +19,8 @@ export default Marionette.ItemView.extend({
   deleteRule: function () {
     var that = this;
     confirmDialog({
-      title: t('delete'),
-      html: t('are_you_sure'),
+      title: window.t('delete'),
+      html: window.t('are_you_sure'),
       yesHandler: function () {
         var url = baseUrl + '/api/rules/delete',
             options = { key: that.model.id };
index cb0869490d0371a491c8fc6134e06204655554bb..dab19f1fb130ac69b68327638da11d67691e437c 100644 (file)
@@ -99,7 +99,7 @@ export default ModalFormView.extend({
     }).fail(function (jqXHR) {
       if (jqXHR.status === 409) {
         that.existingRule = jqXHR.responseJSON.rule;
-        that.showErrors([], [{ msg: t('coding_rules.reactivate.help') }]);
+        that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]);
         that.ui.manualRuleCreationCreate.addClass('hidden');
         that.ui.manualRuleCreationReactivate.removeClass('hidden');
       } else {
index c1a2bc458e53c5381c258545bcbd673b1d032d76..9b88e3267ce60f1939ee518d766b81323da3456a 100644 (file)
@@ -64,7 +64,7 @@ export default Marionette.ItemView.extend({
   removeExtendedDescription: function () {
     var that = this;
     confirmDialog({
-      html: t('coding_rules.remove_extended_description.confirm'),
+      html: window.t('coding_rules.remove_extended_description.confirm'),
       yesHandler: function () {
         that.ui.extendDescriptionText.val('');
         that.submitExtendDescription();
index 1c74fc9dd63e7329d39fe0712924c80df1c4b9c9..6139044cbf6aa42d0e61cf7084829c1125a8a16b 100644 (file)
@@ -50,8 +50,8 @@ export default Marionette.ItemView.extend({
     var that = this,
         ruleKey = this.options.rule.get('key');
     confirmDialog({
-      title: t('coding_rules.revert_to_parent_definition'),
-      html: tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name),
+      title: window.t('coding_rules.revert_to_parent_definition'),
+      html: window.tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name),
       yesHandler: function () {
         return $.ajax({
           type: 'POST',
@@ -72,8 +72,8 @@ export default Marionette.ItemView.extend({
     var that = this,
         ruleKey = this.options.rule.get('key');
     confirmDialog({
-      title: t('coding_rules.deactivate'),
-      html: tp('coding_rules.deactivate.confirm'),
+      title: window.t('coding_rules.deactivate'),
+      html: window.tp('coding_rules.deactivate.confirm'),
       yesHandler: function () {
         return $.ajax({
           type: 'POST',
@@ -137,5 +137,3 @@ export default Marionette.ItemView.extend({
     });
   }
 });
-
-
index 6563efc2e3adc4005723b1bb9b3b6728526baa4a..5045ff3891d2c8988b5bcdc99b69eb3c86fed90b 100644 (file)
@@ -4,8 +4,6 @@ export default Marionette.ItemView.extend({
   className: 'search-navigator-no-results',
 
   template: function () {
-    return t('coding_rules.no_results');
+    return window.t('coding_rules.no_results');
   }
 });
-
-
index 5897372020bbe7995a328d7f2bc3412159c93dbb..05e54964103054a46544781b27087af1eb5342b8 100644 (file)
@@ -62,8 +62,8 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({
         ruleKey = this.model.get('key'),
         activation = this.model.get('activation');
     confirmDialog({
-      title: t('coding_rules.deactivate'),
-      html: tp('coding_rules.deactivate.confirm'),
+      title: window.t('coding_rules.deactivate'),
+      html: window.tp('coding_rules.deactivate.confirm'),
       yesHandler: function () {
         return $.ajax({
           type: 'POST',
index 6567912ab1e3203bf34b8d131fee4eb21b5d925a..ec9d1a2966efff01c15e644afd3113690728dec8 100644 (file)
@@ -11,13 +11,13 @@ export default CustomValuesFacet.extend({
       minimumInputLength: 2,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       formatInputTooShort: function () {
-        return tp('select2.tooShort', 2);
+        return window.tp('select2.tooShort', 2);
       },
       width: '100%',
       ajax: {
@@ -38,5 +38,3 @@ export default CustomValuesFacet.extend({
     });
   }
 });
-
-
index bf86b4970fb2af81d294f1c85c26ee8a98410053..e9bb08d5853ff10850a9b18b8a78e549833cadd8 100644 (file)
@@ -26,13 +26,13 @@ export default BaseFacet.extend({
       minimumInputLength: 2,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       formatInputTooShort: function () {
-        return tp('select2.tooShort', 2);
+        return window.tp('select2.tooShort', 2);
       },
       width: '100%',
       ajax: this.prepareAjaxSearch()
@@ -65,5 +65,3 @@ export default BaseFacet.extend({
     return this.options.app.state.updateFilter(obj);
   }
 });
-
-
index c3d6f2744204066086fc63de45396d0fda311600..e1d48fd5ac24b7af7f4bd73ef5436f944bc4a7a5 100644 (file)
@@ -12,13 +12,13 @@ export default CustomValuesFacet.extend({
       minimumInputLength: 2,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       formatInputTooShort: function () {
-        return tp('select2.tooShort', 2);
+        return window.tp('select2.tooShort', 2);
       },
       width: '100%',
       ajax: {
@@ -62,5 +62,3 @@ export default CustomValuesFacet.extend({
     });
   }
 });
-
-
index 5c8eef0fd0ef03d916f1de7b57edd87612abf817..b4657f808dfdbf602f63763d6f37036afe750645 100644 (file)
@@ -28,13 +28,13 @@ export default CustomValuesFacet.extend({
       minimumInputLength: 2,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       formatInputTooShort: function () {
-        return tp('select2.tooShort', 2);
+        return window.tp('select2.tooShort', 2);
       },
       width: '100%',
       ajax: {
@@ -78,5 +78,3 @@ export default CustomValuesFacet.extend({
     });
   }
 });
-
-
index 8d50f462c0e677556b7dae93d493a22b2696b3d9..d049890807beb6b650c1fcd408a6544ffaaeacc1 100644 (file)
@@ -13,13 +13,13 @@ export default CustomValuesFacet.extend({
       minimumInputLength: 2,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       formatInputTooShort: function () {
-        return tp('select2.tooShort', 2);
+        return window.tp('select2.tooShort', 2);
       },
       width: '100%',
       ajax: {
@@ -74,5 +74,3 @@ export default CustomValuesFacet.extend({
     });
   }
 });
-
-
index 291bcf6f393273b5d69506737c3072abe97afa73..52b0a49c5bb7854b7a27bb5cfb81bb12e06abbdd 100644 (file)
@@ -13,10 +13,10 @@ export default CustomValuesFacet.extend({
       minimumInputLength: 0,
       allowClear: false,
       formatNoMatches: function () {
-        return t('select2.noMatches');
+        return window.t('select2.noMatches');
       },
       formatSearching: function () {
-        return t('select2.searching');
+        return window.t('select2.searching');
       },
       width: '100%',
       ajax: {
@@ -50,5 +50,3 @@ export default CustomValuesFacet.extend({
     });
   }
 });
-
-
index b40c68d0ab69d95fbcd876ba480c1d2d6091004d..391dbbfd4610e0ddddc01fc2990ca4ef300c0362 100644 (file)
@@ -4,8 +4,6 @@ export default Marionette.ItemView.extend({
   className: 'search-navigator-no-results',
 
   template: function () {
-    return t('issue_filter.no_issues');
+    return window.t('issue_filter.no_issues');
   }
 });
-
-
index 2223139a7604f9fe233359d05fa89dc409b2d0f1..861e82ad2b5cba08987bf4b793b6304ea57915ac 100644 (file)
@@ -8,13 +8,12 @@ import { DomainTreemap } from '../components/domain-treemap';
 import { DomainBubbleChart } from '../components/domain-bubble-chart';
 import { getPeriodLabel, getPeriodDate } from './../helpers/periods';
 import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
-import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics';
+import { filterMetrics, filterMetricsForDomains, getMetricName } from '../helpers/metrics';
 import { DomainLeakTitle } from '../main/components';
 import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants';
 import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures';
 import { DonutChart } from '../../../components/charts/donut-chart';
 import { DrilldownLink } from '../../../components/shared/drilldown-link';
-import { getMetricName } from '../helpers/metrics';
 
 
 export const DuplicationsMain = React.createClass({
index c5e12ab40d87b6f6fd6002b65d3d7fc05af0fbd2..8f8951c7b1a50cebf9fc9ccf585d099d6e337730 100644 (file)
@@ -1,5 +1,4 @@
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
 
 export default ModalForm.extend({
 
@@ -19,5 +18,3 @@ export default ModalForm.extend({
   }
 
 });
-
-
index 9ab319a78e7f35982f3ebd29e73c0ac264ff955d..fef2d7638ac5a90555f43d6db0aeebe8fac178e7 100644 (file)
@@ -90,11 +90,9 @@ export default Marionette.ItemView.extend({
     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()
     });
   }
 });
-
-
index 4994a9da37bae52ea3ef8515995bd2bdd285a4fc..e7f75a33107471a9a5aeff78a5769f928479ec27 100644 (file)
@@ -34,7 +34,7 @@ export default Marionette.CompositeView.extend({
     this.ui.metricSelect.select2({
       allowClear: false,
       width: '250px',
-      placeholder: t('alerts.select_metric')
+      placeholder: window.t('alerts.select_metric')
     });
   },
 
@@ -71,5 +71,3 @@ export default Marionette.CompositeView.extend({
     });
   }
 });
-
-
index ff7816bd6592fe5a4d6384004a9c5197ac765093..5d0493a59f5bd66a78fed82f1ae66296952ff04e 100644 (file)
@@ -25,14 +25,14 @@ export default Marionette.ItemView.extend({
         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')
         }
       });
     }
@@ -44,5 +44,3 @@ export default Marionette.ItemView.extend({
     });
   }
 });
-
-
index 7e060b9599b64c592aa14913df607586e5a4461f..479b9b18299dc25fc9393ec0278cb1ef41a712d1 100644 (file)
@@ -15,15 +15,19 @@ Handlebars.registerHelper('exporterUrl', function (profile, exporterKey) {
 });
 
 Handlebars.registerHelper('severityChangelog', function (severity) {
-  var label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + t('severity', severity),
-      message = tp('quality_profiles.severity_set_to_x', label);
+  var label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + window.t('severity', severity),
+      message = window.tp('quality_profiles.severity_set_to_x', label);
   return new Handlebars.SafeString(message);
 });
 
 Handlebars.registerHelper('parameterChangelog', function (value, parameter) {
   if (parameter) {
-    return new Handlebars.SafeString(tp('quality_profiles.parameter_set_to_x', value, parameter));
+    return new Handlebars.SafeString(
+      window.tp('quality_profiles.parameter_set_to_x', value, parameter)
+    );
   } else {
-    return new Handlebars.SafeString(tp('quality_profiles.changelog.parameter_reset_to_default_value_x', parameter));
+    return new Handlebars.SafeString(
+      window.tp('quality_profiles.changelog.parameter_reset_to_default_value_x', parameter)
+    );
   }
 });
index b5f9167033d9bbae23ab08994c96d010b0a3f7bd..10fc51c4a309f536044de5bec47ac7f96f6b1f0b 100644 (file)
@@ -74,14 +74,14 @@ export default Marionette.LayoutView.extend({
       selectParameter: 'projectUuid',
       selectParameterValue: 'uuid',
       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_profiles.projects.select_hint'),
-        deselect: t('quality_profiles.projects.deselect_hint')
+        select: window.t('quality_profiles.projects.select_hint'),
+        deselect: window.t('quality_profiles.projects.deselect_hint')
       }
     });
     this.listenTo(this.projectsSelectList.collection, 'change:selected', this.onProjectsChange);
@@ -158,5 +158,3 @@ export default Marionette.LayoutView.extend({
     });
   }
 });
-
-
index e732493b89a2c4f0b1fe3dc383f8262b094e002e..76f1ea1eb1a158806c32911e38284441504da31c 100644 (file)
@@ -122,7 +122,7 @@ export default ActionOptionsView.extend({
     if (this.assignees) {
       return this.assignees;
     }
-    var assignees = [{ id: '', text: t('unassigned') }],
+    var assignees = [{ id: '', text: window.t('unassigned') }],
         currentUser = window.SS.user,
         currentUserName = window.SS.userName;
     assignees.push({ id: currentUser, text: currentUserName });
@@ -138,5 +138,3 @@ export default ActionOptionsView.extend({
     });
   }
 });
-
-
index 244d65e6a79761a07d4ed6946fd90d8c5c5e2972..ad924a6302e01695e535adc4e72a86cea4ff7beb 100644 (file)
@@ -26,7 +26,7 @@ export default ActionOptionsView.extend({
   },
 
   getActionPlans: function () {
-    return [{ key: '', name: t('issue.unplanned') }].concat(this.collection.toJSON());
+    return [{ key: '', name: window.t('issue.unplanned') }].concat(this.collection.toJSON());
   },
 
   serializeData: function () {
@@ -35,5 +35,3 @@ export default ActionOptionsView.extend({
     });
   }
 });
-
-
index 153cae4fc9ee5cf5a8ee3f1671539960fdce723c..f3df5eea1221c596b9e6384cc004927e956308f9 100644 (file)
@@ -250,7 +250,7 @@ var ChoiceFilterView = BaseFilters.BaseFilterView.extend({
         }),
         defaultValue = this.model.has('defaultValue') ?
             this.model.get('defaultValue') :
-            this.model.get('multiple') ? t('all') : t('any');
+            this.model.get('multiple') ? window.t('all') : window.t('any');
 
     return this.isDefaultValue() ? defaultValue : value.join(', ');
   },
@@ -387,5 +387,3 @@ export default {
   DetailsChoiceFilterView: DetailsChoiceFilterView,
   ChoiceFilterView: ChoiceFilterView
 };
-
-
index cf0ef14db0af07a42f8dcd00a4d6466f280d3db5..27b9af66d379e3b960ae5638f05cfb5b1213fe5a 100644 (file)
@@ -712,7 +712,7 @@ export default Marionette.LayoutView.extend({
     $(e.currentTarget).tooltip({
       container: 'body',
       placement: 'right',
-      title: tp('source_viewer.tooltip.new_code', this.sinceLabel),
+      title: window.tp('source_viewer.tooltip.new_code', this.sinceLabel),
       trigger: 'manual'
     }).tooltip('show');
   },
index ea15e5ea684163385cf66c904b4f8394df9087ec..03fca21da0d2d36d93c8f951fc97d9d994863192 100644 (file)
@@ -1,6 +1,7 @@
 import $ from 'jquery';
 import _ from 'underscore';
 import moment from 'moment';
+import d3 from 'd3';
 
 function trans (left, top) {
   return 'translate(' + left + ', ' + top + ')';
index e2a5110ee74063110521525fed37000e08e4a089..b9c54ea456237a7c667ee970cedb4d12e5e65a9b 100644 (file)
@@ -1,5 +1,6 @@
 import _ from 'underscore';
 import moment from 'moment';
+import numeral from 'numeral';
 import Handlebars from 'hbsfy/runtime';
 import md5 from 'blueimp-md5';
 import { formatMeasure, formatMeasureVariation } from './measures';
@@ -77,7 +78,7 @@ Handlebars.registerHelper('severityIcon', function (severity) {
 
 Handlebars.registerHelper('severityHelper', function (severity) {
   return new Handlebars.SafeString(
-      '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + t('severity', severity)
+      '<i class="icon-severity-' + severity.toLowerCase() + '"></i>&nbsp;' + window.t('severity', severity)
   );
 });
 
@@ -88,9 +89,9 @@ Handlebars.registerHelper('statusIcon', function (status) {
 });
 
 Handlebars.registerHelper('statusHelper', function (status, resolution) {
-  var s = '<i class="icon-status-' + status.toLowerCase() + '"></i>&nbsp;' + t('issue.status', status);
+  var s = '<i class="icon-status-' + status.toLowerCase() + '"></i>&nbsp;' + window.t('issue.status', status);
   if (resolution != null) {
-    s = s + '&nbsp;(' + t('issue.resolution', resolution) + ')';
+    s = s + '&nbsp;(' + window.t('issue.resolution', resolution) + ')';
   }
   return new Handlebars.SafeString(s);
 });
@@ -450,13 +451,13 @@ Handlebars.registerHelper('operators', function (options) {
 Handlebars.registerHelper('changelog', function (diff) {
   var message = '';
   if (diff.newValue != null) {
-    message = tp('issue.changelog.changed_to', t('issue.changelog.field', diff.key), diff.newValue);
+    message = window.tp('issue.changelog.changed_to', window.t('issue.changelog.field', diff.key), diff.newValue);
   } else {
-    message = tp('issue.changelog.removed', t('issue.changelog.field', diff.key));
+    message = window.tp('issue.changelog.removed', window.t('issue.changelog.field', diff.key));
   }
   if (diff.oldValue != null) {
     message += ' (';
-    message += tp('issue.changelog.was', diff.oldValue);
+    message += window.tp('issue.changelog.was', diff.oldValue);
     message += ')';
   }
   return message;
index 65a3a4a7740c1c44a84278eca5e3004b1adc9aec..fbe9f3bcddc231d946c660478f10f24677978da1 100644 (file)
@@ -155,16 +155,16 @@ export default Marionette.LayoutView.extend({
             url: url,
             name: historyItem.name,
             q: historyItem.icon,
-            extra: index === 0 ? t('browsed_recently') : null
+            extra: index === 0 ? window.t('browsed_recently') : null
           };
         }),
         favorite = _.first(this.favorite, 6).map(function (f, index) {
-          return _.extend(f, { extra: index === 0 ? t('favorite') : null });
+          return _.extend(f, { extra: index === 0 ? window.t('favorite') : null });
         }),
         qualifiers = this.model.get('qualifiers').map(function (q, index) {
           return {
             url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q),
-            name: t('qualifiers.all', q),
+            name: window.t('qualifiers.all', q),
             extra: index === 0 ? '' : null
           };
         });
@@ -201,22 +201,22 @@ export default Marionette.LayoutView.extend({
 
   getNavigationFindings: function (q) {
     var DEFAULT_ITEMS = [
-          { name: t('issues.page'), url: baseUrl + '/issues/search' },
-          { name: t('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' },
-          { name: t('coding_rules.page'), url: baseUrl + '/coding_rules' },
-          { name: t('quality_profiles.page'), url: baseUrl + '/profiles' },
-          { name: t('quality_gates.page'), url: baseUrl + '/quality_gates' },
-          { name: t('comparison_global.page'), url: baseUrl + '/comparison' }
+          { name: window.t('issues.page'), url: baseUrl + '/issues/search' },
+          { name: window.t('layout.measures'), url: baseUrl + '/measures/search?qualifiers[]=TRK' },
+          { name: window.t('coding_rules.page'), url: baseUrl + '/coding_rules' },
+          { name: window.t('quality_profiles.page'), url: baseUrl + '/profiles' },
+          { name: window.t('quality_gates.page'), url: baseUrl + '/quality_gates' },
+          { name: window.t('comparison_global.page'), url: baseUrl + '/comparison' }
         ],
         customItems = [];
     if (window.SS.isUserAdmin) {
-      customItems.push({ name: t('layout.settings'), url: baseUrl + '/settings' });
+      customItems.push({ name: window.t('layout.settings'), url: baseUrl + '/settings' });
     }
     var findings = [].concat(DEFAULT_ITEMS, customItems).filter(function (f) {
       return f.name.match(new RegExp(q, 'i'));
     });
     if (findings.length > 0) {
-      findings[0].extra = t('navigation');
+      findings[0].extra = window.t('navigation');
     }
     return _.first(findings, 6);
   },
@@ -230,7 +230,7 @@ export default Marionette.LayoutView.extend({
       return f.name.match(new RegExp(q, 'i'));
     });
     if (findings.length > 0) {
-      findings[0].extra = t('dashboard.global_dashboards');
+      findings[0].extra = window.t('dashboard.global_dashboards');
     }
     return _.first(findings, 6);
   },
@@ -240,10 +240,8 @@ export default Marionette.LayoutView.extend({
       return f.name.match(new RegExp(q, 'i'));
     });
     if (findings.length > 0) {
-      findings[0].extra = t('favorite');
+      findings[0].extra = window.t('favorite');
     }
     return _.first(findings, 6);
   }
 });
-
-
index 1d685ab953d5f7a82d7f6a626cfa903b4d54d502..af67b1b6197631c88fba9f881faf59926fdf2f6d 100644 (file)
@@ -30,7 +30,7 @@ var Process = Backbone.Model.extend({
 
       fail: function (message) {
         var that = this,
-            msg = message || t('process.fail');
+            msg = message || window.t('process.fail');
         if (msg === 'process.fail') {
           // no translation
           msg = 'An error happened, some parts of the page might not render correctly. ' +
index d09f38b55bbbdacdbd37048f11877678476f8446..cd2851ab8a26ce72c504e1d3d617386f4b12dda0 100644 (file)
@@ -64,7 +64,7 @@
 
   TagCloud.prototype.tooltip = function (d) {
     var suffixKey = d.value === 1 ? 'issue' : 'issues',
-        suffix = t(suffixKey);
+        suffix = window.t(suffixKey);
     return (d.value + '\u00a0') + suffix;
   };