From 916ae0c982ec412cbbd3374d547c80b0575695c8 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Tue, 15 Mar 2016 17:05:41 +0100 Subject: [PATCH] Expose RevisionInfo to panel extension points Currently there is no way for panel extension points to retrieve the revision information. This is needed to call the plugin specific RevisionResource endpoints. For example, verify-status plugin needs this to retrieve verification info for the patch set that is currently displayed on the change screen. Change-Id: Ifd1f1636684054a9cf188a10d50dd4af6ee77976 --- Documentation/dev-plugins.txt | 3 +++ .../gerrit/client/GerritUiExtensionPoint.java | 2 +- .../gerrit/client/change/ChangeScreen.java | 16 ++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt index abb332e7c8..501f9869a2 100644 --- a/Documentation/dev-plugins.txt +++ b/Documentation/dev-plugins.txt @@ -1065,6 +1065,9 @@ Panel will be shown below the change info block. + The link:rest-api-changes.html#change-info[ChangeInfo] entity for the current change. ++ +The link:rest-api-changes.html#revision-info[RevisionInfo] entity for +the current patch set. * Project Info Screen: ** `GerritUiExtensionPoint.PROJECT_INFO_SCREEN_TOP`: diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java index 61f73c0ccc..9dcb111b04 100644 --- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java +++ b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java @@ -34,6 +34,6 @@ public enum GerritUiExtensionPoint { PROJECT_INFO_SCREEN_TOP, PROJECT_INFO_SCREEN_BOTTOM; public enum Key { - ACCOUNT_INFO, CHANGE_INFO, PROJECT_NAME + ACCOUNT_INFO, CHANGE_INFO, PROJECT_NAME, REVISION_INFO } } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java index 49c94c4895..00a9c70342 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java @@ -278,8 +278,7 @@ public class ChangeScreen extends Screen { @Override public void onSuccess(ChangeInfo info) { info.init(); - addExtensionPoints(info); - initCurrentRevision(info); + addExtensionPoints(info, initCurrentRevision(info)); loadConfigInfo(info, base); } })); @@ -324,22 +323,23 @@ public class ChangeScreen extends Screen { return resolveRevisionToDisplay(info); } - private void addExtensionPoints(ChangeInfo change) { + private void addExtensionPoints(ChangeInfo change, RevisionInfo rev) { addExtensionPoint(GerritUiExtensionPoint.CHANGE_SCREEN_HEADER, - headerExtension, change); + headerExtension, change, rev); addExtensionPoint(GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_BUTTONS, - headerExtensionMiddle, change); + headerExtensionMiddle, change, rev); addExtensionPoint(GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS, - headerExtensionRight, change); + headerExtensionRight, change, rev); addExtensionPoint( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK, - changeExtension, change); + changeExtension, change, rev); } private void addExtensionPoint(GerritUiExtensionPoint extensionPoint, - Panel p, ChangeInfo change) { + Panel p, ChangeInfo change, RevisionInfo rev) { ExtensionPanel extensionPanel = new ExtensionPanel(extensionPoint); extensionPanel.putObject(GerritUiExtensionPoint.Key.CHANGE_INFO, change); + extensionPanel.putObject(GerritUiExtensionPoint.Key.REVISION_INFO, rev); p.add(extensionPanel); }