diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html index 00fb2c9277..8b77489fd4 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html @@ -18,7 +18,6 @@ limitations under the License. - @@ -218,22 +217,6 @@ limitations under the License. } } - - - - -
Loading...
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js index 9af6aa9224..0709f62b88 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js @@ -225,31 +225,6 @@ return '(' + status.toLowerCase() + ')'; }, - _computeDetailPath: function(changeNum) { - return '/changes/' + changeNum + '/detail'; - }, - - _computeCommitInfoPath: function(changeNum, patchNum) { - return this.changeBaseURL(changeNum, patchNum) + '/commit?links'; - }, - - _computeCommentsPath: function(changeNum) { - return '/changes/' + changeNum + '/comments'; - }, - - _computeProjectConfigPath: function(project) { - return '/projects/' + encodeURIComponent(project) + '/config'; - }, - - _computeDetailQueryParams: function() { - var options = this.listChangesOptionsToHex( - this.ListChangesOption.ALL_REVISIONS, - this.ListChangesOption.CHANGE_ACTIONS, - this.ListChangesOption.DOWNLOAD_COMMANDS - ); - return {O: options}; - }, - _computeLatestPatchNum: function(change) { return change.revisions[change.current_revision]._number; }, @@ -345,13 +320,44 @@ _getDiffDrafts: function() { return this.$.restAPI.getDiffDrafts(this._changeNum).then( - function(drafts) { return this._diffDrafts = drafts; }.bind(this)); + function(drafts) { + return this._diffDrafts = drafts; + }.bind(this)); }, _getLoggedIn: function() { return this.$.restAPI.getLoggedIn(); }, + _getProjectConfig: function() { + return this.$.restAPI.getProjectConfig(this._change.project).then( + function(config) { + this._projectConfig = config; + }.bind(this)); + }, + + _getChangeDetail: function() { + return this.$.restAPI.getChangeDetail(this._changeNum).then( + function(change) { + this._change = change; + }.bind(this)); + }, + + _getComments: function() { + return this.$.restAPI.getDiffComments(this._changeNum).then( + function(comments) { + this._comments = comments; + }.bind(this)); + }, + + _getCommitInfo: function() { + return this.$.restAPI.getChangeCommitInfo( + this._changeNum, this._patchNum).then( + function(commitInfo) { + this._commitInfo = commitInfo; + }.bind(this)); + }, + _reloadDiffDrafts: function() { this._diffDrafts = {}; this._getDiffDrafts().then(function() { @@ -362,24 +368,31 @@ }, _reload: function() { + this._loading = true; + this._getLoggedIn().then(function(loggedIn) { if (!loggedIn) { return; } this._reloadDiffDrafts(); }.bind(this)); - var detailCompletes = this.$.detailXHR.generateRequest().completes; - this.$.commentsXHR.generateRequest(); + var detailCompletes = this._getChangeDetail().then(function() { + this._loading = false; + }.bind(this)); + this._getComments(); var reloadPatchNumDependentResources = function() { return Promise.all([ - this.$.commitInfoXHR.generateRequest().completes, + this._getCommitInfo(), this.$.actions.reload(), this.$.fileList.reload(), ]); }.bind(this); var reloadDetailDependentResources = function() { - return this.$.relatedChanges.reload(); + return Promise.all([ + this.$.relatedChanges.reload(), + this._getProjectConfig(), + ]); }.bind(this); this._resetHeaderEl(); diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html index 6d4d4b0740..ee08ba1f98 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html @@ -35,27 +35,12 @@ limitations under the License.