Skip to content

Commit

Permalink
3.12 (#1008)
Browse files Browse the repository at this point in the history
* Update to 3.12

* es5-getter-ember-codemod

* Testing code mods

* ember-modules-codemod

* Fix lint
  • Loading branch information
nummi authored and RobbieTheWagner committed Aug 19, 2019
1 parent 4186955 commit feca4bc
Show file tree
Hide file tree
Showing 71 changed files with 444 additions and 424 deletions.
4 changes: 2 additions & 2 deletions app/adapters/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ export default EmberObject.extend({
when a message from EmberDebug is received
**/
onMessageReceived(callback) {
this.get('_messageCallbacks').pushObject(callback);
this._messageCallbacks.pushObject(callback);
},

_messageCallbacks: computed(function() { return []; }),

_messageReceived(message) {
this.get('_messageCallbacks').forEach(callback => {
this._messageCallbacks.forEach(callback => {
callback(message);
});
},
Expand Down
4 changes: 2 additions & 2 deletions app/adapters/bookmarklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default BasicAdapter.extend({

sendMessage(options) {
options = options || {};
this.get('inspectedWindow').postMessage(options, this.get('inspectedWindowURL'));
this.inspectedWindow.postMessage(options, this.inspectedWindowURL);
},

/**
Expand All @@ -43,7 +43,7 @@ export default BasicAdapter.extend({
_connect() {
window.addEventListener('message', e => {
let message = e.data;
if (e.origin !== this.get('inspectedWindowURL')) {
if (e.origin !== this.inspectedWindowURL) {
return;
}
// close inspector if inspected window is unloading
Expand Down
4 changes: 2 additions & 2 deletions app/adapters/web-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export default BasicAdapter.extend({

sendMessage(options) {
options = options || {};
this.get('_chromePort').postMessage(options);
this._chromePort.postMessage(options);
},

_chromePort: computed(function() {
return chrome.runtime.connect();
}),

_connect() {
let chromePort = this.get('_chromePort');
let chromePort = this._chromePort;
chromePort.postMessage({ appId: chrome.devtools.inspectedWindow.tabId });

chromePort.onMessage.addListener(message => {
Expand Down
6 changes: 3 additions & 3 deletions app/adapters/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ export default BasicAdapter.extend({

sendMessage(options) {
options = options || {};
this.get('socket').emit('emberInspectorMessage', options);
this.socket.emit('emberInspectorMessage', options);
},

_connect() {
this.get('socket').on('emberInspectorMessage', message => {
this.socket.on('emberInspectorMessage', message => {
run(() => {
this._messageReceived(message);
});
});
},

_disconnect() {
this.get('socket').removeAllListeners('emberInspectorMessage');
this.socket.removeAllListeners('emberInspectorMessage');
},

willDestroy() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/app-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default Component.extend({

selectedDidChange: observer('selectedApp', function() {
// Change app being debugged
const applicationId = this.get('selectedApp');
const applicationId = this.selectedApp;
const port = getOwner(this).lookup('port:main');
port.set('applicationId', applicationId);
}),
Expand Down
2 changes: 1 addition & 1 deletion app/components/deprecation-item-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default Component.extend({

url: computed('model.map.{line,source}', 'known', function() {
let source = this.get('model.map.source');
if (this.get('known')) {
if (this.known) {
return `${source}:${this.get('model.map.line')}`;
} else {
return 'Unkown source';
Expand Down
12 changes: 6 additions & 6 deletions app/components/drag-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export default Component.extend({

style: computed('side', 'position', 'left', function() {
let string;
if (this.get('side')) {
string = `${this.get('side')}: ${(this.get('position') + this.get('left'))}px;`;
if (this.side) {
string = `${this.side}: ${(this.position + this.left)}px;`;
} else {
string = '';
}
Expand All @@ -92,14 +92,14 @@ export default Component.extend({
let containerOffsetLeft = getOffsetLeft(container);
let containerOffsetRight = containerOffsetLeft + container.offsetWidth;

let position = this.get('isLeft') ?
let position = this.isLeft ?
e.pageX - containerOffsetLeft :
containerOffsetRight - e.pageX;

position -= this.get('left');
if (position >= this.get('minWidth') && position <= this.get('maxWidth')) {
position -= this.left;
if (position >= this.minWidth && position <= this.maxWidth) {
this.set('position', position);
this.get('on-drag')(position);
this['on-drag'](position);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/components/draggable-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default Component.extend({
* @method triggerResize
*/
triggerResize() {
this.get('layoutService').trigger('resize', { source: 'draggable-column' });
this.layoutService.trigger('resize', { source: 'draggable-column' });
},

actions: {
Expand Down
2 changes: 1 addition & 1 deletion app/components/item-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { computed } from '@ember/object';
export default Component.extend({
tagName: '',
typeClass: computed('type', function() {
return `js-${this.get('type')}-type`;
return `js-${this.type}-type`;
})
});
4 changes: 2 additions & 2 deletions app/components/list-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default Component.extend({
* @type {SafeString}
*/
safeStyle: computed('style', function() {
return htmlSafe(this.get('style'));
return htmlSafe(this.style);
}),

/**
Expand Down Expand Up @@ -121,6 +121,6 @@ export default Component.extend({
* @method click
*/
click() {
this.get('on-click')();
this['on-click']();
}
});
12 changes: 6 additions & 6 deletions app/components/list-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default Component.extend(Evented, {
*/
setupHeight() {
this.set('contentHeight', this.get('layoutService.contentHeight'));
this.get('layoutService').on('content-height-update', this, this.updateContentHeight);
this.layoutService.on('content-height-update', this, this.updateContentHeight);
},

/**
Expand All @@ -76,7 +76,7 @@ export default Component.extend(Evented, {
* @param {Number} height The app's new content height
*/
updateContentHeight(height) {
let previousHeight = this.get('contentHeight');
let previousHeight = this.contentHeight;
this.set('contentHeight', height);
if (previousHeight === 0 && height > 0) {
this.rerender();
Expand All @@ -90,14 +90,14 @@ export default Component.extend(Evented, {
* @method willDestroyElement
*/
willDestroyElement() {
this.get('layoutService').off('content-height-update', this, this.updateContentHeight);
this.layoutService.off('content-height-update', this, this.updateContentHeight);
return this._super(...arguments);
},

attributeBindings: ['style'],

style: computed('height', function() {
return htmlSafe(`height:${this.get('height')}px`);
return htmlSafe(`height:${this.height}px`);
}),

/**
Expand All @@ -114,8 +114,8 @@ export default Component.extend(Evented, {
* @type {Integer}
*/
height: computed('contentHeight', 'headerHeight', function() {
let headerHeight = this.get('headerHeight');
let contentHeight = this.get('contentHeight');
let headerHeight = this.headerHeight;
let contentHeight = this.contentHeight;

// In testing list-view is created before `contentHeight` is set
// which will trigger an exception
Expand Down
16 changes: 8 additions & 8 deletions app/components/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export default Component.extend({
* @param {Object} newAttrs and oldAttrs
*/
didUpdateAttrs() {
let oldSchema = this.get('oldSchema');
let newSchema = this.get('schema');
let oldSchema = this.oldSchema;
let newSchema = this.schema;
if (newSchema && newSchema !== oldSchema) {
scheduleOnce('actions', this, this.setupColumns);
}
Expand Down Expand Up @@ -138,9 +138,9 @@ export default Component.extend({
didInsertElement() {
scheduleOnce('afterRender', this, this.setupColumns);
this.onResize = () => {
this.get('debounceColumnWidths').perform();
this.debounceColumnWidths.perform();
};
this.get('layoutService').on('content-height-update', this.onResize);
this.layoutService.on('content-height-update', this.onResize);
return this._super(...arguments);
},

Expand Down Expand Up @@ -220,7 +220,7 @@ export default Component.extend({
if (listHeader) {
listHeader.removeEventListener('contextmenu', this.showBasicContext);
}
this.get('layoutService').off('content-height-update', this.onResize);
this.layoutService.off('content-height-update', this.onResize);
return this._super(...arguments);
},

Expand All @@ -242,10 +242,10 @@ export default Component.extend({
*/
setupColumns() {
let resizableColumns = new ResizableColumns({
key: this.get('storageKey'),
key: this.storageKey,
tableWidth: this.getTableWidth(),
minWidth: this.get('minWidth'),
storage: this.get('storage'),
minWidth: this.minWidth,
storage: this.storage,
columnSchema: this.get('schema.columns') || []
});
resizableColumns.build();
Expand Down
4 changes: 2 additions & 2 deletions app/components/main-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default Component.extend({

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

window.addEventListener('resize', this._performUpdateHeight);
Expand Down Expand Up @@ -48,7 +48,7 @@ export default Component.extend({
* @method updateHeight
*/
updateHeight() {
this.get('layoutService').updateContentHeight(this.element.clientHeight);
this.layoutService.updateContentHeight(this.element.clientHeight);
},

willDestroyElement() {
Expand Down
18 changes: 9 additions & 9 deletions app/components/mixin-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ export default Component.extend({
}),

sendToConsole: action(function ({ name }) {
let objectId = this.get('objectId');
let objectId = this.objectId;

this.get('port').send('objectInspector:sendToConsole', {
this.port.send('objectInspector:sendToConsole', {
objectId,
property: name
});
}),

calculate: action(function ({ name }) {
let objectId = this.get('objectId');
let mixinIndex = this.get('mixinDetails.model.mixins').indexOf(this.get('model'));
let objectId = this.objectId;
let mixinIndex = this.get('mixinDetails.model.mixins').indexOf(this.model);

this.get('port').send('objectInspector:calculate', {
this.port.send('objectInspector:calculate', {
objectId,
mixinIndex,
property: name
Expand All @@ -63,17 +63,17 @@ export default Component.extend({

actions: {
digDeeper({ name }) {
let objectId = this.get('objectId');
let objectId = this.objectId;

this.get('port').send('objectInspector:digDeeper', {
this.port.send('objectInspector:digDeeper', {
objectId,
property: name
});
},

saveProperty(property, value, dataType) {
this.get('port').send('objectInspector:saveProperty', {
objectId: this.get('objectId'),
this.port.send('objectInspector:saveProperty', {
objectId: this.objectId,
property,
value,
dataType
Expand Down
2 changes: 1 addition & 1 deletion app/components/mixin-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default Component.extend({
},

traceErrors: action(function () {
this.get('port').send('objectInspector:traceErrors', {
this.port.send('objectInspector:traceErrors', {
objectId: this.get('model.objectId')
});
}),
Expand Down
22 changes: 11 additions & 11 deletions app/components/mixin-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default Component.extend({
dateValue: null,

isCalculated: computed('valueType', function () {
return this.get('valueType') !== 'type-descriptor';
return this.valueType !== 'type-descriptor';
}),

valueType: alias('model.value.type'),
Expand Down Expand Up @@ -63,28 +63,28 @@ export default Component.extend({

valueClick: action(function () {
if (this.canDig()) {
this.get('mixin').send('digDeeper', this.get('model'));
this.mixin.send('digDeeper', this.model);
return;
}

if (this.get('isComputedProperty') && !this.get('isCalculated')) {
this.get('mixin').send('calculate', this.get('model'));
if (this.isComputedProperty && !this.isCalculated) {
this.mixin.send('calculate', this.model);
return;
}

if (this.get('isFunction') || this.get('model.overridden') || this.get('model.readOnly')) {
if (this.isFunction || this.get('model.overridden') || this.get('model.readOnly')) {
return;
}

let value = this.get('model.value.inspect');
let type = this.get('valueType');
let type = this.valueType;
if (type === 'type-string') {
// If the value is not already wrapped in quotes, wrap it
if (!value.startsWith('"') && !value.endsWith('"')) {
value = `"${value}"`;
}
}
if (!this.get('isDate')) {
if (!this.isDate) {
this.set('txtValue', value);
} else {
this.set('dateValue', new Date(value));
Expand All @@ -95,13 +95,13 @@ export default Component.extend({
actions: {
saveProperty() {
let realValue, dataType;
if (!this.get('isDate')) {
realValue = parseText(this.get('txtValue'));
if (!this.isDate) {
realValue = parseText(this.txtValue);
} else {
realValue = this.get('dateValue').getTime();
realValue = this.dateValue.getTime();
dataType = 'date';
}
this.get('mixin').send('saveProperty', this.get('model.name'), realValue, dataType);
this.mixin.send('saveProperty', this.get('model.name'), realValue, dataType);
},

finishedEditing() {
Expand Down
Loading

0 comments on commit feca4bc

Please sign in to comment.