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

Tidy up container tab #1032

Merged
merged 1 commit into from
Sep 19, 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
37 changes: 19 additions & 18 deletions app/controllers/container-type.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { get, computed } from '@ember/object';
import { action, get, computed } from '@ember/object';
import Controller, { inject as controller } from '@ember/controller';
import debounceComputed from 'ember-inspector/computed/debounce';
import searchMatch from 'ember-inspector/utils/search-match';
Expand Down Expand Up @@ -34,22 +34,23 @@ export default Controller.extend({
this.sortProperties = ['name'];
},

actions: {
/**
* Inspect an instance in the object inspector.
* Called whenever an item in the list is clicked.
*
* @method inspectInstance
* @param {Object} obj
*/
inspectInstance(obj) {
if (!get(obj, 'inspectable')) {
return;
}
this.port.send('objectInspector:inspectByContainerLookup', { name: get(obj, 'fullName') });
},
sendContainerToConsole() {
this.port.send('objectInspector:sendContainerToConsole');
/**
* Inspect an instance in the object inspector.
* Called whenever an item in the list is clicked.
*
* @method inspectInstance
* @param {Object} obj
*/
inspectInstance: action(function(obj) {
if (!get(obj, 'inspectable')) {
return;
}
}
this.port.send('objectInspector:inspectByContainerLookup', {
name: get(obj, 'fullName')
});
}),

sendContainerToConsole: action(function() {
this.port.send('objectInspector:sendContainerToConsole');
}),
});
9 changes: 4 additions & 5 deletions app/controllers/container-types/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { action } from '@ember/object';
import Controller from '@ember/controller';

export default Controller.extend({
actions: {
sendContainerToConsole() {
this.port.send('objectInspector:sendContainerToConsole');
}
}
sendContainerToConsole: action(function() {
this.port.send('objectInspector:sendContainerToConsole');
})
});
16 changes: 8 additions & 8 deletions app/templates/components/item-types.hbs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div class="split">
{{#draggable-column
classes="split__panel split__panel--sidebar-2 nav"
setIsDragging=setIsDragging
width=width
setIsDragging=@setIsDragging
width=@width
}}
<div class="split__panel__bd">
<h1 class="nav__title">{{header}}</h1>
<h1 class="nav__title">{{@header}}</h1>

<ul>
{{#each sorted as |itemType|}}
<li class={{typeClass}}>
{{#each @sorted as |itemType|}}
<li class={{this.typeClass}}>
{{#link-to
(if (eq type "model") "records" "container-type")
(if (eq @type "model") "records" "container-type")
(escape-url itemType.name)
class="nav__item"
}}
<span class={{concat typeClass "-name" " nav__item-label"}}>
<span class={{concat this.typeClass "-name" " nav__item-label"}}>
{{itemType.name}}
</span>

<span class={{concat typeClass "-count" " pill"}}>{{itemType.count}}</span>
<span class={{concat this.typeClass "-count" " pill"}}>{{itemType.count}}</span>
{{/link-to}}
</li>
{{/each}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/container-type-toolbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<Ui::ToolbarDivider />

<Ui::SendToConsole @action={{action "sendContainerToConsole"}} />
<Ui::SendToConsole @action={{this.sendContainerToConsole}} />

<Ui::ToolbarDivider />

Expand Down
5 changes: 4 additions & 1 deletion app/templates/container-type.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
}}
{{#r.cell as |value|}}
{{#if value.inspectable}}
<div class="is-link js-instance-name" {{action "inspectInstance" value}}>
<div
class="is-link js-instance-name"
{{on "click" (fn this.inspectInstance value)}}
>
{{value.name}}
</div>
{{else}}
Expand Down
16 changes: 8 additions & 8 deletions app/templates/container-types.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{#item-types
header="Types"
setIsDragging=(action "setIsDragging" target=application)
sorted=(readonly sorted)
type="container"
width=180
}}
<ItemTypes
@header="Types"
@setIsDragging={{action "setIsDragging" target=application}}
@sorted={{readonly sorted}}
@type="container"
@width={{180}}
>
{{outlet}}
{{/item-types}}
</ItemTypes>
2 changes: 1 addition & 1 deletion app/templates/container-types/index-toolbar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

<Ui::ToolbarDivider />

<Ui::SendToConsole @action={{action "sendContainerToConsole"}} />
<Ui::SendToConsole @action={{this.sendContainerToConsole}} />
</div>
16 changes: 8 additions & 8 deletions app/templates/model-types.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{#item-types
header="Model Types"
setIsDragging=(action "setIsDragging" target=application)
sorted=(readonly (if orderByRecordCount sortByDescCount sortByName))
type="model"
width=navWidth
}}
<ItemTypes
@header="Model Types"
@setIsDragging={{action "setIsDragging" target=application}}
@sorted={{readonly (if this.orderByRecordCount this.sortByDescCount this.sortByName)}}
@type="model"
@width={{navWidth}}
>
{{outlet}}
{{/item-types}}
</ItemTypes>