Adapt ProjectBranchesScreen to use REST for listing/deleting branches

This removes the old RPC for deleting branches which is now not used
anymore.

Change-Id: Ib50c61aa7aaff86f5dfe0244b2925d3532018f93
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-06-06 14:46:26 +02:00
parent 9c6e5376e6
commit 71b43a9b73
11 changed files with 175 additions and 252 deletions

View File

@@ -0,0 +1,53 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.client.access;
import com.google.gerrit.client.rpc.NativeMap;
import com.google.gerrit.client.rpc.RestApi;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gwt.user.client.rpc.AsyncCallback;
import java.util.Collections;
import java.util.Set;
/** Access rights available from {@code /access/}. */
public class AccessMap extends NativeMap<ProjectAccessInfo> {
public static void get(Set<Project.NameKey> projects,
AsyncCallback<AccessMap> callback) {
RestApi api = new RestApi("/access/");
for (Project.NameKey p : projects) {
api.addParameter("project", p.get());
}
api.get(NativeMap.copyKeysIntoChildren(callback));
}
public static void get(final Project.NameKey project,
final AsyncCallback<ProjectAccessInfo> cb) {
get(Collections.singleton(project), new AsyncCallback<AccessMap>() {
@Override
public void onSuccess(AccessMap result) {
cb.onSuccess(result.get(project.get()));
}
@Override
public void onFailure(Throwable caught) {
cb.onFailure(caught);
}
});
}
protected AccessMap() {
}
}

View File

@@ -0,0 +1,24 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.client.access;
import com.google.gwt.core.client.JavaScriptObject;
public class ProjectAccessInfo extends JavaScriptObject {
public final native boolean canAddRefs() /*-{ return this.can_add ? true : false; }-*/;
protected ProjectAccessInfo() {
}
}