Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc Component Cleanup #1044

Merged
merged 10 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Component from '@ember/component';
import { schedule } from '@ember/runloop';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { task, timeout } from 'ember-concurrency';

// Currently used to determine the height of list-views
export default Component.extend({
tagName: '',

/**
* Layout service. We inject it to keep its `contentHeight` property
* up-to-date.
Expand All @@ -14,15 +16,29 @@ export default Component.extend({
*/
layoutService: service('layout'),

didInsertElement() {
/**
* Reference to drag-handle on mousedown
*
* @property el
* @type {DOMNode|null}
* @default null
*/
el: null,

setupListeners: action(function(element) {
this.el = element;

this._performUpdateHeight = () => {
this.updateHeightDebounce.perform();
};

window.addEventListener('resize', this._performUpdateHeight);
schedule('afterRender', this, this.updateHeight);
return this._super(...arguments);
},
this.updateHeight();
}),

destroyListeners: action(function() {
window.removeEventListener('resize', this._performUpdateHeight);
}),

/**
* Restartable Ember Concurrency task that triggers
Expand All @@ -48,11 +64,6 @@ export default Component.extend({
* @method updateHeight
*/
updateHeight() {
this.layoutService.updateContentHeight(this.element.clientHeight);
this.layoutService.updateContentHeight(this.el.clientHeight);
},

willDestroyElement() {
window.removeEventListener('resize', this._performUpdateHeight);
return this._super(...arguments);
}
});
38 changes: 0 additions & 38 deletions app/components/x-app.js

This file was deleted.

10 changes: 4 additions & 6 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export default Controller.extend({
});
}),

setActive: action(function(bool) {
this.set('active', bool);
}),

/*
* Called when inspecting an object from outside of the ObjectInspector
*/
Expand Down Expand Up @@ -106,10 +110,4 @@ export default Controller.extend({
}

},

actions: {
setIsDragging(isDragging) {
this.set('isDragging', isDragging);
},
}
});
4 changes: 1 addition & 3 deletions app/controllers/container-types.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { sort } from '@ember/object/computed';

