diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-06-02 10:04:15 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-06-02 10:05:34 +0200 |
commit | fc6b6a4448aeb80d7b0c79963381f70a479d53eb (patch) | |
tree | 8a869e917d238a03b51636bcb9f11b16711f14e7 /server | |
parent | 737435b7013aebaf67e2baddbbbeb17174ac4aaa (diff) | |
download | sonarqube-fc6b6a4448aeb80d7b0c79963381f70a479d53eb.tar.gz sonarqube-fc6b6a4448aeb80d7b0c79963381f70a479d53eb.zip |
fix quality flaws
Diffstat (limited to 'server')
5 files changed, 30 insertions, 48 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js b/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js index a702c4a4d7f..f138a860d30 100644 --- a/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js +++ b/server/sonar-web/src/main/js/apps/issues/component-viewer/main.js @@ -109,8 +109,8 @@ define([ selectIssue: function (e) { var key = $(e.currentTarget).data('issue-key'), - issue = this.issues.find(function (issue) { - return issue.get('key') === key; + issue = this.issues.find(function (model) { + return model.get('key') === key; }), index = this.options.app.list.indexOf(issue); return this.options.app.state.set({ selectedIndex: index }); diff --git a/server/sonar-web/src/main/js/apps/issues/facets-view.js b/server/sonar-web/src/main/js/apps/issues/facets-view.js index 2409c25b019..eb5b4e127fa 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets-view.js +++ b/server/sonar-web/src/main/js/apps/issues/facets-view.js @@ -21,44 +21,29 @@ define([ TagFacet, ResolutionFacet, CreationDateFacet, ActionPlanFacet, FileFacet, ReporterFacet, LanguageFacet, AuthorFacet, IssueKeyFacet, ContextFacet) { + var viewsMapping = { + severities: SeverityFacet, + statuses: StatusFacet, + assignees: AssigneeFacet, + resolutions: ResolutionFacet, + createdAt: CreationDateFacet, + projectUuids: ProjectFacet, + moduleUuids: ModuleFacet, + rules: RuleFacet, + tags: TagFacet, + actionPlans: ActionPlanFacet, + fileUuids: FileFacet, + reporters: ReporterFacet, + languages: LanguageFacet, + authors: AuthorFacet, + issues: IssueKeyFacet, + context: ContextFacet + }; + return FacetsView.extend({ getItemView: function (model) { - switch (model.get('property')) { - case 'severities': - return SeverityFacet; - case 'statuses': - return StatusFacet; - case 'assignees': - return AssigneeFacet; - case 'resolutions': - return ResolutionFacet; - case 'createdAt': - return CreationDateFacet; - case 'projectUuids': - return ProjectFacet; - case 'moduleUuids': - return ModuleFacet; - case 'rules': - return RuleFacet; - case 'tags': - return TagFacet; - case 'actionPlans': - return ActionPlanFacet; - case 'fileUuids': - return FileFacet; - case 'reporters': - return ReporterFacet; - case 'languages': - return LanguageFacet; - case 'authors': - return AuthorFacet; - case 'issues': - return IssueKeyFacet; - case 'context': - return ContextFacet; - default: - return BaseFacet; - } + var view = viewsMapping[model.get('property')]; + return view ? view : BaseFacet; } }); diff --git a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js index 30305f317f1..831cead6424 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js @@ -39,13 +39,12 @@ define([ }); var values = this.model.getValues(); if (!(_.isArray(values) && values.length > 0)) { - var date = moment(), - i, j; + var date = moment(); values = []; - for (i = j = 0; j <= 10; i = ++j) { - values.push({ count: 0, val: date.toDate().toString() }); - date = date.subtract(1, 'days'); - } + _.times(10, function () { + values.push({ count: 0, val: date.toDate().toString() }); + date = date.subtract(1, 'days'); + }); values.reverse(); } return this.$('.js-barchart').barchart(values); diff --git a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js index 7752451272b..96a0d85729e 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/tag-facet.js @@ -37,8 +37,7 @@ define([ }, getValuesWithLabels: function () { - var values = this.model.getValues(), - tags = this.options.app.facets.tags; + var values = this.model.getValues(); values.forEach(function (v) { v.label = v.val; v.extra = ''; diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js index 408900fb63e..dbacfea71bb 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-home-view.js @@ -1,7 +1,6 @@ define([ - 'widgets/issue-filter/widget', './templates' -], function (IssueFilter) { +], function () { var $ = jQuery; |