couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb pull request: 2125 sort tasks refactor
Date Wed, 09 Apr 2014 19:37:52 GMT
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/203#discussion_r11454797
  
    --- Diff: src/fauxton/app/addons/activetasks/resources.js ---
    @@ -12,104 +12,44 @@
     
     define([
       "app",
    -  "backbone",
       "addons/fauxton/base",
    -  "d3"
     ],
     
    -function (app, backbone, Fauxton) {
    +function (app, Fauxton) {
       var Active = {},
           apiv = app.versionAPI;
           app.taskSortBy = 'type';
     
    -  Active.Task = Backbone.Model.extend({
    -    initialize: function() { 
    -      this.set({"id": this.get('pid')});
    -    }
    -  });
    -
    -// ALL THE TASKS
    -  Active.Tasks = Backbone.Model.extend({
    -    alltypes: {
    -      "all": "All tasks",
    -      "replication": "Replication",
    -      "database_compaction":" Database Compaction",
    -      "indexer": "Indexer",
    -      "view_compaction": "View Compaction"
    -    },
    -    documentation: "_active_tasks",
    -    url: function (context) {
    -      if (context === "apiurl"){
    -        return window.location.origin + '/_active_tasks';
    -      } else {
    -        return app.host + '/_active_tasks';
    -      }
    -    },
    -    fetch: function (options) {
    -     var fetchoptions = options || {};
    -     fetchoptions.cache = false;
    -     return Backbone.Model.prototype.fetch.call(this, fetchoptions);
    -    },
    -    parse: function(resp){
    -      var types = this.getUniqueTypes(resp),
    -          that = this;
     
    -      var typeCollections = _.reduce(types, function (collection, val, key) {
    -          collection[key] = new Active.AllTasks(that.sortThis(resp, key));
    -          return collection;
    -        }, {});
    +  Active.events = {};
    +  _.extend(Active.events, Backbone.Events);
     
    -      typeCollections.all = new Active.AllTasks(resp);
    -
    -      this.set(typeCollections);  //now set them all to the model
    -    },
    -    getUniqueTypes: function(resp){
    -      var types = this.alltypes;
    -
    -      _.each(resp, function(type){
    -        if( typeof(types[type.type]) === "undefined"){
    -          types[type.type] = type.type.replace(/_/g,' ');
    -        }
    -      },this);
    -
    -      this.alltypes = types;
    -      return types;
    -    },
    -    sortThis: function(resp, type){
    -      return _.filter(resp, function(item) { return item.type === type; });
    -    },
    -    changeView: function (view){
    -      this.set({
    -        "currentView": view
    -      });
    -    },
    -    getCurrentViewData: function(){
    -      var currentView = this.get('currentView');
    -      return this.get(currentView);
    -    },
    -    getDatabaseCompactions: function(){
    -      return this.get('databaseCompactions');
    -    },
    -    getIndexes: function(){
    -      return this.get('indexes');
    -    },
    -    getViewCompactions: function(){
    -      return this.get('viewCompactions');
    +  Active.Task = Backbone.Model.extend({
    +    initialize: function () {
    +      this.set({"id": this.get('pid')});
    --- End diff --
    
    Good to know. It is a leftover from the old code, but I will change that!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message