export default Controller.extend({
application: controller(),

sorted: sort('model', 'sortProperties'),

init() {
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/info.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';

export default Controller.extend({
application: controller()
navWidth: 180,
});
3 changes: 1 addition & 2 deletions app/controllers/model-types.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { get, computed } from '@ember/object';
import LocalStorageService from 'ember-inspector/services/storage/local';
import { sort } from '@ember/object/computed';
Expand All @@ -9,7 +9,6 @@ import {
} from 'ember-inspector/utils/local-storage-keys';

export default Controller.extend({
application: controller(),
navWidth: 180,
storage: service(`storage/${LocalStorageService.STORAGE_TYPE_TO_USE}`),

Expand Down
4 changes: 1 addition & 3 deletions app/controllers/promise-tree.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { action, observer } from '@ember/object';
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { isEmpty } from '@ember/utils';
import { equal, bool, and, not, filter } from '@ember/object/computed';
import { debounce, next, once } from '@ember/runloop';

export default Controller.extend({
application: controller(),

queryParams: ['filter'],

createdAfter: null,
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/render-tree.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { action, computed, get } from '@ember/object';
import { isEmpty } from '@ember/utils';
import Controller, { inject as controller } from '@ember/controller';
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import escapeRegExp from "ember-inspector/utils/escape-reg-exp";
import debounceComputed from "ember-inspector/computed/debounce";
import LocalStorageService from "ember-inspector/services/storage/local";
import { and, equal } from '@ember/object/computed';

export default Controller.extend({
application: controller(),
initialEmpty: false,
modelEmpty: equal('model.length', 0),
showEmpty: and('initialEmpty', 'modelEmpty'),
Expand Down
4 changes: 2 additions & 2 deletions app/services/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import Evented from '@ember/object/evented';
export default Service.extend(Evented, {
/**
* Stores the app's content height. This property is kept up-to-date
* by the `main-content` component.
* by the `monitor-content-height` component.
*
* @property contentHeight
* @type {Number}
*/
contentHeight: null,

/**
* This is called by `main-content` whenever a window resize is detected
* This is called by `monitor-content-height` whenever a window resize is detected
* and the app's content height has changed. We therefore update the
* `contentHeight` property and notify all listeners (mostly lists).
*
Expand Down
4 changes: 0 additions & 4 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
z-index: 0;
}

.app.is-dragging {
cursor: col-resize;
}

@import "base";
@import "colors";
@import "utils";
Expand Down
150 changes: 73 additions & 77 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,84 +1,80 @@
<div class="ember-view">
{{#x-app
active=this.active
isDragging=this.isDragging
}}
{{#if isEmberApplication}}
<div class="split">
<div class="split__panel">
{{!-- Begin main --}}
<div class="split split--main">
{{#draggable-column
width=this.navWidth
classes="split__panel split__panel--sidebar-1"
setIsDragging=(action "setIsDragging")
}}
<div class="split__panel__hd">
{{app-picker}}
</div>
<div class="split__panel__bd">
<SideNav @deprecationCount={{this.deprecationCount}} />
</div>
<div class="split__panel__ft">
<a target="_blank" href="https://github.com/emberjs/ember-inspector/issues">
Submit an Issue
</a>
</div>
{{/draggable-column}}

<div class="split__panel">
<div class="split__panel__hd">
{{outlet "toolbar"}}
<button
class="sidebar-toggle toolbar__icon-button {{if this.inspectorExpanded "flip"}}"
{{on "click" this.toggleInspector}}
>
{{svg-jar "sidebar-toggle" width="16" height="16"}}
</button>
</div>
<div
class="ember-view app {{if this.active "" "inactive"}}"
tabindex="1"
{{on "focusin" (fn this.setActive true)}}
{{on "focusout" (fn this.setActive false)}}
>
{{#if this.isEmberApplication}}
<div class="split">
<div class="split__panel">
<div class="split split--main">
<Ui::DraggableColumn
@classes="split__panel split__panel--sidebar-1"
@side="left"
@width={{this.navWidth}}
>
<div class="split__panel__hd">
{{app-picker}}
</div>
<div class="split__panel__bd">
<SideNav @deprecationCount={{this.deprecationCount}} />
</div>
<div class="split__panel__ft">
<a target="_blank" href="https://github.com/emberjs/ember-inspector/issues">
Submit an Issue
</a>
</div>
</Ui::DraggableColumn>

{{#main-content class="split__panel__bd"}}
{{outlet}}
{{/main-content}}
<div class="split__panel">
<div class="split__panel__hd">
{{outlet "toolbar"}}
<button
class="sidebar-toggle toolbar__icon-button {{if this.inspectorExpanded "flip"}}"
{{on "click" this.toggleInspector}}
>
{{svg-jar "sidebar-toggle" width="16" height="16"}}
</button>
</div>
</div>

{{!-- End main --}}
<MonitorContentHeight class="split__panel__bd">
{{outlet}}
</MonitorContentHeight>
</div>
</div>

{{#if this.inspectorExpanded}}
{{#draggable-column
side="right"
width=this.inspectorWidth
classes="split__panel"
setIsDragging=(action "setIsDragging")
}}
<ObjectInspector
@popMixinDetails={{this.popMixinDetails}}
@model={{this.mixinStack}}
@mixinDetails={{this.mixinDetails}}
/>
{{/draggable-column}}
{{/if}}
</div>
{{else}}
<Ui::ErrorPage @description="Ember application not detected!">
<ul>
<li>This is not an Ember application.</li>
<li>You are using an old version of Ember (&lt; rc5).</li>
{{#if this.isChrome}}
<li>
You are using the file:// protocol (instead of http://), in which case:

<ul>
<li>Visit the URL: chrome://extensions.</li>
<li>Find the Ember Inspector.</li>
<li>Make sure "Allow access to file URLs" is checked.</li>
</ul>
</li>
{{/if}}
</ul>
</Ui::ErrorPage>
{{/if}}
{{/x-app}}
{{#if this.inspectorExpanded}}
<Ui::DraggableColumn
@classes="split__panel"
@side="right"
@width={{this.inspectorWidth}}
>
<ObjectInspector
@popMixinDetails={{this.popMixinDetails}}
@model={{this.mixinStack}}
@mixinDetails={{this.mixinDetails}}
/>
</Ui::DraggableColumn>
{{/if}}
</div>
{{else}}
<Ui::ErrorPage @description="Ember application not detected!">
<ul>
<li>This is not an Ember application.</li>
<li>You are using an old version of Ember (&lt; rc5).</li>
{{#if this.isChrome}}
<li>
You are using the file:// protocol (instead of http://), in which case:

<ul>
<li>Visit the URL: chrome://extensions.</li>
<li>Find the Ember Inspector.</li>
<li>Make sure "Allow access to file URLs" is checked.</li>
</ul>
</li>
{{/if}}
</ul>
</Ui::ErrorPage>
{{/if}}
</div>
1 change: 0 additions & 1 deletion app/templates/components/drag-handle.hbs

This file was deleted.

14 changes: 0 additions & 14 deletions app/templates/components/draggable-column.hbs

This file was deleted.

Loading