Search in sources :

Example 21 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class ConfigServerApi method confirmEmail.

public static void confirmEmail(String token, AsyncCallback<VoidResult> cb) {
    EmailConfirmationInput input = EmailConfirmationInput.create();
    input.setToken(token);
    new RestApi("/config/server/email.confirm").put(input, cb);
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 22 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class DiffApi method list.

public static void list(int id, String revision, RevisionInfo base, AsyncCallback<NativeMap<FileInfo>> cb) {
    RestApi api = ChangeApi.revision(id, revision).view("files");
    if (base != null) {
        if (base._number() < 0) {
            api.addParameter("parent", -base._number());
        } else {
            api.addParameter("base", base.name());
        }
    }
    api.get(NativeMap.copyKeysIntoChildren("path", cb));
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi)

Example 23 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class DownloadBox method insertPatch.

private void insertPatch() {
    String id = revision.substring(0, 7);
    Anchor patchBase64 = new Anchor(id + ".diff.base64");
    patchBase64.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("download").url());
    Anchor patchZip = new Anchor(id + ".diff.zip");
    patchZip.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("zip").url());
    HorizontalPanel p = new HorizontalPanel();
    p.add(patchBase64);
    InlineLabel spacer = new InlineLabel("|");
    spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
    p.add(spacer);
    p.add(patchZip);
    insertCommand("Patch-File", p);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) RestApi(com.google.gerrit.client.rpc.RestApi) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Example 24 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class DownloadBox method onLoad.

@Override
protected void onLoad() {
    if (fetch == null) {
        if (psId.get() == 0) {
            ChangeApi.editWithCommands(change.legacyId().get()).get(new AsyncCallback<EditInfo>() {

                @Override
                public void onSuccess(EditInfo result) {
                    fetch = result.fetch();
                    renderScheme();
                }

                @Override
                public void onFailure(Throwable caught) {
                }
            });
        } else {
            RestApi call = ChangeApi.detail(change.legacyId().get());
            ChangeList.addOptions(call, EnumSet.of(revision.equals(change.currentRevision()) ? ListChangesOption.CURRENT_REVISION : ListChangesOption.ALL_REVISIONS, ListChangesOption.DOWNLOAD_COMMANDS));
            call.get(new AsyncCallback<ChangeInfo>() {

                @Override
                public void onSuccess(ChangeInfo result) {
                    fetch = result.revision(revision).fetch();
                    renderScheme();
                }

                @Override
                public void onFailure(Throwable caught) {
                }
            });
        }
    }
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi) ChangeInfo(com.google.gerrit.client.info.ChangeInfo) EditInfo(com.google.gerrit.client.info.ChangeInfo.EditInfo)

Example 25 with RestApi

use of com.google.gerrit.client.rpc.RestApi in project gerrit by GerritCodeReview.

the class DownloadBox method insertArchive.

private void insertArchive() {
    List<String> activated = Gerrit.info().download().archives();
    if (activated.isEmpty()) {
        return;
    }
    List<Anchor> anchors = new ArrayList<>(activated.size());
    for (String f : activated) {
        Anchor archive = new Anchor(f);
        archive.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("archive").addParameter("format", f).url());
        anchors.add(archive);
    }
    HorizontalPanel p = new HorizontalPanel();
    Iterator<Anchor> it = anchors.iterator();
    while (it.hasNext()) {
        Anchor a = it.next();
        p.add(a);
        if (it.hasNext()) {
            InlineLabel spacer = new InlineLabel("|");
            spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
            p.add(spacer);
        }
    }
    insertCommand("Archive", p);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) RestApi(com.google.gerrit.client.rpc.RestApi) ArrayList(java.util.ArrayList) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Aggregations

RestApi (com.google.gerrit.client.rpc.RestApi)42 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)8 ChangeInfo (com.google.gerrit.client.info.ChangeInfo)3 EditInfo (com.google.gerrit.client.info.ChangeInfo.EditInfo)2 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)2 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 Anchor (com.google.gwt.user.client.ui.Anchor)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)2 ArrayList (java.util.ArrayList)2 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)1 ActionInfo (com.google.gerrit.client.info.ActionInfo)1 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)1 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)1 NativeMap (com.google.gerrit.client.rpc.NativeMap)1 NativeString (com.google.gerrit.client.rpc.NativeString)1 ListChangesOption (com.google.gerrit.extensions.client.ListChangesOption)1 Change (com.google.gerrit.reviewdb.client.Change)1 Project (com.google.gerrit.reviewdb.client.Project)1 JsArray (com.google.gwt.core.client.JsArray)1