Skip to content

Commit 3042da4

Browse files
chancancodepatricklx
authored andcommitted
Remove unused code (emberjs#1061)
* Remove unused options The inspector used to support filtering out components in the view tab, and there are a lot of supporting code for that. Since the view tab was removed, there is no longer any way to set this option, and it is always true in practice. * Remove unused `completeViewClass` property This property contains the "full" class name string, something like `<app@component:textarea::ember545>` as opposed to `textarea`. It is only set but never read by anything. * Remove unused `shouldShowView` method This method is defined but never used. It is also the only thing that reads the `isVirtual` property, which is an Ember 1.0-ism that is no longer needed. * Remove a lot (!) of unused code! Most of the job of view-debug has already been moved to glimmer-tree, leaving behind a lot of code that was never called.
1 parent 0f873ae commit 3042da4

6 files changed

Lines changed: 4 additions & 407 deletions

File tree

app/controllers/component-tree.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export default Controller.extend({
9898
*/
9999
pinnedObjectId: null,
100100
inspectingViews: false,
101-
components: true,
102101
viewTreeLoaded: false,
103102

104103
/**
@@ -159,9 +158,6 @@ export default Controller.extend({
159158
init() {
160159
this._super(...arguments);
161160
this.set('expandedStateCache', {});
162-
this.options = {
163-
components: true
164-
};
165161
},
166162

167163
/**

app/routes/component-tree.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export default TabRoute.extend({
1919
this.port.on('view:inspectDOMNode', this, this.inspectDOMNode);
2020

2121
this.set('controller.viewTreeLoaded', false);
22-
this.port.send('view:setOptions', { options: this.get('controller.options') });
2322
this.port.send('view:getTree');
2423
},
2524

ember_debug/libs/glimmer-tree.js

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export default class {
4343
* @param {Object} options
4444
* - {owner} owner The Ember app's owner.
4545
* - {Function} retainObject Called to retain an object for future inspection.
46-
* - {Object} options Options whether to show components or not.
4746
* - {Object} durations Hash containing time to render per view id.
4847
* - {Function} highlightRange Called to highlight a range of elements.
4948
* - {Object} ObjectInspector Used to inspect models.
@@ -52,29 +51,19 @@ export default class {
5251
constructor({
5352
owner,
5453
retainObject,
55-
options,
5654
durations,
5755
highlightRange,
5856
objectInspector,
5957
viewRegistry
6058
}) {
6159
this.owner = owner;
6260
this.retainObject = retainObject;
63-
this.options = options;
6461
this.durations = durations;
6562
this.highlightRange = highlightRange;
6663
this.objectInspector = objectInspector;
6764
this.viewRegistry = viewRegistry;
6865
}
6966

70-
/**
71-
* @method updateOptions
72-
* @param {Object} options
73-
*/
74-
updateOptions(options) {
75-
this.options = options;
76-
}
77-
7867
/**
7968
* @method updateDurations
8069
* @param {Object} durations
@@ -84,8 +73,7 @@ export default class {
8473
}
8574

8675
/**
87-
* Builds the view tree. The view tree may or may not contain
88-
* components depending on the current options.
76+
* Builds the view tree.
8977
*
9078
* The view tree has the top level outlet as the root of the tree.
9179
* The format is:
@@ -114,7 +102,7 @@ export default class {
114102
build() {
115103
if (this.getRoot()) {
116104
let outletTree = this.buildOutletTree();
117-
let componentTrees = this.options.components ? this.buildComponentTrees(outletTree) : [];
105+
let componentTrees = this.buildComponentTrees(outletTree);
118106
return this.addComponentsToOutlets(outletTree, componentTrees);
119107
}
120108
}
@@ -421,7 +409,6 @@ export default class {
421409
*/
422410
inspectComponent(component) {
423411
let viewClass = getShortViewName(component);
424-
let completeViewClass = viewClass;
425412
let tagName = get(component, 'tagName');
426413
let objectId = this.retainObject(component);
427414
let duration = this.durations[objectId];
@@ -435,7 +422,6 @@ export default class {
435422
objectId,
436423
viewClass,
437424
duration,
438-
completeViewClass,
439425
isComponent: true,
440426
tagName: isNone(tagName) ? 'div' : tagName
441427
};
@@ -732,19 +718,4 @@ export default class {
732718
componentById(id) {
733719
return this.viewRegistry[id];
734720
}
735-
736-
/**
737-
* @method modelForViewNodeValue
738-
* @param {Boolean} isComponent
739-
* @param {Object} inspectedNodeValue
740-
* @return {Any} The inspected node's model (if it has one)
741-
*/
742-
modelForViewNodeValue({ isComponent, objectId, name }) {
743-
if (isComponent) {
744-
return this.modelForComponent(this.componentById(objectId));
745-
} else {
746-
let { controller } = A(this.outletArray()).findBy('value.name', name);
747-
return get(controller, 'model');
748-
}
749-
}
750721
}

0 commit comments

Comments
 (0)