use of com.google.gerrit.client.config.CapabilityInfo 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.config.CapabilityInfo in project gerrit by GerritCodeReview.
the class ProjectAccessScreen method displayReadOnly.
private void displayReadOnly(ProjectAccess access) {
this.access = access;
Map<String, String> allCapabilities = new HashMap<>();
for (CapabilityInfo c : Natives.asList(capabilityMap.values())) {
allCapabilities.put(c.id(), c.name());
}
this.access.setCapabilities(allCapabilities);
accessEditor.setEditing(false);
UIObject.setVisible(editTools, !access.getOwnerOf().isEmpty() || access.canUpload());
edit.setEnabled(!access.getOwnerOf().isEmpty() || access.canUpload());
cancel1.setVisible(false);
UIObject.setVisible(commitTools, false);
driver.edit(access);
}
Aggregations