Search in sources :

Example 1 with GlusterTaskType

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType in project ovirt-engine by oVirt.

the class VolumeActivityStatusColumn method getTooltip.

@Override
public SafeHtml getTooltip(T value) {
    // Nothing to render if no task is provided, or if task status is empty:
    if (value == null || value.getAsyncTask() == null || value.getAsyncTask().getType() == null || value.getAsyncTask().getStatus() == null) {
        return null;
    }
    GlusterTaskType taskType = value.getAsyncTask().getType();
    String tooltip = null;
    if (taskType == GlusterTaskType.REBALANCE) {
        switch(value.getAsyncTask().getStatus()) {
            case STARTED:
                tooltip = constants.rebalanceInProgress();
                break;
            case ABORTED:
                tooltip = constants.rebalanceStopped();
                break;
            case FAILED:
                tooltip = constants.rebalanceFailed();
                break;
            case FINISHED:
                tooltip = constants.rebalanceCompleted();
                break;
            case UNKNOWN:
                tooltip = constants.rebalanceStatusUnknown();
                break;
            default:
                // $NON-NLS-1$
                tooltip = "";
        }
    } else if (taskType == GlusterTaskType.REMOVE_BRICK) {
        switch(value.getAsyncTask().getStatus()) {
            case STARTED:
                tooltip = constants.removeBrickInProgress();
                break;
            case ABORTED:
                tooltip = constants.removeBrickStopped();
                break;
            case FAILED:
                tooltip = constants.removeBrickFailed();
                break;
            case FINISHED:
                tooltip = constants.removeBrickCommitRequired();
                break;
            case UNKNOWN:
                tooltip = constants.removeBrickStatusUnknown();
                break;
            default:
                // $NON-NLS-1$
                tooltip = "";
        }
    }
    return SafeHtmlUtils.fromSafeConstant(tooltip);
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)

Example 2 with GlusterTaskType

use of org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType in project ovirt-engine by oVirt.

the class VolumeActivityStatusCell method render.

@Override
public void render(Context context, T value, SafeHtmlBuilder sb, String id) {
    // Nothing to render if no task is provided, or if task status is empty:
    if (value == null || value.getAsyncTask() == null || value.getAsyncTask().getType() == null || value.getAsyncTask().getStatus() == null) {
        return;
    }
    // Find the image corresponding to the task
    GlusterTaskType taskType = value.getAsyncTask().getType();
    ImageResource taskImage = null;
    if (taskType == GlusterTaskType.REBALANCE) {
        switch(value.getAsyncTask().getStatus()) {
            case STARTED:
                taskImage = resources.rebalanceRunning();
                break;
            case ABORTED:
                taskImage = resources.rebalanceStoppped();
                break;
            case FAILED:
                taskImage = resources.rebalanceFailed();
                break;
            case FINISHED:
                taskImage = resources.rebalanceCompleted();
                break;
            case UNKNOWN:
                taskImage = resources.questionMarkImage();
                break;
            default:
                taskImage = null;
        }
    } else if (taskType == GlusterTaskType.REMOVE_BRICK) {
        switch(value.getAsyncTask().getStatus()) {
            case STARTED:
                taskImage = resources.removeBrickRunning();
                break;
            case ABORTED:
                taskImage = resources.removeBrickStopped();
                break;
            case FAILED:
                taskImage = resources.removeBrickFailed();
                break;
            case FINISHED:
                taskImage = resources.removeBrickCommitRequired();
                break;
            case UNKNOWN:
                taskImage = resources.questionMarkImage();
                break;
            default:
                taskImage = null;
        }
    }
    if (taskImage != null) {
        // Generate the HTML for the image:
        SafeHtml activityImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(taskImage).getHTML());
        sb.append(templates.imageWithId(activityImageHtml, id));
    }
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)

Aggregations

GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)2 ImageResource (com.google.gwt.resources.client.ImageResource)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1