github.com/outbrain/consul@v1.4.5/ui-v2/app/routes/settings.js (about)

     1  import Route from '@ember/routing/route';
     2  import { inject as service } from '@ember/service';
     3  import { hash } from 'rsvp';
     4  import { get } from '@ember/object';
     5  
     6  import WithBlockingActions from 'consul-ui/mixins/with-blocking-actions';
     7  export default Route.extend(WithBlockingActions, {
     8    repo: service('settings'),
     9    dcRepo: service('repository/dc'),
    10    model: function(params) {
    11      return hash({
    12        item: get(this, 'repo').findAll(),
    13        dcs: get(this, 'dcRepo').findAll(),
    14      }).then(model => {
    15        return hash({
    16          ...model,
    17          ...{
    18            dc: get(this, 'dcRepo').getActive(null, model.dcs),
    19          },
    20        });
    21      });
    22    },
    23    setupController: function(controller, model) {
    24      this._super(...arguments);
    25      controller.setProperties(model);
    26    },
    27    // overwrite afterUpdate and afterDelete hooks
    28    // to avoid the default 'return to listing page'
    29    afterUpdate: function() {},
    30    afterDelete: function() {},
    31  });