Skip to content

Commit c3e919e

Browse files
RobbieTheWagnercyril-sf
authored andcommitted
Fix beta and canary (emberjs#787)
* Fix setIsDragging test errors * Fix lint * Pass setIsDragging where missed, use layoutService instead of layout
1 parent 328ebc2 commit c3e919e

20 files changed

Lines changed: 140 additions & 79 deletions

app/components/drag-handle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ export default Component.extend({
5252
startDragging() {
5353
let namespace = `drag-${this.elementId}`;
5454

55-
this.sendAction('action', true);
55+
this.setIsDragging(true);
5656

5757
document.body.addEventListener(`mousemove.${namespace}`, this._mouseMoveHandler);
5858
document.body.addEventListener(`mouseup.${namespace} mouseleave.${namespace}`, this.stopDragging);
5959
},
6060

6161
stopDragging() {
62-
this.sendAction('action', false);
62+
this.setIsDragging(false);
6363
document.body.removeEventListener(`.drag-${this.elementId}`, this._mouseMoveHandler);
6464
document.body.removeEventListener(`.drag-${this.elementId}`, this.stopDragging);
6565
},

app/components/draggable-column.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ export default Component.extend({
99
tagName: '', // Prevent wrapping in a div
1010
side: 'left',
1111
minWidth: 60,
12-
setIsDragging: 'setIsDragging',
1312

1413
/**
1514
* Injected `layout` service. Used to broadcast
1615
* changes the layout of the app.
1716
*
18-
* @property layout
17+
* @property layoutService
1918
* @type {Service}
2019
*/
21-
layout: service(),
20+
layoutService: service('layout'),
2221

2322
/**
2423
* Trigger that the application dimensions have changed due to
@@ -28,14 +27,10 @@ export default Component.extend({
2827
* @method triggerResize
2928
*/
3029
triggerResize() {
31-
this.get('layout').trigger('resize', { source: 'draggable-column' });
30+
this.get('layoutService').trigger('resize', { source: 'draggable-column' });
3231
},
3332

3433
actions: {
35-
setIsDragging(isDragging) {
36-
this.sendAction('setIsDragging', isDragging);
37-
},
38-
3934
/**
4035
* Action called whenever the draggable column has been
4136
* resized.

app/components/x-list.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ export default Component.extend({
2626

2727
/**
2828
* Layout service used to listen to changes to the application
29-
* layout such as resizing of the main nav or object inspecto.
29+
* layout such as resizing of the main nav or object inspector.
3030
*
31-
* @property layout
31+
* @property layoutService
3232
* @type {Service}
3333
*/
34-
layout: service(),
34+
layoutService: service('layout'),
3535

3636
/**
3737
* Indicate the table's header's height in pixels.
@@ -140,7 +140,7 @@ export default Component.extend({
140140
this.get('debounceColumnWidths').perform();
141141
};
142142
window.addEventListener(`resize.${this.get('elementId')}`, this.onResize);
143-
this.get('layout').on('resize', this.onResize);
143+
this.get('layoutService').on('resize', this.onResize);
144144
return this._super(...arguments);
145145
},
146146

@@ -221,7 +221,7 @@ export default Component.extend({
221221
if (listHeader) {
222222
listHeader.removeEventListener('contextmenu', this.showBasicContext);
223223
}
224-
this.get('layout').off('resize', this.onResize);
224+
this.get('layoutService').off('resize', this.onResize);
225225
return this._super(...arguments);
226226
},
227227

app/routes/application.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Route from '@ember/routing/route';
33
import { inject as service } from '@ember/service';
44
import { schedule } from '@ember/runloop';
55
import Ember from "ember";
6+
67
const {
78
NativeArray
89
} = Ember;
@@ -77,24 +78,24 @@ export default Route.extend({
7778
* Service used to broadcast changes to the application's layout
7879
* such as toggling of the object inspector.
7980
*
80-
* @property layout
81+
* @property layoutService
8182
* @type {Service}
8283
*/
83-
layout: service(),
84+
layoutService: service('layout'),
8485

8586
actions: {
8687
expandInspector() {
8788
this.set("controller.inspectorExpanded", true);
8889
// Broadcast that tables have been resized (used by `x-list`).
8990
schedule('afterRender', () => {
90-
this.get('layout').trigger('resize', { source: 'object-inspector' });
91+
this.get('layoutService').trigger('resize', { source: 'object-inspector' });
9192
});
9293
},
9394
toggleInspector() {
9495
this.toggleProperty("controller.inspectorExpanded");
9596
// Broadcast that tables have been resized (used by `x-list`).
9697
schedule('afterRender', () => {
97-
this.get('layout').trigger('resize', { source: 'object-inspector' });
98+
this.get('layoutService').trigger('resize', { source: 'object-inspector' });
9899
});
99100
},
100101
inspectObject(objectId) {

app/templates/-main.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<div class="split split--main">
22
{{#draggable-column
3-
width=navWidth
4-
classes="split__panel split__panel--sidebar-1"}}
3+
width=navWidth
4+
classes="split__panel split__panel--sidebar-1"
5+
setIsDragging=(route-action 'setIsDragging')}}
56
<div class="split__panel__hd">
67
{{iframe-picker}}
78
</div>
@@ -20,7 +21,7 @@
2021
{{outlet "toolbar"}}
2122
{{#unless inspectorExpanded}}
2223
{{sidebar-toggle action="toggleInspector" side="right"
23-
isExpanded=false classNames="toolbar__icon-button"}}
24+
isExpanded=false classNames="toolbar__icon-button"}}
2425
{{/unless}}
2526
</div>
2627

app/templates/application.hbs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,29 @@
77

88
{{#if inspectorExpanded}}
99
{{#draggable-column
10-
side="right"
11-
width=inspectorWidth
12-
classes="split__panel"}}
13-
{{object-inspector application=this model=mixinStack mixinDetails=mixinDetails toggleInspector="toggleInspector"}}
10+
side="right"
11+
width=inspectorWidth
12+
classes="split__panel"
13+
setIsDragging=(route-action 'setIsDragging')}}
14+
{{object-inspector application=this model=mixinStack mixinDetails=mixinDetails
15+
toggleInspector="toggleInspector"}}
1416
{{/draggable-column}}
1517
{{/if}}
1618
</div>
1719

1820
{{else}}
1921
{{#not-detected description="Ember application"}}
20-
<li>This is not an Ember application.</li>
21-
<li>You are using an old version of Ember (&lt; rc5).</li>
22-
{{#if isChrome}}
23-
<li>You are using the file:// protocol (instead of http://), in which case:
24-
<ul>
25-
<li>Visit the URL: chrome://extensions.</li>
26-
<li>Find the Ember Inspector.</li>
27-
<li>Make sure "Allow access to file URLs" is checked.</li>
28-
</ul>
29-
</li>
30-
{{/if}}
22+
<li>This is not an Ember application.</li>
23+
<li>You are using an old version of Ember (&lt; rc5).</li>
24+
{{#if isChrome}}
25+
<li>You are using the file:// protocol (instead of http://), in which case:
26+
<ul>
27+
<li>Visit the URL: chrome://extensions.</li>
28+
<li>Find the Ember Inspector.</li>
29+
<li>Make sure "Allow access to file URLs" is checked.</li>
30+
</ul>
31+
</li>
32+
{{/if}}
3133
{{/not-detected}}
3234
{{/if}}
3335
{{/x-app}}

app/templates/components/draggable-column.hbs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
{{yield}}
33
{{/resizable-column}}
44

5-
{{drag-handle side=side position=width minWidth=minWidth action="setIsDragging" on-drag=(action "didDrag")}}
5+
{{drag-handle
6+
minWidth=minWidth
7+
on-drag=(action "didDrag")
8+
position=width
9+
setIsDragging=setIsDragging
10+
side=side}}

app/templates/components/x-list.hbs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
{{/each}}
99
</colgroup>
1010
<tbody>
11-
<tr class="list__row">
12-
{{#each columns key="id" as |column|}}
13-
{{#x-list-cell
14-
tagName="th"
15-
class="js-header-column"}}
16-
{{column.name}}
17-
{{/x-list-cell}}
18-
{{/each}}
19-
</tr>
11+
<tr class="list__row">
12+
{{#each columns key="id" as |column|}}
13+
{{#x-list-cell
14+
tagName="th"
15+
class="js-header-column"}}
16+
{{column.name}}
17+
{{/x-list-cell}}
18+
{{/each}}
19+
</tr>
2020
</tbody>
2121
</table>
2222
</div>
@@ -39,12 +39,13 @@
3939
{{#each columns key="id" as |column|}}
4040
{{#unless (eq column columns.lastObject)}}
4141
{{drag-handle
42-
side="left"
42+
faded=true
4343
left=column.left
44-
position=(one-way column.width)
4544
minWidth=minWidth
4645
maxWidth=column.maxWidth
4746
on-drag=(action "didResize" column.id)
48-
faded=true}}
47+
position=(one-way column.width)
48+
setIsDragging=setIsDragging
49+
side="left"}}
4950
{{/unless}}
5051
{{/each}}

app/templates/container-type.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
{{#x-list name="container-instance-list" schema=(hash columns=null) headerHeight=0 as |list|}}
1+
{{#x-list
2+
headerHeight=0
3+
name="container-instance-list"
4+
schema=(hash columns=null)
5+
setIsDragging=(route-action 'setIsDragging') as |list|}}
26
{{#list.vertical-collection filtered estimateHeight=30 itemClass="js-instance-row" as |content index|}}
37
<tr class="list__row js-container-instance-list-item" {{action "inspectInstance" content}}>
48
{{#list.cell class="list__cell_main" clickable=content.inspectable}}

app/templates/container-types.hbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<div class="split">
22

33
{{#draggable-column
4-
width=180
5-
classes="split__panel split__panel--sidebar-2 nav"}}
4+
width=180
5+
classes="split__panel split__panel--sidebar-2 nav"
6+
setIsDragging=(route-action 'setIsDragging')}}
67

78
<div class="split__panel__bd">
89
<div class="nav__title">

0 commit comments

Comments
 (0)