use of com.google.gerrit.client.rpc.NativeMap in project gerrit by GerritCodeReview.
the class ProjectAccessScreen method onLoad.
@Override
protected void onLoad() {
super.onLoad();
CallbackGroup cbs = new CallbackGroup();
ConfigServerApi.capabilities(cbs.add(new AsyncCallback<NativeMap<CapabilityInfo>>() {
@Override
public void onSuccess(NativeMap<CapabilityInfo> result) {
capabilityMap = result;
}
@Override
public void onFailure(Throwable caught) {
// Handled by ScreenLoadCallback.onFailure().
}
}));
Util.PROJECT_SVC.projectAccess(getProjectKey(), cbs.addFinal(new ScreenLoadCallback<ProjectAccess>(this) {
@Override
public void preDisplay(ProjectAccess access) {
displayReadOnly(access);
}
}));
savedPanel = ACCESS;
}
use of com.google.gerrit.client.rpc.NativeMap in project gerrit by GerritCodeReview.
the class ChangeScreen method loadRevisionInfo.
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);
}
});
}
use of com.google.gerrit.client.rpc.NativeMap in project gerrit by GerritCodeReview.
the class GroupSuggestOracle method requestSuggestions.
@Override
public void requestSuggestions(final Request req, final Callback done) {
if (req.getQuery().length() < chars) {
responseEmptySuggestion(req, done);
return;
}
RestApi rest = new RestApi("/groups/").addParameter("suggest", req.getQuery());
if (req.getLimit() > 0) {
rest.addParameter("n", req.getLimit());
}
rest.get(new AsyncCallback<NativeMap<JavaScriptObject>>() {
@Override
public void onSuccess(NativeMap<JavaScriptObject> result) {
List<String> keys = result.sortedKeys();
List<Suggestion> suggestions = new ArrayList<>(keys.size());
for (String g : keys) {
suggestions.add(new HighlightSuggestion(req.getQuery(), g));
}
done.onSuggestionsReady(req, new Response(suggestions));
}
@Override
public void onFailure(Throwable caught) {
responseEmptySuggestion(req, done);
}
});
}
use of com.google.gerrit.client.rpc.NativeMap in project gerrit by GerritCodeReview.
the class ChangeScreen method loadConfigInfo.
private void loadConfigInfo(final ChangeInfo info, DiffObject base) {
final RevisionInfo rev = info.revision(revision);
if (base.isAutoMerge() && !initCurrentRevision(info).isMerge()) {
Gerrit.display(getToken(), new NotFoundScreen());
}
updateToken(info, base, rev);
RevisionInfo baseRev = resolveRevisionOrPatchSetId(info, base.asString(), null);
CallbackGroup group = new CallbackGroup();
Timestamp lastReply = myLastReply(info);
if (rev.isEdit()) {
// Comments are filtered for the current revision. Use parent
// patch set for edits, as edits themself can never have comments.
RevisionInfo p = RevisionInfo.findEditParentRevision(info.revisions().values());
List<NativeMap<JsArray<CommentInfo>>> comments = loadComments(p, group);
loadFileList(base, baseRev, rev, lastReply, group, comments, null);
} else {
loadDiff(base, baseRev, rev, lastReply, group);
}
group.addListener(new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
loadConfigInfo(info, rev);
}
@Override
public void onFailure(Throwable caught) {
logger.log(Level.SEVERE, "Loading file list and inline comments failed: " + caught.getMessage());
loadConfigInfo(info, rev);
}
});
group.done();
}
use of com.google.gerrit.client.rpc.NativeMap in project gerrit by GerritCodeReview.
the class MyGpgKeysScreen method refreshKeys.
private void refreshKeys() {
AccountApi.self().view("gpgkeys").get(NativeMap.copyKeysIntoChildren("id", new GerritCallback<NativeMap<GpgKeyInfo>>() {
@Override
public void onSuccess(NativeMap<GpgKeyInfo> result) {
List<GpgKeyInfo> list = Natives.asList(result.values());
// TODO(dborowitz): Sort on something more meaningful, like
// created date?
Collections.sort(list, new Comparator<GpgKeyInfo>() {
@Override
public int compare(GpgKeyInfo a, GpgKeyInfo b) {
return a.id().compareTo(b.id());
}
});
keys.clear();
keyText.setText("");
errorPanel.setVisible(false);
addButton.setEnabled(true);
if (!list.isEmpty()) {
keys.setVisible(true);
for (GpgKeyInfo k : list) {
keys.addOneKey(k);
}
showKeyTable(true);
showAddKeyBlock(false);
} else {
keys.setVisible(false);
showAddKeyBlock(true);
showKeyTable(false);
}
display();
}
}));
}
Aggregations