From 16da227dd96bd79d6c246d9d488e4f93d8c191d5 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 10:26:09 +0100
Subject: [PATCH 01/24] [deprecations] Use LinkComponent instead of LinkView
---
app/app.js | 2 +-
config/deprecation-workflow.js | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/app.js b/app/app.js
index e4aed0e2..f56a9fcf 100644
--- a/app/app.js
+++ b/app/app.js
@@ -5,7 +5,7 @@ import config from './config/environment';
Ember.MODEL_FACTORY_INJECTIONS = true;
-Ember.LinkView.reopen({
+Ember.LinkComponent.reopen({
attributeBindings: ['alt']
});
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 3757f4a7..cc0c3e59 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -1,7 +1,10 @@
window.deprecationWorkflow = window.deprecationWorkflow || {};
window.deprecationWorkflow.config = {
workflow: [
- { handler: "silence", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." },
+ // DONE
+ { handler: "log", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." },
+
+ // TODO
{ handler: "silence", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." },
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
{ handler: "silence", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" },
From 03332a86545770798052b25d96aefceb01f4d750 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 10:26:57 +0100
Subject: [PATCH 02/24] [deprecations] Don't run Ember.set directly in
didInsertElement
---
app/components/job-log.js | 4 ++--
app/components/log-content.js | 6 +++---
config/deprecation-workflow.js | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/components/job-log.js b/app/components/job-log.js
index 37f31999..4ce88a27 100644
--- a/app/components/job-log.js
+++ b/app/components/job-log.js
@@ -4,7 +4,7 @@ export default Ember.Component.extend({
logBinding: 'job.log',
didInsertElement() {
- return this.setupLog();
+ Ember.run.scheduleOnce('afterRender', this, 'setupLog');
},
logDidChange: function() {
@@ -16,7 +16,7 @@ export default Ember.Component.extend({
}.observesBefore('log'),
willDestroyElement() {
- return this.teardownLog();
+ Ember.run.scheduleOnce('afterRender', this, 'teardownLog');
},
teardownLog() {
diff --git a/app/components/log-content.js b/app/components/log-content.js
index 0fd30781..0c0f58f5 100644
--- a/app/components/log-content.js
+++ b/app/components/log-content.js
@@ -68,14 +68,14 @@ export default Ember.Component.extend({
console.log('log view: did insert');
}
this._super.apply(this, arguments);
- return this.createEngine();
+ Ember.run.scheduleOnce('afterRender', this, 'createEngine');
},
willDestroyElement() {
if (Log.DEBUG) {
console.log('log view: will destroy');
}
- return this.teardownLog();
+ Ember.run.scheduleOnce('afterRender', this, 'teardownLog');
},
teardownLog(log) {
@@ -121,7 +121,7 @@ export default Ember.Component.extend({
this.engine.limit = this.limit;
this.logFolder = new LogFolder(this.$('#log'));
this.lineSelector = new LinesSelector(this.$('#log'), this.scroll, this.logFolder);
- return this.observeParts(log);
+ this.observeParts(log);
}
},
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index cc0c3e59..ecba7192 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -3,6 +3,7 @@ window.deprecationWorkflow.config = {
workflow: [
// DONE
{ handler: "log", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." },
+ { handler: "log", matchMessage: new RegExp("A property of .*? was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.") },
// TODO
{ handler: "silence", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." },
@@ -18,7 +19,6 @@ window.deprecationWorkflow.config = {
{ handler: "silence", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." },
{ handler: "silence", matchMessage: "Using the same function as getter and setter is deprecated." },
{ handler: "silence", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
- { handler: "silence", matchMessage: "A property of was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
{ handler: "silence", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." }
]
From f5823669b2347c128d6c63d97c005e8fec73eac7 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 10:28:08 +0100
Subject: [PATCH 03/24] [deprecations] Use regular computed property instead of
arrayComputed
---
app/controllers/repos.js | 1 -
app/utils/computed-limit.js | 30 ++++++------------------------
config/deprecation-workflow.js | 2 +-
3 files changed, 7 insertions(+), 26 deletions(-)
diff --git a/app/controllers/repos.js b/app/controllers/repos.js
index 33d7cd2c..2af67045 100644
--- a/app/controllers/repos.js
+++ b/app/controllers/repos.js
@@ -1,5 +1,4 @@
import Ember from 'ember';
-import limit from 'travis/utils/computed-limit';
import Repo from 'travis/models/repo';
import Config from 'travis/config/environment';
diff --git a/app/utils/computed-limit.js b/app/utils/computed-limit.js
index e594acef..72f9a601 100644
--- a/app/utils/computed-limit.js
+++ b/app/utils/computed-limit.js
@@ -1,30 +1,12 @@
import Ember from 'ember';
var limit = function(dependentKey, limitKey) {
- var options = {
- addedItem: function(array, item, changeMeta) {
- var limit = Ember.get(this, limitKey);
- if (changeMeta.index < limit) {
- array.insertAt(changeMeta.index, item);
- if (Ember.get(array, "length") > limit) {
- array.popObject();
- }
- }
- return array;
- },
- removedItem: function(array, item, changeMeta) {
- var limit = Ember.get(this, limitKey);
- if (changeMeta.index < limit && changeMeta.index < Ember.get(array, 'length')) {
- array.removeAt(changeMeta.index, 1);
- var toPush = changeMeta.arrayChanged.objectAt(limit);
- if (toPush) {
- array.pushObject(toPush);
- }
- }
- return array;
- }
- };
- return Ember.arrayComputed(dependentKey, limitKey, options);
+ return Ember.computed(dependentKey, dependentKey + ".[]", function() {
+ var limit = Ember.get(this, limitKey),
+ array = this.get(dependentKey);
+
+ return array.toArray().slice(0, limit);
+ });
};
export default limit;
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index ecba7192..4d6b3387 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -4,11 +4,11 @@ window.deprecationWorkflow.config = {
// DONE
{ handler: "log", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." },
{ handler: "log", matchMessage: new RegExp("A property of .*? was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.") },
+ { handler: "log", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" },
// TODO
{ handler: "silence", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." },
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
- { handler: "silence", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" },
{ handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" },
{ handler: "silence", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
{ handler: "silence", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
From 131a09c9c5b3953c1e811a6b9c4c0ef854615a95 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 10:29:08 +0100
Subject: [PATCH 04/24] [deprecations] Use store.query instead of store.find
where appropriate
---
app/models/repo.js | 6 +++---
config/deprecation-workflow.js | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/models/repo.js b/app/models/repo.js
index 89ead250..3a9ba036 100644
--- a/app/models/repo.js
+++ b/app/models/repo.js
@@ -220,7 +220,7 @@ Repo.reopenClass({
return promise;
} else {
login = reposIdsOrlogin;
- return store.find('repo', {
+ return store.query('repo', {
member: login,
orderBy: 'name'
});
@@ -253,7 +253,7 @@ Repo.reopenClass({
});
});
} else {
- return store.find('repo', {
+ return store.query('repo', {
search: query,
orderBy: 'name'
});
@@ -299,7 +299,7 @@ Repo.reopenClass({
return repo;
});
} else {
- promise = store.find('repo', {
+ promise = store.query('repo', {
slug: slug
}).then(function(repos) {
return repos.get('firstObject') || (function() {
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 4d6b3387..829f563b 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -3,11 +3,11 @@ window.deprecationWorkflow.config = {
workflow: [
// DONE
{ handler: "log", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." },
+ { handler: "log", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." },
{ handler: "log", matchMessage: new RegExp("A property of .*? was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.") },
{ handler: "log", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" },
// TODO
- { handler: "silence", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." },
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
{ handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" },
{ handler: "silence", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
From a6087d4fcdf61688765e5303c2165234d56533db Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 10:53:02 +0100
Subject: [PATCH 05/24] [deprecations] Use Component#_state instead of
Component#state
---
app/components/log-content.js | 2 +-
config/deprecation-workflow.js | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/components/log-content.js b/app/components/log-content.js
index 0c0f58f5..b21cfe6c 100644
--- a/app/components/log-content.js
+++ b/app/components/log-content.js
@@ -158,7 +158,7 @@ export default Ember.Component.extend({
if (Log.DEBUG) {
console.log('log view: parts did change');
}
- if (this.get('state') !== 'inDOM') {
+ if (this.get('_state') !== 'inDOM') {
return;
}
ref = parts.slice(start, start + added);
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 829f563b..6758ed1b 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -6,11 +6,14 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." },
{ handler: "log", matchMessage: new RegExp("A property of .*? was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.") },
{ handler: "log", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" },
+ // this will still emit deprecations, because we use state property in
+ // request-icon compoenent, that makes Ember.js think that we're using
+ // internal component's state
+ { handler: "log", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
{ handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" },
- { handler: "silence", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
{ handler: "silence", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "`Ember.ArrayController` is deprecated." },
From 4e3a7559089dbc668f1773a64d3d25a8699b1989 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 10:54:09 +0100
Subject: [PATCH 06/24] [deprecations] Use Adapter#findRecord instead of
Adapter#find
---
app/adapters/ssh-key.js | 2 +-
config/deprecation-workflow.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/adapters/ssh-key.js b/app/adapters/ssh-key.js
index 25e9113a..2d27f0ba 100644
--- a/app/adapters/ssh-key.js
+++ b/app/adapters/ssh-key.js
@@ -4,7 +4,7 @@ import ApplicationAdapter from 'travis/adapters/application';
export default ApplicationAdapter.extend({
namespace: 'settings',
- find(store, type, id, record) {
+ findRecord(store, type, id, record) {
return this.ajax(this.urlPrefix() + '/ssh_key/' + id, 'GET');
},
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 6758ed1b..0b20489e 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -10,6 +10,7 @@ window.deprecationWorkflow.config = {
// request-icon compoenent, that makes Ember.js think that we're using
// internal component's state
{ handler: "log", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
+ { handler: "log", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
@@ -19,7 +20,6 @@ window.deprecationWorkflow.config = {
{ handler: "silence", matchMessage: "`Ember.ArrayController` is deprecated." },
{ handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
- { handler: "silence", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." },
{ handler: "silence", matchMessage: "Using the same function as getter and setter is deprecated." },
{ handler: "silence", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
From a920ae9cd72c60a1e9cafe94d551df93afc0d79b Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 11:06:23 +0100
Subject: [PATCH 07/24] [deprecations] Use modelName instead of typeKey
---
app/adapters/env-var.js | 4 ++--
app/adapters/ssh-key.js | 2 +-
app/utils/test-auth.js | 2 +-
config/deprecation-workflow.js | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/adapters/env-var.js b/app/adapters/env-var.js
index 4aaca486..c11aa424 100644
--- a/app/adapters/env-var.js
+++ b/app/adapters/env-var.js
@@ -17,10 +17,10 @@ export default ApplicationAdapter.extend({
updateRecord(store, type, record) {
var data, id, serializer;
data = {};
- serializer = store.serializerFor(type.typeKey);
+ serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record);
id = Ember.get(record, 'id');
- return this.ajax(this.buildURL(type.typeKey, id, record), "PATCH", {
+ return this.ajax(this.buildURL(type.modelName, id, record), "PATCH", {
data: data
});
}
diff --git a/app/adapters/ssh-key.js b/app/adapters/ssh-key.js
index 2d27f0ba..165c5a2b 100644
--- a/app/adapters/ssh-key.js
+++ b/app/adapters/ssh-key.js
@@ -17,7 +17,7 @@ export default ApplicationAdapter.extend({
createRecord(store, type, record) {
var data, id, serializer;
data = {};
- serializer = store.serializerFor(type.typeKey);
+ serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record, {
includeId: true
});
diff --git a/app/utils/test-auth.js b/app/utils/test-auth.js
index 5d616a31..860bfa06 100644
--- a/app/utils/test-auth.js
+++ b/app/utils/test-auth.js
@@ -13,7 +13,7 @@ export default Ember.Object.extend({
signInForTests(user) {
this.set('state', 'signed-in');
- if ((user.constructor.typeKey != null) !== 'user') {
+ if ((user.constructor.modelName != null) !== 'user') {
this.store.push({
data: {
type: 'user',
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 0b20489e..82f2a2d2 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -11,6 +11,7 @@ window.deprecationWorkflow.config = {
// internal component's state
{ handler: "log", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
{ handler: "log", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." },
+ { handler: "log", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
@@ -23,6 +24,5 @@ window.deprecationWorkflow.config = {
{ handler: "silence", matchMessage: "Using the same function as getter and setter is deprecated." },
{ handler: "silence", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
- { handler: "silence", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." }
]
};
From e7ca2c8bfe4ce86aa1a20b0436aaae7174353e13 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 11:12:33 +0100
Subject: [PATCH 08/24] [deprecations] Use Store#unloadRecord instaed of
Store#dematerializeRecord
---
app/components/add-ssh-key.js | 2 +-
config/deprecation-workflow.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/components/add-ssh-key.js b/app/components/add-ssh-key.js
index 648ed32d..fce4371d 100644
--- a/app/components/add-ssh-key.js
+++ b/app/components/add-ssh-key.js
@@ -11,7 +11,7 @@ export default Ember.Component.extend({
var model = this.get('store').recordForId('ssh_key', id);
if (model) {
- this.get('store').dematerializeRecord(model._internalModel);
+ this.get('store').unloadRecord(model);
var typeMap = this.get('store').typeMapFor(model.constructor);
var idToRecord = typeMap.idToRecord;
delete idToRecord[id];
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 82f2a2d2..8be959a8 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -12,6 +12,7 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "Usage of `state` is deprecated, use `_state` instead." },
{ handler: "log", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." },
{ handler: "log", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." },
+ { handler: "log", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
@@ -22,7 +23,6 @@ window.deprecationWorkflow.config = {
{ handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
{ handler: "silence", matchMessage: "Using the same function as getter and setter is deprecated." },
- { handler: "silence", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
]
};
From 4b71704b1cde5aefca01fee4c6f425f0ba68186b Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 11:16:13 +0100
Subject: [PATCH 09/24] [deprecations] Don't use second argument in a property
This makes Ember.js think that we're trying to use the property as
setter and it's deprecated
---
app/components/env-var.js | 2 +-
config/deprecation-workflow.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/components/env-var.js b/app/components/env-var.js
index 92f935a6..6442130b 100644
--- a/app/components/env-var.js
+++ b/app/components/env-var.js
@@ -8,7 +8,7 @@ export default Ember.Component.extend({
actionType: 'Save',
showValueField: Ember.computed.alias('public'),
- value: function(key, value) {
+ value: function(key) {
if (this.get('envVar.public')) {
return this.get('envVar.value');
} else {
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 8be959a8..0a30bccf 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -13,6 +13,7 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." },
{ handler: "log", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." },
{ handler: "log", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
+ { handler: "log", matchMessage: "Using the same function as getter and setter is deprecated." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
@@ -22,7 +23,6 @@ window.deprecationWorkflow.config = {
{ handler: "silence", matchMessage: "`Ember.ArrayController` is deprecated." },
{ handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
- { handler: "silence", matchMessage: "Using the same function as getter and setter is deprecated." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
]
};
From 39cf0b304436bb93a1dc488b27c1505a7ca226a2 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 11:22:40 +0100
Subject: [PATCH 10/24] [deprecations] Don't use ArrayController
---
app/controllers/accounts.js | 2 +-
app/controllers/builds.js | 8 ++++----
app/controllers/requests.js | 2 +-
app/templates/builds.hbs | 4 ++--
config/deprecation-workflow.js | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/controllers/accounts.js b/app/controllers/accounts.js
index 6f6fd118..38e5364f 100644
--- a/app/controllers/accounts.js
+++ b/app/controllers/accounts.js
@@ -1,3 +1,3 @@
import Ember from 'ember';
-export default Ember.ArrayController.extend();
+export default Ember.Controller.extend();
diff --git a/app/controllers/builds.js b/app/controllers/builds.js
index dff591ff..17dc4f00 100644
--- a/app/controllers/builds.js
+++ b/app/controllers/builds.js
@@ -1,20 +1,20 @@
import Ember from 'ember';
-export default Ember.ArrayController.extend({
+export default Ember.Controller.extend({
sortAscending: false,
sortProperties: ['number'],
repoController: Ember.inject.controller('repo'),
repoBinding: 'repoController.repo',
tabBinding: 'repoController.tab',
- isLoadedBinding: 'content.isLoaded',
- isLoadingBinding: 'content.isLoading',
+ isLoadedBinding: 'model.isLoaded',
+ isLoadingBinding: 'model.isLoading',
showMore() {
var id, number, type;
id = this.get('repo.id');
number = this.get('lastObject.number');
type = this.get('tab') === "builds" ? 'push' : 'pull_request';
- return this.get('content').load(this.olderThanNumber(id, number, type));
+ return this.get('model').load(this.olderThanNumber(id, number, type));
},
displayShowMoreButton: function() {
diff --git a/app/controllers/requests.js b/app/controllers/requests.js
index 816c3f35..e1f16b96 100644
--- a/app/controllers/requests.js
+++ b/app/controllers/requests.js
@@ -1,6 +1,6 @@
import Ember from 'ember';
-export default Ember.ArrayController.extend({
+export default Ember.Controller.extend({
repoController: Ember.inject.controller('repo'),
lintUrl: function() {
diff --git a/app/templates/builds.hbs b/app/templates/builds.hbs
index 06990ad0..fe9fbfe1 100644
--- a/app/templates/builds.hbs
+++ b/app/templates/builds.hbs
@@ -1,6 +1,6 @@
-{{#if content.isLoaded}}
+{{#if model.isLoaded}}
- {{#each controller as |build|}}
+ {{#each model as |build|}}
{{builds-item build=build}}
{{else}}
{{no-builds repo=noticeData isPR=displayPullRequests isBranch=displayBranches}}
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 0a30bccf..dae3a1a7 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -14,13 +14,13 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." },
{ handler: "log", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
{ handler: "log", matchMessage: "Using the same function as getter and setter is deprecated." },
+ { handler: "log", matchMessage: "`Ember.ArrayController` is deprecated." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
{ handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" },
{ handler: "silence", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." },
- { handler: "silence", matchMessage: "`Ember.ArrayController` is deprecated." },
{ handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
From 85b2837c5211e17730e3298a988831dbf43b58ee Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 11:28:52 +0100
Subject: [PATCH 11/24] [deprecations] Disable fetching records in the
background by Ember Data
---
app/adapters/application.js | 10 ++++++++++
config/deprecation-workflow.js | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/adapters/application.js b/app/adapters/application.js
index 77427849..033ecc5a 100644
--- a/app/adapters/application.js
+++ b/app/adapters/application.js
@@ -7,6 +7,16 @@ export default DS.ActiveModelAdapter.extend({
host: config.apiEndpoint,
coalesceFindRequests: true,
+ // Before Ember Data 2.0 the default behaviour of running `findAll` was to get
+ // new records only when there're no records in the store. This will change
+ // to a different strategy in 2.0: when you run `findAll` it will not get any
+ // new data initially, but it will try loading new data in the background.
+ //
+ // I'm disabling the new behaviour for now.
+ shouldBackgroundReloadRecord() {
+ return false;
+ },
+
ajaxOptions(url, type, options) {
var base, hash, token;
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index dae3a1a7..2115b7ec 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -15,6 +15,7 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." },
{ handler: "log", matchMessage: "Using the same function as getter and setter is deprecated." },
{ handler: "log", matchMessage: "`Ember.ArrayController` is deprecated." },
+ { handler: "log", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
@@ -22,7 +23,6 @@ window.deprecationWorkflow.config = {
{ handler: "silence", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
- { handler: "silence", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
]
};
From f9df4b18966b16a9a013a68cccc5c139bbf024c0 Mon Sep 17 00:00:00 2001
From: Piotr Sarnacki
Date: Thu, 7 Jan 2016 11:58:13 +0100
Subject: [PATCH 12/24] [deprecations] Don't use before observer
---
app/mixins/polling.js | 35 +++++++++++++++++++++-------------
config/deprecation-workflow.js | 6 +++---
2 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/app/mixins/polling.js b/app/mixins/polling.js
index 0213671e..001b9edb 100644
--- a/app/mixins/polling.js
+++ b/app/mixins/polling.js
@@ -3,6 +3,12 @@ import Ember from 'ember';
export default Ember.Mixin.create({
polling: Ember.inject.service(),
+ init() {
+ this.set('currentPollModels', {});
+
+ return this._super(...arguments);
+ },
+
didInsertElement() {
this._super.apply(this, arguments);
return this.startPolling();
@@ -17,16 +23,20 @@ export default Ember.Mixin.create({
return this.pollModel(key);
},
- pollModelWillChange(sender, key, value) {
- return this.stopPollingModel(key);
- },
-
pollModel(property) {
- var addToPolling, model;
- addToPolling = () => {
+ var model = this.get(property),
+ currentPollModels = this.get('currentPollModels');
+
+ if(currentPollModels[property]) {
+ this.get('polling').stopPolling(currentPollModels[property]);
+ }
+ currentPollModels[property] = model;
+
+ var addToPolling = () => {
return this.get('polling').startPolling(model);
};
- if (model = this.get(property)) {
+
+ if (model) {
if (model.then) {
return model.then(function(resolved) {
return addToPolling(resolved);
@@ -38,8 +48,8 @@ export default Ember.Mixin.create({
},
stopPollingModel(property) {
- var model;
- if (model = this.get(property)) {
+ var model = this.get(property);
+ if (model) {
return this.get('polling').stopPolling(model);
}
},
@@ -54,7 +64,6 @@ export default Ember.Mixin.create({
pollModels.forEach( (property) => {
this.pollModel(property);
this.addObserver(property, this, 'pollModelDidChange');
- return Ember.addBeforeObserver(this, property, this, 'pollModelWillChange');
});
}
if (this.pollHook) {
@@ -63,15 +72,15 @@ export default Ember.Mixin.create({
},
stopPolling() {
- var pollModels;
- if (pollModels = this.get('pollModels')) {
+ var pollModels = this.get('pollModels');
+
+ if (pollModels) {
if (!Ember.isArray(pollModels)) {
pollModels = [pollModels];
}
pollModels.forEach( (property) => {
this.stopPollingModel(property);
this.removeObserver(property, this, 'pollModelDidChange');
- return Ember.removeBeforeObserver(this, property, this, 'pollModelWillChange');
});
}
return this.get('polling').stopPollingHook(this);
diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js
index 2115b7ec..f033e5cb 100644
--- a/config/deprecation-workflow.js
+++ b/config/deprecation-workflow.js
@@ -16,13 +16,13 @@ window.deprecationWorkflow.config = {
{ handler: "log", matchMessage: "Using the same function as getter and setter is deprecated." },
{ handler: "log", matchMessage: "`Ember.ArrayController` is deprecated." },
{ handler: "log", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." },
+ { handler: "log", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
+ { handler: "log", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." },
+ { handler: "log", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
// TODO
{ handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." },
{ handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" },
- { handler: "silence", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." },
- { handler: "silence", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." },
- { handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." },
{ handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." },
]
};
From 253a56f47d99db28f3adc7cd8144078fb6f78be8 Mon Sep 17 00:00:00 2001
From: Lisa P
Date: Thu, 7 Jan 2016 14:22:39 +0100
Subject: [PATCH 13/24] not use view in accounts
---
app/templates/account.hbs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/templates/account.hbs b/app/templates/account.hbs
index c68f5a7b..d6443d21 100644
--- a/app/templates/account.hbs
+++ b/app/templates/account.hbs
@@ -1,14 +1,15 @@
{{#if allHooks.isLoaded}}
+
{{#if config.billingEndpoint}}