diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-08-24 13:50:18 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-08-26 10:12:03 +0200 |
commit | 223bcb955ba554be354f6b4b1ca0c1acb9431d66 (patch) | |
tree | c055f39d1cf688974d275877c5ff07490c32295f /server/sonar-web/src/main/js/apps/issues | |
parent | 4fa812ee4cb69d00e761b7887fdd30820d6748a9 (diff) | |
download | sonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.tar.gz sonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.zip |
use the single web app
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues')
24 files changed, 80 insertions, 66 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/app-context.js b/server/sonar-web/src/main/js/apps/issues/app-context.js index 3d7db3aa2ef..63221207568 100644 --- a/server/sonar-web/src/main/js/apps/issues/app-context.js +++ b/server/sonar-web/src/main/js/apps/issues/app-context.js @@ -1,4 +1,6 @@ define([ + 'backbone', + 'backbone.marionette', './models/state', './layout', './models/issues', @@ -10,19 +12,19 @@ define([ './workspace-header-view', './facets-view', './helpers/format-facet-value' -], function (State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, WorkspaceHeaderView, - FacetsView) { +], function (Backbone, Marionette, State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, + WorkspaceHeaderView, FacetsView) { var $ = jQuery, App = new Marionette.Application(), init = function (options) { - this.config = options.config; + this.options = options; this.state = new State({ isContext: true, - contextQuery: { componentUuids: options.config.resource }, - contextComponentUuid: options.config.resource, - contextComponentName: options.config.resourceName, - contextComponentQualifier: options.config.resourceQualifier + contextQuery: { componentUuids: options.component.uuid }, + contextComponentUuid: options.component.uuid, + contextComponentName: options.component.name, + contextComponentQualifier: options.component.qualifier }); this.updateContextFacets(); this.list = new Issues(); @@ -62,7 +64,7 @@ define([ }; App.getContextQuery = function () { - return { componentUuids: this.config.resource }; + return { componentUuids: this.options.component.uuid }; }; App.getRestrictedFacets = function () { @@ -81,15 +83,13 @@ define([ facetsFromServer = this.state.get('facetsFromServer'); return this.state.set({ facets: facets, - allFacets: _.difference(allFacets, this.getRestrictedFacets()[this.config.resourceQualifier]), - facetsFromServer: _.difference(facetsFromServer, this.getRestrictedFacets()[this.config.resourceQualifier]) + allFacets: _.difference(allFacets, this.getRestrictedFacets()[this.options.component.qualifier]), + facetsFromServer: _.difference(facetsFromServer, this.getRestrictedFacets()[this.options.component.qualifier]) }); }; App.on('start', function (options) { - $.when(window.requestMessages()).done(function () { - init.call(App, options); - }); + init.call(App, options); }); return App; diff --git a/server/sonar-web/src/main/js/apps/issues/app.js b/server/sonar-web/src/main/js/apps/issues/app.js index 12e5671c5c3..f07102efcf7 100644 --- a/server/sonar-web/src/main/js/apps/issues/app.js +++ b/server/sonar-web/src/main/js/apps/issues/app.js @@ -1,4 +1,6 @@ define([ + 'backbone', + 'backbone.marionette', './models/state', './layout', './models/issues', @@ -11,8 +13,8 @@ define([ './facets-view', './filters-view', './helpers/format-facet-value' -], function (State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, WorkspaceHeaderView, - FacetsView, FiltersView) { +], function (Backbone, Marionette, State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, + WorkspaceHeaderView, FacetsView, FiltersView) { var $ = jQuery, App = new Marionette.Application(), @@ -61,9 +63,7 @@ define([ }; App.on('start', function (options) { - $.when(window.requestMessages()).done(function () { - init.call(App, options); - }); + init.call(App, options); }); return App; 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 8792113e213..43b60af89e9 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 @@ -36,7 +36,7 @@ define([ if (!selectedIssueView) { return; } - return selectedIssueView.find('.js-issue-' + action).click(); + selectedIssueView.find('.js-issue-' + action).click(); }; key('up', 'componentViewer', function () { that.options.app.controller.selectPrev(); diff --git a/server/sonar-web/src/main/js/apps/issues/controller.js b/server/sonar-web/src/main/js/apps/issues/controller.js index 16f5dc53c93..c0467e9b6a1 100644 --- a/server/sonar-web/src/main/js/apps/issues/controller.js +++ b/server/sonar-web/src/main/js/apps/issues/controller.js @@ -1,8 +1,9 @@ define([ + 'backbone', 'components/navigator/controller', './component-viewer/main', './workspace-home-view' -], function (Controller, ComponentViewer, HomeView) { +], function (Backbone, Controller, ComponentViewer, HomeView) { var $ = jQuery, FIELDS = 'component,componentId,project,subProject,rule,status,resolution,author,reporter,assignee,debt,line,' + diff --git a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js index 3645b7215d6..26fa0f3899c 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/assignee-facet.js @@ -9,7 +9,7 @@ define([ template: Templates['issues-assignee-facet'], getUrl: function () { - return baseUrl + '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, prepareAjaxSearch: function () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js index ee987a3d067..7bf8f5e30de 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/author-facet.js @@ -4,7 +4,7 @@ define([ return CustomValuesFacet.extend({ getUrl: function () { - return baseUrl + '/api/issues/authors'; + return window.baseUrl + '/api/issues/authors'; }, prepareSearch: function () { @@ -13,13 +13,13 @@ define([ 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: { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js index 923e1d4e6d1..8cb5f444520 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/base-facet.js @@ -16,7 +16,7 @@ define([ }, serializeData: function () { - return _.extend(this._super(), { + return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), { state: this.options.app.state.toJSON() }); } diff --git a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js index 11b3aebdd74..0b198e1853c 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/custom-values-facet.js @@ -27,13 +27,13 @@ define([ 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() diff --git a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js index 3418158fba4..f18c712d2f6 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/language-facet.js @@ -4,7 +4,7 @@ define([ return CustomValuesFacet.extend({ getUrl: function () { - return baseUrl + '/api/languages/list'; + return window.baseUrl + '/api/languages/list'; }, prepareSearch: function () { @@ -13,13 +13,13 @@ define([ 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: { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js index 454b4e96803..ac81b8c3b8d 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/mode-facet.js @@ -16,7 +16,9 @@ define([ }, serializeData: function () { - return _.extend(this._super(), { mode: this.options.app.state.getFacetMode() }); + return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), { + mode: this.options.app.state.getFacetMode() + }); } }); diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js index 429d9e876c2..15e174ebf38 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js @@ -7,9 +7,9 @@ define([ getUrl: function () { var q = this.options.app.state.get('contextComponentQualifier'); if (q === 'VW' || q === 'SVW') { - return baseUrl + '/api/components/search'; + return window.baseUrl + '/api/components/search'; } else { - return baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true'; + return window.baseUrl + '/api/resources/search?f=s2&q=TRK&display_uuid=true'; } }, @@ -29,13 +29,13 @@ define([ 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: { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js index 6340aefe04f..6bbb5c5e8ad 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/reporter-facet.js @@ -4,7 +4,7 @@ define([ return CustomValuesFacet.extend({ getUrl: function () { - return baseUrl + '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, prepareAjaxSearch: function () { diff --git a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js index 569fcf6c7de..55002f35a9b 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/rule-facet.js @@ -4,7 +4,7 @@ define([ return CustomValuesFacet.extend({ prepareSearch: function () { - var url = baseUrl + '/api/rules/search?f=name,langName', + var url = window.baseUrl + '/api/rules/search?f=name,langName', languages = this.options.app.state.get('query').languages; if (languages != null) { url += '&languages=' + languages; @@ -14,13 +14,13 @@ define([ 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: { 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 96a0d85729e..9a70ea7a006 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 @@ -4,7 +4,7 @@ define([ return CustomValuesFacet.extend({ prepareSearch: function () { - var url = baseUrl + '/api/issues/tags?ps=10', + var url = window.baseUrl + '/api/issues/tags?ps=10', tags = this.options.app.state.get('query').tags; if (tags != null) { url += '&tags=' + tags; @@ -14,10 +14,10 @@ define([ 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: { diff --git a/server/sonar-web/src/main/js/apps/issues/filters-view.js b/server/sonar-web/src/main/js/apps/issues/filters-view.js index 03813eff3c0..568402c3582 100644 --- a/server/sonar-web/src/main/js/apps/issues/filters-view.js +++ b/server/sonar-web/src/main/js/apps/issues/filters-view.js @@ -1,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { var $ = jQuery; diff --git a/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js b/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js index 28a6a86e212..c448fb1f0de 100644 --- a/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js +++ b/server/sonar-web/src/main/js/apps/issues/issue-filter-view.js @@ -12,11 +12,11 @@ define([ var property = $(e.currentTarget).data('property'), value = $(e.currentTarget).data('value'); this.trigger('select', property, value); - this._super(e); + ActionOptionsView.prototype.selectOption.apply(this, arguments); }, serializeData: function () { - return _.extend(this._super(), { + return _.extend(ActionOptionsView.prototype.serializeData.apply(this, arguments), { s: this.model.get('severity') }); } diff --git a/server/sonar-web/src/main/js/apps/issues/layout.js b/server/sonar-web/src/main/js/apps/issues/layout.js index 5dbbcaf1139..3edcb430d41 100644 --- a/server/sonar-web/src/main/js/apps/issues/layout.js +++ b/server/sonar-web/src/main/js/apps/issues/layout.js @@ -1,6 +1,8 @@ define([ + 'backbone.marionette', + '../../components/common/jquery-isolated-scroll', './templates' -], function () { +], function (Marionette) { var $ = jQuery; return Marionette.LayoutView.extend({ diff --git a/server/sonar-web/src/main/js/apps/issues/models/filter.js b/server/sonar-web/src/main/js/apps/issues/models/filter.js index aa31f8ab267..d1cbabc4d4a 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/filter.js +++ b/server/sonar-web/src/main/js/apps/issues/models/filter.js @@ -1,8 +1,10 @@ -define(function () { +define([ + 'backbone' +], function (Backbone) { return Backbone.Model.extend({ url: function () { - return baseUrl + '/api/issue_filters/show/' + this.id; + return window.baseUrl + '/api/issue_filters/show/' + this.id; }, parse: function (r) { diff --git a/server/sonar-web/src/main/js/apps/issues/models/filters.js b/server/sonar-web/src/main/js/apps/issues/models/filters.js index bb66327e423..cde0286b159 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/filters.js +++ b/server/sonar-web/src/main/js/apps/issues/models/filters.js @@ -1,6 +1,7 @@ define([ + 'backbone', './filter' -], function (Filter) { +], function (Backbone, Filter) { return Backbone.Collection.extend({ model: Filter diff --git a/server/sonar-web/src/main/js/apps/issues/models/issue.js b/server/sonar-web/src/main/js/apps/issues/models/issue.js index 6266434fa23..2a096b4db32 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/issue.js +++ b/server/sonar-web/src/main/js/apps/issues/models/issue.js @@ -8,7 +8,7 @@ define([ keepFields.forEach(function (field) { attrs[field] = this.get(field); }.bind(this)); - return this._super(attrs, options); + Issue.prototype.reset.call(this, attrs, options); } }); diff --git a/server/sonar-web/src/main/js/apps/issues/models/issues.js b/server/sonar-web/src/main/js/apps/issues/models/issues.js index aca2e2ac2bf..7f613e0adb7 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/issues.js +++ b/server/sonar-web/src/main/js/apps/issues/models/issues.js @@ -1,12 +1,13 @@ define([ + 'backbone', './issue' -], function (Issue) { +], function (Backbone, Issue) { return Backbone.Collection.extend({ model: Issue, url: function () { - return baseUrl + '/api/issues/search'; + return window.baseUrl + '/api/issues/search'; }, _injectRelational: function (issue, source, baseField, lookupField) { diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js index 928b4b42c5f..5fc1867969e 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-header-view.js @@ -24,7 +24,7 @@ define([ }, onDestroy: function () { - this._super(); + WorkspaceHeaderView.prototype.onDestroy.apply(this, arguments); window.onBulkIssues = this._onBulkIssues; }, @@ -51,7 +51,7 @@ define([ render: function () { if (!this._suppressUpdate) { - this._super(); + WorkspaceHeaderView.prototype.render.apply(this, arguments); } }, @@ -105,7 +105,7 @@ define([ selectedCount = this.options.app.list.where({ selected: true }).length, allSelected = issuesCount > 0 && issuesCount === selectedCount, someSelected = !allSelected && selectedCount > 0; - return _.extend(this._super(), { + return _.extend(WorkspaceHeaderView.prototype.serializeData.apply(this, arguments), { selectedCount: selectedCount, allSelected: allSelected, someSelected: someSelected 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 942e86e4ba7..c501d4af3cf 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,21 +1,23 @@ define([ + 'backbone', + 'backbone.marionette', './templates' -], function () { +], function (Backbone, Marionette) { var $ = jQuery; Handlebars.registerHelper('issuesHomeLink', function (property, value) { - return baseUrl + '/issues/search#resolved=false|createdInLast=1w|' + + return window.baseUrl + '/issues/search#resolved=false|createdInLast=1w|' + property + '=' + (encodeURIComponent(value)); }); Handlebars.registerHelper('myIssuesHomeLink', function (property, value) { - return baseUrl + '/issues/search#resolved=false|createdInLast=1w|assignees=__me__|' + + return window.baseUrl + '/issues/search#resolved=false|createdInLast=1w|assignees=__me__|' + property + '=' + (encodeURIComponent(value)); }); Handlebars.registerHelper('issueFilterHomeLink', function (id) { - return baseUrl + '/issues/search#id=' + id; + return window.baseUrl + '/issues/search#id=' + id; }); return Marionette.ItemView.extend({ diff --git a/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js b/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js index ada57f15a2d..4b85cce7b32 100644 --- a/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js +++ b/server/sonar-web/src/main/js/apps/issues/workspace-list-empty-view.js @@ -1,10 +1,12 @@ -define(function () { +define([ + 'backbone.marionette' +], function (Marionette) { return Marionette.ItemView.extend({ className: 'search-navigator-no-results', template: function () { - return t('issue_filter.no_issues'); + return window.t('issue_filter.no_issues'); } }); |