Search in sources :

Example 1 with BasicInfoBoxPanel

use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method createLastAvailabilityStatusInfo.

private InfoBoxPanel createLastAvailabilityStatusInfo() {
    InfoBoxPanel lastAvailabilityStatus = new BasicInfoBoxPanel(ID_LAST_AVAILABILITY_STATUS, createAvailabilityStatusInfoBoxModel());
    lastAvailabilityStatus.setOutputMarkupId(true);
    return lastAvailabilityStatus;
}
Also used : BasicInfoBoxPanel(com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel) InfoBoxPanel(com.evolveum.midpoint.web.component.box.InfoBoxPanel) BasicInfoBoxPanel(com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel)

Example 2 with BasicInfoBoxPanel

use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method createSchemaStatusInfo.

private InfoBoxPanel createSchemaStatusInfo(ResourceType resource) {
    String backgroundColor = "bg-gray";
    String icon = "fa fa-times";
    String numberMessage;
    String description = null;
    Integer progress = null;
    ResourceSchema refinedSchema;
    try {
        refinedSchema = ResourceSchemaFactory.getCompleteSchema(resource);
        if (refinedSchema != null) {
            backgroundColor = "bg-purple";
            icon = "fa fa-cubes";
            // TODO is this correct?
            int numObjectTypes = refinedSchema.getObjectTypeDefinitions().size();
            int numAllDefinitions = refinedSchema.getObjectClassDefinitions().size() + numObjectTypes;
            numberMessage = numObjectTypes + " " + getPageBase().getString("PageResource.resource.objectTypes");
            if (numAllDefinitions != 0) {
                progress = numObjectTypes * 100 / numAllDefinitions;
                if (progress > 100) {
                    progress = 100;
                }
            }
            description = numAllDefinitions + " " + getPageBase().getString("PageResource.resource.schemaDefinitions");
        } else {
            numberMessage = getPageBase().getString("PageResource.resource.noSchema");
        }
    } catch (SchemaException e) {
        backgroundColor = "bg-danger";
        icon = "fa fa-warning";
        numberMessage = getPageBase().getString("PageResource.resource.schemaError");
    }
    InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, getPageBase().getString("PageResource.resource.schema"));
    infoBoxType.setNumber(numberMessage);
    infoBoxType.setProgress(progress);
    infoBoxType.setDescription(description);
    Model<InfoBoxType> boxModel = new Model<>(infoBoxType);
    return new BasicInfoBoxPanel(ID_SCHEMA_STATUS, boxModel);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) InfoBoxType(com.evolveum.midpoint.web.component.box.InfoBoxType) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) BasicInfoBoxPanel(com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel)

Example 3 with BasicInfoBoxPanel

use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method createLastAvailabilityStatusInfo.

private InfoBoxPanel createLastAvailabilityStatusInfo(ResourceType resource) {
    String messageKey = "PageResource.resource.availabilityUnknown";
    String backgroundColor = "bg-gray";
    String icon = "fa fa-question";
    OperationalStateType operationalState = resource.getOperationalState();
    AdministrativeOperationalStateType administrativeOperationalState = resource.getAdministrativeOperationalState();
    boolean inMaintenance = false;
    if (administrativeOperationalState != null) {
        AdministrativeAvailabilityStatusType administrativeAvailabilityStatus = administrativeOperationalState.getAdministrativeAvailabilityStatus();
        if (administrativeAvailabilityStatus == AdministrativeAvailabilityStatusType.MAINTENANCE) {
            messageKey = "PageResource.resource.maintenance";
            backgroundColor = "bg-gray";
            icon = "fa fa-wrench";
            inMaintenance = true;
        }
    }
    if (operationalState != null && !inMaintenance) {
        AvailabilityStatusType lastAvailabilityStatus = operationalState.getLastAvailabilityStatus();
        if (lastAvailabilityStatus != null) {
            if (lastAvailabilityStatus == AvailabilityStatusType.UP) {
                messageKey = "PageResource.resource.up";
                backgroundColor = "bg-green";
                icon = "fa fa-power-off";
            } else if (lastAvailabilityStatus == AvailabilityStatusType.DOWN) {
                backgroundColor = "bg-red";
                messageKey = "PageResource.resource.down";
                icon = "fa fa-ban";
            } else if (lastAvailabilityStatus == AvailabilityStatusType.BROKEN) {
                backgroundColor = "bg-yellow";
                messageKey = "PageResource.resource.broken";
                icon = "fa fa-warning";
            }
        }
    }
    InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, getPageBase().getString(messageKey));
    ConnectorType connectorType = getConnectorType(resource);
    if (connectorType == null) {
        // Connector not found. Probably bad connectorRef reference.
        infoBoxType.setNumber("--");
        infoBoxType.setDescription("--");
    } else {
        String connectorName = StringUtils.substringAfterLast(WebComponentUtil.getEffectiveName(connectorType, ConnectorType.F_CONNECTOR_TYPE), ".");
        String connectorVersion = connectorType.getConnectorVersion();
        infoBoxType.setNumber(connectorName);
        infoBoxType.setDescription(connectorVersion);
    }
    Model<InfoBoxType> boxModel = new Model<>(infoBoxType);
    InfoBoxPanel lastAvailabilityStatus = new BasicInfoBoxPanel(ID_LAST_AVAILABILITY_STATUS, boxModel);
    lastAvailabilityStatus.setOutputMarkupId(true);
    return lastAvailabilityStatus;
}
Also used : InfoBoxType(com.evolveum.midpoint.web.component.box.InfoBoxType) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) BasicInfoBoxPanel(com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel) InfoBoxPanel(com.evolveum.midpoint.web.component.box.InfoBoxPanel) BasicInfoBoxPanel(com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel)

Example 4 with BasicInfoBoxPanel

use of com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method createSourceTargetInfo.

private BasicInfoBoxPanel createSourceTargetInfo(ResourceType resource) {
    String backgroundColor = "bg-aqua";
    SourceTarget sourceTarget = determineIfSourceOrTarget(resource);
    String numberKey;
    switch(sourceTarget) {
        case SOURCE:
            numberKey = "PageResource.resource.source";
            break;
        case TARGET:
            numberKey = "PageResource.resource.target";
            break;
        case SOURCE_TARGET:
            numberKey = "PageResource.resource.sourceAndTarget";
            break;
        default:
            backgroundColor = "bg-gray";
            numberKey = "PageResource.resource.noMappings";
            break;
    }
    InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, sourceTarget.getCssClass(), getPageBase().getString("PageResource.resource.mappings"));
    infoBoxType.setNumber(getPageBase().getString(numberKey));
    if (isSynchronizationDefined(resource)) {
        infoBoxType.setDescription(getPageBase().getString("PageResource.resource.sync"));
    }
    Model<InfoBoxType> boxModel = new Model<>(infoBoxType);
    return new BasicInfoBoxPanel(ID_SOURCE_TARGET, boxModel);
}
Also used : InfoBoxType(com.evolveum.midpoint.web.component.box.InfoBoxType) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) BasicInfoBoxPanel(com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel)

Aggregations

BasicInfoBoxPanel (com.evolveum.midpoint.web.component.box.BasicInfoBoxPanel)4 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)3 InfoBoxType (com.evolveum.midpoint.web.component.box.InfoBoxType)3 IModel (org.apache.wicket.model.IModel)3 Model (org.apache.wicket.model.Model)3 ListModel (org.apache.wicket.model.util.ListModel)3 InfoBoxPanel (com.evolveum.midpoint.web.component.box.InfoBoxPanel)2 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1