-<div class="overview-card overview-gate" id="overview-gate"></div>
-
-<div class="overview-container columns">
- <div class="column-half">
- <div class="overview-card" id="overview-size"></div>
- </div>
- <div class="column-half">
- <div class="overview-card" id="overview-issues"></div>
- </div>
-</div>
-<div class="overview-container columns">
- <div class="column-half">
- <div class="overview-card" id="overview-coverage"></div>
- </div>
- <div class="column-half">
- <div class="overview-card" id="overview-duplications"></div>
- </div>
-</div>
+<div class="js-region"></div>
--- /dev/null
+<div class="overview-card overview-gate" id="overview-gate"></div>
+
+<div class="overview-container columns">
+ <div class="column-half">
+ <div class="overview-card" id="overview-size"></div>
+ </div>
+ <div class="column-half">
+ <div class="overview-card" id="overview-issues"></div>
+ </div>
+</div>
+<div class="overview-container columns">
+ <div class="column-half">
+ <div class="overview-card" id="overview-coverage"></div>
+ </div>
+ <div class="column-half">
+ <div class="overview-card" id="overview-duplications"></div>
+ </div>
+</div>
*/
requirejs([
'overview/layout',
- 'overview/models/state',
- 'overview/views/gate-view',
- 'overview/views/size-view',
- 'overview/views/issues-view',
- 'overview/views/coverage-view',
- 'overview/views/duplications-view'
+ 'overview/controller',
+ 'overview/router',
+ 'overview/models/state'
], function (Layout,
- State,
- GateView,
- SizeView,
- IssuesView,
- CoverageView,
- DuplicationsView) {
+ Controller,
+ Router,
+ State) {
var $ = jQuery,
App = new Marionette.Application();
App.addInitializer(function () {
$('body').addClass('dashboard-page');
+
+ // add state model
this.state = new State(window.overviewConf);
+
+ // create and render layout
this.layout = new Layout({
el: '.overview',
model: this.state
}).render();
- this.layout.gateRegion.show(new GateView({ model: this.state }));
- this.layout.sizeRegion.show(new SizeView({ model: this.state }));
- this.layout.issuesRegion.show(new IssuesView({ model: this.state }));
- this.layout.coverageRegion.show(new CoverageView({ model: this.state }));
- this.layout.duplicationsRegion.show(new DuplicationsView({ model: this.state }));
- this.state.fetch();
+
+ // create controller
+ this.controller = new Controller({ state: this.state, layout: this.layout });
+
+ // start router
+ this.router = new Router({ controller: this.controller });
+ Backbone.history.start();
});
window.requestMessages().done(function () {
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'overview/main/layout',
+ 'overview/main/gate-view',
+ 'overview/main/size-view',
+ 'overview/main/issues-view',
+ 'overview/main/coverage-view',
+ 'overview/main/duplications-view'
+], function (MainLayout,
+ GateView,
+ SizeView,
+ IssuesView,
+ CoverageView,
+ DuplicationsView) {
+
+ return Marionette.Controller.extend({
+
+ initialize: function (options) {
+ this.state = options.state;
+ this.layout = options.layout;
+ },
+
+ main: function () {
+ var options = { model: this.state },
+ mainLayout = new MainLayout(options);
+ this.layout.mainRegion.show(mainLayout);
+ mainLayout.gateRegion.show(new GateView(options));
+ mainLayout.sizeRegion.show(new SizeView(options));
+ mainLayout.issuesRegion.show(new IssuesView(options));
+ mainLayout.coverageRegion.show(new CoverageView(options));
+ mainLayout.duplicationsRegion.show(new DuplicationsView(options));
+ this.state.fetch();
+ }
+
+ });
+
+});
template: Templates['overview-layout'],
regions: {
- gateRegion: '#overview-gate',
- sizeRegion: '#overview-size',
- issuesRegion: '#overview-issues',
- coverageRegion: '#overview-coverage',
- duplicationsRegion: '#overview-duplications'
- },
-
- modelEvents: {
- 'change': 'toggleRegions'
- },
-
- toggleRegions: function () {
- var conditions = this.model.get('gateConditions'),
- hasGate = _.isArray(conditions) && conditions.length > 0;
- this.$(this.gateRegion.el).toggle(hasGate);
+ mainRegion: '.js-region'
}
});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'templates/overview'
+], function () {
+
+ return Marionette.Layout.extend({
+ template: Templates['overview-coverage'],
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+ onRender: function () {
+ var trend = this.model.get('coverageTrend'),
+ hasCoverage = this.model.get('coverage') != null;
+ if (_.size(trend) > 1 && hasCoverage) {
+ this.$('#overview-coverage-trend').sparkline(this.model.get('coverageTrend'));
+ }
+ }
+ });
+
+});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'templates/overview'
+], function () {
+
+ return Marionette.Layout.extend({
+ template: Templates['overview-duplications'],
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+ onRender: function () {
+ var trend = this.model.get('duplicationsTrend'),
+ hasDuplications = this.model.get('duplications') != null;
+ if (_.size(trend) > 1 && hasDuplications) {
+ this.$('#overview-duplications-trend').sparkline(this.model.get('duplicationsTrend'));
+ }
+ }
+ });
+
+});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'templates/overview'
+], function () {
+
+ return Marionette.Layout.extend({
+ template: Templates['overview-gate'],
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+ onRender: function () {
+ if (this.model.has('gateStatus')) {
+ this.$el.closest('.overview-card').addClass('overview-gate-' + this.model.get('gateStatus').toLowerCase());
+ }
+ this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
+ },
+
+ onClose: function () {
+ this.$('[data-toggle="tooltip"]').tooltip('destroy');
+ }
+ });
+
+});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'templates/overview'
+], function () {
+
+ return Marionette.Layout.extend({
+ template: Templates['overview-issues'],
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+ onRender: function () {
+ var trend = this.model.get('issuesTrend'),
+ hasIssues = this.model.get('issues') != null;
+ if (_.size(trend) > 1 && hasIssues) {
+ this.$('#overview-issues-trend').sparkline(this.model.get('issuesTrend'));
+ }
+ }
+ });
+
+});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'templates/overview'
+], function () {
+
+ return Marionette.Layout.extend({
+ template: Templates['overview-main-layout'],
+
+ regions: {
+ gateRegion: '#overview-gate',
+ sizeRegion: '#overview-size',
+ issuesRegion: '#overview-issues',
+ coverageRegion: '#overview-coverage',
+ duplicationsRegion: '#overview-duplications'
+ },
+
+ modelEvents: {
+ 'change': 'toggleRegions'
+ },
+
+ toggleRegions: function () {
+ var conditions = this.model.get('gateConditions'),
+ hasGate = _.isArray(conditions) && conditions.length > 0;
+ this.$(this.gateRegion.el).toggle(hasGate);
+ }
+ });
+
+});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define([
+ 'templates/overview'
+], function () {
+
+ return Marionette.Layout.extend({
+ template: Templates['overview-size'],
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+ onRender: function () {
+ var trend = this.model.get('sizeTrend'),
+ hasSize = this.model.get('ncloc') != null;
+ if (_.size(trend) > 1 && hasSize) {
+ this.$('#overview-size-trend').sparkline(this.model.get('sizeTrend'));
+ }
+ }
+ });
+
+});
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+define(function () {
+
+ return Backbone.Router.extend({
+
+ routes: {
+ '': 'main'
+ },
+
+ initialize: function (options) {
+ this.controller = options.controller;
+ },
+
+ main: function () {
+ this.controller.main();
+ }
+ });
+
+});
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-define([
- 'templates/overview'
-], function () {
-
- return Marionette.Layout.extend({
- template: Templates['overview-coverage'],
-
- modelEvents: {
- 'change': 'render'
- },
-
- onRender: function () {
- var trend = this.model.get('coverageTrend'),
- hasCoverage = this.model.get('coverage') != null;
- if (_.size(trend) > 1 && hasCoverage) {
- this.$('#overview-coverage-trend').sparkline(this.model.get('coverageTrend'));
- }
- }
- });
-
-});
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-define([
- 'templates/overview'
-], function () {
-
- return Marionette.Layout.extend({
- template: Templates['overview-duplications'],
-
- modelEvents: {
- 'change': 'render'
- },
-
- onRender: function () {
- var trend = this.model.get('duplicationsTrend'),
- hasDuplications = this.model.get('duplications') != null;
- if (_.size(trend) > 1 && hasDuplications) {
- this.$('#overview-duplications-trend').sparkline(this.model.get('duplicationsTrend'));
- }
- }
- });
-
-});
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-define([
- 'templates/overview'
-], function () {
-
- return Marionette.Layout.extend({
- template: Templates['overview-gate'],
-
- modelEvents: {
- 'change': 'render'
- },
-
- onRender: function () {
- if (this.model.has('gateStatus')) {
- this.$el.closest('.overview-card').addClass('overview-gate-' + this.model.get('gateStatus').toLowerCase());
- }
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
- },
-
- onClose: function () {
- this.$('[data-toggle="tooltip"]').tooltip('destroy');
- }
- });
-
-});
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-define([
- 'templates/overview'
-], function () {
-
- return Marionette.Layout.extend({
- template: Templates['overview-issues'],
-
- modelEvents: {
- 'change': 'render'
- },
-
- onRender: function () {
- var trend = this.model.get('issuesTrend'),
- hasIssues = this.model.get('issues') != null;
- if (_.size(trend) > 1 && hasIssues) {
- this.$('#overview-issues-trend').sparkline(this.model.get('issuesTrend'));
- }
- }
- });
-
-});
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-define([
- 'templates/overview'
-], function () {
-
- return Marionette.Layout.extend({
- template: Templates['overview-size'],
-
- modelEvents: {
- 'change': 'render'
- },
-
- onRender: function () {
- var trend = this.model.get('sizeTrend'),
- hasSize = this.model.get('ncloc') != null;
- if (_.size(trend) > 1 && hasSize) {
- this.$('#overview-size-trend').sparkline(this.model.get('sizeTrend'));
- }
- }
- });
-
-});