},
"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
}
}
"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",
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') }]);
}
},
App.manualRepository = function () {
return {
key: 'manual',
- name: t('coding_rules.manual_rule'),
+ name: window.t('coding_rules.manual_rule'),
language: 'none'
};
};
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>');
},
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 () {
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()
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 () {
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
};
});
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;
},
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 };
}).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 {
var statuses = ['READY', 'BETA', 'DEPRECATED'].map(function (status) {
return {
id: status,
- text: t('rules.status', status.toLowerCase())
+ text: window.t('rules.status', status.toLowerCase())
};
});
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 };
}).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 {
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();
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',
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',
});
}
});
-
-
className: 'search-navigator-no-results',
template: function () {
- return t('coding_rules.no_results');
+ return window.t('coding_rules.no_results');
}
});
-
-
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',
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: {
});
}
});
-
-
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()
return this.options.app.state.updateFilter(obj);
}
});
-
-
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: {
});
}
});
-
-
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: {
});
}
});
-
-
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: {
});
}
});
-
-
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: {
});
}
});
-
-
className: 'search-navigator-no-results',
template: function () {
- return t('issue_filter.no_issues');
+ return window.t('issue_filter.no_issues');
}
});
-
-
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({
-import ModalForm from 'components/common/modal-form';
-import './templates';
+import ModalForm from '../../components/common/modal-form';
export default ModalForm.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()
});
}
});
-
-
this.ui.metricSelect.select2({
allowClear: false,
width: '250px',
- placeholder: t('alerts.select_metric')
+ placeholder: window.t('alerts.select_metric')
});
},
});
}
});
-
-
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')
}
});
}
});
}
});
-
-
});
Handlebars.registerHelper('severityChangelog', function (severity) {
- var label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i> ' + t('severity', severity),
- message = tp('quality_profiles.severity_set_to_x', label);
+ var label = '<i class="icon-severity-' + severity.toLowerCase() + '"></i> ' + 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)
+ );
}
});
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);
});
}
});
-
-
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 });
});
}
});
-
-
},
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 () {
});
}
});
-
-
}),
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(', ');
},
DetailsChoiceFilterView: DetailsChoiceFilterView,
ChoiceFilterView: ChoiceFilterView
};
-
-
$(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');
},
import $ from 'jquery';
import _ from 'underscore';
import moment from 'moment';
+import d3 from 'd3';
function trans (left, top) {
return 'translate(' + left + ', ' + top + ')';
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';
Handlebars.registerHelper('severityHelper', function (severity) {
return new Handlebars.SafeString(
- '<i class="icon-severity-' + severity.toLowerCase() + '"></i> ' + t('severity', severity)
+ '<i class="icon-severity-' + severity.toLowerCase() + '"></i> ' + window.t('severity', severity)
);
});
});
Handlebars.registerHelper('statusHelper', function (status, resolution) {
- var s = '<i class="icon-status-' + status.toLowerCase() + '"></i> ' + t('issue.status', status);
+ var s = '<i class="icon-status-' + status.toLowerCase() + '"></i> ' + window.t('issue.status', status);
if (resolution != null) {
- s = s + ' (' + t('issue.resolution', resolution) + ')';
+ s = s + ' (' + window.t('issue.resolution', resolution) + ')';
}
return new Handlebars.SafeString(s);
});
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;
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
};
});
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);
},
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);
},
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);
}
});
-
-
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. ' +
TagCloud.prototype.tooltip = function (d) {
var suffixKey = d.value === 1 ? 'issue' : 'issues',
- suffix = t(suffixKey);
+ suffix = window.t(suffixKey);
return (d.value + '\u00a0') + suffix;
};