ChangeScreen: explicitly load revision info
The new explicit loading of the revision actions is performed by the new REST API call /changes/<id>/revisions/<id>/actions, which also checks other changes for submittability if `submitWholeTopic` is enabled. This may slow down revision loading, hence move it out in an extra async call. Change-Id: I0be8bcef18aed34d912ab3048436bd62cbc47ead
This commit is contained in:
@@ -240,7 +240,10 @@ public class ChangeScreen extends Screen {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo info) {
|
||||
info.init();
|
||||
// Revision loading may be slower than the rest, so do it
|
||||
// asynchronous to have the rest fast.
|
||||
loadConfigInfo(info, base);
|
||||
loadRevisionInfo();
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -248,7 +251,7 @@ public class ChangeScreen extends Screen {
|
||||
void loadChangeInfo(boolean fg, AsyncCallback<ChangeInfo> cb) {
|
||||
RestApi call = ChangeApi.detail(changeId.get());
|
||||
ChangeList.addOptions(call, EnumSet.of(
|
||||
ListChangesOption.CURRENT_ACTIONS,
|
||||
ListChangesOption.CHANGE_ACTIONS,
|
||||
ListChangesOption.ALL_REVISIONS));
|
||||
if (!fg) {
|
||||
call.background();
|
||||
@@ -256,6 +259,18 @@ public class ChangeScreen extends Screen {
|
||||
call.get(cb);
|
||||
}
|
||||
|
||||
void loadRevisionInfo() {
|
||||
RestApi call = ChangeApi.actions(changeId.get(), revision);
|
||||
call.background();
|
||||
call.get(new GerritCallback<NativeMap<ActionInfo>>() {
|
||||
@Override
|
||||
public void onSuccess(NativeMap<ActionInfo> actionMap) {
|
||||
actionMap.copyKeysIntoChildren("id");
|
||||
renderRevisionInfo(changeInfo, actionMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUnload() {
|
||||
if (replyAction != null) {
|
||||
@@ -1074,12 +1089,9 @@ public class ChangeScreen extends Screen {
|
||||
}
|
||||
setWindowTitle(sb.toString());
|
||||
|
||||
RevisionInfo revInfo = info.revision(revision);
|
||||
NativeMap<ActionInfo> actionMap = revInfo.has_actions()
|
||||
? info.actions()
|
||||
: NativeMap.<ActionInfo> create();
|
||||
actionMap.copyKeysIntoChildren("id");
|
||||
renderRevisionInfo(info, actionMap);
|
||||
// Properly render revision actions initially while waiting for
|
||||
// the callback to populate them correctly.
|
||||
renderRevisionInfo(changeInfo, NativeMap.<ActionInfo> create());
|
||||
}
|
||||
|
||||
private void renderRevisionInfo(ChangeInfo info,
|
||||
|
||||
Reference in New Issue
Block a user