Search in sources :

Example 1 with PushCertificateInfo

use of com.google.gerrit.client.info.PushCertificateInfo in project gerrit by GerritCodeReview.

the class ChangeScreen method renderPushCertificate.

private void renderPushCertificate(RevisionInfo revInfo, FlowPanel panel) {
    if (!enableSignedPush()) {
        return;
    }
    Image status = new Image();
    panel.add(status);
    status.setStyleName(style.pushCertStatus());
    if (!revInfo.hasPushCertificate() || revInfo.pushCertificate().key() == null) {
        status.setResource(Gerrit.RESOURCES.question());
        status.setTitle(Util.C.pushCertMissing());
        return;
    }
    PushCertificateInfo certInfo = revInfo.pushCertificate();
    GpgKeyInfo.Status s = certInfo.key().status();
    switch(s) {
        case BAD:
            status.setResource(Gerrit.RESOURCES.redNot());
            status.setTitle(problems(Util.C.pushCertBad(), certInfo));
            break;
        case OK:
            status.setResource(Gerrit.RESOURCES.warning());
            status.setTitle(problems(Util.C.pushCertOk(), certInfo));
            break;
        case TRUSTED:
            status.setResource(Gerrit.RESOURCES.greenCheck());
            status.setTitle(Util.C.pushCertTrusted());
            break;
    }
}
Also used : Image(com.google.gwt.user.client.ui.Image) AvatarImage(com.google.gerrit.client.AvatarImage) PushCertificateInfo(com.google.gerrit.client.info.PushCertificateInfo) GpgKeyInfo(com.google.gerrit.client.info.GpgKeyInfo)

Aggregations

AvatarImage (com.google.gerrit.client.AvatarImage)1 GpgKeyInfo (com.google.gerrit.client.info.GpgKeyInfo)1 PushCertificateInfo (com.google.gerrit.client.info.PushCertificateInfo)1 Image (com.google.gwt.user.client.ui.Image)1