couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garrensmith <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Active tasks in React
Date Tue, 14 Apr 2015 12:11:45 GMT
Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/317#discussion_r28320921
  
    --- Diff: app/addons/activetasks/routes.js ---
    @@ -14,60 +14,40 @@ define([
       'app',
       'api',
       'addons/activetasks/resources',
    -  'addons/activetasks/views'
    +  'addons/activetasks/components.react',
    +  'addons/activetasks/actions'
     ],
     
    -function (app, FauxtonAPI, Activetasks, Views) {
    +function (app, FauxtonAPI, ActiveTasksResources, ActiveTasksComponents, Actions) {
     
       var ActiveTasksRouteObject = FauxtonAPI.RouteObject.extend({
    -    layout: 'with_tabs_sidebar',
    -
    +    selectedHeader: 'Active Tasks',
    +    layout: 'one_pane',
         routes: {
    -      'activetasks/:id': 'defaultView',
    -      'activetasks': 'defaultView'
    -    },
    -
    -    events: {
    -      'route:changeFilter': 'changeFilter'
    +      'activetasks/:id': 'showActiveTasks',
    +      'activetasks': 'showActiveTasks'
         },
    -
    -    selectedHeader: 'Active Tasks',
    -
         crumbs: [
           {'name': 'Active tasks', 'link': 'activetasks'}
         ],
    -
         apiUrl: function () {
    -      return [this.allTasks.url('apiurl'), this.allTasks.documentation];
    +      var apiurl = window.location.origin + '/_active_tasks';
    +      return [ apiurl, FauxtonAPI.constants.DOC_URLS.ACTIVE_TASKS];
         },
    -
         roles: ['_admin'],
    -
         initialize: function () {
    -      this.allTasks = new Activetasks.AllTasks();
    -      this.search = new Activetasks.Search();
    -    },
    -
    -    defaultView: function () {
    -      this.setView('#dashboard-lower-content', new Views.View({
    -        collection: this.allTasks,
    -        currentView: 'all',
    -        searchModel: this.search
    -      }));
    -
    -      this.setView('#sidebar-content', new Views.TabMenu({}));
    -
    -      this.headerView = this.setView('#dashboard-upper-content', new Views.TabHeader({
    -        searchModel: this.search
    -      }));
    +      this.allTasks = new ActiveTasksResources.AllTasks();
         },
    +    showActiveTasks: function () {
    +      Actions.fetchAndSetActiveTasks(this.allTasks);
    +      Actions.changePollingInterval(5);
     
    -    changeFilter: function (filterType) {
    -      this.search.set('filterType', filterType);
    +      this.activeTasksSection = this.setComponent('#dashboard-content', ActiveTasksComponents.ActiveTasksController);
    --- End diff --
    
    This looks great. I don't think you need `this.pollingwidget` or `this.activeTasksSection`.
The RouteObject will call `removeComponent` so you don't need to manually remove them.


---
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