From 8ed7eaf75763f53a9a8e556cb64aa7551792289a Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Mon, 17 Nov 2014 17:07:13 +0000 Subject: [PATCH] App.Manifest shouldn't use App.__container__.lookup https://bugs.webkit.org/show_bug.cgi?id=138768 Reviewed by Andreas Kling. Removed the hack to find the store object via App.__container__.lookup. Pass around the store object instead. * public/v2/app.js: (App.DashboardRow._createPane): Add "store" property to the pane. (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): Ditto. (App.IndexController.gridChanged): Ditto. (App.IndexController.actions.addRow): Ditto. (App.IndexController.init): Ditto. (App.Pane._fetch): Ditto. (App.ChartsController._parsePaneList): Ditto. (App.ChartsController._updateQueryString): Ditto. (App.ChartsController.actions.addPaneByMetricAndPlatform): Ditto. (App.BuildPopup): Ditto. (App.AnalysisTaskRoute.model): Ditto. (App.AnalysisTaskViewModel._taskUpdated): Ditto. * public/v2/manifest.js: (App.Manifest.fetch): Removed the code to find the store object. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176203 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Websites/perf.webkit.org/ChangeLog | 27 ++++++++++++++++++++++++++ Websites/perf.webkit.org/public/v2/app.js | 25 ++++++++++++++---------- Websites/perf.webkit.org/public/v2/manifest.js | 10 +++------- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/Websites/perf.webkit.org/ChangeLog b/Websites/perf.webkit.org/ChangeLog index 2e6c60e..835c6e03 100644 --- a/Websites/perf.webkit.org/ChangeLog +++ b/Websites/perf.webkit.org/ChangeLog @@ -1,3 +1,30 @@ +2014-11-17 Ryosuke Niwa + + App.Manifest shouldn't use App.__container__.lookup + https://bugs.webkit.org/show_bug.cgi?id=138768 + + Reviewed by Andreas Kling. + + Removed the hack to find the store object via App.__container__.lookup. + Pass around the store object instead. + + * public/v2/app.js: + (App.DashboardRow._createPane): Add "store" property to the pane. + (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): Ditto. + (App.IndexController.gridChanged): Ditto. + (App.IndexController.actions.addRow): Ditto. + (App.IndexController.init): Ditto. + (App.Pane._fetch): Ditto. + (App.ChartsController._parsePaneList): Ditto. + (App.ChartsController._updateQueryString): Ditto. + (App.ChartsController.actions.addPaneByMetricAndPlatform): Ditto. + (App.BuildPopup): Ditto. + (App.AnalysisTaskRoute.model): Ditto. + (App.AnalysisTaskViewModel._taskUpdated): Ditto. + + * public/v2/manifest.js: + (App.Manifest.fetch): Removed the code to find the store object. + 2014-11-08 Ryosuke Niwa Fix Ember.js warnings the new perf dashboard diff --git a/Websites/perf.webkit.org/public/v2/app.js b/Websites/perf.webkit.org/public/v2/app.js index b8d2224..febc434 100755 --- a/Websites/perf.webkit.org/public/v2/app.js +++ b/Websites/perf.webkit.org/public/v2/app.js @@ -33,6 +33,7 @@ App.DashboardRow = Ember.Object.extend({ paneInfo = null; var pane = App.Pane.create({ + store: this.get('store'), platformId: paneInfo ? paneInfo[0] : null, metricId: paneInfo ? paneInfo[1] : null, }); @@ -45,7 +46,7 @@ App.DashboardPaneProxyForPicker = Ember.ObjectProxy.extend({ _platformOrMetricIdChanged: function () { var self = this; - App.BuildPopup('choosePane', this) + App.BuildPopup(this.get('store'), 'choosePane', this) .then(function (platforms) { self.set('pickerData', platforms); }); }.observes('platformId', 'metricId').on('init'), paneList: function () { @@ -87,8 +88,10 @@ App.IndexController = Ember.Controller.extend({ return {label:name, index: index}; })); + var store = this.store; this.set('rows', table.slice(1).map(function (rowParam) { return App.DashboardRow.create({ + store: store, header: rowParam[0], cellsInfo: rowParam.slice(1), columnCount: columnCount, @@ -170,6 +173,7 @@ App.IndexController = Ember.Controller.extend({ addRow: function () { this.get('rows').pushObject(App.DashboardRow.create({ + store: this.store, header: this.get('newRowHeader'), columnCount: this.get('columnCount'), })); @@ -195,7 +199,7 @@ App.IndexController = Ember.Controller.extend({ init: function () { this._super(); - App.Manifest.fetch(); + App.Manifest.fetch(this.get('store')); } }); @@ -340,7 +344,7 @@ App.Pane = Ember.Object.extend({ else { var self = this; - App.Manifest.fetchRunsWithPlatformAndMetric(this.store, platformId, metricId).then(function (result) { + App.Manifest.fetchRunsWithPlatformAndMetric(this.get('store'), platformId, metricId).then(function (result) { self.set('platform', result.platform); self.set('metric', result.metric); self.set('chartData', result.runs); @@ -510,6 +514,7 @@ App.ChartsController = Ember.Controller.extend({ } } return App.Pane.create({ + store: self.store, info: paneInfo, platformId: paneInfo[0], metricId: paneInfo[1], @@ -561,6 +566,7 @@ App.ChartsController = Ember.Controller.extend({ addPaneByMetricAndPlatform: function (param) { this.addPane(App.Pane.create({ + store, this.store, platformId: param.platform.get('id'), metricId: param.metric.get('id'), showingDetails: false @@ -572,15 +578,15 @@ App.ChartsController = Ember.Controller.extend({ { this._super(); var self = this; - App.BuildPopup('addPaneByMetricAndPlatform').then(function (platforms) { + App.BuildPopup(this.store, 'addPaneByMetricAndPlatform').then(function (platforms) { self.set('platforms', platforms); }); }, }); -App.BuildPopup = function(action, position) +App.BuildPopup = function(store, action, position) { - return App.Manifest.fetch().then(function () { + return App.Manifest.fetch(store).then(function () { return App.Manifest.get('platforms').map(function (platform) { return App.PlatformProxyForPopup.create({content: platform, action: action, position: position}); @@ -1592,9 +1598,8 @@ App.AnalysisRoute = Ember.Route.extend({ App.AnalysisTaskRoute = Ember.Route.extend({ model: function (param) { - var store = this.store; - return this.store.find('analysisTask', param.taskId).then(function (task) { - return App.AnalysisTaskViewModel.create({content: task}); + return store.find('analysisTask', param.taskId).then(function (task) { + return App.AnalysisTaskViewModel.create({content: task, store: store}); }); }, }); @@ -1606,7 +1611,7 @@ App.AnalysisTaskViewModel = Ember.ObjectProxy.extend({ { var platformId = this.get('platform').get('id'); var metricId = this.get('metric').get('id'); - App.Manifest.fetchRunsWithPlatformAndMetric(this.store, platformId, metricId).then(this._fetchedRuns.bind(this)); + App.Manifest.fetchRunsWithPlatformAndMetric(this.get('store'), platformId, metricId).then(this._fetchedRuns.bind(this)); }.observes('platform', 'metric').on('init'), _fetchedRuns: function (data) { var runs = data.runs; diff --git a/Websites/perf.webkit.org/public/v2/manifest.js b/Websites/perf.webkit.org/public/v2/manifest.js index 64e3787..7cca009 100755 --- a/Websites/perf.webkit.org/public/v2/manifest.js +++ b/Websites/perf.webkit.org/public/v2/manifest.js @@ -160,14 +160,10 @@ App.Manifest = Ember.Controller.extend({ _builderById: {}, _repositoryById: {}, _fetchPromise: null, - fetch: function () + fetch: function (store) { - if (this._fetchPromise) - return this._fetchPromise; - // FIXME: We shouldn't use DS.Store at all. - var store = App.__container__.lookup('store:main'); - var promise = store.findAll('platform'); - this._fetchPromise = promise.then(this._fetchedManifest.bind(this, store)); + if (!this._fetchPromise) + this._fetchPromise = store.findAll('platform').then(this._fetchedManifest.bind(this, store)); return this._fetchPromise; }, isFetched: function () { return !!this.get('platforms'); }.property('platforms'), -- 1.8.3.1