Repository: couchdb-fauxton Updated Branches: refs/heads/master 7d0aab0e4 -> e87539cc9
Remove stats section for 2.0 Right now also the stats are not working in Fauxton and we decided to remove it right now. In a serious production setup stats are provided by external tools like collectd, graphite, monit and friends - we include couchdb-folsom for that in 2.0. Discussion on ML: https://www.mail-archive.com/dev%40couchdb.apache.org/msg37245.html Closes COUCHDB-2429 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/e87539cc Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/e87539cc Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/e87539cc Branch: refs/heads/master Commit: e87539cc9f8fd28b0410660c1a3ef94dcccc767b Parents: 7d0aab0 Author: Robert Kowalski <[email protected]> Authored: Mon Nov 17 15:39:39 2014 +0100 Committer: Robert Kowalski <[email protected]> Committed: Mon Nov 17 15:50:50 2014 +0100 ---------------------------------------------------------------------- .gitignore | 1 - app/addons/stats/assets/less/stats.less | 20 --- app/addons/stats/base.js | 26 ---- app/addons/stats/resources.js | 39 ------ app/addons/stats/routes.js | 62 --------- app/addons/stats/templates/by_method.html | 16 --- app/addons/stats/templates/pie_table.html | 54 -------- app/addons/stats/templates/stats.html | 16 --- app/addons/stats/templates/statselect.html | 22 --- app/addons/stats/views.js | 170 ------------------------ settings.json.default | 1 - 11 files changed, 427 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 81ff628..71dcf22 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ app/addons/* !app/addons/activetasks !app/addons/config !app/addons/plugins -!app/addons/stats !app/addons/replication !app/addons/contribute !app/addons/auth http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/assets/less/stats.less ---------------------------------------------------------------------- diff --git a/app/addons/stats/assets/less/stats.less b/app/addons/stats/assets/less/stats.less deleted file mode 100644 index 95020b5..0000000 --- a/app/addons/stats/assets/less/stats.less +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -.datatypes { - padding: 0 15px; - - .span5 svg { - height:450px; - min-width: 450px; - } -} http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/base.js ---------------------------------------------------------------------- diff --git a/app/addons/stats/base.js b/app/addons/stats/base.js deleted file mode 100644 index 1b44b8b..0000000 --- a/app/addons/stats/base.js +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - "api", - "addons/stats/routes" -], - -function(app, FauxtonAPI, Stats) { - - Stats.initialize = function() { - FauxtonAPI.addHeaderLink({title: "Statistics", href: "#stats", icon: "fonticon-stats", className: 'stats'}); - }; - - return Stats; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/stats/resources.js b/app/addons/stats/resources.js deleted file mode 100644 index fb59372..0000000 --- a/app/addons/stats/resources.js +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - "api", - "backbone", - "lodash", - "addons/fauxton/base" -], - -function (app, FauxtonAPI, backbone, _, Fauxton) { - var Stats = new FauxtonAPI.addon(); - - Stats.Collection = Backbone.Collection.extend({ - model: Backbone.Model, - documentation: 'stats', - url: window.location.origin + '/_stats', - - parse: function(resp) { - return _.flatten(_.map(resp, function(doc, key) { - return _.map(doc, function(v, k){ - return _.extend({id: k, type: key}, v); - }); - }), true); - } - }); - - return Stats; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/stats/routes.js b/app/addons/stats/routes.js deleted file mode 100644 index 9939d43..0000000 --- a/app/addons/stats/routes.js +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - "api", - "addons/stats/views" -], - -function(app, FauxtonAPI, Stats) { - - var StatsRouteObject = FauxtonAPI.RouteObject.extend({ - layout: "with_sidebar", - - routes: { - "stats":"showStats", - "_stats": "showStats" - }, - - - crumbs: [ - {"name": "Statistics", "link": "_stats"} - ], - - selectedHeader: "Statistics", - - initialize: function () { - this.stats = new Stats.Collection(); - this.setView("#sidebar-content", new Stats.Views.StatSelect({ - collection: this.stats - })); - - }, - - showStats: function () { - this.setView("#dashboard-content", new Stats.Views.Statistics({ - collection: this.stats - })); - }, - - establish: function() { - return [this.stats.fetch()]; - }, - - apiUrl: function(){ - return [ this.stats.url, this.stats.documentation]; - } - }); - - Stats.RouteObjects = [StatsRouteObject]; - - return Stats; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/templates/by_method.html ---------------------------------------------------------------------- diff --git a/app/addons/stats/templates/by_method.html b/app/addons/stats/templates/by_method.html deleted file mode 100644 index 099d737..0000000 --- a/app/addons/stats/templates/by_method.html +++ /dev/null @@ -1,16 +0,0 @@ -<!-- -Licensed under the Apache License, Version 2.0 (the "License"); you may not -use this file except in compliance with the License. You may obtain a copy of -the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations under -the License. ---> - -<h2>By Method <small>GET, POST, PUT, DELETE</small></h2> -<div id="httpd_request_methods"></div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/templates/pie_table.html ---------------------------------------------------------------------- diff --git a/app/addons/stats/templates/pie_table.html b/app/addons/stats/templates/pie_table.html deleted file mode 100644 index 8c4682c..0000000 --- a/app/addons/stats/templates/pie_table.html +++ /dev/null @@ -1,54 +0,0 @@ -<!-- -Licensed under the Apache License, Version 2.0 (the "License"); you may not -use this file except in compliance with the License. You may obtain a copy of -the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations under -the License. ---> - -<div class="row-fluid"> - <h2> <%= datatype %> </h2> -</div> - -<div class="row-fluid"> - <div> - <table class="table table-condensed table-striped"> - <thead> - <tr> - <th> Description </th> - <th> current </th> - <th> sum </th> - <th> mean </th> - <th> stddev </th> - <th> min </th> - <th> max </th> - </tr> - </thead> - <% _.each (statistics, function (stat_line) { - if (stat_line.get("sum")){ - %> - <tr> - <td><%= stat_line.get("description") %></td> - <td><%= stat_line.get("current") %></td> - <td><%= stat_line.get("sum") %></td> - <td><%= stat_line.get("mean") %></td> - <td><%= stat_line.get("stddev") %></td> - <td><%= stat_line.get("min") %></td> - <td><%= stat_line.get("max") %></td> - </tr> - <% }}) %> - </table> - </div> - - <div class="span5"> - <center> - <svg id="<%= datatype %>_graph"></svg> - </center> - </div> -</div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/templates/stats.html ---------------------------------------------------------------------- diff --git a/app/addons/stats/templates/stats.html b/app/addons/stats/templates/stats.html deleted file mode 100644 index ae7ce14..0000000 --- a/app/addons/stats/templates/stats.html +++ /dev/null @@ -1,16 +0,0 @@ -<!-- -Licensed under the Apache License, Version 2.0 (the "License"); you may not -use this file except in compliance with the License. You may obtain a copy of -the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations under -the License. ---> - -<div class="datatypes"> -</div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/templates/statselect.html ---------------------------------------------------------------------- diff --git a/app/addons/stats/templates/statselect.html b/app/addons/stats/templates/statselect.html deleted file mode 100644 index ef1133c..0000000 --- a/app/addons/stats/templates/statselect.html +++ /dev/null @@ -1,22 +0,0 @@ -<!-- -Licensed under the Apache License, Version 2.0 (the "License"); you may not -use this file except in compliance with the License. You may obtain a copy of -the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -License for the specific language governing permissions and limitations under -the License. ---> - -<% _.each(datatypes, function (datatype) { %> -<li> -<a href="#stats" class="datatype-select" data-type-select="<%= datatype %>"> - <%= datatype %> - <i class="icon-chevron-right" style="float:right"></i> -</a> -</li> -<% }); %> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/app/addons/stats/views.js ---------------------------------------------------------------------- diff --git a/app/addons/stats/views.js b/app/addons/stats/views.js deleted file mode 100644 index 275c30b..0000000 --- a/app/addons/stats/views.js +++ /dev/null @@ -1,170 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - - "api", - 'addons/stats/resources', - "d3", - "nv.d3" - -], - -function(app, FauxtonAPI, Stats, d3, nv) { - var Views = {}, - datatypeEventer = {}; - - _.extend(datatypeEventer, Backbone.Events); - - Views.Legend = FauxtonAPI.View.extend({ - tagName: 'ul', - template: "addons/stats/templates/legend", - - serialize: function () { - return { - legend_items: this.collection.toJSON() - }; - } - }); - - Views.Pie = FauxtonAPI.View.extend({ - className: "datatype-section", - template: 'addons/stats/templates/pie_table', - - initialize: function(args){ - this.datatype = args.datatype; - }, - - serialize: function() { - return { - statistics: this.collection.where({type: this.datatype}), - datatype: this.datatype - }; - }, - - afterRender: function(){ - var collection = this.collection, - chartelem = "#" + this.datatype + '_graph', - series = _.map(this.collection.where({type: this.datatype}), - function(d, counter){ - // TODO: x should be a counter - var point = { - y: d.get("sum") || 0, - key: d.id - }; - return point; - } - ); - - series = _.filter(series, function(d){return d.y > 0;}); - series = _.sortBy(series, function(d){return -d.y;}); - - nv.addGraph(function() { - var width = 440, - height = 440; - - var chart = nv.models.pieChart() - .x(function(d) { return d.key; }) - .y(function(d) { return d.y; }) - .showLabels(true) - .showLegend(false) - .color(d3.scale.category10().range()) - .width(width) - .height(height); - - d3.select(chartelem) - .datum(series) - .transition().duration(300) - .attr('width', width) - .attr('height', height) - .call(chart); - - return chart; - }); - - this.$el.addClass(this.datatype + '_section'); - } - }); - - Views.StatSelect = FauxtonAPI.View.extend({ - className: 'nav nav-tabs nav-stacked', - tagName: 'ul', - - template: "addons/stats/templates/statselect", - - initialize: function (options) { - this.rows = []; - }, - - events: { - 'click .datatype-select': "datatype_selected" - }, - - serialize: function () { - return { - datatypes: _.uniq(this.collection.pluck("type")) - }; - }, - - afterRender: function () { - this.$('.datatype-select').first().addClass('active'); - }, - - datatype_selected: function (event) { - var $target = $(event.currentTarget); - - event.preventDefault(); - event.stopPropagation(); - this.$('.datatype-select').removeClass('active'); - $target.addClass('active'); - datatypeEventer.trigger('datatype-select', $target.attr('data-type-select')); - } - }); - - Views.Statistics = FauxtonAPI.View.extend({ - template: "addons/stats/templates/stats", - - initialize: function (options) { - this.rows = []; - datatypeEventer.on('datatype-select', this.display_datatype, this); - }, - - serialize: function () { - return { - datatypes: _.uniq(this.collection.pluck("type")) - }; - }, - - beforeRender: function () { - _.each(_.uniq(this.collection.pluck("type")), function(datatype) { - this.rows[datatype] = this.insertView(".datatypes", new Views.Pie({ - collection: this.collection, - datatype: datatype - })); - }, this); - }, - - afterRender: function () { - this.$('.datatype-section').hide().first().toggle(); - }, - - display_datatype: function (datatype) { - this.$('.datatype-section').hide(); - this.$('.' + datatype + '_section').show(); - } - }); - - Stats.Views = Views; - - return Stats; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e87539cc/settings.json.default ---------------------------------------------------------------------- diff --git a/settings.json.default b/settings.json.default index bc5a617..3120631 100644 --- a/settings.json.default +++ b/settings.json.default @@ -6,7 +6,6 @@ { "name": "pouchdb" }, { "name": "activetasks" }, { "name": "config" }, - { "name": "stats" }, { "name": "replication" }, { "name": "plugins" }, { "name": "contribute" },
