diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-04-05 11:46:02 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-04-05 11:46:02 +0200 |
commit | 0bac18d71ccd2504254cd82c89ea208320a5fb30 (patch) | |
tree | 1a5c465a5411469833a612f0893f2de907997682 /server/sonar-web/src/main/js/components/navigator | |
parent | 7c90d26047935985378a3aa0f26ee316acba59e1 (diff) | |
download | sonarqube-0bac18d71ccd2504254cd82c89ea208320a5fb30.tar.gz sonarqube-0bac18d71ccd2504254cd82c89ea208320a5fb30.zip |
enforce js code style5.5-M14
Diffstat (limited to 'server/sonar-web/src/main/js/components/navigator')
20 files changed, 3 insertions, 185 deletions
diff --git a/server/sonar-web/src/main/js/components/navigator/controller.js b/server/sonar-web/src/main/js/components/navigator/controller.js index 7eb88e37704..c97a8e5d482 100644 --- a/server/sonar-web/src/main/js/components/navigator/controller.js +++ b/server/sonar-web/src/main/js/components/navigator/controller.js @@ -155,4 +155,3 @@ export default Marionette.Controller.extend({ }); - diff --git a/server/sonar-web/src/main/js/components/navigator/facets-view.js b/server/sonar-web/src/main/js/components/navigator/facets-view.js index b7a67411a61..2bf2158f036 100644 --- a/server/sonar-web/src/main/js/components/navigator/facets-view.js +++ b/server/sonar-web/src/main/js/components/navigator/facets-view.js @@ -51,4 +51,3 @@ export default Marionette.CollectionView.extend({ }); - diff --git a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js index f496ba66143..b6b2946729b 100644 --- a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js +++ b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js @@ -118,4 +118,3 @@ export default Marionette.ItemView.extend({ } }); - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js index 461d4113348..cc4421cd3aa 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js @@ -27,7 +27,6 @@ import ListTemplate from '../templates/choice-filter-item.hbs'; const PAGE_SIZE = 100; - const Suggestions = Backbone.Collection.extend({ comparator: 'text', @@ -36,13 +35,11 @@ const Suggestions = Backbone.Collection.extend({ this.page = 0; }, - parse (r) { this.more = r.more; return r.results; }, - fetch (options) { this.data = _.extend({ p: 1, @@ -53,7 +50,6 @@ const Suggestions = Backbone.Collection.extend({ return Backbone.Collection.prototype.fetch.call(this, settings); }, - fetchNextPage (options) { if (this.more) { this.data.p += 1; @@ -65,7 +61,6 @@ const Suggestions = Backbone.Collection.extend({ }); - const UserSuggestions = Suggestions.extend({ url () { @@ -80,7 +75,6 @@ const UserSuggestions = Suggestions.extend({ }); - const ProjectSuggestions = Suggestions.extend({ url () { @@ -89,7 +83,6 @@ const ProjectSuggestions = Suggestions.extend({ }); - const ComponentSuggestions = Suggestions.extend({ url () { @@ -116,13 +109,11 @@ const ComponentSuggestions = Suggestions.extend({ }); - const AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({ template: Template, listTemplate: ListTemplate, searchKey: 's', - render () { ChoiceFilters.DetailsChoiceFilterView.prototype.render.apply(this, arguments); @@ -148,7 +139,6 @@ const AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend .on('scroll', throttledScroll); }, - search () { const that = this; this.query = this.$('.navigator-filter-search input').val(); @@ -182,13 +172,11 @@ const AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend } }, - showSearchError () { this.$el.removeClass('fetching'); this.$('.navigator-filter-search').addClass('fetching-error'); }, - scroll () { const that = this; const el = this.$('.choices'); @@ -201,14 +189,12 @@ const AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend } }, - keydown (e) { if (_([38, 40, 13]).indexOf(e.keyCode) !== -1) { e.preventDefault(); } }, - resetChoices () { const that = this; this.options.filterView.choices.reset(this.options.filterView.choices.filter(function (item) { @@ -219,7 +205,6 @@ const AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend }); }, - onShow () { ChoiceFilters.DetailsChoiceFilterView.prototype.onShow.apply(this, arguments); this.resetChoices(); @@ -229,7 +214,6 @@ const AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend }); - const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ initialize (options) { @@ -238,12 +222,10 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ }); }, - isDefaultValue () { return this.getSelected().length === 0; }, - renderInput () { const value = this.model.get('value') || []; const input = $('<input>') @@ -254,7 +236,6 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ input.appendTo(this.$el); }, - restoreFromQuery (q) { let param = _.findWhere(q, { key: this.model.get('property') }); @@ -282,7 +263,6 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ } }, - restore (value, param) { const that = this; if (_.isString(value)) { @@ -316,7 +296,6 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ } }, - restoreFromText (value, text) { const that = this; _.each(value, function (v, i) { @@ -329,7 +308,6 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ this.onRestore(value); }, - restoreByRequests (value) { const that = this; const requests = _.map(value, function (v) { @@ -341,13 +319,11 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ }); }, - onRestore () { this.projectsView.updateLists(); this.renderBase(); }, - clear () { this.model.unset('value'); if (this.choices) { @@ -356,13 +332,11 @@ const AjaxSelectFilterView = ChoiceFilters.ChoiceFilterView.extend({ this.render(); }, - createRequest () { } }); - const ComponentFilterView = AjaxSelectFilterView.extend({ initialize () { @@ -372,7 +346,6 @@ const ComponentFilterView = AjaxSelectFilterView.extend({ this.choices = new ComponentSuggestions(); }, - createRequest (v) { const that = this; return $ @@ -391,7 +364,6 @@ const ComponentFilterView = AjaxSelectFilterView.extend({ }); - const ProjectFilterView = AjaxSelectFilterView.extend({ initialize () { @@ -402,7 +374,6 @@ const ProjectFilterView = AjaxSelectFilterView.extend({ this.choices = new ProjectSuggestions(); }, - createRequest (v) { const that = this; return $ @@ -422,7 +393,6 @@ const ProjectFilterView = AjaxSelectFilterView.extend({ }); - const AssigneeFilterView = AjaxSelectFilterView.extend({ initialize () { @@ -452,7 +422,6 @@ const AssigneeFilterView = AjaxSelectFilterView.extend({ }); - /* * Export public classes */ @@ -466,4 +435,3 @@ export default { AssigneeFilterView }; - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js index 44705c1de1b..ef9cb3c8315 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js @@ -35,17 +35,14 @@ const Filter = Backbone.Model.extend({ }); - const Filters = Backbone.Collection.extend({ model: Filter }); - const DetailsFilterView = Marionette.ItemView.extend({ template: DetailsTemplate, className: 'navigator-filter-details', - initialize () { this.$el.on('click', function (e) { e.stopPropagation(); @@ -53,7 +50,6 @@ const DetailsFilterView = Marionette.ItemView.extend({ this.$el.attr('id', 'filter-' + this.model.get('property')); }, - onShow () { }, @@ -61,12 +57,10 @@ const DetailsFilterView = Marionette.ItemView.extend({ } }); - const BaseFilterView = Marionette.ItemView.extend({ template: Template, className: 'navigator-filter', - events () { return { 'click': 'toggleDetails', @@ -74,7 +68,6 @@ const BaseFilterView = Marionette.ItemView.extend({ }; }, - modelEvents: { 'change:enabled': 'focus', 'change:value': 'renderBase', @@ -83,12 +76,11 @@ const BaseFilterView = Marionette.ItemView.extend({ 'change:filters': 'render' }, - initialize (options) { Marionette.ItemView.prototype.initialize.apply(this, arguments); - const detailsView = (options && options.projectsView) || DetailsFilterView; - this.projectsView = new detailsView({ + const DetailsView = (options && options.projectsView) || DetailsFilterView; + this.projectsView = new DetailsView({ model: this.model, filterView: this }); @@ -96,12 +88,10 @@ const BaseFilterView = Marionette.ItemView.extend({ this.model.view = this; }, - attachDetailsView () { this.projectsView.$el.detach().appendTo($('body')); }, - render () { this.renderBase(); @@ -117,7 +107,6 @@ const BaseFilterView = Marionette.ItemView.extend({ this.model.get('optional')); }, - renderBase () { Marionette.ItemView.prototype.render.apply(this, arguments); this.renderInput(); @@ -127,16 +116,13 @@ const BaseFilterView = Marionette.ItemView.extend({ this.$el.attr('data-property', this.model.get('property')); }, - renderInput () { }, - focus () { this.render(); }, - toggleDetails (e) { e.stopPropagation(); this.options.filterBarView.selected = this.options.filterBarView.getEnabledFilters().index(this.$el); @@ -149,7 +135,6 @@ const BaseFilterView = Marionette.ItemView.extend({ } }, - showDetails () { this.registerShowedDetails(); @@ -161,35 +146,29 @@ const BaseFilterView = Marionette.ItemView.extend({ this.projectsView.onShow(); }, - registerShowedDetails () { this.options.filterBarView.hideDetails(); this.options.filterBarView.showedView = this; }, - hideDetails () { this.projectsView.$el.removeClass('active'); this.$el.removeClass('active'); this.projectsView.onHide(); }, - isActive () { return this.$el.is('.active'); }, - renderValue () { return this.model.get('value') || 'unset'; }, - isDefaultValue () { return true; }, - restoreFromQuery (q) { const param = _.findWhere(q, { key: this.model.get('property') }); if (param && param.value) { @@ -200,18 +179,15 @@ const BaseFilterView = Marionette.ItemView.extend({ } }, - restore (value) { this.model.set({ value }, { silent: true }); this.renderBase(); }, - clear () { this.model.unset('value'); }, - disable (e) { e.stopPropagation(); this.hideDetails(); @@ -222,7 +198,6 @@ const BaseFilterView = Marionette.ItemView.extend({ }); }, - formatValue () { const q = {}; if (this.model.has('property') && this.model.has('value') && this.model.get('value')) { @@ -231,7 +206,6 @@ const BaseFilterView = Marionette.ItemView.extend({ return q; }, - serializeData () { return _.extend({}, this.model.toJSON(), { value: this.renderValue(), @@ -241,7 +215,6 @@ const BaseFilterView = Marionette.ItemView.extend({ }); - /* * Export public classes */ @@ -252,5 +225,3 @@ export default { BaseFilterView, DetailsFilterView }; - - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js index f337e0ee9a2..78b2e1c7fcc 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js @@ -25,18 +25,15 @@ export default BaseFilters.BaseFilterView.extend({ template: Template, className: 'navigator-filter navigator-filter-inline', - events () { return { 'click .navigator-filter-disable': 'disable' }; }, - showDetails () { }, - renderInput () { if (this.model.get('enabled')) { $('<input>') @@ -49,17 +46,14 @@ export default BaseFilters.BaseFilterView.extend({ } }, - renderValue () { return this.model.get('value'); }, - isDefaultValue () { return false; }, - restore (value) { this.model.set({ value, @@ -69,4 +63,3 @@ export default BaseFilters.BaseFilterView.extend({ }); - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js index 1bf7b2f4cc7..7f1b82d9b3a 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js @@ -29,20 +29,17 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ template: Template, itemTemplate: ItemTemplate, - events () { return { 'click label': 'onCheck' }; }, - render () { BaseFilters.DetailsFilterView.prototype.render.apply(this, arguments); this.updateLists(); }, - renderList (collection, selector) { const that = this; const container = this.$(selector); @@ -57,7 +54,6 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ }); }, - updateLists () { const choices = new Backbone.Collection(this.options.filterView.choices.reject(function (item) { return item.get('id')[0] === '!'; @@ -73,7 +69,6 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ this.updateCurrent(current); }, - onCheck (e) { const checkbox = $(e.currentTarget); const id = checkbox.data('id'); @@ -102,32 +97,27 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ this.updateLists(); }, - updateValue () { this.model.set('value', this.options.filterView.getSelected().map(function (m) { return m.get('id'); })); }, - updateCurrent (index) { this.currentChoice = index; this.$('label').removeClass('current') .eq(this.currentChoice).addClass('current'); }, - onShow () { this.bindedOnKeyDown = _.bind(this.onKeyDown, this); $('body').on('keydown', this.bindedOnKeyDown); }, - onHide () { $('body').off('keydown', this.bindedOnKeyDown); }, - onKeyDown (e) { switch (e.keyCode) { case 38: @@ -143,12 +133,12 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ this.selectCurrent(); break; default: + // Not a functional key - then skip break; } }, - selectNextChoice () { if (this.$('label').length > this.currentChoice + 1) { this.updateCurrent(this.currentChoice + 1); @@ -156,7 +146,6 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ } }, - scrollNext () { const currentLabel = this.$('label').eq(this.currentChoice); if (currentLabel.length > 0) { @@ -170,7 +159,6 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ } }, - selectPrevChoice () { if (this.currentChoice > 0) { this.updateCurrent(this.currentChoice - 1); @@ -178,7 +166,6 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ } }, - scrollPrev () { const currentLabel = this.$('label').eq(this.currentChoice); if (currentLabel.length > 0) { @@ -191,13 +178,11 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ } }, - selectCurrent () { const cb = this.$('label').eq(this.currentChoice); cb.click(); }, - serializeData () { return _.extend({}, this.model.toJSON(), { choices: new Backbone.Collection(this.options.filterView.choices.reject(function (item) { @@ -211,7 +196,6 @@ const DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ }); - const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ initialize (options) { @@ -240,14 +224,12 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ ); }, - getSelected () { return this.choices.filter(function (m) { return m.get('checked'); }); }, - renderInput () { const input = $('<select>') .prop('name', this.model.get('property')) @@ -263,7 +245,6 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ input.appendTo(this.$el); }, - renderValue () { const value = this.getSelected().map(function (item) { return item.get('text'); @@ -275,13 +256,11 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ return this.isDefaultValue() ? defaultValue : value.join(', '); }, - isDefaultValue () { const selected = this.getSelected(); return selected.length === 0; }, - disable () { this.choices.each(function (item) { item.set('checked', false); @@ -289,7 +268,6 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ BaseFilters.BaseFilterView.prototype.disable.apply(this, arguments); }, - restoreFromQuery (q) { let param = _.findWhere(q, { key: this.model.get('property') }); @@ -322,7 +300,6 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ } }, - restore (value) { if (_.isString(value)) { value = value.split(','); @@ -359,7 +336,6 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ } }, - clear () { if (this.choices) { this.choices.each(function (item) { @@ -373,7 +349,6 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ } }, - formatValue () { const q = {}; if (this.model.has('property') && this.model.has('value') && this.model.get('value').length > 0) { @@ -398,7 +373,6 @@ const ChoiceFilterView = BaseFilters.BaseFilterView.extend({ }); - /* * Export public classes */ diff --git a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js index 1c14e30f127..2ba0b86e5a6 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js @@ -27,24 +27,20 @@ import DetailsTemplate from '../templates/favorite-details-filter.hbs'; const DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({ template: DetailsTemplate, - events: { 'click label[data-id]': 'applyFavorite', 'click .manage label': 'manage' }, - applyFavorite (e) { const id = $(e.target).data('id'); window.location = window.baseUrl + this.model.get('favoriteUrl') + '/' + id; }, - manage () { window.location = window.baseUrl + this.model.get('manageUrl'); }, - serializeData () { const choices = this.model.get('choices'); const choicesArray = @@ -61,35 +57,29 @@ const DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({ }); - const FavoriteFilterView = ChoiceFilters.ChoiceFilterView.extend({ template: Template, className: 'navigator-filter navigator-filter-favorite', - initialize () { ChoiceFilters.ChoiceFilterView.prototype.initialize.call(this, { projectsView: DetailsFavoriteFilterView }); }, - renderValue () { return ''; }, - renderInput () { }, - isDefaultValue () { return false; } }); - /* * Export public classes */ @@ -99,4 +89,3 @@ export default { FavoriteFilterView }; - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js index 843ac9184ad..5182e73e415 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js @@ -26,17 +26,14 @@ import MoreCriteriaFilters from './more-criteria-filters'; export default Marionette.CompositeView.extend({ childViewContainer: '.navigator-filters-list', - collectionEvents: { 'change:enabled': 'changeEnabled' }, - getChildView (item) { return item.get('type') || BaseFilters.BaseFilterView; }, - childViewOptions () { return { filterBarView: this, @@ -44,7 +41,6 @@ export default Marionette.CompositeView.extend({ }; }, - initialize () { Marionette.CompositeView.prototype.initialize.apply(this, arguments); @@ -90,7 +86,6 @@ export default Marionette.CompositeView.extend({ }); }, - getEnabledFilters () { return this.$(this.childViewContainer).children() .not('.navigator-filter-disabled') @@ -98,13 +93,11 @@ export default Marionette.CompositeView.extend({ .not('.navigator-filter-favorite'); }, - selectFirst () { this.selected = -1; this.selectNext(); }, - selectPrev () { const filters = this.getEnabledFilters(); if (this.selected > 0) { @@ -115,7 +108,6 @@ export default Marionette.CompositeView.extend({ } }, - selectNext () { const filters = this.getEnabledFilters(); if (this.selected < filters.length - 1) { @@ -129,7 +121,6 @@ export default Marionette.CompositeView.extend({ } }, - addMoreCriteriaFilter () { const disabledFilters = this.collection.where({ enabled: false }); if (disabledFilters.length > 0) { @@ -143,14 +134,12 @@ export default Marionette.CompositeView.extend({ } }, - onAddChild (childView) { if (childView.model.get('type') === MoreCriteriaFilters.FavoriteFilterView) { $('.navigator-header').addClass('navigator-header-favorite'); } }, - restoreFromQuery (q) { this.collection.each(function (item) { item.set('enabled', !item.get('optional')); @@ -159,14 +148,12 @@ export default Marionette.CompositeView.extend({ }); }, - hideDetails () { if (_.isObject(this.showedView)) { this.showedView.hideDetails(); } }, - enableFilter (id) { const filter = this.collection.get(id); const filterView = filter.view; @@ -176,7 +163,6 @@ export default Marionette.CompositeView.extend({ filterView.showDetails(); }, - changeEnabled () { const disabledFilters = _.reject(this.collection.where({ enabled: false }), function (filter) { return filter.get('type') === MoreCriteriaFilters.MoreCriteriaFilterView; diff --git a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js index 1753c1cd138..dba09ff94a8 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js @@ -26,12 +26,10 @@ import { translate } from '../../../helpers/l10n'; const DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({ template: Template, - events: { 'change :input': 'inputChanged' }, - inputChanged () { const metric = this.$('[name=metric]').val(); const isDifferentialMetric = metric.indexOf('new_') === 0; @@ -68,7 +66,6 @@ const DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({ this.model.set('value', value); }, - updateDataType (value) { const metric = _.find(window.SS.metrics, function (m) { return m.metric.name === value.metric; @@ -84,7 +81,6 @@ const DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({ } }, - onRender () { const periodZeroLabel = this.$('[name=period]').children('[value="0"]').html(); this.periodZeroOption = `<option value="0">${periodZeroLabel}</option>`; @@ -108,7 +104,6 @@ const DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({ this.inputChanged(); }, - onShow () { const select = this.$('[name=metric]'); if (this.model.get('value').metric === '') { @@ -120,7 +115,6 @@ const DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({ }); - export default BaseFilters.BaseFilterView.extend({ initialize () { @@ -131,7 +125,6 @@ export default BaseFilters.BaseFilterView.extend({ this.groupMetrics(); }, - groupMetrics () { const metrics = _.map(this.model.get('metrics'), function (metric) { return metric.metric; @@ -151,7 +144,6 @@ export default BaseFilters.BaseFilterView.extend({ this.model.set('groupedMetrics', groupedMetrics); }, - renderValue () { return this.isDefaultValue() ? translate('measure_filter.criteria.metric.not_set') : @@ -159,7 +151,6 @@ export default BaseFilters.BaseFilterView.extend({ this.model.get('value').valText; }, - renderInput () { const that = this; const value = this.model.get('value'); @@ -181,7 +172,6 @@ export default BaseFilters.BaseFilterView.extend({ } }, - isDefaultValue () { const value = this.model.get('value'); if (!_.isObject(value)) { @@ -190,7 +180,6 @@ export default BaseFilters.BaseFilterView.extend({ return !(value.metric && value.op && (value.val != null)); }, - restoreFromQuery (q) { const that = this; const value = {}; @@ -213,4 +202,3 @@ export default BaseFilters.BaseFilterView.extend({ }); - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js index 0d148321b1a..acf1f0b812a 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js @@ -26,18 +26,15 @@ import DetailsTemplate from '../templates/more-criteria-details-filter.hbs'; const DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({ template: DetailsTemplate, - events: { 'click label[data-id]:not(.inactive)': 'enableFilter' }, - enableById (id) { this.model.view.options.filterBarView.enableFilter(id); this.model.view.hideDetails(); }, - enableByProperty (property) { const filter = _.find(this.model.get('filters'), function (f) { return f.get('property') === property; @@ -47,19 +44,16 @@ const DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.exte } }, - enableFilter (e) { const id = $(e.target).data('id'); this.enableById(id); this.updateCurrent(0); }, - selectCurrent () { this.$('label').eq(this.currentChoice).click(); }, - serializeData () { const filters = this.model.get('filters').map(function (filter) { return _.extend(filter.toJSON(), { id: filter.cid }); @@ -74,41 +68,34 @@ const DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.exte }); - const MoreCriteriaFilterView = ChoiceFilters.ChoiceFilterView.extend({ template: Template, className: 'navigator-filter navigator-filter-more-criteria', - initialize () { ChoiceFilters.ChoiceFilterView.prototype.initialize.call(this, { projectsView: DetailsMoreCriteriaFilterView }); }, - renderValue () { return ''; }, - renderInput () { }, - renderBase () { ChoiceFilters.ChoiceFilterView.prototype.renderBase.call(this); this.$el.prop('title', ''); }, - isDefaultValue () { return false; } }); - /* * Export public classes */ @@ -118,4 +105,3 @@ export default { MoreCriteriaFilterView }; - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js index 964e73d10a7..3ae434f9e5e 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js @@ -26,12 +26,10 @@ import { translate } from '../../../helpers/l10n'; const DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({ template: Template, - events: { 'change input': 'change' }, - change () { const value = {}; const valueFrom = this.$('input').eq(0).val(); @@ -48,7 +46,6 @@ const DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({ this.model.set('value', value); }, - populateInputs () { const value = this.model.get('value'); const propertyFrom = this.model.get('propertyFrom'); @@ -60,14 +57,12 @@ const DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({ this.$('input').eq(1).val(valueTo || ''); }, - onShow () { this.$(':input:first').focus(); } }); - const RangeFilterView = BaseFilters.BaseFilterView.extend({ initialize () { @@ -76,7 +71,6 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ }); }, - renderValue () { if (!this.isDefaultValue()) { const value = _.values(this.model.get('value')); @@ -86,7 +80,6 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ } }, - renderInput () { const value = this.model.get('value'); const propertyFrom = this.model.get('propertyFrom'); @@ -109,7 +102,6 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ .appendTo(this.$el); }, - isDefaultValue () { const value = this.model.get('value'); const propertyFrom = this.model.get('propertyFrom'); @@ -120,7 +112,6 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ return !valueFrom && !valueTo; }, - restoreFromQuery (q) { const paramFrom = _.findWhere(q, { key: this.model.get('propertyFrom') }); const paramTo = _.findWhere(q, { key: this.model.get('propertyTo') }); @@ -144,7 +135,6 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ } }, - restore (value) { if (this.choices && this.selection && value.length > 0) { const that = this; @@ -169,12 +159,10 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ } }, - formatValue () { return this.model.get('value'); }, - clear () { this.model.unset('value'); this.projectsView.render(); @@ -182,7 +170,6 @@ const RangeFilterView = BaseFilters.BaseFilterView.extend({ }); - const DateRangeFilterView = RangeFilterView.extend({ render () { @@ -199,7 +186,6 @@ const DateRangeFilterView = RangeFilterView.extend({ }); }, - renderValue () { if (!this.isDefaultValue()) { const value = _.values(this.model.get('value')); @@ -211,7 +197,6 @@ const DateRangeFilterView = RangeFilterView.extend({ }); - /* * Export public classes */ @@ -221,4 +206,3 @@ export default { DateRangeFilterView }; - diff --git a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js index b6f6f8124db..b1ff255083e 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js @@ -25,23 +25,19 @@ import Template from '../templates/string-filter.hbs'; const DetailsStringFilterView = BaseFilters.DetailsFilterView.extend({ template: Template, - events: { 'change input': 'change' }, - change (e) { this.model.set('value', $(e.target).val()); }, - onShow () { BaseFilters.DetailsFilterView.prototype.onShow.apply(this, arguments); this.$(':input').focus(); }, - serializeData () { return _.extend({}, this.model.toJSON(), { value: this.model.get('value') || '' @@ -50,7 +46,6 @@ const DetailsStringFilterView = BaseFilters.DetailsFilterView.extend({ }); - export default BaseFilters.BaseFilterView.extend({ initialize () { @@ -59,12 +54,10 @@ export default BaseFilters.BaseFilterView.extend({ }); }, - renderValue () { return this.isDefaultValue() ? '—' : this.model.get('value'); }, - renderInput () { $('<input>') .prop('name', this.model.get('property')) @@ -74,12 +67,10 @@ export default BaseFilters.BaseFilterView.extend({ .appendTo(this.$el); }, - isDefaultValue () { return !this.model.get('value'); }, - restore (value) { this.model.set({ value, @@ -87,7 +78,6 @@ export default BaseFilters.BaseFilterView.extend({ }); }, - clear () { this.model.unset('value'); this.projectsView.render(); @@ -95,4 +85,3 @@ export default BaseFilters.BaseFilterView.extend({ }); - diff --git a/server/sonar-web/src/main/js/components/navigator/models/facet.js b/server/sonar-web/src/main/js/components/navigator/models/facet.js index 0013e2ad525..d2658e314a0 100644 --- a/server/sonar-web/src/main/js/components/navigator/models/facet.js +++ b/server/sonar-web/src/main/js/components/navigator/models/facet.js @@ -36,4 +36,3 @@ export default Backbone.Model.extend({ } }); - diff --git a/server/sonar-web/src/main/js/components/navigator/models/facets.js b/server/sonar-web/src/main/js/components/navigator/models/facets.js index 3880f3b545d..052ad93bf84 100644 --- a/server/sonar-web/src/main/js/components/navigator/models/facets.js +++ b/server/sonar-web/src/main/js/components/navigator/models/facets.js @@ -24,4 +24,3 @@ export default Backbone.Collection.extend({ model: Facet }); - diff --git a/server/sonar-web/src/main/js/components/navigator/models/state.js b/server/sonar-web/src/main/js/components/navigator/models/state.js index a0aa949a522..8c287de5e15 100644 --- a/server/sonar-web/src/main/js/components/navigator/models/state.js +++ b/server/sonar-web/src/main/js/components/navigator/models/state.js @@ -70,4 +70,3 @@ export default Backbone.Model.extend({ } }); - diff --git a/server/sonar-web/src/main/js/components/navigator/router.js b/server/sonar-web/src/main/js/components/navigator/router.js index 1a60a737968..4e3415026d5 100644 --- a/server/sonar-web/src/main/js/components/navigator/router.js +++ b/server/sonar-web/src/main/js/components/navigator/router.js @@ -43,4 +43,3 @@ export default Backbone.Router.extend({ } }); - diff --git a/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js b/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js index 775f94b50f1..10610eb1b91 100644 --- a/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js +++ b/server/sonar-web/src/main/js/components/navigator/workspace-header-view.js @@ -96,4 +96,3 @@ export default Marionette.ItemView.extend({ } }); - diff --git a/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js b/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js index d5d6b97c80f..dfda1b59a4b 100644 --- a/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js +++ b/server/sonar-web/src/main/js/components/navigator/workspace-list-item-view.js @@ -40,4 +40,3 @@ export default Marionette.ItemView.extend({ }); - diff --git a/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js b/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js index cba0d33701a..b533058a41c 100644 --- a/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js +++ b/server/sonar-web/src/main/js/components/navigator/workspace-list-view.js @@ -132,4 +132,3 @@ export default Marionette.CompositeView.extend({ }); - |