How to use the ember-inspector/routes/tab.extend function in ember-inspector

To help you get started, we’ve selected a few ember-inspector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember-inspector / app / routes / promise-tree.js View on Github external
import { Promise } from 'rsvp';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  model() {
    // block rendering until first batch arrives
    // Helps prevent flashing of "please refresh the page"
    return new Promise(resolve => {
      this.get('assembler').one('firstMessageReceived', () => {
        resolve(this.get('assembler.topSort'));
      });
      this.get('assembler').start();
    });
  },

  setupController() {
    this._super(...arguments);
    this.get('port').on('promise:instrumentWithStack', this, this.setInstrumentWithStack);
    this.get('port').send('promise:getInstrumentWithStack');
  },
github emberjs / ember-inspector / app / routes / records.js View on Github external
import { set } from '@ember/object';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  setupController(controller, model) {
    this._super(controller, model);

    const type = this.modelFor('model_type');

    controller.set('modelType', type);

    this.get('port').on('data:recordsAdded', this, this.addRecords);
    this.get('port').on('data:recordsUpdated', this, this.updateRecords);
    this.get('port').on('data:recordsRemoved', this, this.removeRecords);
    this.get('port').one('data:filters', this, function(message) {
      this.set('controller.filters', message.filters);
    });
    this.get('port').send('data:getFilters');
    this.get('port').send('data:getRecords', { objectId: type.objectId });
  },
github emberjs / ember-inspector / app / routes / container-type.js View on Github external
import { Promise } from 'rsvp';
import { get } from '@ember/object';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  setupController(controller) {
    controller.setProperties({
      search: '',
      searchVal: ''
    });
    this._super(...arguments);
  },
  model(params) {
    const type = params.type_id;
    const port = this.get('port');
    return new Promise((resolve, reject) => {
      port.one('container:instances', message => {
        if (message.status === 200) {
          resolve(message.instances);
        } else {
          reject(message);
github emberjs / ember-inspector / app / routes / view-tree.js View on Github external
import { assign } from '@ember/polyfills';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  model() {
    return [];
  },

  setupController() {
    this._super(...arguments);
    this.get('port').on('view:viewTree', this, this.setViewTree);
    this.get('port').on('view:stopInspecting', this, this.stopInspecting);
    this.get('port').on('view:startInspecting', this, this.startInspecting);
    this.get('port').on('view:inspectDOMElement', this, this.inspectDOMElement);

    this.set('controller.viewTreeLoaded', false);
    this.get('port').send('view:setOptions', { options: this.get('controller.options') });
    this.get('port').send('view:getTree');
  },
github emberjs / ember-inspector / app / routes / info.js View on Github external
import { Promise } from 'rsvp';
import TabRoute from "ember-inspector/routes/tab";
import { oneWay } from '@ember/object/computed';

export default TabRoute.extend({
  version: oneWay('config.VERSION').readOnly(),

  model() {
    const version = this.get('version');
    const port = this.get('port');
    return new Promise(resolve => {
      port.one('general:libraries', message => {
        message.libraries.insertAt(0, {
          name: 'Ember Inspector',
          version
        });
        resolve(message.libraries);
      });
      port.send('general:getLibraries');
    });
  }
github emberjs / ember-inspector / app / routes / deprecations.js View on Github external
import { Promise } from 'rsvp';
import { setProperties } from '@ember/object';
import TabRoute from 'ember-inspector/routes/tab';

export default TabRoute.extend({
  model() {
    return new Promise(resolve => {
      this.port.one('deprecation:deprecationsAdded', resolve);
      this.port.send('deprecation:watch');
    });
  },

  setupController(controller, message) {
    this._super(...arguments);
    this.deprecationsAdded(message);
  },

  activate() {
    this._super(...arguments);
    this.port.on('deprecation:deprecationsAdded', this, this.deprecationsAdded);
  },
github emberjs / ember-inspector / app / routes / render-tree.js View on Github external
import { Promise } from 'rsvp';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  model() {
    const port = this.get('port');
    return new Promise(function(resolve) {
      port.one('render:profilesAdded', function(message) {
        resolve(message.profiles);
      });
      port.send('render:watchProfiles');
    });
  },

  setupController(controller, model) {
    this._super(...arguments);
    if (model.length === 0) {
      controller.set('initialEmpty', true);
    }
    const port = this.get('port');
github emberjs / ember-inspector / app / routes / route-tree.js View on Github external
import $ from 'jquery';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  setupController() {
    this.get('port').on('route:currentRoute', this, this.setCurrentRoute);
    this.get('port').send('route:getCurrentRoute');
    this.get('port').on('route:routeTree', this, this.setTree);
    this.get('port').send('route:getTree');
  },

  deactivate() {
    this.get('port').off('route:currentRoute');
    this.get('port').off('route:routeTree', this, this.setTree);
  },

  setCurrentRoute(message) {
    this.get('controller').set('currentRoute', message.name);
  },
github emberjs / ember-inspector / app / routes / model-types.js View on Github external
import { set } from '@ember/object';
import { Promise } from 'rsvp';
import TabRoute from "ember-inspector/routes/tab";

export default TabRoute.extend({
  setupController(controller, model) {
    this._super(controller, model);
    this.get('port').on('data:modelTypesAdded', this, this.addModelTypes);
    this.get('port').on('data:modelTypesUpdated', this, this.updateModelTypes);
  },

  model() {
    const port = this.get('port');
    return new Promise(function(resolve) {
      port.one('data:modelTypesAdded', function(message) {
        resolve(message.modelTypes);
      });
      port.send('data:getModelTypes');
    });
  },
github emberjs / ember-inspector / app / routes / whats-new.js View on Github external
if (response.status >= 200 && response.status < 300) {
    return response;
  } else {
    const error = new Error(response.statusText);
    error.response = response;
    throw error;
  }
};

const getLatestEntry = function(doc) {
  const regex = /^#{2} ?\[(v?[.\d]+)\]((?:[\s\S](?!^#{2}))+)/gm;
  const matches = doc.match(regex);
  return matches ? matches[0] : '';
};

export default TabRoute.extend({
  error: false,

  model() {
    return fetch('https://raw.githubusercontent.com/emberjs/ember-inspector/master/CHANGELOG.md')
      .then(checkStatus)
      .then((response) => response.text())
      .then((text) => getLatestEntry(text))
      .catch((error) => { this.set('error', error); });
  },

  setupController(controller, model) {
    this._super(controller, model);
    controller.set('error', this.error);
  }
});