Remove all remaining app deprecations
This commit is contained in:
parent
dc34ab38e7
commit
f8d05dea78
|
@ -1,6 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import Resolver from './resolver';
|
import Resolver from './resolver';
|
||||||
import loadInitializers from 'ember-load-initializers';
|
import loadInitializers from 'ember-load-initializers';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
import config from './config/environment';
|
import config from './config/environment';
|
||||||
|
|
||||||
Ember.MODEL_FACTORY_INJECTIONS = true;
|
Ember.MODEL_FACTORY_INJECTIONS = true;
|
||||||
|
@ -19,12 +20,8 @@ var App = Ember.Application.extend(Ember.Evented, {
|
||||||
podModulePrefix: config.podModulePrefix,
|
podModulePrefix: config.podModulePrefix,
|
||||||
Resolver: Resolver,
|
Resolver: Resolver,
|
||||||
|
|
||||||
lookup() {
|
|
||||||
return this.__container__.lookup.apply(this.__container__, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
flash(options) {
|
flash(options) {
|
||||||
return Travis.lookup('controller:flash').loadFlashes([options]);
|
return Ember.getOwner(Travis).lookup('controller:flash').loadFlashes([options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSidebar() {
|
toggleSidebar() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
sync() {
|
sync() {
|
||||||
|
@ -11,7 +12,7 @@ export default Ember.Controller.extend({
|
||||||
var user;
|
var user;
|
||||||
if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) {
|
if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) {
|
||||||
return Ember.run.scheduleOnce('routerTransitions', this, function() {
|
return Ember.run.scheduleOnce('routerTransitions', this, function() {
|
||||||
return this.container.lookup('router:main').send('renderFirstSync');
|
return Ember.getOwner(this).lookup('router:main').send('renderFirstSync');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}.observes('isSyncing', 'auth.currentUser')
|
}.observes('isSyncing', 'auth.currentUser')
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import Repo from 'travis/models/repo';
|
import Repo from 'travis/models/repo';
|
||||||
import Config from 'travis/config/environment';
|
import Config from 'travis/config/environment';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
var sortCallback = function(repo1, repo2) {
|
var sortCallback = function(repo1, repo2) {
|
||||||
// this function could be made simpler, but I think it's clearer this way
|
// this function could be made simpler, but I think it's clearer this way
|
||||||
|
@ -76,7 +77,7 @@ var Controller = Ember.Controller.extend({
|
||||||
possiblyRedirectToGettingStartedPage() {
|
possiblyRedirectToGettingStartedPage() {
|
||||||
return Ember.run.scheduleOnce('routerTransitions', this, function() {
|
return Ember.run.scheduleOnce('routerTransitions', this, function() {
|
||||||
if (this.get('tab') === 'owned' && this.get('isLoaded') && this.get('repos.length') === 0) {
|
if (this.get('tab') === 'owned' && this.get('isLoaded') && this.get('repos.length') === 0) {
|
||||||
return this.container.lookup('router:main').send('redirectToGettingStarted');
|
return Ember.getOwner(this).lookup('router:main').send('redirectToGettingStarted');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,16 +2,15 @@ import config from 'travis/config/environment';
|
||||||
import TravisPusher from 'travis/utils/pusher';
|
import TravisPusher from 'travis/utils/pusher';
|
||||||
var PusherInitializer, initialize;
|
var PusherInitializer, initialize;
|
||||||
|
|
||||||
initialize = function(data) {
|
initialize = function(applicationInstance) {
|
||||||
var application;
|
const app = applicationInstance.application;
|
||||||
application = data.application;
|
|
||||||
if (config.pusher.key) {
|
if (config.pusher.key) {
|
||||||
application.pusher = new TravisPusher(config.pusher, data.container.lookup('service:ajax'));
|
app.pusher = new TravisPusher(config.pusher, applicationInstance.lookup('service:ajax'));
|
||||||
application.register('pusher:main', application.pusher, {
|
app.register('pusher:main', app.pusher, {
|
||||||
instantiate: false
|
instantiate: false
|
||||||
});
|
});
|
||||||
application.inject('route', 'pusher', 'pusher:main');
|
app.inject('route', 'pusher', 'pusher:main');
|
||||||
return application.pusher.store = data.container.lookup('service:store');
|
return app.pusher.store = applicationInstance.lookup('service:store');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import Model from 'travis/models/model';
|
import Model from 'travis/models/model';
|
||||||
import attr from 'ember-data/attr';
|
import attr from 'ember-data/attr';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
var indexOf = [].indexOf;
|
var indexOf = [].indexOf;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ var Broadcast = Model.extend({
|
||||||
Broadcast.reopenClass({
|
Broadcast.reopenClass({
|
||||||
seen: function() {
|
seen: function() {
|
||||||
var seenBroadcasts;
|
var seenBroadcasts;
|
||||||
seenBroadcasts = Travis.lookup('service:storage').getItem('travis.seen_broadcasts');
|
seenBroadcasts = Ember.getOwner(Travis).lookup('service:storage').getItem('travis.seen_broadcasts');
|
||||||
if (seenBroadcasts != null) {
|
if (seenBroadcasts != null) {
|
||||||
seenBroadcasts = JSON.parse(seenBroadcasts);
|
seenBroadcasts = JSON.parse(seenBroadcasts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import config from './config/environment';
|
import config from './config/environment';
|
||||||
import Location from 'travis/utils/location';
|
import Location from 'travis/utils/location';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
var Router = Ember.Router.extend({
|
var Router = Ember.Router.extend({
|
||||||
location: function() {
|
location: function() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import TravisRoute from 'travis/routes/basic';
|
import TravisRoute from 'travis/routes/basic';
|
||||||
import config from 'travis/config/environment';
|
import config from 'travis/config/environment';
|
||||||
import BuildFaviconMixin from 'travis/mixins/build-favicon';
|
import BuildFaviconMixin from 'travis/mixins/build-favicon';
|
||||||
|
import Ember from 'ember';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
export default TravisRoute.extend(BuildFaviconMixin, {
|
export default TravisRoute.extend(BuildFaviconMixin, {
|
||||||
needsAuth: false,
|
needsAuth: false,
|
||||||
|
@ -99,7 +101,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
|
||||||
error(error) {
|
error(error) {
|
||||||
var authController;
|
var authController;
|
||||||
if (error === 'needs-auth') {
|
if (error === 'needs-auth') {
|
||||||
authController = this.container.lookup('controller:auth');
|
authController = Ember.getOwner(this).lookup('controller:auth');
|
||||||
authController.set('redirected', true);
|
authController.set('redirected', true);
|
||||||
return this.transitionTo('auth');
|
return this.transitionTo('auth');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import TravisRoute from 'travis/routes/basic';
|
import TravisRoute from 'travis/routes/basic';
|
||||||
|
import Ember from 'ember';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
export default TravisRoute.extend({
|
export default TravisRoute.extend({
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
return this.container.lookup('controller:repos').activate('owned');
|
return Ember.getOwner(this).lookup('controller:repos').activate('owned');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import TravisRoute from 'travis/routes/basic';
|
import TravisRoute from 'travis/routes/basic';
|
||||||
import config from 'travis/config/environment';
|
import config from 'travis/config/environment';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
export default TravisRoute.extend({
|
export default TravisRoute.extend({
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default TravisRoute.extend(ScrollResetMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.container.lookup('controller:repos').activate('owned');
|
this.controllerFor('repos').activate('owned');
|
||||||
if (model && !model.get) {
|
if (model && !model.get) {
|
||||||
model = this.get('store').find('repo', model.id);
|
model = this.get('store').find('repo', model.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import TravisRoute from 'travis/routes/basic';
|
import TravisRoute from 'travis/routes/basic';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
|
|
||||||
export default TravisRoute.extend({
|
export default TravisRoute.extend({
|
||||||
setupController: function() {
|
setupController: function() {
|
||||||
$('body').attr('id', 'simple');
|
$('body').attr('id', 'simple');
|
||||||
this.container.lookup('controller:repos').activate('owned');
|
this.controllerFor('repos').activate('owned');
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import config from 'travis/config/environment';
|
import config from 'travis/config/environment';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
var default_options;
|
var default_options;
|
||||||
|
|
||||||
jQuery.support.cors = true;
|
jQuery.support.cors = true;
|
||||||
|
@ -64,7 +65,7 @@ export default Ember.Service.extend({
|
||||||
success = options.success || (function() {});
|
success = options.success || (function() {});
|
||||||
options.success = (data, status, xhr) => {
|
options.success = (data, status, xhr) => {
|
||||||
if (data != null ? data.flash : void 0) {
|
if (data != null ? data.flash : void 0) {
|
||||||
Travis.lookup('controller:flash').loadFlashes(data.flash);
|
Ember.getOwner(Travis).lookup('controller:flash').loadFlashes(data.flash);
|
||||||
}
|
}
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
delete data.flash;
|
delete data.flash;
|
||||||
|
@ -75,7 +76,7 @@ export default Ember.Service.extend({
|
||||||
options.error = (data, status, xhr) => {
|
options.error = (data, status, xhr) => {
|
||||||
console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data)));
|
console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(data)));
|
||||||
if (data != null ? data.flash : void 0) {
|
if (data != null ? data.flash : void 0) {
|
||||||
Travis.lookup('controller:flash').pushObject(data.flash);
|
Ember.getOwner(Travis).lookup('controller:flash').pushObject(data.flash);
|
||||||
}
|
}
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
delete data.flash;
|
delete data.flash;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import config from 'travis/config/environment';
|
import config from 'travis/config/environment';
|
||||||
|
import Ember from 'ember';
|
||||||
|
import getOwner from 'ember-getowner-polyfill';
|
||||||
var ccXml, email, githubAdmin, githubCommit, githubNetwork, githubPullRequest,
|
var ccXml, email, githubAdmin, githubCommit, githubNetwork, githubPullRequest,
|
||||||
githubRepo, githubWatchers, gravatarImage, plainTextLog, statusImage;
|
githubRepo, githubWatchers, gravatarImage, plainTextLog, statusImage;
|
||||||
|
|
||||||
|
@ -33,7 +35,7 @@ githubAdmin = function(slug) {
|
||||||
statusImage = function(slug, branch) {
|
statusImage = function(slug, branch) {
|
||||||
var token;
|
var token;
|
||||||
if (config.pro) {
|
if (config.pro) {
|
||||||
token = Travis.__container__.lookup('controller:currentUser').get('model.token');
|
token = Ember.getOwner(Travis).lookup('controller:currentUser').get('model.token');
|
||||||
return (location.protocol + "//" + location.host + "/" + slug + ".svg?token=" + token) + (branch ? "&branch=" + branch : '');
|
return (location.protocol + "//" + location.host + "/" + slug + ".svg?token=" + token) + (branch ? "&branch=" + branch : '');
|
||||||
} else {
|
} else {
|
||||||
return (location.protocol + "//" + location.host + "/" + slug + ".svg") + (branch ? "?branch=" + (encodeURIComponent(branch)) : '');
|
return (location.protocol + "//" + location.host + "/" + slug + ".svg") + (branch ? "?branch=" + (encodeURIComponent(branch)) : '');
|
||||||
|
@ -48,7 +50,7 @@ ccXml = function(slug, branch) {
|
||||||
}
|
}
|
||||||
if (config.pro) {
|
if (config.pro) {
|
||||||
delimiter = url.indexOf('?') === -1 ? '?' : '&';
|
delimiter = url.indexOf('?') === -1 ? '?' : '&';
|
||||||
token = Travis.__container__.lookup('controller:currentUser').get('model.token');
|
token = Ember.getOwner(Travis).lookup('controller:currentUser').get('model.token');
|
||||||
url = "" + url + delimiter + "token=" + token;
|
url = "" + url + delimiter + "token=" + token;
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
window.deprecationWorkflow = window.deprecationWorkflow || {};
|
window.deprecationWorkflow = window.deprecationWorkflow || {};
|
||||||
window.deprecationWorkflow.config = {
|
window.deprecationWorkflow.config = {
|
||||||
workflow: [
|
workflow: []
|
||||||
{ handler: "silence", matchMessage: "Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead." },
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user